|
@@ -248,25 +248,25 @@ public class WmDaAgentServiceImpl extends ServiceImpl<WmDaAgentMapper, WmDaAgent
|
|
|
|
|
|
IPage<WmDaAgent> wmDaAgentIPage = wmDaAgentMapper.selectWmManagementPage(page, wmDaAgent);
|
|
|
|
|
|
- // wmDaAgentIPage.getRecords().forEach(agent ->{
|
|
|
- //
|
|
|
- // Map<String, Integer> collect = sysDeptSubMapper.selectList(Wrappers.<SysDeptSub>lambdaQuery().eq(SysDeptSub::getDeptId, agent.getDeptId()))
|
|
|
- // .stream().collect(Collectors.toMap(SysDeptSub::getSubjectType, SysDeptSub::getSubjectChannel));
|
|
|
- //
|
|
|
- // agent.setSubjectTypeAndChannel(collect);
|
|
|
- //
|
|
|
- // });
|
|
|
-
|
|
|
- wmDaAgentIPage.getRecords().forEach(agent -> {
|
|
|
- SysDeptSub sysDeptSub = new SysDeptSub();
|
|
|
- sysDeptSub.setDeptId(Integer.valueOf(agent.getDeptId()));
|
|
|
- sysDeptSub.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
- List<SysDeptSub> subList = sysDeptSubMapper.selectList(Wrappers.query(sysDeptSub));
|
|
|
- if (CollUtil.isNotEmpty(subList)) {
|
|
|
- String[] subTypeArr = subList.stream().map(SysDeptSub::getSubjectType).toArray(String[]::new);
|
|
|
- agent.setSubjectType(subTypeArr);
|
|
|
- }
|
|
|
- });
|
|
|
+ wmDaAgentIPage.getRecords().forEach(agent ->{
|
|
|
+
|
|
|
+ Map<String, Integer> collect = sysDeptSubMapper.selectList(Wrappers.<SysDeptSub>lambdaQuery().eq(SysDeptSub::getDeptId, agent.getDeptId()))
|
|
|
+ .stream().collect(Collectors.toMap(sysDeptSub -> sysDeptSub.getSubjectLocation().name(), SysDeptSub::getSubjectChannel));
|
|
|
+ agent.setSubjectType(collect.keySet().toArray(collect.keySet().toArray(new String[0])));
|
|
|
+ agent.setSubjectTypeAndChannel(collect);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+// wmDaAgentIPage.getRecords().forEach(agent -> {
|
|
|
+// SysDeptSub sysDeptSub = new SysDeptSub();
|
|
|
+// sysDeptSub.setDeptId(Integer.valueOf(agent.getDeptId()));
|
|
|
+// sysDeptSub.setEnableFlag(SubjectTypeEnum.ENABLE_FLAG_TRUE.getCode());
|
|
|
+// List<SysDeptSub> subList = sysDeptSubMapper.selectList(Wrappers.query(sysDeptSub));
|
|
|
+// if (CollUtil.isNotEmpty(subList)) {
|
|
|
+// String[] subTypeArr = subList.stream().map(SysDeptSub::getSubjectType).distinct().toArray(String[]::new);
|
|
|
+// agent.setSubjectType(subTypeArr);
|
|
|
+// }
|
|
|
+// });
|
|
|
|
|
|
return wmDaAgentIPage;
|
|
|
}
|
|
@@ -554,28 +554,28 @@ public class WmDaAgentServiceImpl extends ServiceImpl<WmDaAgentMapper, WmDaAgent
|
|
|
.eq(SysDeptSub::getDeptId,sysDept.getDeptId())
|
|
|
.set(SysDeptSub::getEnableFlag, SubjectTypeEnum.ENABLE_FLAG_FALSE.getCode()));
|
|
|
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// 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);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
}
|
|
|
/**
|