|
@@ -97,6 +97,11 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
@Resource
|
|
|
private DeptService deptService;
|
|
|
|
|
|
+ @Override
|
|
|
+ public void approvalMaintain(Long businessKey, Integer bpmStatus) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Long submitForApproval(Long id) {
|
|
@@ -145,7 +150,8 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
//本地库存减少且记录出库
|
|
|
localStockAndOut(createReqVO);
|
|
|
if ("in".equals(createReqVO.getMaintain().getType())) {
|
|
|
- sendMessage(BeanUtils.toBean(iotMaintain, IotMaintainDO.class));
|
|
|
+ String msg = "【PMS】维修工单 - "+createReqVO.getMaintain().getFailureName()+"已处理。"+"["+new Date()+"]";
|
|
|
+ sendMessage(BeanUtils.toBean(iotMaintain, IotMaintainDO.class), "maintain-report", msg);
|
|
|
}
|
|
|
//如果委外发起流程
|
|
|
if ("out".equals(createReqVO.getMaintain().getType())){
|
|
@@ -153,6 +159,8 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY).setBusinessKey(String.valueOf(iotMaintain.getId())));
|
|
|
// 将流程实例id 更新到维修工单主数据表
|
|
|
iotMaintainMapper.updateById(new IotMaintainDO().setId(iotMaintain.getId()).setProcessInstanceId(processInstanceId).setAuditStatus(FailureAuditStatusEnum.PROCESS.getStatus()));
|
|
|
+ String msg = "【PMS】有新的委外维修流程, 请前往系统审批";
|
|
|
+ sendMessage(BeanUtils.toBean(iotMaintain, IotMaintainDO.class), "maintain-out", msg);
|
|
|
}
|
|
|
//异步写入故障知识库
|
|
|
CompletableFuture.runAsync(()->{
|
|
@@ -214,11 +222,14 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
//本地库存减少且记录出库
|
|
|
localStockAndOut(updateReqVO);
|
|
|
if ("in".equals(updateReqVO.getMaintain().getType())) {
|
|
|
- sendMessage(BeanUtils.toBean(updateReqVO.getMaintain(), IotMaintainDO.class));
|
|
|
+ String msg = "【PMS】维修工单 - "+updateReqVO.getMaintain().getFailureName()+"已处理。"+"["+new Date()+"]";
|
|
|
+ sendMessage(BeanUtils.toBean(updateReqVO.getMaintain(), IotMaintainDO.class), "maintain-report", msg);
|
|
|
}
|
|
|
//委外发起流程
|
|
|
if ("out".equals(updateReqVO.getMaintain().getType())){
|
|
|
submitForApproval(updateReqVO.getMaintain().getId());
|
|
|
+ String msg = "【PMS】有新的委外维修流程, 请前往系统审批";
|
|
|
+ sendMessage(BeanUtils.toBean(updateReqVO, IotMaintainDO.class), "maintain-out", msg);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -273,18 +284,16 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void sendMessage(IotMaintainDO iotMaintainDO) {
|
|
|
+ private void sendMessage(IotMaintainDO iotMaintainDO, String templateCode, String msg) {
|
|
|
Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
|
|
DeptRespDTO dept = deptApi.getDept(loginUserDeptId);
|
|
|
DeptRespDTO parentDept = deptApi.getDeptNoPermission(dept.getParentId());
|
|
|
- String templateCode = "maintain-report";
|
|
|
Map<String, Object> templateParams = new HashMap<>();
|
|
|
templateParams.put("name", iotMaintainDO.getDeviceName());
|
|
|
// CompletableFuture.runAsync(() ->{
|
|
|
if (Objects.nonNull(parentDept.getLeaderUserId())){
|
|
|
notifyMessageSendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
.setUserId(parentDept.getLeaderUserId()).setTemplateCode(templateCode).setTemplateParams(templateParams));
|
|
|
- String msg = "【PMS】维修工单 - "+iotMaintainDO.getFailureName()+"已处理。"+"["+new Date()+"]";
|
|
|
AdminUserRespDTO user = adminUserApi.getUser(parentDept.getLeaderUserId());
|
|
|
if (Objects.nonNull(user)) {
|
|
|
dingtalkSendApi.send(user.getMobile(), msg);
|