|
@@ -25,6 +25,8 @@ import cn.iocoder.yudao.module.pms.dal.mysql.iotoutbound.IotOutboundMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.maintain.IotMaintainMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.maintain.material.IotMaintainMaterialMapper;
|
|
|
import cn.iocoder.yudao.module.pms.enums.common.FailureAuditStatusEnum;
|
|
|
+import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
|
import cn.iocoder.yudao.module.system.api.dingtalk.DingtalkSendApi;
|
|
|
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
|
|
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
|
@@ -69,7 +71,7 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
@Autowired
|
|
|
private IotFailureReportMapper iotFailureReportMapper;
|
|
|
@Resource
|
|
|
- private DeptService deptService;
|
|
|
+ private DeptApi deptApi;
|
|
|
@Resource
|
|
|
private AdminUserApi adminUserApi;
|
|
|
@Resource
|
|
@@ -106,9 +108,9 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
}).collect(Collectors.toList());
|
|
|
iotMaintainMaterialMapper.insertBatch(collect);
|
|
|
//本地库存减少且记录出库
|
|
|
- if ("finished".equals(createReqVO.getMaintain().getStatus())&&"in".equals(createReqVO.getMaintain().getType())) {
|
|
|
+// if ("finished".equals(createReqVO.getMaintain().getStatus())&&"in".equals(createReqVO.getMaintain().getType())) {
|
|
|
localStockAndOut(createReqVO);
|
|
|
- }
|
|
|
+// }
|
|
|
//如果委外发起流程
|
|
|
if ("out".equals(createReqVO.getMaintain().getType())){
|
|
|
String processInstanceId = processInstanceApi.createProcessInstance(SecurityFrameworkUtils.getLoginUserId(),
|
|
@@ -196,31 +198,31 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
}
|
|
|
}
|
|
|
//异步发送消息
|
|
|
- CompletableFuture.runAsync(()->{
|
|
|
+// CompletableFuture.runAsync(()->{
|
|
|
sendMessage(BeanUtils.toBean(iotMaintain, IotMaintainDO.class));
|
|
|
- });
|
|
|
+// });
|
|
|
}
|
|
|
|
|
|
|
|
|
private void sendMessage(IotMaintainDO iotMaintainDO) {
|
|
|
Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
|
|
- DeptDO dept = deptService.getDept(loginUserDeptId);
|
|
|
- DeptDO parentDept = deptService.getDept(dept.getParentId());
|
|
|
+ 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(() ->{
|
|
|
+// 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.getParentId());
|
|
|
+ AdminUserRespDTO user = adminUserApi.getUser(parentDept.getLeaderUserId());
|
|
|
if (Objects.nonNull(user)) {
|
|
|
dingtalkSendApi.send(user.getMobile(), msg);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- });
|
|
|
+// });
|
|
|
}
|
|
|
|
|
|
@Override
|