Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 2 years ago
parent
commit
dacdb3c68b
  1. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/scheduled/DutyRecCreateTask.java
  2. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainPersonService.java
  3. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java
  4. 35
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupServiceImpl.java
  5. 58
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainPersonServiceImpl.java
  6. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  7. 279
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  8. 25
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainStatisticsServiceImpl.java

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/scheduled/DutyRecCreateTask.java

@ -5,8 +5,6 @@ import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import static com.hnac.hzims.operational.duty.constant.DutyScheduledConstant.TASK_VALUE_MESSAGE_REMINDING_CREATE; import static com.hnac.hzims.operational.duty.constant.DutyScheduledConstant.TASK_VALUE_MESSAGE_REMINDING_CREATE;
@ -24,13 +22,17 @@ public class DutyRecCreateTask {
* @return * @return
* @throws Exception * @throws Exception
*/ */
// @XxlJob(TASK_VALUE_MESSAGE_REMINDING_CREATE)
// public ReturnT<String> messageRemonding(String param) throws Exception {
// recService.messageRemonding();
// return new ReturnT<>("SUCCESS");
// }
@XxlJob(TASK_VALUE_MESSAGE_REMINDING_CREATE) @XxlJob(TASK_VALUE_MESSAGE_REMINDING_CREATE)
public ReturnT<String> messageRemonding(String param) throws Exception { public ReturnT<String> messageRemondingV2(String param) throws Exception {
recService.messageRemonding(); recService.messageRemondingV2();
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
} }

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainPersonService.java

@ -14,4 +14,7 @@ public interface IImsDutyMainPersonService extends BaseService<ImsDutyMainPerson
void doSaveBasch(List<ImsDutyMainPersonEntity> list); void doSaveBasch(List<ImsDutyMainPersonEntity> list);
List<ImsDutyMainPersonEntity> selectByMainIds(List<Long> dutyMainIds);
List<ImsDutyMainPersonEntity> selectByMainId(Long dutyMainId);
} }

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java

