|
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.pms.service.maintain;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
+import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
|
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
@@ -134,6 +135,10 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
//更新责任人
|
|
|
IotMaintainDO iotMaintainDO = iotMaintainMapper.selectById(iotFailureReportProcessVO.getId());
|
|
|
iotMaintainDO.setMaintainPerson(iotFailureReportProcessVO.getAssigneeUserId());
|
|
|
+ if (Objects.isNull(iotFailureReportProcessVO.getAssigneeUserId())) throw new ServiceException(new ErrorCode(11,"责任人id不存在"));
|
|
|
+ AdminUserRespDTO user = adminUserApi.getUser(iotFailureReportProcessVO.getAssigneeUserId());
|
|
|
+ if (Objects.isNull(user)) throw new ServiceException(new ErrorCode(22,"责任人不存在"));
|
|
|
+ iotMaintainDO.setMaintainPersonName(user.getNickname());
|
|
|
iotMaintainMapper.updateById(iotMaintainDO);
|
|
|
return iotMaintainDO.getId();
|
|
|
}
|
|
@@ -150,6 +155,10 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
}
|
|
|
iotMaintain.setDeleted(false);
|
|
|
iotMaintain.setMaintainPerson(SecurityFrameworkUtils.getLoginUserId());
|
|
|
+ if (Objects.isNull(SecurityFrameworkUtils.getLoginUserId())) throw new ServiceException(new ErrorCode(11,"责任人id不存在"));
|
|
|
+ AdminUserRespDTO user = adminUserApi.getUser(SecurityFrameworkUtils.getLoginUserId());
|
|
|
+ if (Objects.isNull(user)) throw new ServiceException(new ErrorCode(22,"责任人不存在"));
|
|
|
+ iotMaintain.setMaintainPersonName(user.getNickname());
|
|
|
iotMaintain.setMaintainType("手动新增");
|
|
|
iotMaintainMapper.insert(iotMaintain);
|
|
|
//插入工单bom
|
|
@@ -373,6 +382,16 @@ public class IotMaintainServiceImpl implements IotMaintainService {
|
|
|
return iotMaintainMapper.selectPage(pageReqVO, ids);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public PageResult<IotMaintainDO> getIotMaintainPageApp(IotMaintainPageReqVO pageReqVO) {
|
|
|
+ Set<Long> ids = new HashSet<>();
|
|
|
+ if (Objects.nonNull(pageReqVO.getDeptId())) {
|
|
|
+ ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
|
+ ids.add(pageReqVO.getDeptId());
|
|
|
+ }
|
|
|
+ return iotMaintainMapper.selectPageApp(pageReqVO, ids);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void syncWordOrderData(List<Long> deviceIds, Long deptId) {
|
|
|
List<IotMaintainDO> maintainDOS = iotMaintainMapper.selectByStatusAndAuditStatusAndDeviceId("finished", 20, deviceIds);
|