|
@@ -17,6 +17,8 @@ import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.failure.IotFailureReportMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.maintain.IotMaintainMapper;
|
|
|
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;
|
|
@@ -62,6 +64,8 @@ public class IotFailureReportServiceImpl implements IotFailureReportService {
|
|
|
private BpmProcessInstanceApi processInstanceApi;
|
|
|
@Autowired
|
|
|
private IotMaintainMapper iotMaintainMapper;
|
|
|
+ @Autowired
|
|
|
+ private DeptApi deptApi;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -118,7 +122,7 @@ public class IotFailureReportServiceImpl implements IotFailureReportService {
|
|
|
iotFailureReportMapper.insert(iotFailureReport);
|
|
|
//直接发起流程
|
|
|
submitForApproval(iotFailureReport.getId());
|
|
|
- sendMessage(iotFailureReport);
|
|
|
+ //sendMessage(iotFailureReport);
|
|
|
}
|
|
|
// 返回
|
|
|
return iotFailureReport.getId();
|
|
@@ -127,7 +131,7 @@ public class IotFailureReportServiceImpl implements IotFailureReportService {
|
|
|
private void sendMessage(IotFailureReportDO iotFailureReport) {
|
|
|
Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
|
|
DeptDO dept = deptService.getDept(loginUserDeptId);
|
|
|
- DeptDO parentDept = deptService.getDept(dept.getParentId());
|
|
|
+ DeptRespDTO parentDept = deptApi.getDeptNoPermission(dept.getParentId());
|
|
|
String templateCode = "failure-report"; // 站内信模版,记得在【站内信管理】中配置噢
|
|
|
Map<String, Object> templateParams = new HashMap<>();
|
|
|
templateParams.put("name", iotFailureReport.getDeviceName());
|
|
@@ -137,7 +141,7 @@ public class IotFailureReportServiceImpl implements IotFailureReportService {
|
|
|
notifyMessageSendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
.setUserId(parentDept.getLeaderUserId()).setTemplateCode(templateCode).setTemplateParams(templateParams));
|
|
|
String msg = "【PMS】故障上报 - "+iotFailureReport.getFailureName()+"故障已解决。"+"["+new Date()+"]";
|
|
|
- AdminUserRespDTO user = adminUserApi.getUser(parentDept.getParentId());
|
|
|
+ AdminUserRespDTO user = adminUserApi.getUser(parentDept.getLeaderUserId());
|
|
|
if (Objects.nonNull(user)) {
|
|
|
dingtalkSendApi.send(user.getMobile(), msg);
|
|
|
}
|
|
@@ -153,7 +157,7 @@ public class IotFailureReportServiceImpl implements IotFailureReportService {
|
|
|
reportDO.setAssigneeUserId(processVO.getAssigneeUserId());
|
|
|
reportDO.setType(processVO.getType());
|
|
|
iotFailureReportMapper.insertOrUpdate(reportDO);
|
|
|
- sendMessage(reportDO);
|
|
|
+ //sendMessage(reportDO);
|
|
|
return reportDO.getId();
|
|
|
}
|
|
|
|