@ -6,10 +6,8 @@ import com.hnac.hzims.operational.duty.dto.ChangeShiftsRspDTO;
import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import com.hnac.hzims.operational.duty.vo.ImsDutyQrCodeVo;
import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO; import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO;
import com.hnac.hzims.operational.duty.vo.ImsRecVo; import com.hnac.hzims.operational.duty.vo.ImsRecVo;
import com.hnac.hzims.operational.duty.vo.ImsSchedulingVo;
import com.hnac.hzinfo.inspect.plan.vo.PlanVO; import com.hnac.hzinfo.inspect.plan.vo.PlanVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -62,9 +60,15 @@ public interface IImsDutyRecService extends BaseService<ImsDutyRecEntity> {
String getQRCode(); String getQRCode();
/** /**
* 消息提醒 20230414之后已弃用
* 根据黄兴的消息中心模板更新为新的V2的接口
*/
// void messageRemonding();
/**
* 消息提醒 * 消息提醒
*/ */
void messageRemonding(); void messageRemondingV2();
/** /**
* 消息提醒测试 * 消息提醒测试

35
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupServiceImpl.java

@ -3,12 +3,10 @@ package com.hnac.hzims.operational.duty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.duty.entity.ImsDutyGroupEntity; import com.hnac.hzims.operational.duty.entity.*;
import com.hnac.hzims.operational.duty.entity.ImsDutyGroupPEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import com.hnac.hzims.operational.duty.mapper.ImsDutyGroupMapper; import com.hnac.hzims.operational.duty.mapper.ImsDutyGroupMapper;
import com.hnac.hzims.operational.duty.mapper.ImsDutyGroupPMapper; import com.hnac.hzims.operational.duty.mapper.ImsDutyGroupPMapper;
import com.hnac.hzims.operational.duty.mapper.ImsDutyMainPersonMapper;
import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService; import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService;
import com.hnac.hzims.operational.duty.service.IImsDutyGroupService; import com.hnac.hzims.operational.duty.service.IImsDutyGroupService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
@ -48,7 +46,8 @@ public class ImsDutyGroupServiceImpl extends BaseServiceImpl<ImsDutyGroupMapper,
@Autowired @Autowired
private ImsDutyGroupPMapper imsDutyGroupPMapper; private ImsDutyGroupPMapper imsDutyGroupPMapper;
@Autowired
private ImsDutyMainPersonMapper imsDutyMainPersonMapper;
@Autowired @Autowired
private IUserClient userClient; private IUserClient userClient;
@ -292,17 +291,33 @@ public class ImsDutyGroupServiceImpl extends BaseServiceImpl<ImsDutyGroupMapper,
if (CollectionUtil.isNotEmpty(list1)) { if (CollectionUtil.isNotEmpty(list1)) {
ImsDutyMainEntity imsDutyMainEntity = list1.get(0); ImsDutyMainEntity imsDutyMainEntity = list1.get(0);
ImsDutyGroupEntity groupEntity = this.baseMapper.selectById(imsDutyMainEntity.getDutyGroupId());
String userName = ""; String userName = "";
if (null != groupEntity.getManagerId()) { Long managerId = null;
R<User> userR = userClient.userInfoById(groupEntity.getManagerId()); String groupName = "";
if (imsDutyMainEntity.getDutyGroupId()!=null) {
ImsDutyGroupEntity groupEntity = this.baseMapper.selectById(imsDutyMainEntity.getDutyGroupId());
if (null != groupEntity.getManagerId()){
managerId=groupEntity.getManagerId();
}
groupName=groupEntity.getGroupName();
}else {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, imsDutyMainEntity.getId());
last(" limit 1");
}});
managerId=imsDutyMainPersonEntity.getDutyChargePerson();
groupName="灵活排班";
}
if (managerId!=null) {
R<User> userR = userClient.userInfoById(managerId);
if (userR.isSuccess() && ObjectUtil.isNotEmpty(userR.getData())) { if (userR.isSuccess() && ObjectUtil.isNotEmpty(userR.getData())) {
userName = userR.getData().getName(); userName = userR.getData().getName();
} }
} }
return R.fail(groupEntity.getGroupName() + userName + return R.fail(groupName +"-"+ userName +
"是负责人,且存在排班不能直接删除,请先更换" + groupEntity.getGroupName() + "负责人,再进行删除操作!"); "是负责人,且存在排班不能直接删除,请先更换" + groupName + "负责人,再进行删除操作!");
} }
} }
imsDutyGroupPService.deleteBatch(ids); imsDutyGroupPService.deleteBatch(ids);

58
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainPersonServiceImpl.java

@ -1,47 +1,19 @@
package com.hnac.hzims.operational.duty.service.impl; package com.hnac.hzims.operational.duty.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.operational.defect.constants.DefectConstant;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper; import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper;
import com.hnac.hzims.operational.duty.entity.*; import com.hnac.hzims.operational.duty.entity.ImsDutyMainPersonEntity;
import com.hnac.hzims.operational.duty.enume.DutyRecStatus;
import com.hnac.hzims.operational.duty.enume.JoinStatus;
import com.hnac.hzims.operational.duty.mapper.*; import com.hnac.hzims.operational.duty.mapper.*;
import com.hnac.hzims.operational.duty.scheduled.ThreadTask;
import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService; import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainPersonService; import com.hnac.hzims.operational.duty.service.IImsDutyMainPersonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainTemplateService; import com.hnac.hzims.operational.duty.service.IImsDutyMainTemplateService;
import com.hnac.hzims.operational.duty.vo.*;
import com.hnac.hzims.operational.main.vo.DutyPersonalReportVO;
import com.hnac.hzims.operational.report.vo.DutyReportVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Time; import java.util.List;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* 服务实现类 * 服务实现类
@ -71,4 +43,28 @@ public class ImsDutyMainPersonServiceImpl extends BaseServiceImpl<ImsDutyMainPer
public void doSaveBasch(List<ImsDutyMainPersonEntity> list) { public void doSaveBasch(List<ImsDutyMainPersonEntity> list) {
this.saveBatch(list); this.saveBatch(list);
} }
@Override
public List<ImsDutyMainPersonEntity> selectByMainIds(List<Long> dutyMainIds) {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = this.baseMapper.selectList(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
in(ImsDutyMainPersonEntity::getDutyMainId, dutyMainIds);
}});
if (CollectionUtils.isNotEmpty(imsDutyMainPersonEntities)){
return imsDutyMainPersonEntities;
}
return null;
}
@Override
public List<ImsDutyMainPersonEntity> selectByMainId(Long dutyMainId) {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = this.baseMapper.selectList(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainId);
}});
if (CollectionUtils.isNotEmpty(imsDutyMainPersonEntities)){
return imsDutyMainPersonEntities;
}
return null;
}
} }

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

@ -160,6 +160,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
imsSchedulingVo.setGroupName("临时班组"); imsSchedulingVo.setGroupName("临时班组");
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, id); eq(ImsDutyMainPersonEntity::getDutyMainId, id);
last(" limit 1");
}}); }});
imsSchedulingVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson()); imsSchedulingVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson());
} else { } else {
@ -1110,7 +1111,6 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
eq(DutyGroupGeneratingCapacityEntity::getEndTime, dutyMainInfoVo.getEndTime()); eq(DutyGroupGeneratingCapacityEntity::getEndTime, dutyMainInfoVo.getEndTime());
eq(DutyGroupGeneratingCapacityEntity::getDutyDept, dutyMainInfoVo.getCreateDept()); eq(DutyGroupGeneratingCapacityEntity::getDutyDept, dutyMainInfoVo.getCreateDept());
eq(DutyGroupGeneratingCapacityEntity::getDateTime, DateUtil.format(dutyMainInfoVo.getDutyDate(), DateUtil.PATTERN_DATE)); eq(DutyGroupGeneratingCapacityEntity::getDateTime, DateUtil.format(dutyMainInfoVo.getDutyDate(), DateUtil.PATTERN_DATE));
eq(DutyGroupGeneratingCapacityEntity::getGroupId, dutyMainInfoVo.getDutyGroupId());
}}); }});
if (CollectionUtil.isNotEmpty(generatingCapacityList)) { if (CollectionUtil.isNotEmpty(generatingCapacityList)) {
double generatingCapacity = generatingCapacityList.stream().mapToDouble(DutyGroupGeneratingCapacityEntity::getGeneratingCapacity).sum(); double generatingCapacity = generatingCapacityList.stream().mapToDouble(DutyGroupGeneratingCapacityEntity::getGeneratingCapacity).sum();
@ -1376,7 +1376,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
*/ */
private NextDutyInfoVo getUpDutyInfo(DutyInfoVo item) { private NextDutyInfoVo getUpDutyInfo(DutyInfoVo item) {
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.queryDutyInfoV2(item.getPreDutyId()); DutyMainInfoVo dutyMainInfoVo = this.baseMapper.queryDutyInfoV2(item.getPreDutyId());
if (null == dutyMainInfoVo.getGroupName()) { if (null == dutyMainInfoVo.getDutyGroupId()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId()); eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId());
}}); }});
@ -1634,7 +1634,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
public List<DutyMainInfoVo> getDutyDataV2(Long deptId) { public List<DutyMainInfoVo> getDutyDataV2(Long deptId) {
List<DutyMainInfoVo> dutyMainInfoVos = this.baseMapper.selectDutyMainInfoVoV2(deptId); List<DutyMainInfoVo> dutyMainInfoVos = this.baseMapper.selectDutyMainInfoVoV2(deptId);
dutyMainInfoVos = dutyMainInfoVos.stream().map(s -> { dutyMainInfoVos = dutyMainInfoVos.stream().map(s -> {
if (null == s.getGroupName()) { if (null == s.getDutyGroupId()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getId()); eq(ImsDutyMainPersonEntity::getDutyMainId, s.getId());
}}); }});
@ -1658,7 +1658,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
@Override @Override
public DutyMainInfoVo getNextDutyDataV2(Long parentId) { public DutyMainInfoVo getNextDutyDataV2(Long parentId) {
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.selectDutyMainInfoSignV2(parentId); DutyMainInfoVo dutyMainInfoVo = this.baseMapper.selectDutyMainInfoSignV2(parentId);
if (null == dutyMainInfoVo.getGroupName()) { if (null == dutyMainInfoVo.getDutyGroupId()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId()); eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId());
}}); }});

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

