|
@@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
|
|
import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotattachment.vo.IotAttachmentSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotdevicerunlog.vo.IotDeviceRunLogRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotdevicerunlog.vo.IotDeviceRunLogRespVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotlockstock.vo.IotLockStockPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotlockstock.vo.IotLockStockPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomPageReqVO;
|
|
@@ -25,6 +26,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.iotmainworkorderbommaterial.
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotattachment.IotAttachmentDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotlockstock.IotLockStockDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotlockstock.IotLockStockDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmaintenancebom.IotMaintenanceBomDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmaintenancebom.IotMaintenanceBomDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainworkorder.IotMainWorkOrderDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainworkorder.IotMainWorkOrderDO;
|
|
@@ -32,6 +34,7 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainworkorderbom.IotMainWor
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainworkorderbommaterial.IotMainWorkOrderBomMaterialDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainworkorderbommaterial.IotMainWorkOrderBomMaterialDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotoutbound.IotOutboundDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotoutbound.IotOutboundDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotattachment.IotAttachmentMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotlockstock.IotLockStockMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotlockstock.IotLockStockMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotmaintenancebom.IotMaintenanceBomMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotmaintenancebom.IotMaintenanceBomMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotmainworkorder.IotMainWorkOrderMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotmainworkorder.IotMainWorkOrderMapper;
|
|
@@ -39,6 +42,8 @@ import cn.iocoder.yudao.module.pms.dal.mysql.iotmainworkorderbom.IotMainWorkOrde
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotmainworkorderbommaterial.IotMainWorkOrderBomMaterialMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotmainworkorderbommaterial.IotMainWorkOrderBomMaterialMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotoutbound.IotOutboundMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotoutbound.IotOutboundMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.redis.BizNoRedisDAO;
|
|
import cn.iocoder.yudao.module.pms.dal.redis.BizNoRedisDAO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.enums.AttachmentCategoryEnum;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.enums.AttachmentTypeEnum;
|
|
|
import cn.iocoder.yudao.module.pms.service.IotDeviceService;
|
|
import cn.iocoder.yudao.module.pms.service.IotDeviceService;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotdevicerunlog.IotDeviceRunLogService;
|
|
import cn.iocoder.yudao.module.pms.service.iotdevicerunlog.IotDeviceRunLogService;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotmaintenancebom.IotMaintenanceBomService;
|
|
import cn.iocoder.yudao.module.pms.service.iotmaintenancebom.IotMaintenanceBomService;
|
|
@@ -47,6 +52,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper;
|
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import com.google.common.collect.ImmutableMap;
|
|
|
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;
|
|
@@ -68,7 +74,6 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap;
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap;
|
|
|
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_MAIN_WORK_ORDER_EXECUTED;
|
|
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_MAIN_WORK_ORDER_EXECUTED;
|
|
|
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_MAIN_WORK_ORDER_NOT_EXISTS;
|
|
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_MAIN_WORK_ORDER_NOT_EXISTS;
|
|
|
-import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.DEPT_NOT_FOUND;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 保养工单 Service 实现类
|
|
* 保养工单 Service 实现类
|
|
@@ -105,6 +110,8 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
|
|
|
private IotOutboundMapper iotOutboundMapper;
|
|
private IotOutboundMapper iotOutboundMapper;
|
|
|
@Resource
|
|
@Resource
|
|
|
private DeptMapper deptMapper;
|
|
private DeptMapper deptMapper;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private IotAttachmentMapper iotAttachmentMapper;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Long createIotMainWorkOrder(IotMainWorkOrderSaveReqVO createReqVO) {
|
|
public Long createIotMainWorkOrder(IotMainWorkOrderSaveReqVO createReqVO) {
|
|
@@ -2049,6 +2056,34 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
|
|
|
updateObj.setResult(2);
|
|
updateObj.setResult(2);
|
|
|
}
|
|
}
|
|
|
iotMainWorkOrderMapper.updateById(updateObj);
|
|
iotMainWorkOrderMapper.updateById(updateObj);
|
|
|
|
|
+
|
|
|
|
|
+ // 更新工单的附件记录 rq_iot_attachment
|
|
|
|
|
+ List<IotAttachmentSaveReqVO> attachmentReqVO = mainWorkOrder.getAttachments();
|
|
|
|
|
+ List<IotAttachmentDO> tobeAddedAttachments = new ArrayList<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(attachmentReqVO)) {
|
|
|
|
|
+ attachmentReqVO.forEach(att -> {
|
|
|
|
|
+ IotAttachmentDO attachment = new IotAttachmentDO();
|
|
|
|
|
+ attachment.setBizId(updateObj.getId());
|
|
|
|
|
+ attachment.setCategory(AttachmentCategoryEnum.MAINTENANCE.getCode());
|
|
|
|
|
+ attachment.setType(AttachmentTypeEnum.MAINTENANCE_STANDARD.getCode());
|
|
|
|
|
+ attachment.setFilePath(att.getFilePath());
|
|
|
|
|
+ attachment.setFileSize(att.getFileSize());
|
|
|
|
|
+ attachment.setFilename(att.getFilename());
|
|
|
|
|
+ attachment.setFileType(att.getFileType());
|
|
|
|
|
+ attachment.setRemark(att.getRemark());
|
|
|
|
|
+ tobeAddedAttachments.add(attachment);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 先删除附件再新增附件
|
|
|
|
|
+ int count = iotAttachmentMapper.deleteByMap(ImmutableMap.of(
|
|
|
|
|
+ "category", AttachmentCategoryEnum.MAINTENANCE.getCode(),
|
|
|
|
|
+ "biz_id", updateObj.getId(),
|
|
|
|
|
+ "type", AttachmentTypeEnum.MAINTENANCE_STANDARD.getCode()
|
|
|
|
|
+ ));
|
|
|
|
|
+ if (CollUtil.isNotEmpty(tobeAddedAttachments)) {
|
|
|
|
|
+ iotAttachmentMapper.insertBatch(tobeAddedAttachments);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 如果有保养项已经保养完成,根据保养项规则 实时更新 关联 的 保养计划 明细 保养项的 ‘上次保养运行时间、上次保养自然日期、上次保养公里数’
|
|
// 如果有保养项已经保养完成,根据保养项规则 实时更新 关联 的 保养计划 明细 保养项的 ‘上次保养运行时间、上次保养自然日期、上次保养公里数’
|
|
|
// 查询明细中所有设备的累计运行里程、累计运行时间
|
|
// 查询明细中所有设备的累计运行里程、累计运行时间
|
|
|
// 全部按照多个累计属性 来统计
|
|
// 全部按照多个累计属性 来统计
|
|
@@ -2326,6 +2361,35 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
iotMainWorkOrderMapper.insert(order);
|
|
iotMainWorkOrderMapper.insert(order);
|
|
|
|
|
+
|
|
|
|
|
+ // 添加附件 先删除再新增
|
|
|
|
|
+ // 更新工单的附件记录 rq_iot_attachment
|
|
|
|
|
+ List<IotAttachmentSaveReqVO> attachmentReqVO = mainWorkOrder.getAttachments();
|
|
|
|
|
+ List<IotAttachmentDO> tobeAddedAttachments = new ArrayList<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(attachmentReqVO)) {
|
|
|
|
|
+ attachmentReqVO.forEach(att -> {
|
|
|
|
|
+ IotAttachmentDO attachment = new IotAttachmentDO();
|
|
|
|
|
+ attachment.setBizId(order.getId());
|
|
|
|
|
+ attachment.setCategory(AttachmentCategoryEnum.MAINTENANCE.getCode());
|
|
|
|
|
+ attachment.setType(AttachmentTypeEnum.MAINTENANCE_STANDARD.getCode());
|
|
|
|
|
+ attachment.setFilePath(att.getFilePath());
|
|
|
|
|
+ attachment.setFileSize(att.getFileSize());
|
|
|
|
|
+ attachment.setFilename(att.getFilename());
|
|
|
|
|
+ attachment.setFileType(att.getFileType());
|
|
|
|
|
+ attachment.setRemark(att.getRemark());
|
|
|
|
|
+ tobeAddedAttachments.add(attachment);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 先删除附件再新增附件
|
|
|
|
|
+ int count = iotAttachmentMapper.deleteByMap(ImmutableMap.of(
|
|
|
|
|
+ "category", AttachmentCategoryEnum.MAINTENANCE.getCode(),
|
|
|
|
|
+ "biz_id", order.getId(),
|
|
|
|
|
+ "type", AttachmentTypeEnum.MAINTENANCE_STANDARD.getCode()
|
|
|
|
|
+ ));
|
|
|
|
|
+ if (CollUtil.isNotEmpty(tobeAddedAttachments)) {
|
|
|
|
|
+ iotAttachmentMapper.insertBatch(tobeAddedAttachments);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 保养工单明细
|
|
// 保养工单明细
|
|
|
Set<Long> bomNodeIds = new HashSet<>();
|
|
Set<Long> bomNodeIds = new HashSet<>();
|
|
|
Set<Long> deviceIds = new HashSet<>();
|
|
Set<Long> deviceIds = new HashSet<>();
|
|
@@ -2910,6 +2974,49 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void hiWorkOrderAttachment(IotMainWorkOrderSaveReqVO orderReqVO) {
|
|
|
|
|
+ if (ObjectUtil.isEmpty(orderReqVO)) {
|
|
|
|
|
+ throw exception(IOT_MAIN_WORK_ORDER_NOT_EXISTS);
|
|
|
|
|
+ }
|
|
|
|
|
+ Long mainWorkOrderId = orderReqVO.getId();
|
|
|
|
|
+ if (ObjectUtil.isEmpty(mainWorkOrderId)) {
|
|
|
|
|
+ throw exception(IOT_MAIN_WORK_ORDER_NOT_EXISTS);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询保养工单是否存在
|
|
|
|
|
+ IotMainWorkOrderDO workOrder = iotMainWorkOrderMapper.selectById(mainWorkOrderId);
|
|
|
|
|
+ if (ObjectUtil.isEmpty(workOrder)) {
|
|
|
|
|
+ throw exception(IOT_MAIN_WORK_ORDER_NOT_EXISTS);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 更新工单的附件记录 rq_iot_attachment
|
|
|
|
|
+ List<IotAttachmentSaveReqVO> attachmentReqVO = orderReqVO.getAttachments();
|
|
|
|
|
+ List<IotAttachmentDO> tobeAddedAttachments = new ArrayList<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(attachmentReqVO)) {
|
|
|
|
|
+ attachmentReqVO.forEach(att -> {
|
|
|
|
|
+ IotAttachmentDO attachment = new IotAttachmentDO();
|
|
|
|
|
+ attachment.setBizId(mainWorkOrderId);
|
|
|
|
|
+ attachment.setCategory(AttachmentCategoryEnum.MAINTENANCE.getCode());
|
|
|
|
|
+ attachment.setType(AttachmentTypeEnum.MAINTENANCE_STANDARD.getCode());
|
|
|
|
|
+ attachment.setFilePath(att.getFilePath());
|
|
|
|
|
+ attachment.setFileSize(att.getFileSize());
|
|
|
|
|
+ attachment.setFilename(att.getFilename());
|
|
|
|
|
+ attachment.setFileType(att.getFileType());
|
|
|
|
|
+ attachment.setRemark(att.getRemark());
|
|
|
|
|
+ tobeAddedAttachments.add(attachment);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 先删除附件再新增附件
|
|
|
|
|
+ int count = iotAttachmentMapper.deleteByMap(ImmutableMap.of(
|
|
|
|
|
+ "category", AttachmentCategoryEnum.MAINTENANCE.getCode(),
|
|
|
|
|
+ "biz_id", mainWorkOrderId,
|
|
|
|
|
+ "type", AttachmentTypeEnum.MAINTENANCE_STANDARD.getCode()
|
|
|
|
|
+ ));
|
|
|
|
|
+ if (CollUtil.isNotEmpty(tobeAddedAttachments)) {
|
|
|
|
|
+ iotAttachmentMapper.insertBatch(tobeAddedAttachments);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private static class Triple<A, B, C> {
|
|
private static class Triple<A, B, C> {
|
|
|
private final A first;
|
|
private final A first;
|
|
|
private final B second;
|
|
private final B second;
|