Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/main/java/com/iemr/admin/data/employeemaster/M_User1.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ public class M_User1{
@Expose
@Column(name = "failed_attempt", insertable = false)
private Integer failedAttempt;
@Expose
@Column(name = "lock_timestamp", insertable = false)
private Timestamp lockTimestamp;
public M_User1() {
// TODO Auto-generated constructor stub
}
Expand All @@ -229,6 +232,14 @@ public void setFailedAttempt(Integer failedAttempt) {
this.failedAttempt = failedAttempt;
}

public Timestamp getLockTimestamp() {
return lockTimestamp;
}

public void setLockTimestamp(Timestamp lockTimestamp) {
this.lockTimestamp = lockTimestamp;
}

public Integer getUserID() {
return userID;
}
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/com/iemr/admin/data/employeemaster/V_Showuser.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,18 @@ public class V_Showuser {
@Column(name="DistrictID")
private Integer districtID;

@Expose
@Transient
private Integer failedAttempt;

@Expose
@Transient
private Timestamp lockTimestamp;

@Expose
@Transient
private Boolean lockedDueToFailedAttempts;




Expand Down Expand Up @@ -922,6 +934,30 @@ public void setDistrictID(Integer districtID) {
this.districtID = districtID;
}

public Integer getFailedAttempt() {
return failedAttempt;
}

public void setFailedAttempt(Integer failedAttempt) {
this.failedAttempt = failedAttempt;
}

public Timestamp getLockTimestamp() {
return lockTimestamp;
}

public void setLockTimestamp(Timestamp lockTimestamp) {
this.lockTimestamp = lockTimestamp;
}

public Boolean getLockedDueToFailedAttempts() {
return lockedDueToFailedAttempts;
}

public void setLockedDueToFailedAttempts(Boolean lockedDueToFailedAttempts) {
this.lockedDueToFailedAttempts = lockedDueToFailedAttempts;
}




Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.iemr.admin.repo.employeemaster;

import java.util.ArrayList;
import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
Expand Down Expand Up @@ -80,4 +81,6 @@ M_User1 checkingEmpDetails(@Param("userName") String userName, @Param("aadhaarNo
ArrayList<M_User1> getempByDesiganation(@Param("designationID") Integer designationID,@Param("serviceProviderID") Integer serviceProviderID);

M_User1 findByUserID(Integer userID);

List<M_User1> findByUserIDIn(List<Integer> userIDs);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
Expand Down Expand Up @@ -1062,8 +1063,36 @@ public ArrayList<M_Community> getAllCommunity() {

@Override
public ArrayList<V_Showuser> getEmployeeDetails4(Integer serviceProviderID) {
ArrayList<V_Showuser> users = v_ShowuserRepo.EmployeeDetails4(serviceProviderID);
if (users.isEmpty()) {
return users;
}

ArrayList<Integer> userIDs = new ArrayList<Integer>(users.size());
for (V_Showuser user : users) {
userIDs.add(user.getUserID());
}

Map<Integer, M_User1> userRecords = new HashMap<Integer, M_User1>();
for (M_User1 userRecord : employeeMasterRepoo.findByUserIDIn(userIDs)) {
userRecords.put(userRecord.getUserID(), userRecord);
}

for (V_Showuser user : users) {
enrichAccountLockState(user, userRecords.get(user.getUserID()));
}
return users;
}

private void enrichAccountLockState(V_Showuser user, M_User1 userRecord) {
if (userRecord == null) {
return;
}

return v_ShowuserRepo.EmployeeDetails4(serviceProviderID);
Timestamp lockTimestamp = userRecord.getLockTimestamp();
user.setFailedAttempt(userRecord.getFailedAttempt() != null ? userRecord.getFailedAttempt() : 0);
user.setLockTimestamp(lockTimestamp);
user.setLockedDueToFailedAttempts(Boolean.TRUE.equals(userRecord.getDeleted()) && lockTimestamp != null);
}

@Override
Expand Down