|
|
|
@ -780,6 +780,15 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
collect = collect.stream().map(s -> { |
|
|
|
|
//灵活排班把班组名称拼接成人员名称
|
|
|
|
|
if (s.getGroupId() == null) { |
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getId()); |
|
|
|
|
last(" limit 1"); |
|
|
|
|
}}); |
|
|
|
|
//如果person的表中有班组名称,则直接取
|
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyMainPersonEntity) && imsDutyMainPersonEntity.getDutyGroupName() != null) { |
|
|
|
|
s.setName(imsDutyMainPersonEntity.getDutyGroupName()); |
|
|
|
|
} else { |
|
|
|
|
//否则,拼接对应人员
|
|
|
|
|
String[] split = s.getDutyPersonIds().split("\\^"); |
|
|
|
|
if (null != split && split.length > 0) { |
|
|
|
|
for (int j = 0; j < split.length; j++) { |
|
|
|
@ -793,6 +802,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getGroupId()); |
|
|
|
|
s.setName(s.getName() + imsDutyGroupEntity.getGroupName()); |
|
|
|
@ -867,11 +877,11 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
if (null != split && split.length > 0) { |
|
|
|
|
for (String s : split) { |
|
|
|
|
ImsDutyMainVO vo = new ImsDutyMainVO(); |
|
|
|
|
User user = UserCache.getUser(Long.valueOf(s)); |
|
|
|
|
if (ObjectUtil.isNotEmpty(user)) { |
|
|
|
|
R<User> user = userClient.userInfoById(Long.valueOf(s)); |
|
|
|
|
if (user.isSuccess() && ObjectUtil.isNotEmpty(user.getData())) { |
|
|
|
|
vo.setUserId(s); |
|
|
|
|
if (ObjectUtil.isNotEmpty(user)) { |
|
|
|
|
vo.setUserName(user.getName()); |
|
|
|
|
if (ObjectUtil.isNotEmpty(user.getData().getName())) { |
|
|
|
|
vo.setUserName(user.getData().getName()); |
|
|
|
|
} |
|
|
|
|
vo.setId(id); |
|
|
|
|
list.add(vo); |
|
|
|
@ -891,7 +901,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
managerId = imsDutyMainPersonEntity.getDutyChargePerson(); |
|
|
|
|
} |
|
|
|
|
list = list.stream().map(s -> { |
|
|
|
|
if (s.getUserId().equals(managerId.toString())) { |
|
|
|
|
if (managerId.toString().equals(s.getUserId())) { |
|
|
|
|
s.setUserName(s.getUserName() + "(值班组组长)"); |
|
|
|
|
} |
|
|
|
|
return s; |
|
|
|
@ -1260,6 +1270,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
List<ImsDutyMainPersonEntity> personEntityList = imsDutyMainPersonMapper.selectList(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
in(ImsDutyMainPersonEntity::getDutyMainId, mainIds); |
|
|
|
|
}}); |
|
|
|
|
List<Long> list = personEntityList.stream().map(s -> Long.valueOf(s.getId())).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isEmpty(personEntityList)) { |
|
|
|
|
//如果人员计划表中,无值,需要填充对应信息(只有排班-班组,人员计划表才有可能无值)
|
|
|
|
|
//对上一个版本做兼容
|
|
|
|
@ -1303,14 +1314,35 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
List<String> dutyChargePersonIds = personEntityList.stream().filter(s -> s.getDutyChargePerson() != null) |
|
|
|
|
.map(s -> s.getDutyChargePerson().toString()).collect(Collectors.toList()); |
|
|
|
|
manageIds.addAll(dutyChargePersonIds); |
|
|
|
|
personId.stream().map(s -> { |
|
|
|
|
for (String manageId : manageIds) { |
|
|
|
|
if (s.equals(manageId)){ |
|
|
|
|
for (String s : personId) { |
|
|
|
|
if (manageIds.contains(s)) { |
|
|
|
|
return R.fail("值班组组长无法修改排班"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return s; |
|
|
|
|
}); |
|
|
|
|
// personId.stream().map(s -> {
|
|
|
|
|
// for (String manageId : manageIds) {
|
|
|
|
|
// if (s.equals(manageId)){
|
|
|
|
|
// return R.fail("值班组组长无法修改排班");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return s;
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
//之前原有的排版-人员表,需要修改的部分
|
|
|
|
|
List<ImsDutyMainPersonEntity> updatePersonEntityList = personEntityList.stream().map(sig -> { |
|
|
|
|
//如果是班组排班,灵活调动后,对应的班组名称保留,但是不再有groupId
|
|
|
|
|
List<Long> collect = imsDutyMainEntities.stream().filter(s -> s.getId().equals(sig.getDutyMainId())).map(s -> s.getDutyGroupId()).collect(Collectors.toList()); |
|
|
|
|
if (Func.isNotEmpty(collect)) { |
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(collect.get(0)); |
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyGroupEntity)) { |
|
|
|
|
sig.setDutyGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
sig.setDutyGroupId(null); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
long id = IdWorker.getId(sig); |
|
|
|
|
sig.setId(id); |
|
|
|
|
return sig; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
List<ImsDutyMainPersonEntity> addPersonEntityList = new ArrayList<>(); |
|
|
|
|
List<ImsDutyMainEntity> updateDutyMainEntities = imsDutyMainEntities.stream().map(s -> { |
|
|
|
|
String[] dutyMainPersonIds = s.getDutyPersonIds().split("\\^"); |
|
|
|
@ -1328,18 +1360,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
} |
|
|
|
|
return s; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
//之前原有的排版-人员表,需要修改的部分
|
|
|
|
|
List<ImsDutyMainPersonEntity> updatePersonEntityList= personEntityList.stream().map(sig -> { |
|
|
|
|
if (sig.getDutyGroupId() != null) { |
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(sig.getDutyGroupId()); |
|
|
|
|
sig.setDutyGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
sig.setDutyGroupId(null); |
|
|
|
|
} |
|
|
|
|
long id = IdWorker.getId(sig); |
|
|
|
|
sig.setId(id); |
|
|
|
|
return sig; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
//如果是添加,填充对应人员的排版人员表
|
|
|
|
|
//如果是添加,填充对应人员排版表
|
|
|
|
|
if (1 == changeDutyMainVo.getType()) { |
|
|
|
|
for (String addId : personId) { |
|
|
|
|
for (Long mainId : mainIds) { |
|
|
|
@ -1364,8 +1385,9 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//更新排班-班组表,删除排班人员表,再添加排班班组人员表
|
|
|
|
|
this.updateBatchById(updateDutyMainEntities); |
|
|
|
|
List<Long> list = personEntityList.stream().map(s -> Long.valueOf(s.getId())).collect(Collectors.toList()); |
|
|
|
|
List<Long> updateDutyMainIds = updateDutyMainEntities.stream().map(s -> Long.valueOf(s.getId())).collect(Collectors.toList()); |
|
|
|
|
this.baseMapper.deleteByUserId(updateDutyMainIds); |
|
|
|
|
this.saveBatch(updateDutyMainEntities); |
|
|
|
|
iImsDutyMainPersonService.deleteLogic(list); |
|
|
|
|
iImsDutyMainPersonService.saveBatch(updatePersonEntityList); |
|
|
|
|
return R.success("修改成功"); |
|
|
|
|