Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 9 months ago
parent
commit
34dd847ffa
  1. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  2. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  3. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

@ -96,8 +96,8 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
@Override
@Transactional(rollbackFor = Exception.class)
public OperPhenomenonEntity startCheck(OperPhenomenonEntity entity) {
if (ObjectUtil.isEmpty(AuthUtil.getDeptId())) {
throw new ServiceException("获取当前用户机构失败!");
if (ObjectUtil.isEmpty(entity.getCreateDept())) {
throw new ServiceException("获取缺陷所属机构失败!");
}
if (ObjectUtil.isNotEmpty(entity.getFinder())&&StringUtils.isBlank(entity.getFinderName())){
User user = UserCache.getUser(entity.getFinder());
@ -109,7 +109,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
entity.setCreateUserName(AuthUtil.getUserName());
}
//加锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent("SysUserLock" + AuthUtil.getDeptId(), AuthUtil.getDeptId(), 30, TimeUnit.SECONDS);
Boolean lock = redisTemplate.opsForValue().setIfAbsent("SysUserLock" + entity.getCreateDept(), entity.getCreateDept(), 30, TimeUnit.SECONDS);
try {
if (lock) {
// 步骤1.保存现象
@ -122,7 +122,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
last("limit 1");
}});
this.startDefectCheckV2(operPhenomenon);
redisTemplate.delete("SysUserLock" + AuthUtil.getDeptId()); //删除key,释放锁
redisTemplate.delete("SysUserLock" + entity.getCreateDept()); //删除key,释放锁
} else {
// 加锁失败,抛出异常
throw new ServiceException("开启现象流程失败!");
@ -134,7 +134,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
//抛出异常,以便回滚
throw new ServiceException("保存现象失败!"+e.getMessage());
}finally {
redisTemplate.delete("SysUserLock" + AuthUtil.getDeptId()); //删除key,释放锁
redisTemplate.delete("SysUserLock" + entity.getCreateDept()); //删除key,释放锁
}
}
@ -145,7 +145,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
* @return
*/
private boolean savePhenomenon(OperPhenomenonEntity entity) {
String deptId = AuthUtil.getDeptId();
String deptId = entity.getCreateDept().toString();
if (StringUtils.isBlank(deptId)) {
throw new ServiceException("获取当前用户机构失败!");
}
@ -180,7 +180,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
// 现象更新时间
entity.setUpdateTime(new Date());
entity.setCreateUser(AuthUtil.getUserId());
entity.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
entity.setCreateDept(entity.getCreateDept());
// 现在最后甄别时间
// Date discriminateDeadline = DateUtil.plusHours(entity.getUpdateTime(), DefectConfiguration.discriminateDeadline);
// entity.setDiscriminateDeadline(discriminateDeadline);

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -1591,7 +1591,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
// 获取一天的排班
List<ImsDutyMainEntity> dutyMainDayList = dutyMainList.stream().filter(var -> dateFormat.format(var.getDutyDate()).equals(dateStr)).collect(Collectors.toList());
List<Long> dayUserIds=new ArrayList<>();
// 循环获取当前日期每个班次组员id
for (ImsDutyMainEntity imsDutyMainEntity : dutyMainDayList) {
ImsDutyMainReportExcel reportExcel = new ImsDutyMainReportExcel();
@ -1602,23 +1602,25 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
}
reportExcel.setDutyDate(dateStr);
reportExcel.setClassName(imsDutyClass.getClassName() + "(" + imsDutyClass.getStartTime() + " - " + imsDutyClass.getEndTime() + ")");
List<Long> personIds;
String managerName;
if (Func.isNotEmpty(imsDutyMainEntity.getDutyGroupId())) {
// 存在分组id需要从分组中获取组长和组员
LambdaQueryWrapper<ImsDutyGroupPEntity> groupPWrapper = new LambdaQueryWrapper();
groupPWrapper.eq(ImsDutyGroupPEntity::getGroupId, imsDutyMainEntity.getDutyGroupId());
List<ImsDutyGroupPEntity> list = imsDutyGroupPService.list(groupPWrapper);
managerName = deptUserMap.get(deptDutyGroupMap.get(imsDutyMainEntity.getDutyGroupId()).getManagerId());
dayUserIds.addAll(list.stream().map(ImsDutyGroupPEntity::getPersonId).collect(Collectors.toList()));
personIds = list.stream()
// 过滤出组长
.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());
dayUserIds.addAll( personList.stream().map(ImsDutyMainPersonEntity::getDutyPerson).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());
}
@ -1628,8 +1630,6 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
for (int j = 0; j < personIds.size(); j++) {
Long userId = personIds.get(j);
String userName = deptUserMap.get(userId);
// 把排班的组员从休息名单中移除
restUserList.removeIf(user -> user.getId().equals(userId));
if (ObjectUtil.isNotEmpty(userName)) {
if (j == personIds.size() - 1) {
personNames += userName;
@ -1648,6 +1648,10 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
restReportExcel.setClassName("休息");
restReportExcel.setManagerName("无班组长");
String personNames = "";
// 把排班的组员从休息名单中移除
for (Long userId : dayUserIds) {
restUserList.removeIf(user -> user.getId().equals(userId));
}
// 获取休息组员的名称
for (int j = 0; j < restUserList.size(); j++) {
User user = restUserList.get(j);

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java

@ -271,7 +271,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
});
//获取接班人班组组长
Long managerId;
if (Func.isNotEmpty(dutyMain.getDutyGroupId())) {
if (Func.isNotEmpty(carryDutyMain.getDutyGroupId())) {
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(carryDutyMain.getDutyGroupId());
ImsDutyGroupPEntity groupPEntity = imsDutyGroupPService.getOne(new LambdaQueryWrapper<ImsDutyGroupPEntity>() {{
eq(ImsDutyGroupPEntity::getGroupId, groupEntity.getId());
@ -854,8 +854,8 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
ImsDutyMainEntity entity = new ImsDutyMainEntity();
entity.setId(id);
entity.setDutyDate(DateUtil.parse(date, DateUtil.PATTERN_DATE));
String format1 = DateUtil.format(new Date(), DateUtil.PATTERN_DATE);
Date parse = DateUtil.parse(format1, DateUtil.PATTERN_DATE);
// String format1 = DateUtil.format(new Date(), DateUtil.PATTERN_DATE);
// Date parse = DateUtil.parse(format1, DateUtil.PATTERN_DATE);
ImsDutyMainEntity mainEntityById = imsDutyMainService.getById(id);
ImsDutyClassEntity classEntity = imsDutyClassService.getOne(new LambdaQueryWrapper<ImsDutyClassEntity>() {{
eq(ImsDutyClassEntity::getId, mainEntityById.getClassId());
@ -863,7 +863,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
}});
String dutyTime = DateUtil.format(mainEntityById.getDutyDate(), DateUtil.PATTERN_DATE) + " " +DateUtil.format(classEntity.getStartTime(), DateUtil.PATTERN_TIME);
Date dutyDate = DateUtil.parse(dutyTime, PATTERN_DATETIME);
if (dutyDate.getTime() > parse.getTime()) {
if (dutyDate.getTime() > new Date().getTime()) {
return R.fail("指定的值班开始时间不能晚于当前时间");
}

Loading…
Cancel
Save