|
@@ -16,6 +16,7 @@
|
|
|
*/
|
|
|
package com.qunzhixinxi.hnqz.admin.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -544,24 +545,26 @@ public class WmDaAgentServiceImpl extends ServiceImpl<WmDaAgentMapper, WmDaAgent
|
|
|
.eq(SysDeptSub::getDeptId,sysDept.getDeptId())
|
|
|
.set(SysDeptSub::getEnableFlag, SubjectTypeEnum.ENABLE_FLAG_FALSE.getCode()));
|
|
|
|
|
|
- for (Map.Entry<String, Integer> entry : wmDaAgent.getSubjectTypeAndChannel().entrySet()){
|
|
|
- SysDeptSub condition = new SysDeptSub();
|
|
|
- condition.setDeptId(sysDept.getDeptId());
|
|
|
- condition.setSubjectType(entry.getKey());
|
|
|
- condition.setSubjectChannel(entry.getValue());
|
|
|
- SysDeptSub existSub = sysDeptSubMapper.selectOne(Wrappers.query(condition));
|
|
|
- if(null != existSub){
|
|
|
- existSub.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
- existSub.setUpdateTime(LocalDateTime.now());
|
|
|
- sysDeptSubMapper.updateById(existSub);
|
|
|
- }else {
|
|
|
- existSub = new SysDeptSub();
|
|
|
- existSub.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
- existSub.setDeptId(sysDept.getDeptId());
|
|
|
- existSub.setSubjectType(entry.getKey());
|
|
|
- existSub.setSubjectChannel(entry.getValue());
|
|
|
- existSub.setUpdateTime(LocalDateTime.now());
|
|
|
- sysDeptSubMapper.insert(existSub);
|
|
|
+ if (CollUtil.isNotEmpty(wmDaAgent.getSubjectTypeAndChannel())) {
|
|
|
+ for (Map.Entry<String, Integer> entry : wmDaAgent.getSubjectTypeAndChannel().entrySet()) {
|
|
|
+ SysDeptSub condition = new SysDeptSub();
|
|
|
+ condition.setDeptId(sysDept.getDeptId());
|
|
|
+ condition.setSubjectType(entry.getKey());
|
|
|
+ condition.setSubjectChannel(entry.getValue());
|
|
|
+ SysDeptSub existSub = sysDeptSubMapper.selectOne(Wrappers.query(condition));
|
|
|
+ if (null != existSub) {
|
|
|
+ existSub.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
+ existSub.setUpdateTime(LocalDateTime.now());
|
|
|
+ sysDeptSubMapper.updateById(existSub);
|
|
|
+ } else {
|
|
|
+ existSub = new SysDeptSub();
|
|
|
+ existSub.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
+ existSub.setDeptId(sysDept.getDeptId());
|
|
|
+ existSub.setSubjectType(entry.getKey());
|
|
|
+ existSub.setSubjectChannel(entry.getValue());
|
|
|
+ existSub.setUpdateTime(LocalDateTime.now());
|
|
|
+ sysDeptSubMapper.insert(existSub);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|