@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.message.fegin.IMessagePushClient; import com.hnac.hzims.message.fegin.IMessagePushClient;
import com.hnac.hzims.message.req.PushExtrasReq; import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.monitor.utils.DateUtils; import com.hnac.hzims.monitor.utils.DateUtils;
@ -46,6 +49,7 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -79,6 +83,8 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
@Autowired @Autowired
private IMessagePushClient messagePushClient; private IMessagePushClient messagePushClient;
@Autowired @Autowired
private IMessageClient messageClient;
@Autowired
private IUserClient userClient; private IUserClient userClient;
@Autowired @Autowired
private IFlowClient flowClient; private IFlowClient flowClient;
@ -113,23 +119,39 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
if (ObjectUtil.isEmpty(dutyMainEntity)) { if (ObjectUtil.isEmpty(dutyMainEntity)) {
return R.fail("当前时间没有接班人!"); return R.fail("当前时间没有接班人!");
} }
//获取交班人班组 Long handGroupManagerId;
if (handDutyMainEntity.getDutyGroupId() != null) {
//获取交班人班
ImsDutyGroupEntity handGroupEntity = imsDutyGroupService.getById(handDutyMainEntity.getDutyGroupId()); ImsDutyGroupEntity handGroupEntity = imsDutyGroupService.getById(handDutyMainEntity.getDutyGroupId());
handGroupManagerId = handGroupEntity.getManagerId();
} else {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = imsDutyMainPersonService.selectByMainId(handDutyMainEntity.getId());
handGroupManagerId = imsDutyMainPersonEntities.get(0).getDutyChargePerson();
}
Long groupEntityManagerId;
//获取接班人班组 //获取接班人班组
if (dutyMainEntity.getDutyGroupId() != null) {
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(dutyMainEntity.getDutyGroupId()); ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(dutyMainEntity.getDutyGroupId());
groupEntityManagerId = groupEntity.getManagerId();
//判断班组长是否存在
R<User> userR = userClient.userInfoById(groupEntity.getManagerId());
ImsDutyGroupPEntity groupPEntity = imsDutyGroupPService.getOne(new LambdaQueryWrapper<ImsDutyGroupPEntity>() {{ ImsDutyGroupPEntity groupPEntity = imsDutyGroupPService.getOne(new LambdaQueryWrapper<ImsDutyGroupPEntity>() {{
eq(ImsDutyGroupPEntity::getGroupId, groupEntity.getId()); eq(ImsDutyGroupPEntity::getGroupId, groupEntity.getId());
eq(ImsDutyGroupPEntity::getPersonId, groupEntity.getManagerId()).last(" LIMIT 1"); eq(ImsDutyGroupPEntity::getPersonId, groupEntityManagerId).last(" LIMIT 1");
}}); }});
if (ObjectUtil.isEmpty(groupPEntity)) {
return R.fail("接班班组长不存在,请指定班组长后进行交班!");
}
} else {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities2 = imsDutyMainPersonService.selectByMainId(dutyMainEntity.getId());
groupEntityManagerId = imsDutyMainPersonEntities2.get(0).getDutyChargePerson();
if (!userR.isSuccess() || ObjectUtil.isEmpty(userR.getData()) || ObjectUtil.isEmpty(groupPEntity)) { }
//判断班组长是否存在
R<User> userR = userClient.userInfoById(groupEntityManagerId);
if (!userR.isSuccess() || ObjectUtil.isEmpty(userR.getData())) {
return R.fail("接班班组长不存在,请指定班组长后进行交班!"); return R.fail("接班班组长不存在,请指定班组长后进行交班!");
} }
Long inspectTaskId = getInspectTaskId(vo, groupEntity.getManagerId());//新增巡检任务 Long inspectTaskId = getInspectTaskId(vo, groupEntityManagerId);//新增巡检任务
if (null == inspectTaskId) { if (null == inspectTaskId) {
return R.fail("创建巡检计划失败"); return R.fail("创建巡检计划失败");
} }
@ -137,19 +159,19 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
// 保存 // 保存
save(recEntity); save(recEntity);
} }
log.info("groupEntity-------------------------:" + groupEntity + "----- inspectTaskId-------------------------:" + inspectTaskId); log.info("groupEntityManagerId-------------------------:" + groupEntityManagerId + "----- inspectTaskId-------------------------:" + inspectTaskId);
R<BladeFlow> result = flowClient.startProcessInstanceByKey(DutyRecProcessConstant. R<BladeFlow> result = flowClient.startProcessInstanceByKey(DutyRecProcessConstant.
DUTY_REC_FLOW_KEY, StringUtil.format("{}:{}", DUTY_REC_FLOW_KEY, StringUtil.format("{}:{}",
DutyRecProcessConstant.DUTY_REC_PROCESS_TABLE, recEntity.getId()), new HashMap<String, Object>() {{ DutyRecProcessConstant.DUTY_REC_PROCESS_TABLE, recEntity.getId()), new HashMap<String, Object>() {{
put("taskId", recEntity.getId()); put("taskId", recEntity.getId());
put(DutyRecProcessConstant.TASK_VARIABLE_CARRY_USER, TaskUtil.getTaskUser(groupEntity.getManagerId().toString())); put(DutyRecProcessConstant.TASK_VARIABLE_CARRY_USER, TaskUtil.getTaskUser(groupEntityManagerId.toString()));
//put(DutyRecProcessConstant.TASK_VARIABLE_CARRY_USER, Arrays.stream(dutyMainEntity.getDutyPersonIds().split("\\^")).map(o -> TaskUtil.getTaskUser(o)).collect(Collectors.joining(","))); //put(DutyRecProcessConstant.TASK_VARIABLE_CARRY_USER, Arrays.stream(dutyMainEntity.getDutyPersonIds().split("\\^")).map(o -> TaskUtil.getTaskUser(o)).collect(Collectors.joining(",")));
}}); }});
log.info("result-------------------------:" + result); log.info("result-------------------------:" + result);
if (result.isSuccess()) { if (result.isSuccess()) {
Date date = new Date(); Date date = new Date();
//消息提醒 //消息提醒
handMessageRemind(handGroupEntity, groupEntity, date); handMessageRemind(handGroupManagerId, groupEntityManagerId, date);
//判断是否延时交班 //判断是否延时交班
judgeDelayedHand(handDutyMainEntity, recEntity);//判断交班是否延时 judgeDelayedHand(handDutyMainEntity, recEntity);//判断交班是否延时
@ -177,22 +199,22 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
imsDutyMainMapper.updateById(imsDutyMainEntity); imsDutyMainMapper.updateById(imsDutyMainEntity);
} }
void handMessageRemind(ImsDutyGroupEntity handGroupEntity, ImsDutyGroupEntity groupEntity, Date date) { void handMessageRemind(Long handGroupManagerId, Long groupEntityManagerId, Date date) {
//消息提醒 //消息提醒
R<User> userR = userClient.userInfoById(handGroupEntity.getManagerId()); R<User> userR = userClient.userInfoById(handGroupManagerId);
if (userR.isSuccess()) { if (userR.isSuccess()) {
String userName = ""; String userName = "";
PushExtrasReq req = new PushExtrasReq(); PushExtrasReq req = new PushExtrasReq();
log.info("--------------------------req:" + req, groupEntity.getManagerId(), userName, date); log.info("--------------------------req:" + req, groupEntityManagerId, userName, date);
if (ObjectUtil.isNotEmpty(userR.getData()) && StringUtil.isNotBlank(userR.getData().getName())) { if (ObjectUtil.isNotEmpty(userR.getData()) && StringUtil.isNotBlank(userR.getData().getName())) {
userName = userR.getData().getName(); userName = userR.getData().getName();
log.info("--------------------------req2:" + req, groupEntity.getManagerId(), userName, date); log.info("--------------------------req2:" + req, groupEntityManagerId, userName, date);
} }
String format = DateUtil.format(date, DateUtil.PATTERN_DATETIME); String format = DateUtil.format(date, DateUtil.PATTERN_DATETIME);
/*remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), /*remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(),
groupEntity.getManagerId(), userName, null, groupEntity.getManagerId(), userName, null,
format, groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());*/ format, groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());*/
log.info("--------------------------req3:" + req, groupEntity.getManagerId(), userName, date); log.info("--------------------------req3:" + req, groupEntityManagerId, userName, date);
} }
} }
@ -252,6 +274,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
/** /**
* 详情 * 详情
*
* @param vo * @param vo
* @return * @return
*/ */
@ -292,7 +315,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
}}); }});
IPage<ImsDutyRecVO> imsDutyRecVOIPage = ImsDutyRecWrapper.build().pageVO(imsDutyRecEntityIPage); IPage<ImsDutyRecVO> imsDutyRecVOIPage = ImsDutyRecWrapper.build().pageVO(imsDutyRecEntityIPage);
List<ImsDutyRecVO> records = imsDutyRecVOIPage.getRecords(); List<ImsDutyRecVO> records = imsDutyRecVOIPage.getRecords();
if(CollectionUtil.isEmpty(records)){ if (CollectionUtil.isEmpty(records)) {
return imsDutyRecVOIPage; return imsDutyRecVOIPage;
} }
for (ImsDutyRecVO imsDutyRecVO : records) { for (ImsDutyRecVO imsDutyRecVO : records) {
@ -331,20 +354,24 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
return R.success("您当前未值班"); return R.success("您当前未值班");
} }
if (entity.getDutyGroupId() != null) {
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getOne(new LambdaQueryWrapper<ImsDutyGroupEntity>() {{ ImsDutyGroupEntity groupEntity = imsDutyGroupService.getOne(new LambdaQueryWrapper<ImsDutyGroupEntity>() {{
eq(ImsDutyGroupEntity::getId, entity.getDutyGroupId()); eq(ImsDutyGroupEntity::getId, entity.getDutyGroupId());
eq(ImsDutyGroupEntity::getManagerId, AuthUtil.getUserId()); eq(ImsDutyGroupEntity::getManagerId, AuthUtil.getUserId());
}}); }});
if (ObjectUtils.isEmpty(groupEntity)) {
return R.success("您不是该班组负责人,不可交班!");
}
} else {
ImsDutyMainPersonEntity personEntity = imsDutyMainPersonService.getOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ ImsDutyMainPersonEntity personEntity = imsDutyMainPersonService.getOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, entity.getId()); eq(ImsDutyMainPersonEntity::getDutyMainId, entity.getId());
eq(ImsDutyMainPersonEntity::getDutyChargePerson, AuthUtil.getUserId()); eq(ImsDutyMainPersonEntity::getDutyChargePerson, AuthUtil.getUserId());
last(" limit 1"); last(" limit 1");
}}); }});
if (ObjectUtil.isEmpty(groupEntity)&&ObjectUtil.isEmpty(personEntity)) { if ( ObjectUtil.isEmpty(personEntity)) {
return R.success("您不是该班组负责人,不可交班!"); return R.success("您不是该班组负责人,不可交班!");
} }
}
ImsDutyRecEntity recEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{ ImsDutyRecEntity recEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
eq(ImsDutyRecEntity::getDutyId, entity.getId()); eq(ImsDutyRecEntity::getDutyId, entity.getId());
}}); }});
@ -421,6 +448,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
// vo.setCarryDutyMainVo(imsSchedulingVo1); // vo.setCarryDutyMainVo(imsSchedulingVo1);
// return R.data(vo); // return R.data(vo);
// } // }
/** /**
* 获取签到二维码 * 获取签到二维码
* *
@ -503,19 +531,82 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
/** /**
* 消息提醒 * 消息提醒
*/ */
//20230414已弃用,改用V2
// @Override
// public void messageRemonding() {
// List<ImsDutyMainEntity> list = imsDutyMainService.list(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
// eq(ImsDutyMainEntity::getStatus, JoinStatus.DUTY_ING.getStatus());
// }});
// if (CollectionUtil.isNotEmpty(list)) {
// for (ImsDutyMainEntity entity : list) {
// ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(entity.getDutyGroupId());
// ImsDutyClassEntity classEntity = imsDutyClassService.getById(entity.getClassId());
// if (ObjectUtil.isNotEmpty(groupEntity) && ObjectUtil.isNotEmpty(classEntity)) {
// String userName = "";
// if (null != groupEntity.getManagerId()) {
// userName = userClient.userInfoById(groupEntity.getManagerId()).getData().getName();
// }
// PushExtrasReq req = new PushExtrasReq();
// if (null != entity.getPreDutyId()) {
// ImsDutyRecEntity one = this.getOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
// eq(ImsDutyRecEntity::getDutyId, entity.getId());
// }});
// ImsDutyMainEntity carryMainentity = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
// eq(ImsDutyMainEntity::getPreDutyId, entity.getPreDutyId());
// }});
// ImsDutyGroupEntity carryGroupEntity = imsDutyGroupService.getById(carryMainentity.getDutyGroupId());
// if (ObjectUtil.isEmpty(one)) {//未发起交班流程 判断是否提醒交班
// Long differMinute = DateUtils.getDifferMinute(calculateDate(entity, classEntity, OperationalConstants.DutyRecTypeEnum.HAND_REC.getVal()));
// if (differMinute == -OperationalConstants.MessageRecTypeEnum.HAND_REC_MESSAGE.getVal()) { // 提醒交班
// remondingHead(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), groupEntity.getManagerId(), groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());
// } else if (differMinute == OperationalConstants.MessageRecTypeEnum.DELAYED_HAND_REC_MESSAGE.getVal()) {//延时交班提醒
// //提醒站长 接班人 交班人
// User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData();
// remondingStation(req, admin, userName, classEntity);//提醒站长
// remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), carryGroupEntity.getManagerId(), userName, classEntity, null, carryGroupEntity.getTenantId(), carryGroupEntity.getCreateDept(), carryGroupEntity.getCreateUser());//提醒接班人
// remondingHead(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), groupEntity.getManagerId(), groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());//提醒交班人
// }
// } else {//已发起接班流程 判断是否提醒接班
// ImsDutyClassEntity carryClassEntity = imsDutyClassService.getById(carryMainentity.getClassId());
// Long differMinute = DateUtils.getDifferMinute(calculateDate(carryMainentity, carryClassEntity, OperationalConstants.DutyRecTypeEnum.CARRY_REC.getVal()));
// if (differMinute > 0 && one.getDelayStatus() == 0) {
// ImsDutyGroupEntity groupEntity1 = imsDutyGroupService.getById(carryMainentity.getDutyGroupId());
// //提醒站长 接班人 交班人
// User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData();
// remondingStation(req, admin, groupEntity1.getManagerId().toString(), classEntity);//提醒站长
// remondingCarry(req, 2, carryGroupEntity.getManagerId(), groupEntity1.getManagerId().toString(), classEntity, null, groupEntity1.getTenantId(), groupEntity1.getCreateDept(), groupEntity1.getCreateUser());//提醒接班人
// }
// }
// }
// }
// }
// }
// }
/**
* 消息提醒
* 相较于上一个版本大体逻辑没变只改了推送消息的方式调用黄兴接口
*/
@Override @Override
public void messageRemonding() { public void messageRemondingV2() {
List<ImsDutyMainEntity> list = imsDutyMainService.list(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ List<ImsDutyMainEntity> list = imsDutyMainService.list(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
eq(ImsDutyMainEntity::getStatus, JoinStatus.DUTY_ING.getStatus()); eq(ImsDutyMainEntity::getStatus, JoinStatus.DUTY_ING.getStatus());
}}); }});
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
for (ImsDutyMainEntity entity : list) { for (ImsDutyMainEntity entity : list) {
Long groupEntityManagerId;
if (entity.getDutyGroupId() != null) {
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(entity.getDutyGroupId()); ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(entity.getDutyGroupId());
groupEntityManagerId = groupEntity.getManagerId();
} else {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = imsDutyMainPersonService.selectByMainId(entity.getId());
groupEntityManagerId = imsDutyMainPersonEntities.get(0).getDutyChargePerson();
}
ImsDutyClassEntity classEntity = imsDutyClassService.getById(entity.getClassId()); ImsDutyClassEntity classEntity = imsDutyClassService.getById(entity.getClassId());
if (ObjectUtil.isNotEmpty(groupEntity) && ObjectUtil.isNotEmpty(classEntity)) { if (ObjectUtil.isNotEmpty(groupEntityManagerId) && ObjectUtil.isNotEmpty(classEntity)) {
String userName = ""; String userName = "";
if (null != groupEntity.getManagerId()) { if (null != groupEntityManagerId) {
userName = userClient.userInfoById(groupEntity.getManagerId()).getData().getName(); userName = userClient.userInfoById(groupEntityManagerId).getData().getName();
} }
PushExtrasReq req = new PushExtrasReq(); PushExtrasReq req = new PushExtrasReq();
if (null != entity.getPreDutyId()) { if (null != entity.getPreDutyId()) {
@ -525,27 +616,40 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
ImsDutyMainEntity carryMainentity = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ ImsDutyMainEntity carryMainentity = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
eq(ImsDutyMainEntity::getPreDutyId, entity.getPreDutyId()); eq(ImsDutyMainEntity::getPreDutyId, entity.getPreDutyId());
}}); }});
Long carryManagerId;
String carryTenantId;
Long carryCreateDept;
if (carryMainentity.getDutyGroupId() == null) {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = imsDutyMainPersonService.selectByMainId(carryMainentity.getId());
carryManagerId = imsDutyMainPersonEntities.get(0).getDutyChargePerson();
carryTenantId = imsDutyMainPersonEntities.get(0).getTenantId();
carryCreateDept = imsDutyMainPersonEntities.get(0).getCreateDept();
} else {
ImsDutyGroupEntity carryGroupEntity = imsDutyGroupService.getById(carryMainentity.getDutyGroupId()); ImsDutyGroupEntity carryGroupEntity = imsDutyGroupService.getById(carryMainentity.getDutyGroupId());
carryManagerId = carryGroupEntity.getManagerId();
carryTenantId = carryGroupEntity.getTenantId();
carryCreateDept = carryGroupEntity.getCreateDept();
}
R<User> user = userClient.userInfoById(carryManagerId);
if (ObjectUtil.isEmpty(one)) {//未发起交班流程 判断是否提醒交班 if (ObjectUtil.isEmpty(one)) {//未发起交班流程 判断是否提醒交班
Long differMinute = DateUtils.getDifferMinute(calculateDate(entity, classEntity, OperationalConstants.DutyRecTypeEnum.HAND_REC.getVal())); Long differMinute = DateUtils.getDifferMinute(calculateDate(entity, classEntity, OperationalConstants.DutyRecTypeEnum.HAND_REC.getVal()));
if (differMinute == -OperationalConstants.MessageRecTypeEnum.HAND_REC_MESSAGE.getVal()) { // 提醒交班 if (differMinute == -OperationalConstants.MessageRecTypeEnum.HAND_REC_MESSAGE.getVal()) { // 提醒交班
remondingHead(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), groupEntity.getManagerId(), groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser()); remondingHeadV2(OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), groupEntityManagerId, userName, entity.getTenantId(), entity.getCreateDept(), entity.getId(), entity.getCreateUser());
} else if (differMinute == OperationalConstants.MessageRecTypeEnum.DELAYED_HAND_REC_MESSAGE.getVal()) {//延时交班提醒 } else if (differMinute == OperationalConstants.MessageRecTypeEnum.DELAYED_HAND_REC_MESSAGE.getVal()) {//延时交班提醒
//提醒站长 接班人 交班人 //提醒站长 接班人 交班人
User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData(); User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData();
remondingStation(req, admin, userName, classEntity);//提醒站长 remondingStationV2(admin, userName, classEntity, carryMainentity.getTenantId(), carryMainentity.getId(), carryMainentity.getCreateDept(), carryMainentity.getCreateUser());//提醒站长
remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), carryGroupEntity.getManagerId(), userName, classEntity, null, carryGroupEntity.getTenantId(), carryGroupEntity.getCreateDept(), carryGroupEntity.getCreateUser());//提醒接班人 remondingCarryV2(OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), carryManagerId, userName, classEntity, null, carryTenantId, carryCreateDept, carryMainentity.getId(), carryMainentity.getCreateUser());//提醒接班人
remondingHead(req, OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), groupEntity.getManagerId(), groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());//提醒交班人 remondingHeadV2(OperationalConstants.RecTypeEnum.HAND_DELAY.getVal(), groupEntityManagerId, userName, entity.getTenantId(), entity.getCreateDept(), entity.getId(), entity.getCreateUser());//提醒交班人
} }
} else {//已发起接班流程 判断是否提醒接班 } else {//已发起接班流程 判断是否提醒接班
ImsDutyClassEntity carryClassEntity = imsDutyClassService.getById(carryMainentity.getClassId()); ImsDutyClassEntity carryClassEntity = imsDutyClassService.getById(carryMainentity.getClassId());
Long differMinute = DateUtils.getDifferMinute(calculateDate(carryMainentity, carryClassEntity, OperationalConstants.DutyRecTypeEnum.CARRY_REC.getVal())); Long differMinute = DateUtils.getDifferMinute(calculateDate(carryMainentity, carryClassEntity, OperationalConstants.DutyRecTypeEnum.CARRY_REC.getVal()));
if (differMinute > 0 && one.getDelayStatus() == 0) { if (differMinute > 0 && one.getDelayStatus() == 0) {
ImsDutyGroupEntity groupEntity1 = imsDutyGroupService.getById(carryMainentity.getDutyGroupId());
//提醒站长 接班人 交班人 //提醒站长 接班人 交班人
User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData(); User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData();
remondingStation(req, admin, groupEntity1.getManagerId().toString(), classEntity);//提醒站长 remondingStationV2(admin, admin.getName(), classEntity, carryMainentity.getTenantId(), carryMainentity.getId(), carryMainentity.getCreateDept(), carryMainentity.getCreateUser());//提醒站长
remondingCarry(req, 2, carryGroupEntity.getManagerId(), groupEntity1.getManagerId().toString(), classEntity, null, groupEntity1.getTenantId(), groupEntity1.getCreateDept(), groupEntity1.getCreateUser());//提醒接班人 remondingCarryV2(2, carryManagerId, user.getData().getName(), classEntity, null, carryTenantId, carryCreateDept, carryMainentity.getId(), carryMainentity.getCreateUser());//提醒接班人
} }
} }
} }
@ -587,7 +691,6 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
}}); }});
List<Long> idList = new ArrayList<>(); List<Long> idList = new ArrayList<>();
boolean bool = true; boolean bool = true;
ImsDutyMainEntity dutyMainEntity = new ImsDutyMainEntity(); ImsDutyMainEntity dutyMainEntity = new ImsDutyMainEntity();
@ -610,8 +713,8 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
} }
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(mainEntityById.getDutyGroupId()); ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(mainEntityById.getDutyGroupId());
if(ObjectUtil.isNotEmpty(groupEntity)){ if (ObjectUtil.isNotEmpty(groupEntity)) {
if(null == groupEntity.getManagerId()){ if (null == groupEntity.getManagerId()) {
return R.fail("该指定班组中的班组长不存在,请添加班组长后进行指定!"); return R.fail("该指定班组中的班组长不存在,请添加班组长后进行指定!");
} }
//判断班组长是否存在 //判断班组长是否存在
@ -850,6 +953,35 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
} }
/** /**
* 消息提醒站长
*/
private void remondingStationV2(User admin, String userName, ImsDutyClassEntity
classEntity, String tenantId, Long taskId, Long createDept, Long createUser) {
MessagePushRecordDto messagePushRecordDto = new MessagePushRecordDto();
messagePushRecordDto.setBusinessClassify("dailyRemind");
messagePushRecordDto.setBusinessKey(MessageConstants.BusinessClassifyEnum.DUTY.getKey());
messagePushRecordDto.setSubject(MessageConstants.BusinessClassifyEnum.DUTY.getDescription());
messagePushRecordDto.setTaskId(taskId);
messagePushRecordDto.setTenantId(tenantId);
messagePushRecordDto.setPusher(admin.getId().toString());
messagePushRecordDto.setPusherName(userName);
messagePushRecordDto.setAccount(admin.getId().toString());
messagePushRecordDto.setContent(userName + " 负责人 值班日期为:(" + classEntity.getStartTime()
+ "-" + classEntity.getEndTime() + ") 目前已交班延迟,请尽快联系该负责人进行交班工作");
messagePushRecordDto.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
messagePushRecordDto.setPushType(MessageConstants.IMMEDIATELY);
messagePushRecordDto.setDeptId(Long.valueOf(admin.getDeptId()));
R<String> deptName = sysClient.getDeptName(Long.valueOf(admin.getDeptId()));
if (deptName.isSuccess()) {
messagePushRecordDto.setDeptName(deptName.getData());
}
messagePushRecordDto.setCreateDept(createDept);
messagePushRecordDto.setCreateUser(createUser);
R<Boolean> booleanR = messageClient.sendMessage(messagePushRecordDto);
System.out.println(booleanR.toString());
}
/**
* 消息提醒交班人 * 消息提醒交班人
*/ */
private void remondingHead(PushExtrasReq req, int type, Long managerId, String tenantId, Long createDept, Long createUser) { private void remondingHead(PushExtrasReq req, int type, Long managerId, String tenantId, Long createDept, Long createUser) {
@ -866,7 +998,35 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
} }
/** /**
* 消息提醒接班人 * 消息提醒交班人
*/
private void remondingHeadV2(int type, Long managerId, String userName, String tenantId, Long createDept, Long taskId, Long createUser) {
MessagePushRecordDto messagePushRecordDto = new MessagePushRecordDto();
messagePushRecordDto.setBusinessClassify("dailyRemind");
messagePushRecordDto.setBusinessKey(MessageConstants.BusinessClassifyEnum.DUTY.getKey());
messagePushRecordDto.setSubject(MessageConstants.BusinessClassifyEnum.DUTY.getDescription());
messagePushRecordDto.setTaskId(taskId);
messagePushRecordDto.setTenantId(tenantId);
messagePushRecordDto.setPusher(managerId.toString());
messagePushRecordDto.setPusherName(userName);
messagePushRecordDto.setAccount(managerId.toString());
if (type == OperationalConstants.RecTypeEnum.HAND_REMIND.getVal()) {
messagePushRecordDto.setContent("您距离本次值班结束时间只剩 15 分钟,请尽快进行交班工作");
} else if (type == OperationalConstants.RecTypeEnum.HAND_DELAY.getVal()) {
messagePushRecordDto.setContent("您已交班延迟,请尽快进行交班工作");
}
messagePushRecordDto.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
messagePushRecordDto.setDeptId(createDept);
messagePushRecordDto.setPushType(MessageConstants.IMMEDIATELY);
R<String> deptName = sysClient.getDeptName(createDept);
messagePushRecordDto.setDeptName(deptName.getData());
messagePushRecordDto.setCreateDept(createDept);
messagePushRecordDto.setCreateUser(createUser);
messageClient.sendMessage(messagePushRecordDto);
}
/**
* 消息提醒接班人 启用
*/ */
private void remondingCarry(PushExtrasReq req, int type, Long managerId, String userName, ImsDutyClassEntity private void remondingCarry(PushExtrasReq req, int type, Long managerId, String userName, ImsDutyClassEntity
classEntity, String date, String tenantId, Long createDept, Long createUser) { classEntity, String date, String tenantId, Long createDept, Long createUser) {
@ -883,6 +1043,38 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
messagePushClient.sendMessage(managerId.toString(), req, tenantId, createDept, createUser); messagePushClient.sendMessage(managerId.toString(), req, tenantId, createDept, createUser);
} }
/**
* 消息提醒接班人
*/
private void remondingCarryV2(int type, Long managerId, String userName, ImsDutyClassEntity
classEntity, String date, String tenantId, Long createDept, Long taskId, Long createUser) {
MessagePushRecordDto messagePushRecordDto = new MessagePushRecordDto();
messagePushRecordDto.setBusinessClassify("dailyRemind");
messagePushRecordDto.setBusinessKey(MessageConstants.BusinessClassifyEnum.DUTY.getKey());
messagePushRecordDto.setSubject(MessageConstants.BusinessClassifyEnum.DUTY.getDescription());
messagePushRecordDto.setTaskId(taskId);
messagePushRecordDto.setTenantId(tenantId);
messagePushRecordDto.setPusher(managerId.toString());
messagePushRecordDto.setPusherName(userName);
messagePushRecordDto.setAccount(managerId.toString());
if (type == OperationalConstants.RecTypeEnum.HAND_REMIND.getVal()) {
messagePushRecordDto.setContent(userName + " 于 " + date + " 时已提交交班工作");
} else if (type == OperationalConstants.RecTypeEnum.HAND_DELAY.getVal()) {
messagePushRecordDto.setContent(userName + " 值班日期为(" + classEntity.getStartTime() + " - " + classEntity.getEndTime() + "),目前已延迟交班");
} else if (type == OperationalConstants.RecTypeEnum.REMIND_HAND_PERSON.getVal()) {
messagePushRecordDto.setContent("您已交班延迟,请尽快进行交班工作");
}
messagePushRecordDto.setPushType(MessageConstants.IMMEDIATELY);
messagePushRecordDto.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
messagePushRecordDto.setDeptId(createDept);
R<String> deptName = sysClient.getDeptName(createDept);
messagePushRecordDto.setDeptName(deptName.getData());
messagePushRecordDto.setCreateDept(createDept);
messagePushRecordDto.setCreateUser(createUser);
R<Boolean> booleanR = messageClient.sendMessage(messagePushRecordDto);
System.out.println(booleanR.toString());
}
//新增巡检计划 获取巡检任务ID //新增巡检计划 获取巡检任务ID
public Long getInspectTaskId(PlanVO vo, Long princId) { public Long getInspectTaskId(PlanVO vo, Long princId) {
vo.setName(DateUtil.format(new Date(), "yyyy-MM-dd HH") + "-交接班巡视"); vo.setName(DateUtil.format(new Date(), "yyyy-MM-dd HH") + "-交接班巡视");
@ -973,6 +1165,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
/** /**
* 交接班统计 * 交接班统计
*
* @param param * @param param
* @return * @return
*/ */
@ -981,33 +1174,33 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
ChangeShiftsRspDTO response = new ChangeShiftsRspDTO(); ChangeShiftsRspDTO response = new ChangeShiftsRspDTO();
response.setShiftsCount(0); response.setShiftsCount(0);
response.setShiftsRate(0.0); response.setShiftsRate(0.0);
if(ObjectUtil.isEmpty(param)){ if (ObjectUtil.isEmpty(param)) {
return response; return response;
} }
// 查询交接班记录 // 查询交接班记录
QueryWrapper<ImsDutyRecEntity> queryWrapper = new QueryWrapper<ImsDutyRecEntity>() {{ QueryWrapper<ImsDutyRecEntity> queryWrapper = new QueryWrapper<ImsDutyRecEntity>() {{
if(Optional.ofNullable(param.getCreateDept()).isPresent()){ if (Optional.ofNullable(param.getCreateDept()).isPresent()) {
eq("create_dept",param.getCreateDept()); eq("create_dept", param.getCreateDept());
} }
if(Optional.ofNullable(param.getStartTime()).isPresent()){ if (Optional.ofNullable(param.getStartTime()).isPresent()) {
gt("exec_time", param.getStartTime()); gt("exec_time", param.getStartTime());
} }
if(Optional.ofNullable(param.getEndTime()).isPresent()){ if (Optional.ofNullable(param.getEndTime()).isPresent()) {
lt("exec_time", param.getEndTime()); lt("exec_time", param.getEndTime());
} }
}}; }};
List<ImsDutyRecEntity> list = this.baseMapper.selectList(queryWrapper); List<ImsDutyRecEntity> list = this.baseMapper.selectList(queryWrapper);
if(CollectionUtil.isEmpty(list)){ if (CollectionUtil.isEmpty(list)) {
return response; return response;
} }
// 交接班次数 // 交接班次数
response.setShiftsCount(list.size()); response.setShiftsCount(list.size());
List<ImsDutyRecEntity> normal = list.stream().filter(o-> DutyContants.DutyRecDelayStatusEnum.WIT_DELAY_STATUS.getStatus() == o.getDelayStatus()).collect(Collectors.toList()); List<ImsDutyRecEntity> normal = list.stream().filter(o -> DutyContants.DutyRecDelayStatusEnum.WIT_DELAY_STATUS.getStatus() == o.getDelayStatus()).collect(Collectors.toList());
if(CollectionUtil.isEmpty(normal)){ if (CollectionUtil.isEmpty(normal)) {
return response; return response;
} }
// 交接班正常率 // 交接班正常率
double shiftsRate = BigDecimal.valueOf((double)normal.size() / list.size() * 100L).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); double shiftsRate = BigDecimal.valueOf((double) normal.size() / list.size() * 100L).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
response.setShiftsRate(shiftsRate); response.setShiftsRate(shiftsRate);
return response; return response;
} }

