Pārlūkot izejas kodu

feat: 新增派工企业可不填结算渠道

lixuesong 3 gadi atpakaļ
vecāks
revīzija
cdabeef6b6

+ 21 - 18
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmDaAgentServiceImpl.java

@@ -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);
+					}
 				}
 			}