Răsfoiți Sursa

Merge remote-tracking branch 'origin/master'

zhangcl 2 luni în urmă
părinte
comite
5c8cdf9a57

+ 1 - 1
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java

@@ -92,7 +92,7 @@ public class BpmMessageServiceImpl implements BpmMessageService {
             notifyMessageSendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
                     .setUserId(reqDTO.getAssigneeUserId()).setTemplateCode(templateCode).setTemplateParams(templateParams));
             msg = "您有新的故障上报流程待处理,请审批。"+"["+ DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss")+"]";
-            url="http://iot.deepoil.cc/dingding?id="+reqDTO.getProcessInstanceId()+"&type=failureReport&userId="+reqDTO.getAssigneeUserId();
+            url="https://iot.deepoil.cc/dingding?id="+reqDTO.getProcessInstanceId()+"&type=failureReport&userId="+reqDTO.getAssigneeUserId();
         } else if ("委外维修工单流程".equals(reqDTO.getProcessInstanceName())){
             String templateCode = "maintain-out";
             templateParams.put("businessType", "maintainOut");

+ 1 - 1
yudao-module-pms/yudao-module-pms-api/src/main/java/cn/iocoder/yudao/module/pms/enums/ErrorCodeConstant.java

@@ -69,5 +69,5 @@ public interface ErrorCodeConstant{
     ErrorCode IOT_PROJECT_INFO_NOT_EXISTS = new ErrorCode(152, "项目信息不存在");
     ErrorCode IOT_PROJECT_TASK_NOT_EXISTS = new ErrorCode(153, "该任务不存在");
     ErrorCode PRODUCT_EXITS_CHILDREN = new ErrorCode(1_002_004_003, "存在子分类,无法删除");
-    ErrorCode INSPECT_DEVICE_CHANGE = new ErrorCode(154, "该工单设备已调拨");
+    ErrorCode INSPECT_DEVICE_CHANGE = new ErrorCode(154, "设备已调拨");
 }

+ 31 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotopeationfill/IotOpeationFillController.java

@@ -93,7 +93,7 @@ public class IotOpeationFillController {
             }
         }
         for (IotOpeationFillSaveReqVO totalRun:fillList) {
-            if(totalRun.getPointName().equals("累计运转时间")||totalRun.getPointName().equals("累计运行时间")){
+            if((totalRun.getPointName().equals("累计运转时间")||totalRun.getPointName().equals("累计运行时间"))&&totalRun.getIsCollection()==0){
                 double total = Double.parseDouble(fillContent);
                 totalRun.setTotalRunTime(BigDecimal.valueOf(total).add(totalRun.getTotalRunTime()));
                 break;
@@ -114,6 +114,36 @@ public class IotOpeationFillController {
             }
         }
 
+        fillContent = null;
+        for (IotOpeationFillSaveReqVO dayilyKm:fillList) {
+            if(dayilyKm.getPointName().equals("当日公里数")){
+                fillContent = dayilyKm.getFillContent();
+                break;
+            }
+        }
+        for (IotOpeationFillSaveReqVO totalKm:fillList) {
+            if(totalKm.getPointName().equals("累计公里数")&&totalKm.getIsCollection()==0){
+                double total = Double.parseDouble(fillContent);
+                totalKm.setTotalRunTime(BigDecimal.valueOf(total).add(totalKm.getTotalRunTime()));
+                break;
+            }
+        }
+
+        fillContent = null;
+        for (IotOpeationFillSaveReqVO dayilyDl:fillList) {
+            if(dayilyDl.getPointName().equals("当日用电量")){
+                fillContent = dayilyDl.getFillContent();
+                break;
+            }
+        }
+        for (IotOpeationFillSaveReqVO totalDl:fillList) {
+            if(totalDl.getPointName().equals("累计用电量")&&totalDl.getIsCollection()==0){
+                double total = Double.parseDouble(fillContent);
+                totalDl.setTotalRunTime(BigDecimal.valueOf(total).add(totalDl.getTotalRunTime()));
+                break;
+            }
+        }
+
         List< IotDeviceRunLogDO > logDO = new ArrayList<>();
 
         for (IotOpeationFillSaveReqVO fill:fillList) {

+ 5 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/maintain/IotMaintainController.java

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.pms.controller.admin.maintain;
 
 import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import cn.iocoder.yudao.framework.common.exception.ServiceException;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
@@ -13,6 +14,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainSaveV
 import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.IotMaintainBomDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.IotMaintainDO;
+import cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant;
 import cn.iocoder.yudao.module.pms.service.IotDeviceService;
 import cn.iocoder.yudao.module.pms.service.maintain.IotMaintainBomService;
 import cn.iocoder.yudao.module.pms.service.maintain.IotMaintainService;
@@ -85,6 +87,9 @@ public class IotMaintainController {
     @PreAuthorize("@ss.hasPermission('rq:iot-maintain:query')")
     public CommonResult<IotMaintainRespVO> getIotMaintain(@RequestParam("id") Long id) {
         IotMaintainDO iotMaintain = iotMaintainService.getIotMaintain(id);
+        if (Objects.isNull(iotMaintain)) {
+            throw new ServiceException(ErrorCodeConstant.INSPECT_DEVICE_CHANGE);
+        }
         IotDeviceDO iotDevice = iotDeviceService.getIotDevice(iotMaintain.getDeviceId());
         IotMaintainRespVO bean = BeanUtils.toBean(iotMaintain, IotMaintainRespVO.class);
         if (Objects.nonNull(iotDevice)&&Objects.nonNull(iotDevice.getManufacturerId())) {

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/message/PmsMessage.java

@@ -65,6 +65,9 @@ public class PmsMessage {
             if (PmsConstants.MATERIAL_REQUISITION.equals(businessType)) {
                 msg = "物料领用单 " + name + " 已生成,请知悉。"+"["+ DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss")+"]";
             }
+            if (PmsConstants.GENERATE_MAINTAIN.equals(businessType)) {
+                msg = "您有新的维修工单 " + name + ",请处理。"+"["+ DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss")+"]";
+            }
             if (PmsConstants.GENERATE_MAINTENANCE.equals(businessType)) {
                 msg = "您有新的保养工单 " + name + ",请处理。"+"["+ DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss")+"]";
             }

+ 9 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/failure/IotFailureReportServiceImpl.java

@@ -19,6 +19,7 @@ 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.pms.message.PmsMessage;
 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;
@@ -74,6 +75,8 @@ public class IotFailureReportServiceImpl implements IotFailureReportService {
     private DeptApi deptApi;
     @Autowired
     private RoleApi roleApi;
+    @Autowired
+    private PmsMessage pmsMessage;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -100,8 +103,12 @@ public class IotFailureReportServiceImpl implements IotFailureReportService {
             templateParams.put("name", iotMaintainDO.getDeviceName());
             templateParams.put("businessType", PmsConstants.GENERATE_MAINTAIN);
             templateParams.put("businessId", iotMaintainDO.getId());
-            notifyMessageSendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
-                    .setUserId(failureReportDO.getAssigneeUserId()).setTemplateCode(PmsConstants.GENERATE_MAINTAIN_TEMPLATE).setTemplateParams(templateParams));
+            AdminUserRespDTO user = adminUserApi.getUser(Objects.isNull(failureReportDO.getAssigneeUserId()) ? Long.valueOf(failureReportDO.getCreator()) : failureReportDO.getAssigneeUserId());
+//            notifyMessageSendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
+//                    .setUserId(failureReportDO.getAssigneeUserId()).setTemplateCode(PmsConstants.GENERATE_MAINTAIN).setTemplateParams(templateParams));
+            if (Objects.nonNull(user)) {
+                pmsMessage.sendMessage(iotMaintainDO.getId(), iotMaintainDO.getDeviceName(), PmsConstants.GENERATE_MAINTAIN, failureReportDO.getAssigneeUserId(), user.getMobile());
+            }
         } else if (bpmResult ==3 ) {
             //更新故障上报状态及审核状态
             IotFailureReportDO failureReportDO = iotFailureReportMapper.selectById(id);