|
|
|
@ -348,7 +348,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
imsDutyMainEntity.setCreateDept(imsSchedulingVo.getCreateDept()); |
|
|
|
|
List<Long> collect; |
|
|
|
|
Long managerId; |
|
|
|
|
String groupName =""; |
|
|
|
|
String groupName = ""; |
|
|
|
|
if (2 == imsSchedulingVo.getPersonType()) { |
|
|
|
|
List<String> idList = imsSchedulingVo.getRosters().get(groupIdsSplit[tempSub]); |
|
|
|
|
collect = idList.stream().map(s -> Long.valueOf(s)).collect(Collectors.toList()); |
|
|
|
@ -538,7 +538,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
imsDutyMainEntity.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
imsDutyMainEntityList.add(imsDutyMainEntity); |
|
|
|
|
proDutyMainId = id == null ? "" : imsDutyMainEntity.getId().toString(); |
|
|
|
|
imsDutyMainEntity1=imsDutyMainEntity; |
|
|
|
|
imsDutyMainEntity1 = imsDutyMainEntity; |
|
|
|
|
//同步保存到排班计划-人员表
|
|
|
|
|
copyPersonByDutyMain(imsSchedulingVo, managerId, groupName, personEntityList, imsDutyMainEntity, collectPerson); |
|
|
|
|
} |
|
|
|
@ -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)) { |
|
|
|
|
//如果人员计划表中,无值,需要填充对应信息(只有排班-班组,人员计划表才有可能无值)
|
|
|
|
|
//对上一个版本做兼容
|
|
|
|
@ -1276,10 +1287,10 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
} |
|
|
|
|
//调出时,做是否是班组组长的判断
|
|
|
|
|
List<String> personId = changeDutyMainVo.getPersonId(); |
|
|
|
|
HashSet<String> manageIds=new HashSet<>(); |
|
|
|
|
HashSet<String> personHashSet=new HashSet<>(); |
|
|
|
|
HashSet<String> manageIds = new HashSet<>(); |
|
|
|
|
HashSet<String> personHashSet = new HashSet<>(); |
|
|
|
|
for (ImsDutyMainEntity imsDutyMainEntity : imsDutyMainEntities) { |
|
|
|
|
if (imsDutyMainEntity.getDutyGroupId()!=null){ |
|
|
|
|
if (imsDutyMainEntity.getDutyGroupId() != null) { |
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(imsDutyMainEntity.getDutyGroupId()); |
|
|
|
|
manageIds.add(imsDutyGroupEntity.getManagerId().toString()); |
|
|
|
|
} |
|
|
|
@ -1289,28 +1300,49 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
} |
|
|
|
|
//调入调出,对人员做重复判断
|
|
|
|
|
for (String s : personId) { |
|
|
|
|
if (1==changeDutyMainVo.getType()) { |
|
|
|
|
if (1 == changeDutyMainVo.getType()) { |
|
|
|
|
if (personHashSet.contains(s)) { |
|
|
|
|
return R.fail("不可重复值班"); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
if (!personHashSet.contains(s)) { |
|
|
|
|
return R.fail("该人员暂无排班计划"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//值班组长无法调走
|
|
|
|
|
List<String> dutyChargePersonIds = personEntityList.stream().filter(s -> s.getDutyChargePerson()!=null) |
|
|
|
|
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,24 +1360,13 @@ 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()) { |
|
|
|
|
//如果是添加,填充对应人员排版表
|
|
|
|
|
if (1 == changeDutyMainVo.getType()) { |
|
|
|
|
for (String addId : personId) { |
|
|
|
|
for (Long mainId : mainIds) { |
|
|
|
|
//copy修改后的数据,
|
|
|
|
|
List<ImsDutyMainPersonEntity> collect = updatePersonEntityList.stream().filter(s -> mainId.equals(s.getDutyMainId())).collect(Collectors.toList()); |
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity=collect.get(0); |
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = collect.get(0); |
|
|
|
|
ImsDutyMainPersonEntity addEntity = new ImsDutyMainPersonEntity(); |
|
|
|
|
BeanUtil.copy(imsDutyMainPersonEntity, addEntity); |
|
|
|
|
addEntity.setDutyPerson(Long.valueOf(addId)); |
|
|
|
@ -1358,14 +1379,15 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
} |
|
|
|
|
if (2 == changeDutyMainVo.getType()) { |
|
|
|
|
for (String s : personId) { |
|
|
|
|
updatePersonEntityList=updatePersonEntityList.stream().filter( |
|
|
|
|
updatePersonEntityList = updatePersonEntityList.stream().filter( |
|
|
|
|
sig -> !sig.getDutyPerson().equals(s)) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//更新排班-班组表,删除排班人员表,再添加排班班组人员表
|
|
|
|
|
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("修改成功"); |
|
|
|
@ -1391,7 +1413,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
Map<Long, ImsDutyClassEntity> deptDutyClassMap = deptDutyClassList.stream().collect(Collectors.toMap(ImsDutyClassEntity::getId, Function.identity())); |
|
|
|
|
|
|
|
|
|
// 获取部门的所有组员
|
|
|
|
|
List<User> allUserList = userClient.userList("200000",deptId).getData(); |
|
|
|
|
List<User> allUserList = userClient.userList("200000", deptId).getData(); |
|
|
|
|
Map<Long, String> deptUserMap = allUserList.stream().collect(Collectors.toMap(User::getId, User::getName)); |
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<ImsDutyMainEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
@ -1417,7 +1439,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
for (int i = 1; i <= days; i++) { |
|
|
|
|
String dateStr = getDate(year, month, i); |
|
|
|
|
|
|
|
|
|
List<User> restUserList = userClient.userList("200000",deptId).getData(); |
|
|
|
|
List<User> restUserList = userClient.userList("200000", deptId).getData(); |
|
|
|
|
|
|
|
|
|
// 获取一天的排班
|
|
|
|
|
List<ImsDutyMainEntity> dutyMainDayList = dutyMainList.stream().filter(var -> dateFormat.format(var.getDutyDate()).equals(dateStr)).collect(Collectors.toList()); |
|
|
|
@ -1444,13 +1466,13 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
managerName = deptUserMap.get(deptDutyGroupMap.get(imsDutyMainEntity.getDutyGroupId()).getManagerId()); |
|
|
|
|
personIds = list.stream() |
|
|
|
|
// 过滤出组长
|
|
|
|
|
.filter(s->!s.getPersonId().equals(deptDutyGroupMap.get(imsDutyMainEntity.getDutyGroupId()).getManagerId())) |
|
|
|
|
.filter(s -> !s.getPersonId().equals(deptDutyGroupMap.get(imsDutyMainEntity.getDutyGroupId()).getManagerId())) |
|
|
|
|
.map(ImsDutyGroupPEntity::getPersonId).collect(Collectors.toList()); |
|
|
|
|
} else { |
|
|
|
|
// 不存在分组id从排班人员中获取组长和组员
|
|
|
|
|
List<ImsDutyMainPersonEntity> personList = deptPersonList.stream().filter(var -> var.getDutyMainId().equals(imsDutyMainEntity.getId())).collect(Collectors.toList()); |
|
|
|
|
managerName = deptUserMap.get(personList.get(0).getDutyChargePerson()); |
|
|
|
|
personIds = personList.stream().filter(s->!s.getDutyPerson().equals(personList.get(0).getDutyChargePerson())).map(ImsDutyMainPersonEntity::getDutyPerson).collect(Collectors.toList()); |
|
|
|
|
personIds = personList.stream().filter(s -> !s.getDutyPerson().equals(personList.get(0).getDutyChargePerson())).map(ImsDutyMainPersonEntity::getDutyPerson).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String personNames = ""; |
|
|
|
@ -1714,7 +1736,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
imsDutyMainEntity.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
imsDutyMainEntityList.add(imsDutyMainEntity); |
|
|
|
|
proDutyMainId = id == null ? "" : imsDutyMainEntity.getId().toString(); |
|
|
|
|
BeanUtils.copyProperties(imsDutyMainEntity,imsDutyMainEntity1); |
|
|
|
|
BeanUtils.copyProperties(imsDutyMainEntity, imsDutyMainEntity1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1771,14 +1793,14 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getId()); |
|
|
|
|
last("limit 1"); |
|
|
|
|
}}); |
|
|
|
|
if(ObjectUtil.isNotEmpty(imsDutyMainPersonEntity.getDutyChargePerson())){ |
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyMainPersonEntity.getDutyChargePerson())) { |
|
|
|
|
s.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson().toString()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getDutyGroupId()); |
|
|
|
|
s.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
s.setDutyGroupId(imsDutyGroupEntity.getId()); |
|
|
|
|
if(ObjectUtil.isNotEmpty(imsDutyGroupEntity.getManagerId())){ |
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyGroupEntity.getManagerId())) { |
|
|
|
|
s.setManagerId(imsDutyGroupEntity.getManagerId().toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1795,7 +1817,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
@Override |
|
|
|
|
public DutyMainInfoVo getNextDutyDataV2(Long parentId) { |
|
|
|
|
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.selectDutyMainInfoSignV2(parentId); |
|
|
|
|
if(ObjectUtil.isEmpty(dutyMainInfoVo)){ |
|
|
|
|
if (ObjectUtil.isEmpty(dutyMainInfoVo)) { |
|
|
|
|
return new DutyMainInfoVo(); |
|
|
|
|
} |
|
|
|
|
if (null == dutyMainInfoVo.getDutyGroupId()) { |
|
|
|
@ -1803,14 +1825,14 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId()); |
|
|
|
|
last("limit 1"); |
|
|
|
|
}}); |
|
|
|
|
if(ObjectUtil.isNotEmpty(imsDutyMainPersonEntity) && ObjectUtil.isNotEmpty(imsDutyMainPersonEntity.getDutyChargePerson())){ |
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyMainPersonEntity) && ObjectUtil.isNotEmpty(imsDutyMainPersonEntity.getDutyChargePerson())) { |
|
|
|
|
dutyMainInfoVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson().toString()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(dutyMainInfoVo.getDutyGroupId()); |
|
|
|
|
dutyMainInfoVo.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
dutyMainInfoVo.setDutyGroupId(imsDutyGroupEntity.getId()); |
|
|
|
|
if(ObjectUtil.isNotEmpty(imsDutyGroupEntity) && ObjectUtil.isNotEmpty(imsDutyGroupEntity.getManagerId())){ |
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyGroupEntity) && ObjectUtil.isNotEmpty(imsDutyGroupEntity.getManagerId())) { |
|
|
|
|
dutyMainInfoVo.setManagerId(imsDutyGroupEntity.getManagerId().toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|