Commit 703f73e3 authored by fangxinjiang's avatar fangxinjiang

代码优化-fxj

parent ae0cdea5
...@@ -596,7 +596,6 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -596,7 +596,6 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
autoInsurRuleOld = autoInsurRuleInfoMapper.selectOne(Wrappers.<TAutoInsurRuleInfo>query().lambda() autoInsurRuleOld = autoInsurRuleInfoMapper.selectOne(Wrappers.<TAutoInsurRuleInfo>query().lambda()
.eq(TAutoInsurRuleInfo::getMainId,autoMainRel.getId()).last(CommonConstants.LAST_ONE_SQL)); .eq(TAutoInsurRuleInfo::getMainId,autoMainRel.getId()).last(CommonConstants.LAST_ONE_SQL));
} }
//商险购买标准是否更新标识 false 未更新 true 更新 //商险购买标准是否更新标识 false 未更新 true 更新
boolean flag = false; boolean flag = false;
List<TAutoInsurStandard> insurStandardsOld = null; List<TAutoInsurStandard> insurStandardsOld = null;
...@@ -759,82 +758,75 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -759,82 +758,75 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
autoEmpRuleNew.setMainId(autoMainRel.getId()); autoEmpRuleNew.setMainId(autoMainRel.getId());
autoEmpRuleInfoMapper.updateById(autoEmpRuleNew); autoEmpRuleInfoMapper.updateById(autoEmpRuleNew);
} }
//处理商险规则日志 StringBuilder diffKeys = new StringBuilder();
if (Common.isNotNull(autoInsurRuleNew)){ String differenceKey;
if (Common.isEmpty(autoInsurRuleOld)){ //处理商险规则日志 -- 如果是初次创建的,则不记录日志
autoInsurRuleOld = new TAutoInsurRuleInfo(); if (Common.isNotNull(autoInsurRuleNew) && !Common.isEmpty(autoInsurRuleOld)){
} differenceKey = HrEquator.comparisonValueIgnoreField(autoInsurRuleOld, autoInsurRuleNew,ignoreFields);
String differenceKey = HrEquator.comparisonValueIgnoreField(autoInsurRuleOld, autoInsurRuleNew,ignoreFields);
if (!Common.isEmpty(differenceKey)){ if (!Common.isEmpty(differenceKey)){
diffKeyMap.put("insurRule",differenceKey); diffKeyMap.put("insurRule",differenceKey);
oldMap.put("oldInsurRule",autoInsurRuleOld); oldMap.put("oldInsurRule",autoInsurRuleOld);
newMap.put("newInsurRule",autoInsurRuleNew); newMap.put("newInsurRule",autoInsurRuleNew);
} }
} //处理商险购买标准日志
//处理商险购买标准日志 if (Common.isNotNull(insurStandards)){
StringBuilder diffKeys = new StringBuilder(); Map<String,TAutoInsurStandard> map;
if (Common.isNotNull(insurStandards)){ // 不为空且无新增数据,为空前面校验过了,这里不处理
Map<String,TAutoInsurStandard> map; if (Common.isNotNull(insurStandards) && !flag){
// 不为空且无新增数据,为空前面校验过了,这里不处理 map = insurStandards.stream().collect(Collectors.toMap(TAutoInsurStandard::getId, v->v));
if (Common.isNotNull(insurStandards) && !flag){ if (Common.isNotNull(insurStandardsOld)){
map = insurStandards.stream().collect(Collectors.toMap(TAutoInsurStandard::getId, v->v)); TAutoInsurStandard newTemp;
if (Common.isNotNull(insurStandardsOld)){ for (TAutoInsurStandard old:insurStandardsOld){
String differenceKey; // 如果存在,则比较,不存在则标记为更新
TAutoInsurStandard newTemp; newTemp = map.get(old.getId());
for (TAutoInsurStandard old:insurStandardsOld){ if (Common.isEmpty(newTemp)){
// 如果存在,则比较,不存在则标记为更新 flag = true;
newTemp = map.get(old.getId()); newTemp = new TAutoInsurStandard();
if (Common.isEmpty(newTemp)){ }
flag = true; differenceKey = HrEquator.comparisonValueIgnoreField(old, newTemp,ignoreFields);
newTemp = new TAutoInsurStandard(); if (!Common.isEmpty(differenceKey)){
} diffKeys.append(differenceKey);
differenceKey = HrEquator.comparisonValueIgnoreField(old, newTemp,ignoreFields); flag = true;
if (!Common.isEmpty(differenceKey)){ }
diffKeys.append(differenceKey);
flag = true;
} }
} }
} }
} if (flag){
if (flag){ diffKeyMap.put("insurStandardRule","standardInfos");
diffKeyMap.put("insurStandardRule","standardInfos"); oldMap.put("oldInsurStandards",insurStandardsOld);
oldMap.put("oldInsurStandards",insurStandardsOld); newMap.put("newInsurStandards",insurStandards);
newMap.put("newInsurStandards",insurStandards); }
} }
} }
//处理员工合同签订规则日志 //处理员工合同签订规则日志
if (Common.isNotNull(autoContractRuleNew)){ if (Common.isNotNull(autoContractRuleNew) && !Common.isEmpty(autoContractRuleOld)){
if (Common.isEmpty(autoContractRuleOld)){ differenceKey = HrEquator.comparisonValueIgnoreField(autoContractRuleOld, autoContractRuleNew,ignoreFields);
autoContractRuleOld = new TAutoContractRuleInfo();
}
String differenceKey = HrEquator.comparisonValueIgnoreField(autoContractRuleOld, autoContractRuleNew,ignoreFields);
if (!Common.isEmpty(differenceKey)){ if (!Common.isEmpty(differenceKey)){
diffKeyMap.put("contractRule",differenceKey); diffKeyMap.put("contractRule",differenceKey);
oldMap.put("oldcontractRule",autoContractRuleOld); oldMap.put("oldcontractRule",autoContractRuleOld);
newMap.put("newcontractRule",autoContractRuleNew); newMap.put("newcontractRule",autoContractRuleNew);
} }
} //处理员工合同签订规则方案配置日志
//处理员工合同签订规则方案配置日志 diffKeys = new StringBuilder();
diffKeys = new StringBuilder(); if (Common.isNotNull(schemes)){
if (Common.isNotNull(schemes)){ Map<String,TAutoContractScheme> map;
Map<String,TAutoContractScheme> map; // 不为空且无新增数据,为空前面校验过了,这里不处理
// 不为空且无新增数据,为空前面校验过了,这里不处理 if (Common.isNotNull(schemes) && !schemeFlag){
if (Common.isNotNull(schemes) && !schemeFlag){ map = schemes.stream().collect(Collectors.toMap(TAutoContractScheme::getId, v->v));
map = schemes.stream().collect(Collectors.toMap(TAutoContractScheme::getId, v->v)); if (Common.isNotNull(autoContractRuleOld)){
if (Common.isNotNull(autoContractRuleOld)){ TAutoContractScheme newTemp;
String differenceKey; for (TAutoContractScheme old:schemesOld){
TAutoContractScheme newTemp; // 如果存在,则比较,不存在则标记为更新
for (TAutoContractScheme old:schemesOld){ newTemp = map.get(old.getId());
// 如果存在,则比较,不存在则标记为更新 if (Common.isEmpty(newTemp)){
newTemp = map.get(old.getId()); schemeFlag = true;
if (Common.isEmpty(newTemp)){ newTemp = new TAutoContractScheme();
schemeFlag = true; }
newTemp = new TAutoContractScheme(); differenceKey = HrEquator.comparisonValueIgnoreField(old, newTemp,ignoreFields);
} if (!Common.isEmpty(differenceKey)){
differenceKey = HrEquator.comparisonValueIgnoreField(old, newTemp,ignoreFields); diffKeys.append(differenceKey);
if (!Common.isEmpty(differenceKey)){ schemeFlag = true;
diffKeys.append(differenceKey); }
schemeFlag = true;
} }
} }
} }
......
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