Merge remote-tracking branch 'upstream/test' into test

yun-zuoyi
castle.zang 3 years ago
commit 27609b8e2c

@ -4,6 +4,8 @@ import cn.estsh.i3plus.pojo.platform.bean.SysUserPassword;
import cn.estsh.impp.framework.base.service.ICrudService; import cn.estsh.impp.framework.base.service.ICrudService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.List;
/** /**
* @Description : * @Description :
* @Reference : * @Reference :
@ -33,4 +35,7 @@ public interface ISysUserPasswordService extends ICrudService<SysUserPassword> {
void updatePasswordResetLastModifyTime(Long userId, String password,Boolean isCheckPassword); void updatePasswordResetLastModifyTime(Long userId, String password,Boolean isCheckPassword);
void updatePasswordWizoutSession(String loginName, String password, String newPwd); void updatePasswordWizoutSession(String loginName, String password, String newPwd);
@ApiOperation(value = "根据密码反查")
public List<SysUserPassword> findPasswordByPassword(String password);
} }

@ -661,7 +661,7 @@ public class PersonnelController extends CoreBaseController {
public ResultBean getUserOrganizeList() { public ResultBean getUserOrganizeList() {
try { try {
// List<SysOrganize> list = AuthUtil.getSessionUser().getUser().getOrganizeList(); // List<SysOrganize> list = AuthUtil.getSessionUser().getUser().getOrganizeList();
List<SysOrganize> list = personnelService.findSysUserInfoOrganize(AuthUtil.getSessionUser().getUserInfo().getId()); List<SysOrganize> list = personnelService.findSysUserOrganize(AuthUtil.getSessionUser().getUser().getId());
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(list); return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(list);
} catch (ImppBusiException busExcep) { } catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep); return ResultBean.fail(busExcep);

@ -6,8 +6,10 @@ import cn.estsh.i3plus.core.apiservice.util.SysUserPasswordUtil;
import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum; import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import cn.estsh.i3plus.platform.common.tool.TimeTool; import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.platform.bean.SysUser; import cn.estsh.i3plus.pojo.platform.bean.SysUser;
import cn.estsh.i3plus.pojo.platform.bean.SysUserPassword; import cn.estsh.i3plus.pojo.platform.bean.SysUserPassword;
import cn.estsh.i3plus.pojo.platform.repository.SysUserPasswordRepository; import cn.estsh.i3plus.pojo.platform.repository.SysUserPasswordRepository;
@ -20,6 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/** /**
* @Description : * @Description :
* @Reference : * @Reference :
@ -165,4 +170,15 @@ public class SysUserSavePasswordService extends CrudService<SysUserPassword> imp
ConvertBean.serviceModelUpdate(user, loginName); ConvertBean.serviceModelUpdate(user, loginName);
userService.updateSysUser(user); userService.updateSysUser(user);
} }
@Override
public List<SysUserPassword> findPasswordByPassword(String password) {
List<SysUserPassword> passwordList = new ArrayList<>();
if(StringUtils.isBlank(password)){
return passwordList;
}
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(password,"userPassword",ddlPackBean);
return userPasswordRDao.findByHqlWhere(ddlPackBean);
}
} }

@ -262,11 +262,14 @@ public class SysUserPasswordUtil {
int num = RedisCacheTool.getSysConfigIntVal(CommonConstWords.CONFIG_PWD_REPEAT_DAY, CommonConstWords.CONFIG_PWD_REPEAT_DAY_DEFAULT); int num = RedisCacheTool.getSysConfigIntVal(CommonConstWords.CONFIG_PWD_REPEAT_DAY, CommonConstWords.CONFIG_PWD_REPEAT_DAY_DEFAULT);
if (num > 0) { if (num > 0) {
try { try {
SysUserPassword userPassword = new SysUserPassword(); // SysUserPassword userPassword = new SysUserPassword();
userPassword.setUserId(user.getId()); // userPassword.setUserId(user.getId());
userPassword.setUserPassword(EncryptTool.hexMD5(user.getUserLoginPassword())); // userPassword.setUserPassword(EncryptTool.hexMD5(user.getUserLoginPassword()));
List<SysUserPassword> passwords = userPasswordService.findAllByBean(userPassword); // List<SysUserPassword> passwords = userPasswordService.findAllByBean(userPassword);
//todo: 如果密码数据太多可以考虑建立以Creat eDatetime 相关的索引,ORDER BY create_date_time DESC ,查出最近的一条就行
List<SysUserPassword> passwords = userPasswordService.findPasswordByPassword(EncryptTool.hexMD5(user.getUserLoginPassword()));
int lastDay = Integer.MAX_VALUE; int lastDay = Integer.MAX_VALUE;
if (CollectionUtils.isNotEmpty(passwords)) { if (CollectionUtils.isNotEmpty(passwords)) {
@ -279,9 +282,7 @@ public class SysUserPasswordUtil {
} }
} }
} }
} if (num > lastDay) {
if (lastDay > num) {
throw ImppExceptionBuilder.newInstance() throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode()) .setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode()) .setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
@ -289,6 +290,16 @@ public class SysUserPasswordUtil {
.setErrorSolution("请重新输入") .setErrorSolution("请重新输入")
.build(); .build();
} }
}
// if (lastDay > num) {
// throw ImppExceptionBuilder.newInstance()
// .setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
// .setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
// .setErrorDetail("请勿使用重复密码")
// .setErrorSolution("请重新输入")
// .build();
// }
} catch (ImppBusiException e) { } catch (ImppBusiException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {

Loading…
Cancel
Save