|
|
|
@ -364,6 +364,43 @@ public class PersonnelServiceService implements IPersonnelService {
|
|
|
|
|
return num;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void checkSysPositionRef(Long positionId) {
|
|
|
|
|
LOGGER.debug("平台岗位 SysPosition positionId:{}", positionId);
|
|
|
|
|
|
|
|
|
|
if(positionId != null){
|
|
|
|
|
long positionCount = positionRDao.findByPropertyCount("parentId",positionId);
|
|
|
|
|
if (positionCount >= 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 refUserInfoCount = userInfoRDao.findByPropertyCount("positionId",positionId);
|
|
|
|
|
if (refUserInfoCount >= 1) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("存在用户信息无法删除!")
|
|
|
|
|
.setErrorSolution("请先删除用户引用信息再操作")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/************************************ 用户唯一检查 ****************************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -660,6 +697,52 @@ public class PersonnelServiceService implements IPersonnelService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void refreshRefSysUserInfoPositionRdd(Long positionId) {
|
|
|
|
|
List<Long> result = new ArrayList<>(); // 需要更新的用户ID 集合
|
|
|
|
|
|
|
|
|
|
// 更新关系表中数据
|
|
|
|
|
if(positionId != null){
|
|
|
|
|
SysPosition position = positionRDao.getById(positionId);
|
|
|
|
|
if(position != null){
|
|
|
|
|
List<SysRefUserPosition> list = refUserPositionRDao.findByProperty("positionId", position.getId());
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
|
|
|
|
|
// 更新关系表中的冗余信息
|
|
|
|
|
refUserPositionRDao.updateByProperties(
|
|
|
|
|
"positionId",position.getId(),
|
|
|
|
|
"positionNameRdd", position.getName());
|
|
|
|
|
|
|
|
|
|
// 更新父节点冗余信息
|
|
|
|
|
positionRDao.updateByProperties("parentId",position.getId(),
|
|
|
|
|
"parentNameRdd",position.getName());
|
|
|
|
|
|
|
|
|
|
for (SysRefUserPosition ref : list) {
|
|
|
|
|
result.add(ref.getUserId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 删除关系表中数据
|
|
|
|
|
refUserPositionRDao.deleteByProperty("positionId", positionId);
|
|
|
|
|
|
|
|
|
|
// 获取需要更新的用户
|
|
|
|
|
StringBuffer strWhere = new StringBuffer();
|
|
|
|
|
List<String> nameList = null;
|
|
|
|
|
HqlPack.getInPack(StringUtils.join(result, ","), "userId", strWhere);
|
|
|
|
|
List<SysUserInfo> infoList = userInfoRDao.findByHqlWhere(strWhere.toString());
|
|
|
|
|
|
|
|
|
|
// 更新用户的冗余信息
|
|
|
|
|
if(infoList != null && infoList.size() > 0){
|
|
|
|
|
for (SysUserInfo info : infoList) {
|
|
|
|
|
List<SysRefUserPosition> list = refUserPositionRDao.findByProperty("userId", info.getId());
|
|
|
|
|
if (list != null) {
|
|
|
|
|
for (SysRefUserPosition ref : list) {
|
|
|
|
|
nameList.add(ref.getPositionNameRdd());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
info.setPositionNamesRdd(StringUtils.join(nameList, ","));
|
|
|
|
|
userInfoRDao.save(info);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|