优化注册慢、获取验证码慢的问题和更改异常状态的判断逻辑

main
whj 1 year ago
parent 2ee5168753
commit 1c3c268c2b

@ -461,17 +461,23 @@ public class SsmBaseStaffServiceImpl extends BaseServiceImpl<BaseStaff> implemen
if (!CollectionUtils.isEmpty(staffTemporaries)) {
throw new SmsException(ResponseCode.MSG,"请勿重复提交");
}*/
StaffTemporary query = new StaffTemporary();
query.setIdentityCard(identityCard);
query.setRuzhiTime(ruzhiTime);
StaffTemporary staffTemp = staffTemporaryDao.selectOne(query);
if (staffTemp != null) {
Example example2 = new Example(StaffTemporary.class);
example2.selectProperties("id");
Example.Criteria criteria2 = example2.createCriteria();
criteria2.andEqualTo("identityCard",identityCard);
criteria2.andEqualTo("ruzhiTime",ruzhiTime);
List<StaffTemporary> staffTemporaries = staffTemporaryDao.selectByExample(example2);
if(Objects.nonNull(staffTemporaries) && !staffTemporaries.isEmpty()){
throw new SmsException(ResponseCode.MSG,"请勿重复提交");
}
Example example = new Example(BlackList.class);
Example.Criteria criteria = example.createCriteria();
// criteria.andEqualTo(StaffRequest.Fields.staffName,staffRequest.getStaffName());
example.selectProperties("urgentName","urgentPhone","urgentRelationship","id","beisenUserId",
"email","sex","staffNum","staffName","mobilePhone","identityCard","storeId","inputId",
"inputName","inputDate","type","job","regionId","endType","endId","endName","endTime",
"updateTime","employeeInformationId","employmentRecordId","isBeisen","isZhongkong","blacklistReasons");
criteria.andEqualTo(StaffRequest.Fields.identityCard, identityCard);
criteria.andEqualTo(StaffRequest.Fields.mobilePhone, mobilePhone);
criteria.andEqualTo(StaffRequest.Fields.storeId,staffRequest.getStoreId());
@ -537,34 +543,75 @@ public class SsmBaseStaffServiceImpl extends BaseServiceImpl<BaseStaff> implemen
temporary.setRegionId(staffRequest.getRegionId());
//查询有没有员工,判断是否是异常状态
Example blackExample = new Example(BlackList.class);
// Example blackExample = new Example(BlackList.class);
// Example.Criteria blackExampleCriteria = blackExample.createCriteria();
// //身份证、手机号、名字
//
// blackExampleCriteria.andEqualTo(BlackListDto.Fields.identityCard, identityCard);
// blackExample.or(blackExample.createCriteria().andEqualTo(BlackListDto.Fields.mobilePhone, mobilePhone));
// blackExample.selectProperties("identityCard","type","staffName","mobilePhone");
// List<BlackList> blackLists = blackListDao.selectByExample(blackExample);
// if (!CollectionUtils.isEmpty(blackLists)){
// for (BlackList blackList : blackLists) {
// temporary.setIsOne(1);
// //身份证相同、手机不同
// //手机相同身份证不同
// if (blackList.getIdentityCard().equals(temporary.getIdentityCard()) && blackList.getType()==1){
// throw new SmsException(ResponseCode.MSG,"已拉入系统黑名单,请联系管理员!");
// }
// if (blackList.getIdentityCard().equals(temporary.getIdentityCard())){
// if (!blackList.getMobilePhone().equals(temporary.getMobilePhone()) || !blackList.getStaffName().equals(temporary.getStaffName())){
// temporary.setState(1);
// }
// }
// if (blackList.getMobilePhone().equals(temporary.getMobilePhone())){
// if (!blackList.getIdentityCard().equals(temporary.getIdentityCard()) || !blackList.getStaffName().equals(temporary.getStaffName())){
// temporary.setState(1);
// }
// }
// }
//
// }
//查询有没有员工,判断是否是异常状态
Example blackExample = new Example(StaffTemporary.class);
Example.Criteria blackExampleCriteria = blackExample.createCriteria();
//身份证、手机号、名字
blackExampleCriteria.andEqualTo(BlackListDto.Fields.identityCard, identityCard);
blackExample.or(blackExample.createCriteria().andEqualTo(BlackListDto.Fields.mobilePhone, mobilePhone));
blackExample.selectProperties("identityCard","type","staffName","mobilePhone");
List<BlackList> blackLists = blackListDao.selectByExample(blackExample);
if (!CollectionUtils.isEmpty(blackLists)){
blackExample.setOrderByClause("scan_time desc");
blackExample.selectProperties("identityCard","staffName","mobilePhone");
// List<BlackList> blackLists = blackListDao.selectByExample(blackExample);
List<StaffTemporary> staffTemporaries1 = staffTemporaryDao.selectByExample(blackExample);
if (!CollectionUtils.isEmpty(staffTemporaries1)){
StaffTemporary staffTemporary = staffTemporaries1.get(0);
staffTemporary.setIsOne(1);
//身份证相同、手机不同
//手机相同身份证不同
if (staffTemporary.getIdentityCard().equals(temporary.getIdentityCard())){
if (!staffTemporary.getMobilePhone().equals(temporary.getMobilePhone()) || !staffTemporary.getStaffName().equals(temporary.getStaffName())){
temporary.setState(1);
}
}
if (staffTemporary.getMobilePhone().equals(temporary.getMobilePhone())){
if (!staffTemporary.getIdentityCard().equals(temporary.getIdentityCard()) || !staffTemporary.getStaffName().equals(temporary.getStaffName())){
temporary.setState(1);
}
}
}
//判断是否被拉进黑名单
Example example3 = new Example(BlackList.class);
example3.selectProperties("identityCard","staffName","mobilePhone","type");
Example.Criteria criteria3 = example3.createCriteria();
criteria3.andEqualTo(BlackListDto.Fields.identityCard, identityCard);
example3.or(example3.createCriteria().andEqualTo(BlackListDto.Fields.mobilePhone, mobilePhone));
List<BlackList> blackLists = blackListDao.selectByExample(example3);
if(!CollectionUtils.isEmpty(staffTemporaries1)){
for (BlackList blackList : blackLists) {
temporary.setIsOne(1);
//身份证相同、手机不同
//手机相同身份证不同
if (blackList.getIdentityCard().equals(temporary.getIdentityCard()) && blackList.getType()==1){
throw new SmsException(ResponseCode.MSG,"已拉入系统黑名单,请联系管理员!");
}
if (blackList.getIdentityCard().equals(temporary.getIdentityCard())){
if (!blackList.getMobilePhone().equals(temporary.getMobilePhone()) || !blackList.getStaffName().equals(temporary.getStaffName())){
temporary.setState(1);
}
}
if (blackList.getMobilePhone().equals(temporary.getMobilePhone())){
if (!blackList.getIdentityCard().equals(temporary.getIdentityCard()) || !blackList.getStaffName().equals(temporary.getStaffName())){
temporary.setState(1);
}
}
}
}
//查询临时工是否存在,存在则带 ???
@ -617,7 +664,7 @@ public class SsmBaseStaffServiceImpl extends BaseServiceImpl<BaseStaff> implemen
String staffNum = getStaffNum(staffRequest.getStoreId(),identityCard);
String email = getEmail(staffRequest.getStoreId());
temporary.setEmail(email);
temporary.setState(0);
// temporary.setState(0);
staffTemporaryVo.setStaffNum(staffNum);
temporary.setStaffNum(staffNum);
// TODO 更新可能导致数据被覆盖...
@ -715,12 +762,16 @@ public class SsmBaseStaffServiceImpl extends BaseServiceImpl<BaseStaff> implemen
//查询新添加进黑白名单表的数据
Example example1 = new Example(BlackList.class);
Example.Criteria criteria1 = example.createCriteria();
Example.Criteria criteria1 = example1.createCriteria();
// criteria.andEqualTo(StaffRequest.Fields.staffName,staffRequest.getStaffName());
example1.selectProperties("urgentName","urgentPhone","urgentRelationship","id","beisenUserId",
"email","sex","staffNum","staffName","mobilePhone","identityCard","storeId","inputId",
"inputName","inputDate","type","job","regionId","endType","endId","endName","endTime",
"updateTime","employeeInformationId","employmentRecordId","isBeisen","isZhongkong","blacklistReasons");
criteria1.andEqualTo(StaffRequest.Fields.identityCard, identityCard);
criteria1.andEqualTo(StaffRequest.Fields.mobilePhone, mobilePhone);
criteria1.andEqualTo(StaffRequest.Fields.storeId,staffRequest.getStoreId());
List<BlackList> blackLists1 = blackListDao.selectByExample(example);
List<BlackList> blackLists1 = blackListDao.selectByExample(example1);
if(!CollectionUtils.isEmpty(blackLists1)){
staffTemporaryVo.setBlackList(blackLists1.get(0));
}

@ -497,6 +497,7 @@ public class SsmMemberLoginServiceImpl extends BaseServiceImpl<StoreMemberList>
String code = ObjectUtils.toString((int)((Math.random()*9+1)*1000));//生成验证码
//先判断手机也没有注册
Example example = new Example(BlackList.class);
example.selectProperties("type","storeId");
Example.Criteria criteria = example.createCriteria();
String mobilePhone = memberRequest.getMobilePhone();
if(StringUtils.isEmpty(mobilePhone)){

Loading…
Cancel
Save