|
@@ -1,15 +1,21 @@
|
|
package cn.iocoder.yudao.module.pms.service.maintenance;
|
|
package cn.iocoder.yudao.module.pms.service.maintenance;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotMaintenanceBomSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotTobeMaintenanceBomRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmaintenancebom.vo.IotTobeMaintenanceBomRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.maintenance.vo.IotMaintenancePlanPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.maintenance.vo.IotMaintenancePlanPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.maintenance.vo.IotMaintenancePlanSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.maintenance.vo.IotMaintenancePlanSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.maintenance.vo.IotMaintenanceSaveVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.maintenance.vo.IotMaintenanceSaveVO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
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.maintenance.IotMaintenancePlanDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.maintenance.IotMaintenancePlanDO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
|
|
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.maintenance.IotMaintenancePlanMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.maintenance.IotMaintenancePlanMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.redis.BizNoRedisDAO;
|
|
import cn.iocoder.yudao.module.pms.dal.redis.BizNoRedisDAO;
|
|
@@ -43,6 +49,8 @@ public class IotMaintenancePlanServiceImpl implements IotMaintenancePlanService
|
|
private BizNoRedisDAO bizNoRedisDAO;
|
|
private BizNoRedisDAO bizNoRedisDAO;
|
|
@Resource
|
|
@Resource
|
|
private DeptService deptService;
|
|
private DeptService deptService;
|
|
|
|
+ @Resource
|
|
|
|
+ private IotDeviceMapper iotDeviceMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -114,7 +122,33 @@ public class IotMaintenancePlanServiceImpl implements IotMaintenancePlanService
|
|
ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
ids.add(pageReqVO.getDeptId());
|
|
ids.add(pageReqVO.getDeptId());
|
|
}
|
|
}
|
|
- return iotMaintenancePlanMapper.selectPage(pageReqVO, ids);
|
|
|
|
|
|
+ if (StrUtil.isNotBlank(pageReqVO.getName())) {
|
|
|
|
+ pageReqVO.setDeviceName(pageReqVO.getName());
|
|
|
|
+ pageReqVO.setDeviceCode(pageReqVO.getName());
|
|
|
|
+ }
|
|
|
|
+ // 设备名称模糊搜索 查询保养计划明细
|
|
|
|
+ IotDevicePageReqVO reqVO = new IotDevicePageReqVO();
|
|
|
|
+ reqVO.setDeviceName(pageReqVO.getDeviceName());
|
|
|
|
+ List<IotDeviceDO> devices = iotDeviceMapper.selectListAlone(reqVO);
|
|
|
|
+ Set<Long> deviceIds = new HashSet<>();
|
|
|
|
+ if (CollUtil.isNotEmpty(devices)) {
|
|
|
|
+ devices.forEach(device -> {
|
|
|
|
+ deviceIds.add(device.getId());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ // 根据设备id查询保养计划明细
|
|
|
|
+ Set<Long> planIds = new HashSet<>();
|
|
|
|
+ if (CollUtil.isNotEmpty(deviceIds)) {
|
|
|
|
+ IotMaintenanceBomPageReqVO planBomReqVO = new IotMaintenanceBomPageReqVO();
|
|
|
|
+ planBomReqVO.setDeviceIds(new ArrayList<>(deviceIds));
|
|
|
|
+ List<IotMaintenanceBomDO> planBoms = iotMaintenanceBomMapper.selectList(planBomReqVO);
|
|
|
|
+ if (CollUtil.isNotEmpty(planBoms)) {
|
|
|
|
+ planBoms.forEach(bom -> {
|
|
|
|
+ planIds.add(bom.getPlanId());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return iotMaintenancePlanMapper.selectPage(pageReqVO, ids, planIds);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|