Commit 460ebd75 authored by fangxinjiang's avatar fangxinjiang

社保自动化配置-fxj

parent b1236e7c
...@@ -61,34 +61,34 @@ public class TAutoSocialRuleInfo extends BaseEntity { ...@@ -61,34 +61,34 @@ public class TAutoSocialRuleInfo extends BaseEntity {
/** /**
* 是否自动触发派增(字典:0自动触发派增,1:手动派增) * 是否自动触发派增(字典:0自动触发派增,1:手动派增)
*/ */
@ExcelAttribute(name = "是否自动触发派增(字典:0自动触发派增,1:手动派增)", isNotEmpty = true, errorInfo = "是否自动触发派增(字典:0自动触发派增,1:手动派增)不能为空", maxLength = 1) @ExcelAttribute(name = "是否自动触发派增", isNotEmpty = true, errorInfo = "是否自动触发派增不能为空", maxLength = 1)
@NotBlank(message = "是否自动触发派增(字典:0自动触发派增,1:手动派增)不能为空") @NotBlank(message = "是否自动触发派增不能为空")
@Length(max = 1, message = "是否自动触发派增(字典:0自动触发派增,1:手动派增)不能超过1个字符") @Length(max = 1, message = "是否自动触发派增不能超过1个字符")
@ExcelProperty("是否自动触发派增(字典:0自动触发派增,1:手动派增)") @ExcelProperty("是否自动触发派增")
@Schema(description = "是否自动触发派增(字典:0自动触发派增,1:手动派增)") @Schema(description = "是否自动触发派增(字典:0自动触发派增,1:手动派增)")
private String autoFlag; private String autoFlag;
/** /**
* 派单发起时间(字典::0:入职满1个月...入职满6个月) * 派单发起时间(字典::0:入职满1个月...入职满6个月)
*/ */
@ExcelAttribute(name = "派单发起时间(字典::0:入职满1个月...入职满6个月)", maxLength = 2) @ExcelAttribute(name = "派单发起时间", maxLength = 2,isNotEmpty = true, errorInfo = "派单发起时间不能为空")
@Length(max = 2, message = "派单发起时间(字典::0:入职满1个月...入职满6个月)不能超过2个字符") @Length(max = 2, message = "派单发起时间不能超过2个字符")
@ExcelProperty("派单发起时间(字典::0:入职满1个月...入职满6个月)") @ExcelProperty("派单发起时间")
@Schema(description = "派单发起时间(字典::0:入职满1个月...入职满6个月)") @Schema(description = "派单发起时间(字典::0:入职满1个月...入职满6个月)")
private String startPeriod; private String startPeriod;
/** /**
* 派单发起具体时间字典:0:15:20 * 派单发起具体时间字典:0:15:20
*/ */
@ExcelAttribute(name = "派单发起具体时间字典:0:15:20", maxLength = 10) @ExcelAttribute(name = "派单发起具体时间", maxLength = 10)
@Length(max = 10, message = "派单发起具体时间字典:0:15:20不能超过10个字符") @Length(max = 10, message = "派单发起具体时间不能超过10个字符")
@ExcelProperty("派单发起具体时间字典:0:15:20") @ExcelProperty("派单发起具体时间字典")
@Schema(description = "派单发起具体时间字典:0:15:20") @Schema(description = "派单发起具体时间字典:0:15:20")
private String startTime; private String startTime;
/** /**
* 派单确认时间,字典:0:派单发起当日 * 派单确认时间,字典:0:派单发起当日
*/ */
@ExcelAttribute(name = "派单确认时间,字典:0:派单发起当日", maxLength = 50) @ExcelAttribute(name = "派单确认时间", maxLength = 50,isNotEmpty = true, errorInfo = "派单发起时间不能为空")
@Length(max = 50, message = "派单确认时间,字典:0:派单发起当日不能超过50个字符") @Length(max = 50, message = "派单确认时间不能超过50个字符")
@ExcelProperty("派单确认时间,字典:0:派单发起当日") @ExcelProperty("派单确认时间")
@Schema(description = "派单确认时间,字典:0:派单发起当日") @Schema(description = "派单确认时间,字典:0:派单发起当日")
private String confirmPeriod; private String confirmPeriod;
/** /**
......
...@@ -52,8 +52,7 @@ public class TAutoSocialRuleRel extends BaseEntity { ...@@ -52,8 +52,7 @@ public class TAutoSocialRuleRel extends BaseEntity {
/** /**
* 社保配置ID * 社保配置ID
*/ */
@ExcelAttribute(name = "社保配置ID", isNotEmpty = true, errorInfo = "社保配置ID不能为空", maxLength = 32) @ExcelAttribute(name = "社保配置ID", isNotEmpty = false, errorInfo = "社保配置ID不能为空", maxLength = 32)
@NotBlank(message = "社保配置ID不能为空")
@Length(max = 32, message = "社保配置ID不能超过32个字符") @Length(max = 32, message = "社保配置ID不能超过32个字符")
@ExcelProperty("社保配置ID") @ExcelProperty("社保配置ID")
@Schema(description = "社保配置ID") @Schema(description = "社保配置ID")
...@@ -70,7 +69,7 @@ public class TAutoSocialRuleRel extends BaseEntity { ...@@ -70,7 +69,7 @@ public class TAutoSocialRuleRel extends BaseEntity {
/** /**
* 社保户ID * 社保户ID
*/ */
@ExcelAttribute(name = "社保户ID", maxLength = 50) @ExcelAttribute(name = "社保户ID", maxLength = 50, isNotEmpty = true, errorInfo = "社保户不能为空")
@Length(max = 50, message = "社保户ID不能超过50个字符") @Length(max = 50, message = "社保户ID不能超过50个字符")
@ExcelProperty("社保户ID") @ExcelProperty("社保户ID")
@Schema(description = "社保户ID") @Schema(description = "社保户ID")
...@@ -78,33 +77,33 @@ public class TAutoSocialRuleRel extends BaseEntity { ...@@ -78,33 +77,33 @@ public class TAutoSocialRuleRel extends BaseEntity {
/** /**
* 社保起缴日期是否一致(0-是,1-否) * 社保起缴日期是否一致(0-是,1-否)
*/ */
@ExcelAttribute(name = "社保起缴日期是否一致(0-是,1-否)", maxLength = 1) @ExcelAttribute(name = "社保起缴日期是否一致", maxLength = 1, isNotEmpty = true, errorInfo = "社保起缴日期是否一致不能为空")
@Length(max = 1, message = "社保起缴日期是否一致(0-是,1-否)不能超过1个字符") @Length(max = 1, message = "社保起缴日期是否一致不能超过1个字符")
@ExcelProperty("社保起缴日期是否一致(0-是,1-否)") @ExcelProperty("社保起缴日期是否一致")
@Schema(description = "社保起缴日期是否一致(0-是,1-否)") @Schema(description = "社保起缴日期是否一致(0-是,1-否)")
private String socialDateFlag; private String socialDateFlag;
/** /**
* 起缴日期:0 入职日期 * 起缴日期:0 入职日期
*/ */
@ExcelAttribute(name = "起缴日期:0 入职日期", maxLength = 2) @ExcelAttribute(name = "起缴日期", maxLength = 2)
@Length(max = 2, message = "起缴日期:0 入职日期不能超过2个字符") @Length(max = 2, message = "起缴日期不能超过2个字符")
@ExcelProperty("起缴日期:0 入职日期") @ExcelProperty("起缴日期")
@Schema(description = "起缴日期:0 入职日期") @Schema(description = "起缴日期:0 入职日期")
private String socialDateType; private String socialDateType;
/** /**
* 缴纳类型:0最低、1自定义、2最高 * 缴纳类型:0最低、1自定义、2最高
*/ */
@ExcelAttribute(name = "缴纳类型:0最低、1自定义、2最高", maxLength = 2) @ExcelAttribute(name = "缴纳类型", maxLength = 2, isNotEmpty = true, errorInfo = "缴纳类型不能为空")
@Length(max = 2, message = "缴纳类型:0最低、1自定义、2最高不能超过2个字符") @Length(max = 2, message = "缴纳类型不能超过2个字符")
@ExcelProperty("缴纳类型:0最低、1自定义、2最高") @ExcelProperty("缴纳类型")
@Schema(description = "缴纳类型:0最低、1自定义、2最高") @Schema(description = "缴纳类型:0最低、1自定义、2最高")
private String paymentType; private String paymentType;
/** /**
* 备案基数类型:0固定值1自定义 * 备案基数类型:0固定值1自定义
*/ */
@ExcelAttribute(name = "备案基数类型:0固定值1自定义", maxLength = 2) @ExcelAttribute(name = "备案基数类型", maxLength = 2 ,isNotEmpty = true, errorInfo = "备案基数类型不能为空")
@Length(max = 2, message = "备案基数类型:0固定值1自定义不能超过2个字符") @Length(max = 2, message = "备案基数类型不能超过2个字符")
@ExcelProperty("备案基数类型:0固定值1自定义") @ExcelProperty("备案基数类型")
@Schema(description = "备案基数类型:0固定值1自定义") @Schema(description = "备案基数类型:0固定值1自定义")
private String recordBaseType; private String recordBaseType;
/** /**
...@@ -118,15 +117,15 @@ public class TAutoSocialRuleRel extends BaseEntity { ...@@ -118,15 +117,15 @@ public class TAutoSocialRuleRel extends BaseEntity {
/** /**
* 委托备注(字典值) * 委托备注(字典值)
*/ */
@ExcelAttribute(name = "委托备注(字典值)", maxLength = 100) @ExcelAttribute(name = "委托备注", maxLength = 100)
@Length(max = 100, message = "委托备注(字典值)不能超过100个字符") @Length(max = 100, message = "委托备注不能超过100个字符")
@ExcelProperty("委托备注(字典值)") @ExcelProperty("委托备注")
@Schema(description = "委托备注(字典值)") @Schema(description = "委托备注(字典值)")
private String remarkDict; private String remarkDict;
/** /**
* 项目编码 * 项目编码
*/ */
@ExcelAttribute(name = "项目编码", isNotEmpty = true, errorInfo = "项目编码不能为空", maxLength = 50) @ExcelAttribute(name = "项目编码",maxLength = 50)
@NotBlank(message = "项目编码不能为空") @NotBlank(message = "项目编码不能为空")
@Length(max = 50, message = "项目编码不能超过50个字符") @Length(max = 50, message = "项目编码不能超过50个字符")
@ExcelProperty("项目编码") @ExcelProperty("项目编码")
...@@ -135,7 +134,7 @@ public class TAutoSocialRuleRel extends BaseEntity { ...@@ -135,7 +134,7 @@ public class TAutoSocialRuleRel extends BaseEntity {
/** /**
* 项目ID * 项目ID
*/ */
@ExcelAttribute(name = "项目ID", isNotEmpty = true, errorInfo = "项目ID不能为空", maxLength = 50) @ExcelAttribute(name = "项目ID",maxLength = 50)
@NotBlank(message = "项目ID不能为空") @NotBlank(message = "项目ID不能为空")
@Length(max = 50, message = "项目ID不能超过50个字符") @Length(max = 50, message = "项目ID不能超过50个字符")
@ExcelProperty("项目ID") @ExcelProperty("项目ID")
......
...@@ -46,4 +46,10 @@ public class TAutoMainRelAddVo implements Serializable { ...@@ -46,4 +46,10 @@ public class TAutoMainRelAddVo implements Serializable {
//员工合同签订规则配置方案子表表 //员工合同签订规则配置方案子表表
private List<TAutoContractScheme> contractSchemes; private List<TAutoContractScheme> contractSchemes;
//社保规则主表
private TAutoSocialRuleInfo autoSocialRuleInfo;
//社保规则明细表
private List<TAutoSocialRuleRel> socialRuleRels;
} }
...@@ -60,4 +60,10 @@ public class TAutoMainRelDetailVo implements Serializable { ...@@ -60,4 +60,10 @@ public class TAutoMainRelDetailVo implements Serializable {
//员工合同签订规则配置方案子表表 //员工合同签订规则配置方案子表表
private List<TAutoContractScheme> contractSchemes; private List<TAutoContractScheme> contractSchemes;
//社保规则表
private TAutoSocialRuleInfo socialRuleInfo;
//社保规则明细表
private List<TAutoSocialRuleRel> socialRuleRels;
} }
...@@ -95,6 +95,14 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -95,6 +95,14 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
@Autowired @Autowired
private TAutoContractSchemeMapper contractSchemeMapper; private TAutoContractSchemeMapper contractSchemeMapper;
// 社保规则主表Mapper
@Autowired
private TAutoSocialRuleInfoMapper autoSocialRuleInfoMapper;
// 社保规则明细表Mapper
@Autowired
private TAutoSocialRuleRelMapper autoSocialRuleRelMapper;
public static final String itemsLabel = "label,description,disable"; public static final String itemsLabel = "label,description,disable";
public static final String itemsLabelRepeat = "同一项目岗位名称不可重复"; public static final String itemsLabelRepeat = "同一项目岗位名称不可重复";
...@@ -270,6 +278,12 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -270,6 +278,12 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
detailVo.setContractSchemes(contractSchemeMapper.selectList(Wrappers.<TAutoContractScheme>query().lambda() detailVo.setContractSchemes(contractSchemeMapper.selectList(Wrappers.<TAutoContractScheme>query().lambda()
.eq(TAutoContractScheme::getDeptId,mainRel.getDeptId()))); .eq(TAutoContractScheme::getDeptId,mainRel.getDeptId())));
} }
//社保规则配置表
detailVo.setSocialRuleInfo(autoSocialRuleInfoMapper.selectOne(Wrappers.<TAutoSocialRuleInfo>query().lambda()
.eq(TAutoSocialRuleInfo::getMainId,id)));
//社保规则配置明细表
detailVo.setSocialRuleRels(autoSocialRuleRelMapper.selectList(Wrappers.<TAutoSocialRuleRel>query().lambda()
.eq(TAutoSocialRuleRel::getDeptId,mainRel.getDeptId())));
return R.ok(detailVo); return R.ok(detailVo);
} }
/** /**
...@@ -351,6 +365,21 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -351,6 +365,21 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
if (PARAM_IS_NOT_ERROR != null){ if (PARAM_IS_NOT_ERROR != null){
return PARAM_IS_NOT_ERROR; return PARAM_IS_NOT_ERROR;
} }
//校验社保规则主表信息
TAutoSocialRuleInfo autoSocialRuleInfo = entity.getAutoSocialRuleInfo();
if (Common.isNotNull(autoSocialRuleInfo)){
ExcelUtil<TAutoSocialRuleInfo> excelUtil = new ExcelUtil<>(TAutoSocialRuleInfo.class);
ErrorMessage errorMessage = excelUtil.checkEntity(autoSocialRuleInfo,0);
if (Common.isNotNull(errorMessage)){
return R.failed(errorMessage.getMessage());
}
}
//校验社保规则明细表信息
List<TAutoSocialRuleRel> socialRuleRels = entity.getSocialRuleRels();
PARAM_IS_NOT_ERROR = checkSocialRuleRels(socialRuleRels);
if (PARAM_IS_NOT_ERROR != null){
return PARAM_IS_NOT_ERROR;
}
//新增主表 //新增主表
autoMainRel.setRuleUpdatePerson(user.getNickname()); autoMainRel.setRuleUpdatePerson(user.getNickname());
autoMainRel.setRuleUpdateTime(DateUtil.getCurrentDateTime()); autoMainRel.setRuleUpdateTime(DateUtil.getCurrentDateTime());
...@@ -408,6 +437,28 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -408,6 +437,28 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
contractSchemeMapper.insert(scheme); contractSchemeMapper.insert(scheme);
} }
} }
//新增社保规则主表
if (Common.isNotNull(autoSocialRuleInfo)){
autoSocialRuleInfo.setDeptNo(autoMainRel.getDeptNo());
autoSocialRuleInfo.setDeptId(autoMainRel.getDeptId());
autoSocialRuleInfo.setMainId(autoMainRel.getId());
autoSocialRuleInfo.setCreateBy(user.getId());
autoSocialRuleInfo.setCreateTime(LocalDateTime.now());
autoSocialRuleInfo.setCreateName(user.getNickname());
autoSocialRuleInfoMapper.insert(autoSocialRuleInfo);
}
//新增社保规则明细表
if (Common.isNotNull(socialRuleRels)){
for (TAutoSocialRuleRel rel:socialRuleRels){
rel.setMainId(autoSocialRuleInfo.getId());
rel.setDeptNo(autoMainRel.getDeptNo());
rel.setDeptId(autoMainRel.getDeptId());
rel.setCreateBy(user.getId());
rel.setCreateTime(LocalDateTime.now());
rel.setCreateName(user.getNickname());
autoSocialRuleRelMapper.insert(rel);
}
}
return R.ok(); return R.ok();
}catch (Exception e){ }catch (Exception e){
// 捕获异常并返回友好提示 // 捕获异常并返回友好提示
...@@ -652,6 +703,31 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -652,6 +703,31 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
return R.failed(schemeNameRepeat); return R.failed(schemeNameRepeat);
} }
//校验社保规则主表信息
TAutoSocialRuleInfo autoSocialRuleNew = entity.getAutoSocialRuleInfo();
TAutoSocialRuleInfo autoSocialRuleOld = null;
if (Common.isNotNull(autoSocialRuleNew)){
// 检查社保规则信息的有效性
ExcelUtil<TAutoSocialRuleInfo> excelUtil = new ExcelUtil<>(TAutoSocialRuleInfo.class);
ErrorMessage errorMessage = excelUtil.checkEntity(autoSocialRuleNew,0);
if (Common.isNotNull(errorMessage)){
return R.failed(errorMessage.getMessage());
}
// 根据ID查询原有的社保规则信息
autoSocialRuleOld = autoSocialRuleInfoMapper.selectOne(Wrappers.<TAutoSocialRuleInfo>query().lambda()
.eq(TAutoSocialRuleInfo::getMainId,autoMainRel.getId()).last(CommonConstants.LAST_ONE_SQL));
}
//社保规则明细是否更新标识 false 未更新 true 更新
boolean socialFlag = false;
List<TAutoSocialRuleRel> socialRuleRelsOld = null;
//校验社保规则明细
List<TAutoSocialRuleRel> socialRuleRels = entity.getSocialRuleRels();
PARAM_IS_NOT_ERROR = checkSocialRuleRels(socialRuleRels);
if (PARAM_IS_NOT_ERROR != null){
return PARAM_IS_NOT_ERROR;
}
//保存商险规则 //保存商险规则
if (Common.isNotNull(autoInsurRuleNew)){ if (Common.isNotNull(autoInsurRuleNew)){
if (Common.isNotNull(autoInsurRuleNew.getId())){ if (Common.isNotNull(autoInsurRuleNew.getId())){
...@@ -715,6 +791,50 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -715,6 +791,50 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
// 判断数据对象是否都在页面传的对象里,有不在的数据,则返回true 目的是判断是否更新了 // 判断数据对象是否都在页面传的对象里,有不在的数据,则返回true 目的是判断是否更新了
schemeFlag = checkContractSchemeForNotIn(schemesOld,schemes); schemeFlag = checkContractSchemeForNotIn(schemesOld,schemes);
}
//保存社保规则配置
if (Common.isNotNull(autoSocialRuleNew)){
if (Common.isNotNull(autoSocialRuleNew.getId())){
autoSocialRuleNew.setUpdateBy(user.getId());
autoSocialRuleNew.setUpdateTime(LocalDateTime.now());
autoSocialRuleInfoMapper.updateById(autoSocialRuleNew);
}else {
autoSocialRuleNew.setDeptNo(autoMainRel.getDeptNo());
autoSocialRuleNew.setDeptId(autoMainRel.getDeptId());
autoSocialRuleNew.setMainId(autoMainRel.getId());
autoSocialRuleNew.setCreateBy(user.getId());
autoSocialRuleNew.setCreateTime(LocalDateTime.now());
autoSocialRuleNew.setCreateName(user.getNickname());
autoSocialRuleInfoMapper.insert(autoSocialRuleNew);
}
//获取旧的社保规则明细
if (Common.isNotNull(autoSocialRuleNew.getId())){
//获取旧的社保规则明细
socialRuleRelsOld = autoSocialRuleRelMapper.selectList(Wrappers
.<TAutoSocialRuleRel>query().lambda().eq(TAutoSocialRuleRel::getMainId,autoSocialRuleNew.getId()));
//先删除后面再批增
autoSocialRuleRelMapper.delete(Wrappers.<TAutoSocialRuleRel>query().lambda().eq(TAutoSocialRuleRel::getMainId,autoSocialRuleNew.getId()));
}
//保存社保规则明细
if (Common.isNotNull(socialRuleRels)){
for (TAutoSocialRuleRel rel:socialRuleRels){
//存在新增的直接socialFlag =true 后面不在判断此种场景
if (!Common.isNotNull(rel.getId())){
socialFlag =true;
}
rel.setMainId(autoSocialRuleNew.getId());
rel.setDeptNo(autoMainRel.getDeptNo());
rel.setDeptId(autoMainRel.getDeptId());
rel.setCreateBy(user.getId());
rel.setCreateTime(LocalDateTime.now());
rel.setCreateName(user.getNickname());
autoSocialRuleRelMapper.insert(rel);
}
}
// 判断数据对象是否都在页面传的对象里,有不在的数据,则返回true 目的是判断是否更新了
socialFlag = checkSocialRuleRelForNotIn(socialRuleRelsOld,socialRuleRels);
} }
// 更新主表 // 更新主表
autoMainRel.setRuleUpdatePerson(user.getNickname()); autoMainRel.setRuleUpdatePerson(user.getNickname());
...@@ -837,6 +957,45 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -837,6 +957,45 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
newMap.put("newSchemes",schemes); newMap.put("newSchemes",schemes);
} }
} }
//处理社保规则日志 (更新时不存在规则删除的场景)
if (Common.isNotNull(autoSocialRuleNew) && Common.isNotNull(autoSocialRuleOld)){
differenceKey = HrEquator.comparisonValueIgnoreField(autoSocialRuleOld, autoSocialRuleNew,ignoreFields);
if (!Common.isEmpty(differenceKey)){
diffKeyMap.put("socialRule",differenceKey);
oldMap.put("oldSocialRule",autoSocialRuleOld);
newMap.put("newSocialRule",autoSocialRuleNew);
}
//处理社保规则明细日志
diffKeys = new StringBuilder();
if (Common.isNotNull(socialRuleRels)){
Map<String,TAutoSocialRuleRel> map;
// 不为空且无新增数据,为空前面校验过了,这里不处理
if (Common.isNotNull(socialRuleRels) && !socialFlag){
map = socialRuleRels.stream().collect(Collectors.toMap(TAutoSocialRuleRel::getId, v->v));
if (Common.isNotNull(autoSocialRuleOld)){
TAutoSocialRuleRel newTemp;
for (TAutoSocialRuleRel old:socialRuleRelsOld){
// 如果存在,则比较,不存在则标记为更新
newTemp = map.get(old.getId());
if (Common.isEmpty(newTemp)){
socialFlag = true;
newTemp = new TAutoSocialRuleRel();
}
differenceKey = HrEquator.comparisonValueIgnoreField(old, newTemp,ignoreFields);
if (!Common.isEmpty(differenceKey)){
diffKeys.append(differenceKey);
socialFlag = true;
}
}
}
}
}
if (socialFlag){
diffKeyMap.put("socialRuleRel","socialRuleRels");
oldMap.put("oldSocialRuleRels",socialRuleRelsOld);
newMap.put("newSocialRuleRels",socialRuleRels);
}
}
// 插入变更日志 // 插入变更日志
insertLog(autoMainRel, diffKeyMap, oldMap, newMap); insertLog(autoMainRel, diffKeyMap, oldMap, newMap);
// 返回更新成功的响应 // 返回更新成功的响应
...@@ -1129,4 +1288,54 @@ private R<Boolean> checkItemRepeat(List<SysAutoDictItem> autoDictItems, Map<Stri ...@@ -1129,4 +1288,54 @@ private R<Boolean> checkItemRepeat(List<SysAutoDictItem> autoDictItems, Map<Stri
} }
return map; return map;
} }
/**
* @Author fxj
* @Description 校验社保规则
* @Date 10:24 2025/6/11
**/
private R<Boolean> checkSocialRuleRels(List<TAutoSocialRuleRel> socialRuleRels) {
if (Common.isNotNull(socialRuleRels)){
ExcelUtil<TAutoSocialRuleRel> excelUtil = new ExcelUtil<>(TAutoSocialRuleRel.class);
ErrorMessage errorMessage;
for (TAutoSocialRuleRel rel: socialRuleRels){
errorMessage = excelUtil.checkEntity(rel,0);
if (Common.isNotNull(errorMessage)){
return R.failed(errorMessage.getMessage());
}
}
// 校验socialRuleRels 配置名称是否重复
Set<String> names = socialRuleRels.stream().map(TAutoSocialRuleRel::getConfigName).collect(Collectors.toSet());
if (names.size() != socialRuleRels.size()) {
return R.failed(schemeNameRepeat);
}
}
return null;
}
/**
* @Author fxj
* @Description 校验社保规则明细是否不在已存在的集合中
* @Date 10:24 2025/6/11
**/
private boolean checkSocialRuleRelForNotIn(List<TAutoSocialRuleRel> socialRuleRels, List<TAutoSocialRuleRel> existingRuleRels) {
if (Common.isEmpty(socialRuleRels) && !Common.isEmpty(existingRuleRels)) {
return true; // 数据库数据无 新增有 返回true
}
if (!Common.isEmpty(socialRuleRels) && Common.isEmpty(existingRuleRels)) {
return true; // 数据库有 新增无返回 true
}
// 不为空判断
if (!Common.isEmpty(socialRuleRels) && !Common.isEmpty(existingRuleRels)) {
Set<String> existingKeys = existingRuleRels.stream()
.map(standard -> Optional.ofNullable(standard.getId()).orElse(""))
.collect(Collectors.toSet());
for (TAutoSocialRuleRel standard : socialRuleRels) {
if (!existingKeys.contains(standard.getId())) {
return true; // 存在不在现有集合中的数据,表示需要处理
}
}
}
return false; // 所有数据都在现有集合中,无需额外处理
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment