Commit 9b0a248e authored by fangxinjiang's avatar fangxinjiang

商险规则配置-fxj

parent 8ff8e2fe
...@@ -480,6 +480,14 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -480,6 +480,14 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
if (!checkInsurStandardsForDuplicates(insurStandards)){ if (!checkInsurStandardsForDuplicates(insurStandards)){
return R.failed(buyStandardRepeat); return R.failed(buyStandardRepeat);
} }
//保存商险规则
//保存商险购买标准
//处理商险规则日志
//处理商险购买标准日志
// 获取旧的商险标准 // 获取旧的商险标准
List<TAutoInsurStandard> insurStandardsOld = autoInsurStandardMapper.selectList(Wrappers List<TAutoInsurStandard> insurStandardsOld = autoInsurStandardMapper.selectList(Wrappers
.<TAutoInsurStandard>query().lambda().eq(TAutoInsurStandard::getMainId,autoInsurRuleNew.getId())); .<TAutoInsurStandard>query().lambda().eq(TAutoInsurStandard::getMainId,autoInsurRuleNew.getId()));
...@@ -492,24 +500,8 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -492,24 +500,8 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
.eq(SysAutoDictItem::getDisable,CommonConstants.ZERO_STRING)); .eq(SysAutoDictItem::getDisable,CommonConstants.ZERO_STRING));
// 如果查询到旧的岗位字典项 // 如果查询到旧的岗位字典项
if (Common.isNotNull(oldAutoDictItems)){ repeatItems = getStringSysAutoDictItemMap(autoDictItems, repeatItems, oldAutoDictItems);
repeatItems = oldAutoDictItems.stream().collect(Collectors.toMap(SysAutoDictItem::getLabel,v->v,(k1,k2)->k1)); // 检验岗位字典是否重复
//数据库中查询的字典 页面已经改了 不在作为重复结果集
for (SysAutoDictItem item:oldAutoDictItems){
for (SysAutoDictItem item1:autoDictItems){
if (Common.isNotNull(item1.getId()) && CommonConstants.ONE_STRING.equals(item1.getDisable())){
repeatItems.remove(item1.getLabel());
}
if (Common.isNotNull(item1.getId())
&& item.getId().equals(item1.getId())
&& !item1.getLabel().equals(item.getLabel())){
repeatItems.remove(item.getLabel());
}
}
}
}
// 检验岗位字典是否重复
R<Boolean> checkRes = checkItemRepeat(autoDictItems, repeatItems); R<Boolean> checkRes = checkItemRepeat(autoDictItems, repeatItems);
// 如果检验结果不为空,则返回检验结果 // 如果检验结果不为空,则返回检验结果
if (checkRes != null){ if (checkRes != null){
...@@ -560,7 +552,28 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu ...@@ -560,7 +552,28 @@ public class TAutoMainRelServiceImpl extends ServiceImpl<TAutoMainRelMapper, TAu
return R.ok(true,CommonConstants.UPDATE_SUCCESS); return R.ok(true,CommonConstants.UPDATE_SUCCESS);
} }
/** private Map<String, SysAutoDictItem> getStringSysAutoDictItemMap(List<SysAutoDictItem> autoDictItems, Map<String, SysAutoDictItem> repeatItems, List<SysAutoDictItem> oldAutoDictItems) {
if (Common.isNotNull(oldAutoDictItems)){
repeatItems = oldAutoDictItems.stream().collect(Collectors.toMap(SysAutoDictItem::getLabel, v->v,(k1, k2)->k1));
//数据库中查询的字典 页面已经改了 不在作为重复结果集
for (SysAutoDictItem item: oldAutoDictItems){
for (SysAutoDictItem item1: autoDictItems){
if (Common.isNotNull(item1.getId()) && CommonConstants.ONE_STRING.equals(item1.getDisable())){
repeatItems.remove(item1.getLabel());
}
if (Common.isNotNull(item1.getId())
&& item.getId().equals(item1.getId())
&& !item1.getLabel().equals(item.getLabel())){
repeatItems.remove(item.getLabel());
}
}
}
}
return repeatItems;
}
/**
* 检查字典项列表中是否存在重复的标签 * 检查字典项列表中是否存在重复的标签
* 此方法用于确保在同一字典下不存在重复的字典项标签 * 此方法用于确保在同一字典下不存在重复的字典项标签
* 它通过比较给定的字典项列表与一个用于跟踪重复项的映射来实现这一点 * 它通过比较给定的字典项列表与一个用于跟踪重复项的映射来实现这一点
......
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