|
|
|
@ -1,12 +1,16 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISystemInitService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
|
|
|
|
|
import cn.estsh.i3plus.core.apiservice.util.HqlModelPack;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.shirotoken.UserToken;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.model.platform.UserDetailModel;
|
|
|
|
@ -84,6 +88,12 @@ public class PersonnelServiceService implements IPersonnelService {
|
|
|
|
|
@Resource(name="redisCore")
|
|
|
|
|
protected ImppRedis redisCore;
|
|
|
|
|
|
|
|
|
|
@Resource(name="redisRes")
|
|
|
|
|
private ImppRedis redisRes;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISystemInitService systemInitService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SysUser saveSysUser(SysUser user) {
|
|
|
|
|
LOGGER.debug("平台账号 SysUser user:{}", user);
|
|
|
|
@ -147,6 +157,16 @@ public class PersonnelServiceService implements IPersonnelService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "查询账号信息")
|
|
|
|
|
public ListPager<SysUser> querySysUserPagerByUserDetailModelOrIds(UserDetailModel model,Pager pager, List<Long> ids) {
|
|
|
|
|
LOGGER.debug("平台用户 SysUser model:{} ids:{}", model, ids);
|
|
|
|
|
String modeWhere = HqlModelPack.packHqlSysUserByModelOrIds(model, ids);
|
|
|
|
|
|
|
|
|
|
pager = PagerHelper.getPager(pager, userRDao.findByHqlWhereCount(modeWhere));
|
|
|
|
|
return new ListPager(userRDao.findByHqlWherePage(modeWhere + model.orderBy(), pager), pager);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SysUserInfo getSysUserInfoById(Long id) {
|
|
|
|
|
return userInfoRDao.getById(id);
|
|
|
|
|
}
|
|
|
|
@ -388,19 +408,52 @@ public class PersonnelServiceService implements IPersonnelService {
|
|
|
|
|
.setErrorSolution("请先删除子集信息在操作")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long refPositionCount = refUserPositionRDao.findByPropertyCount("positionId",positionId);
|
|
|
|
|
if (refPositionCount >= 1) {
|
|
|
|
|
// long refPositionCount = refUserPositionRDao.findByPropertyCount("positionId",positionId);
|
|
|
|
|
// if (refPositionCount >= 1) {
|
|
|
|
|
// throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
// .setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
// .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
// .setErrorDetail("存在用户关系引用信息无法删除!")
|
|
|
|
|
// .setErrorSolution("请先删除用户关系信息再操作")
|
|
|
|
|
// .build();
|
|
|
|
|
// }
|
|
|
|
|
long refUserInfoCount = userInfoRDao.findByPropertyCount("positionId",positionId);
|
|
|
|
|
if (refUserInfoCount >= 1) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("存在用户关系引用信息无法删除!")
|
|
|
|
|
.setErrorSolution("请先删除用户关系信息再操作")
|
|
|
|
|
.setErrorDetail("存在用户信息无法删除!")
|
|
|
|
|
.setErrorSolution("请先删除用户引用信息再操作")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long refUserInfoCount = userInfoRDao.findByPropertyCount("positionId",positionId);
|
|
|
|
|
if (refUserInfoCount >= 1) {
|
|
|
|
|
@Override
|
|
|
|
|
public void checkSysDepartmentRef(Long departmentId) {
|
|
|
|
|
LOGGER.debug("平台部门 SysDepartment departmentId:{}", departmentId);
|
|
|
|
|
|
|
|
|
|
if(departmentId != null){
|
|
|
|
|
long departmentCount = departmentRDao.findByPropertyCount("parentId",departmentId);
|
|
|
|
|
if (departmentCount >= 1) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("存在相关部门信息无法删除!")
|
|
|
|
|
.setErrorSolution("请先删除子集信息在操作")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
// long refPositionCount = refUserPositionRDao.findByPropertyCount("positionId",positionId);
|
|
|
|
|
// if (refPositionCount >= 1) {
|
|
|
|
|
// throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
// .setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
// .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
// .setErrorDetail("存在用户关系引用信息无法删除!")
|
|
|
|
|
// .setErrorSolution("请先删除用户关系信息再操作")
|
|
|
|
|
// .build();
|
|
|
|
|
// }
|
|
|
|
|
long userInfoCount = userInfoRDao.findByPropertyCount("departmentId",departmentId);
|
|
|
|
|
if (userInfoCount >= 1) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
@ -408,101 +461,146 @@ public class PersonnelServiceService implements IPersonnelService {
|
|
|
|
|
.setErrorSolution("请先删除用户引用信息再操作")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long userCount = userRDao.findByPropertyCount("departmentId",departmentId);
|
|
|
|
|
if (userCount >= 1) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("存在账号信息无法删除!")
|
|
|
|
|
.setErrorSolution("请先删除账号引用信息再操作")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/************************************ 用户唯一检查 ****************************************/
|
|
|
|
|
@Override
|
|
|
|
|
public void checkSysOrganizeRef(Long organizeId) {
|
|
|
|
|
LOGGER.debug("平台部门 SysOrganize organizeId:{}", organizeId);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 登录名 唯一检查
|
|
|
|
|
* @param userLoginName
|
|
|
|
|
* @param userId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkSysUserLoginName(String userLoginName, long userId) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
if(userId > 0){
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(userLoginName,"userLoginName",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(userId,"id",sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
if(organizeId != null){
|
|
|
|
|
long organizeCount = organizeRDao.findByPropertyCount("parentId",organizeId);
|
|
|
|
|
if (organizeCount >= 1) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("存在相关组织信息无法删除!")
|
|
|
|
|
.setErrorSolution("请先删除子集信息在操作")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount(
|
|
|
|
|
new String[]{"userLoginName","isValid"},
|
|
|
|
|
new Object[]{userLoginName,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
}
|
|
|
|
|
// long refPositionCount = refUserPositionRDao.findByPropertyCount("positionId",positionId);
|
|
|
|
|
// if (refPositionCount >= 1) {
|
|
|
|
|
// throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
// .setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
// .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
// .setErrorDetail("存在用户关系引用信息无法删除!")
|
|
|
|
|
// .setErrorSolution("请先删除用户关系信息再操作")
|
|
|
|
|
// .build();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
long departmentCount = departmentRDao.findByPropertyCount("organizeId",organizeId);
|
|
|
|
|
if (departmentCount >= 1) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("存在部门信息无法删除!")
|
|
|
|
|
.setErrorSolution("请先删除部门引用信息再操作")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户邮箱唯一检查
|
|
|
|
|
* @param email
|
|
|
|
|
* @param infoId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkSysUserEmail(String email, long infoId) {
|
|
|
|
|
int count;
|
|
|
|
|
if(infoId > 0){
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(email,"userEmail",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
long userInfoCount = userInfoRDao.findByPropertyCount("organizeId",organizeId);
|
|
|
|
|
if (userInfoCount >= 1) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("存在用户信息无法删除!")
|
|
|
|
|
.setErrorSolution("请先删除用户引用信息再操作")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount(
|
|
|
|
|
new String[]{"userEmail","isValid"},
|
|
|
|
|
new Object[]{email,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
long userCount = userRDao.findByPropertyCount("organizeId",organizeId);
|
|
|
|
|
if (userCount >= 1) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("存在账号信息无法删除!")
|
|
|
|
|
.setErrorSolution("请先删除账号引用信息再操作")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 手机号码 唯一校验
|
|
|
|
|
* @param phone
|
|
|
|
|
* @param infoId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkSysUserPhone(String phone, long infoId) {
|
|
|
|
|
int count;
|
|
|
|
|
if(infoId > 0){
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(phone,"userPhone",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
@Override
|
|
|
|
|
public void checkSysUserPassword(String password) {
|
|
|
|
|
LOGGER.debug("平台用户 SysUser password:{}", password);
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount(
|
|
|
|
|
new String[]{"userPhone","isValid"},
|
|
|
|
|
new Object[]{phone,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotBlank(password)){
|
|
|
|
|
// 密码长度校验
|
|
|
|
|
String redisKey = CommonConstWords.REDIS_PREFIX_CACHE_CONFIG + "_" + CommonConstWords.CONFIG_PWD_LENGTH;
|
|
|
|
|
SysConfig config = (SysConfig) systemInitService.getDataFromCache(redisKey, SysConfig.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工号唯一检查
|
|
|
|
|
* @param empNo
|
|
|
|
|
* @param infoId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkSysUserEmpNo(String empNo, long infoId) {
|
|
|
|
|
int count;
|
|
|
|
|
if(infoId > 0){
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(empNo,"userEmpNo",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
if(!checkPasswordLength(config,password)){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("密码长度不足")
|
|
|
|
|
.setErrorSolution("请重新输入")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount(
|
|
|
|
|
new String[]{"userEmpNo","isValid"},
|
|
|
|
|
new Object[]{empNo,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
// 密码小写校验
|
|
|
|
|
redisKey = CommonConstWords.REDIS_PREFIX_CACHE_CONFIG + "_" + CommonConstWords.CONFIG_PWD_EXIST_LOWER_ENGLISH;
|
|
|
|
|
config = (SysConfig) systemInitService.getDataFromCache(redisKey, SysConfig.class);
|
|
|
|
|
|
|
|
|
|
if(!checkPasswordLowerEnglish(config,password)){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("密码必须包含小写英文")
|
|
|
|
|
.setErrorSolution("请重新输入")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 密码大写校验
|
|
|
|
|
redisKey = CommonConstWords.REDIS_PREFIX_CACHE_CONFIG + "_" + CommonConstWords.CONFIG_PWD_EXIST_UPPERCASE_ENGLISH;
|
|
|
|
|
config = (SysConfig) systemInitService.getDataFromCache(redisKey, SysConfig.class);
|
|
|
|
|
|
|
|
|
|
if(!checkPasswordUpperEnglish(config,password)){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("密码必须包含大写英文")
|
|
|
|
|
.setErrorSolution("请重新输入")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 密码特殊字符
|
|
|
|
|
redisKey = CommonConstWords.REDIS_PREFIX_CACHE_CONFIG + "_" + CommonConstWords.CONFIG_PWD_EXIST_SPECIAL_CHAR;
|
|
|
|
|
config = (SysConfig) systemInitService.getDataFromCache(redisKey, SysConfig.class);
|
|
|
|
|
|
|
|
|
|
if(!checkPasswordSpecialChar(config,password)){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("密码必须包含特殊字符")
|
|
|
|
|
.setErrorSolution("请重新输入")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 密码特殊字符
|
|
|
|
|
redisKey = CommonConstWords.REDIS_PREFIX_CACHE_CONFIG + "_" + CommonConstWords.CONFIG_PWD_EXIST_NUMBER;
|
|
|
|
|
config = (SysConfig) systemInitService.getDataFromCache(redisKey, SysConfig.class);
|
|
|
|
|
|
|
|
|
|
if(!checkPasswordNumber(config,password)){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("密码必须包含数字")
|
|
|
|
|
.setErrorSolution("请重新输入")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -958,4 +1056,211 @@ public class PersonnelServiceService implements IPersonnelService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*********************************** 检查方法封装 ***********************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验密码长度
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkPasswordLength(SysConfig config,String password){
|
|
|
|
|
if(config != null){
|
|
|
|
|
if(config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.NUMBER.getValue())){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("系统配置格式错误(密码长度)")
|
|
|
|
|
.setErrorSolution("请先配置系统参数")
|
|
|
|
|
.build();
|
|
|
|
|
}else {
|
|
|
|
|
int length = Integer.parseInt(config.getConfigValue());
|
|
|
|
|
return password.trim().length() >= length;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验密码小写
|
|
|
|
|
* @param password
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkPasswordLowerEnglish(SysConfig config,String password){
|
|
|
|
|
if(config != null){
|
|
|
|
|
if(config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("系统配置格式错误(密码英文小写配置)")
|
|
|
|
|
.setErrorSolution("请先配置系统参数")
|
|
|
|
|
.build();
|
|
|
|
|
}else {
|
|
|
|
|
if(config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())){
|
|
|
|
|
return StringTool.isContainLowerCase(password);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验密码大写
|
|
|
|
|
* @param password
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkPasswordUpperEnglish(SysConfig config,String password){
|
|
|
|
|
if(config != null){
|
|
|
|
|
if(config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("系统配置格式错误(密码英文大写配置)")
|
|
|
|
|
.setErrorSolution("请先配置系统参数")
|
|
|
|
|
.build();
|
|
|
|
|
}else {
|
|
|
|
|
if(config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())){
|
|
|
|
|
return StringTool.isContainUpperCase(password);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验密码大写
|
|
|
|
|
* @param password
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkPasswordNumber(SysConfig config,String password){
|
|
|
|
|
if(config != null){
|
|
|
|
|
if(config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("系统配置格式错误(密码数字配置)")
|
|
|
|
|
.setErrorSolution("请先配置系统参数")
|
|
|
|
|
.build();
|
|
|
|
|
}else {
|
|
|
|
|
if(config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())){
|
|
|
|
|
return StringTool.isContainNumber(password);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验密码特殊字符
|
|
|
|
|
* @param password
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkPasswordSpecialChar(SysConfig config,String password){
|
|
|
|
|
if(config != null){
|
|
|
|
|
if(config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("系统配置格式错误(密码特殊字符配置)")
|
|
|
|
|
.setErrorSolution("请先配置系统参数")
|
|
|
|
|
.build();
|
|
|
|
|
}else {
|
|
|
|
|
if(config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())){
|
|
|
|
|
return StringTool.isConSpeCharacters(password);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 登录名 唯一检查
|
|
|
|
|
* @param userLoginName
|
|
|
|
|
* @param userId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkSysUserLoginName(String userLoginName, long userId) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
if(userId > 0){
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(userLoginName,"userLoginName",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(userId,"id",sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount(
|
|
|
|
|
new String[]{"userLoginName","isValid"},
|
|
|
|
|
new Object[]{userLoginName,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户邮箱唯一检查
|
|
|
|
|
* @param email
|
|
|
|
|
* @param infoId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkSysUserEmail(String email, long infoId) {
|
|
|
|
|
int count;
|
|
|
|
|
if(infoId > 0){
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(email,"userEmail",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount(
|
|
|
|
|
new String[]{"userEmail","isValid"},
|
|
|
|
|
new Object[]{email,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 手机号码 唯一校验
|
|
|
|
|
* @param phone
|
|
|
|
|
* @param infoId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkSysUserPhone(String phone, long infoId) {
|
|
|
|
|
int count;
|
|
|
|
|
if(infoId > 0){
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(phone,"userPhone",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount(
|
|
|
|
|
new String[]{"userPhone","isValid"},
|
|
|
|
|
new Object[]{phone,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工号唯一检查
|
|
|
|
|
* @param empNo
|
|
|
|
|
* @param infoId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkSysUserEmpNo(String empNo, long infoId) {
|
|
|
|
|
int count;
|
|
|
|
|
if(infoId > 0){
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(empNo,"userEmpNo",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount(
|
|
|
|
|
new String[]{"userEmpNo","isValid"},
|
|
|
|
|
new Object[]{empNo,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|