|
|
|
@ -2,14 +2,17 @@ package cn.iocoder.yudao.module.mes.service.deviceledger;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodel.DeviceModelDO;
|
|
|
|
import cn.iocoder.yudao.module.iot.dal.dataobject.devicemodel.DeviceModelDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.enums.PlanTypeEnum;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.ticketmanagement.enums.PlanTypeEnum;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairLineDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairLineDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketresults.TicketResultsDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.criticalcomponent.CriticalComponentMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairLineMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairLineMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.ticketresults.TicketResultsMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.ticketresults.TicketResultsMapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -17,6 +20,8 @@ import javax.annotation.Resource;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.deviceledger.vo.*;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.deviceledger.vo.*;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
@ -50,6 +55,8 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private DvRepairMapper dvRepairMapperRepair;
|
|
|
|
private DvRepairMapper dvRepairMapperRepair;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private CriticalComponentMapper criticalComponentMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Long createDeviceLedger(DeviceLedgerSaveReqVO createReqVO) {
|
|
|
|
public Long createDeviceLedger(DeviceLedgerSaveReqVO createReqVO) {
|
|
|
|
@ -116,17 +123,20 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
|
|
|
|
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(id);
|
|
|
|
DeviceLedgerDO deviceLedgerDO = deviceLedgerMapper.selectById(id);
|
|
|
|
Map<String,List<DvRepairLineDO>> dvRepairDOMap=new HashMap<>();
|
|
|
|
Map<String,List<DvRepairLineDO>> dvRepairDOMap=new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//点检列表
|
|
|
|
List<TicketResultsDO> inspectionList = ticketResultsMapper.findByDeviceIdAndPlanType(id, PlanTypeEnum.INSPECTION.getCode());
|
|
|
|
List<TicketResultsDO> inspectionList = ticketResultsMapper.findByDeviceIdAndPlanType(id, PlanTypeEnum.INSPECTION.getCode());
|
|
|
|
if(CollectionUtils.isNotEmpty(inspectionList)){
|
|
|
|
if(CollectionUtils.isNotEmpty(inspectionList)){
|
|
|
|
deviceLedgerDO.setInspectionList(inspectionList);
|
|
|
|
deviceLedgerDO.setInspectionList(inspectionList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保养列表
|
|
|
|
List<TicketResultsDO> maintainList = ticketResultsMapper.findByDeviceIdAndPlanType(id, PlanTypeEnum.MAINTENANCE.getCode());
|
|
|
|
List<TicketResultsDO> maintainList = ticketResultsMapper.findByDeviceIdAndPlanType(id, PlanTypeEnum.MAINTENANCE.getCode());
|
|
|
|
if(CollectionUtils.isNotEmpty(maintainList)){
|
|
|
|
if(CollectionUtils.isNotEmpty(maintainList)){
|
|
|
|
deviceLedgerDO.setMaintainList(maintainList);
|
|
|
|
deviceLedgerDO.setMaintainList(maintainList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//维修列表
|
|
|
|
List<DvRepairDO> dvRepairDOS = dvRepairMapperRepair.selectList(
|
|
|
|
List<DvRepairDO> dvRepairDOS = dvRepairMapperRepair.selectList(
|
|
|
|
Wrappers.<DvRepairDO>lambdaQuery()
|
|
|
|
Wrappers.<DvRepairDO>lambdaQuery()
|
|
|
|
.eq(DvRepairDO::getDeviceId, id));
|
|
|
|
.eq(DvRepairDO::getDeviceId, id));
|
|
|
|
@ -135,7 +145,9 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
|
|
|
|
List<DvRepairLineDO> dvRepairLineDOS = dvRepairLineMapper.selectList(Wrappers.<DvRepairLineDO>lambdaQuery()
|
|
|
|
List<DvRepairLineDO> dvRepairLineDOS = dvRepairLineMapper.selectList(Wrappers.<DvRepairLineDO>lambdaQuery()
|
|
|
|
.eq(DvRepairLineDO::getRepairId, dvRepairDO.getId())
|
|
|
|
.eq(DvRepairLineDO::getRepairId, dvRepairDO.getId())
|
|
|
|
.orderByDesc(DvRepairLineDO::getCreateTime));
|
|
|
|
.orderByDesc(DvRepairLineDO::getCreateTime));
|
|
|
|
dvRepairDOMap.put(dvRepairDO.getRepairName(),dvRepairLineDOS);
|
|
|
|
if (!dvRepairLineDOS.isEmpty()) {
|
|
|
|
|
|
|
|
dvRepairDOMap.put(dvRepairDO.getRepairName(), dvRepairLineDOS);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(dvRepairDOMap)){
|
|
|
|
if(CollectionUtils.isNotEmpty(dvRepairDOMap)){
|
|
|
|
@ -143,6 +155,26 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//关键件列表
|
|
|
|
|
|
|
|
List<CriticalComponentDO> componentList = new ArrayList<>();
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(deviceLedgerDO.getComponentId())) {
|
|
|
|
|
|
|
|
// 将逗号分隔的字符串转换为Long类型的List
|
|
|
|
|
|
|
|
List<Long> idList = Arrays.stream(deviceLedgerDO.getComponentId().split(","))
|
|
|
|
|
|
|
|
.map(String::trim) // 去除可能存在的空格
|
|
|
|
|
|
|
|
.map(Long::valueOf)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
for (Long componentId : idList) {
|
|
|
|
|
|
|
|
CriticalComponentDO criticalComponentDO = criticalComponentMapper.selectById(componentId);
|
|
|
|
|
|
|
|
if(criticalComponentDO!=null){
|
|
|
|
|
|
|
|
componentList.add(criticalComponentDO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceLedgerDO.setComponentList(componentList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return deviceLedgerDO;
|
|
|
|
return deviceLedgerDO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|