|
|
@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|