25
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainStatisticsServiceImpl.java

@ -16,10 +16,8 @@ import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyGroupEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyGroupEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.service.IImsDutyClassService; import com.hnac.hzims.operational.duty.entity.ImsDutyMainPersonEntity;
import com.hnac.hzims.operational.duty.service.IImsDutyGroupService; import com.hnac.hzims.operational.duty.service.*;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.service.IImsDutyRecService;
import com.hnac.hzims.operational.main.service.IMainStatisticsService; import com.hnac.hzims.operational.main.service.IMainStatisticsService;
import com.hnac.hzims.operational.main.vo.*; import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant; import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
@ -30,21 +28,15 @@ import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import com.hnac.hzinfo.inspect.task.feign.IInspectTaskReportClient; import com.hnac.hzinfo.inspect.task.feign.IInspectTaskReportClient;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dict; import org.springblade.system.entity.Dict;
import org.springblade.system.feign.IDictClient; import org.springblade.system.feign.IDictClient;
import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -64,6 +56,7 @@ public class MainStatisticsServiceImpl implements IMainStatisticsService {
private final IOperDefectStatisticsService operDefectStatisticsService; private final IOperDefectStatisticsService operDefectStatisticsService;
private final IImsDutyClassService iImsDutyClassService; private final IImsDutyClassService iImsDutyClassService;
private final IDictClient dictClient; private final IDictClient dictClient;
private final IImsDutyMainPersonService imsDutyMainPersonService;
@Override @Override
@ -85,14 +78,22 @@ public class MainStatisticsServiceImpl implements IMainStatisticsService {
DutyStatisticsVO dutyStatisticsVo = new DutyStatisticsVO(); DutyStatisticsVO dutyStatisticsVo = new DutyStatisticsVO();
if(imsDutyMainEntity != null){ if(imsDutyMainEntity != null){
dutyStatisticsVo = BeanUtil.copy(imsDutyMainEntity, DutyStatisticsVO.class); dutyStatisticsVo = BeanUtil.copy(imsDutyMainEntity, DutyStatisticsVO.class);
if (dutyStatisticsVo.getDutyGroupId()!=null) {
//完善负责人信息 //完善负责人信息
ImsDutyGroupEntity imsDutyGroupEntity = imsDutyGroupService.getById(dutyStatisticsVo.getDutyGroupId()); ImsDutyGroupEntity imsDutyGroupEntity = imsDutyGroupService.getById(dutyStatisticsVo.getDutyGroupId());
if(imsDutyGroupEntity != null){ if (imsDutyGroupEntity != null) {
dutyStatisticsVo.setGroupName(imsDutyGroupEntity.getGroupName()); dutyStatisticsVo.setGroupName(imsDutyGroupEntity.getGroupName());
User managerUser = UserCache.getUser(imsDutyGroupEntity.getManagerId()); User managerUser = UserCache.getUser(imsDutyGroupEntity.getManagerId());
dutyStatisticsVo.setManager(managerUser); dutyStatisticsVo.setManager(managerUser);
} }
}else {
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = imsDutyMainPersonService.selectByMainId(dutyStatisticsVo.getId());
dutyStatisticsVo.setGroupName("灵活排班");
if (CollectionUtil.isNotEmpty(imsDutyMainPersonEntities)) {
User managerUser = UserCache.getUser(imsDutyMainPersonEntities.get(0).getDutyChargePerson());
dutyStatisticsVo.setManager(managerUser);
}
}
String dutyPersonIds = dutyStatisticsVo.getDutyPersonIds(); String dutyPersonIds = dutyStatisticsVo.getDutyPersonIds();
int num = 0; int num = 0;
int completeNum = 0; int completeNum = 0;

Loading…
Cancel
Save