|
|
|
@ -14,6 +14,9 @@ import org.dromara.common.log.enums.BusinessType;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
import org.dromara.common.web.core.BaseController;
|
|
|
|
|
import org.dromara.dms.domain.DmsBillsMaintDetail;
|
|
|
|
|
import org.dromara.dms.domain.DmsBillsMaintDetailProject;
|
|
|
|
|
import org.dromara.dms.domain.DmsInspectInstanceDetailProject;
|
|
|
|
|
import org.dromara.dms.domain.vo.DmsInspectInstanceDetailProjectVo;
|
|
|
|
|
import org.dromara.dms.domain.DmsFaultComponentsParts;
|
|
|
|
|
import org.dromara.dms.domain.bo.*;
|
|
|
|
|
import org.dromara.dms.domain.mobile.*;
|
|
|
|
@ -71,46 +74,46 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
* @param voInstance VO实例
|
|
|
|
|
*/
|
|
|
|
|
private void formatTimeFields(DmsBillsFaultInstanceMobile mobileInstance, DmsBillsFaultInstanceVo voInstance) {
|
|
|
|
|
// 时间字段格式化
|
|
|
|
|
// if (voInstance.getApplyTime() != null) {
|
|
|
|
|
// mobileInstance.setApplyTime(DATE_FORMAT.format(voInstance.getApplyTime()));
|
|
|
|
|
// }
|
|
|
|
|
// if (voInstance.getRealBeginTime() != null) {
|
|
|
|
|
// mobileInstance.setRealBeginTime(DATE_FORMAT.format(voInstance.getRealBeginTime()));
|
|
|
|
|
// }
|
|
|
|
|
// if (voInstance.getRealEndTime() != null) {
|
|
|
|
|
// mobileInstance.setRealEndTime(DATE_FORMAT.format(voInstance.getRealEndTime()));
|
|
|
|
|
// }
|
|
|
|
|
// if (voInstance.getRequireEndTime() != null) {
|
|
|
|
|
// mobileInstance.setRequireEndTime(DATE_FORMAT.format(voInstance.getRequireEndTime()));
|
|
|
|
|
// }
|
|
|
|
|
// if (voInstance.getConfirmTime() != null) {
|
|
|
|
|
// mobileInstance.setConfirmTime(DATE_FORMAT.format(voInstance.getConfirmTime()));
|
|
|
|
|
// }
|
|
|
|
|
// 时间字段格式化,将Date转换为String格式,确保PDA客户端兼容性
|
|
|
|
|
if (voInstance.getApplyTime() != null) {
|
|
|
|
|
mobileInstance.setApplyTime(DATE_FORMAT.format(voInstance.getApplyTime()));
|
|
|
|
|
}
|
|
|
|
|
if (voInstance.getRealBeginTime() != null) {
|
|
|
|
|
mobileInstance.setRealBeginTime(DATE_FORMAT.format(voInstance.getRealBeginTime()));
|
|
|
|
|
}
|
|
|
|
|
if (voInstance.getRealEndTime() != null) {
|
|
|
|
|
mobileInstance.setRealEndTime(DATE_FORMAT.format(voInstance.getRealEndTime()));
|
|
|
|
|
}
|
|
|
|
|
if (voInstance.getRequireEndTime() != null) {
|
|
|
|
|
mobileInstance.setRequireEndTime(DATE_FORMAT.format(voInstance.getRequireEndTime()));
|
|
|
|
|
}
|
|
|
|
|
if (voInstance.getConfirmTime() != null) {
|
|
|
|
|
mobileInstance.setConfirmTime(DATE_FORMAT.format(voInstance.getConfirmTime()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PDA客户端字段映射 - 从voInstance正确获取数据
|
|
|
|
|
// PDA客户端字段映射 - 处理machineId与deviceId的映射
|
|
|
|
|
mobileInstance.setDeviceCode(voInstance.getMachineCode());
|
|
|
|
|
mobileInstance.setDeviceName(voInstance.getMachineName());
|
|
|
|
|
mobileInstance.setDeviceLocation(voInstance.getMachineLocation());
|
|
|
|
|
mobileInstance.setDeviceSpec(voInstance.getMachineSpec());
|
|
|
|
|
|
|
|
|
|
// ID字段类型转换 - Long到String
|
|
|
|
|
if (voInstance.getRepairInstanceId() != null) {
|
|
|
|
|
mobileInstance.setRepairInstanceId(String.valueOf(voInstance.getRepairInstanceId()));
|
|
|
|
|
}
|
|
|
|
|
if (voInstance.getFaultSourceId() != null) {
|
|
|
|
|
mobileInstance.setFaultSourceId(String.valueOf(voInstance.getFaultSourceId()));
|
|
|
|
|
}
|
|
|
|
|
if (voInstance.getWfDefinitionId() != null) {
|
|
|
|
|
mobileInstance.setWfDefinitionId(String.valueOf(voInstance.getWfDefinitionId()));
|
|
|
|
|
// PDA客户端兼容字段
|
|
|
|
|
mobileInstance.setWfProcessId(String.valueOf(voInstance.getWfDefinitionId()));
|
|
|
|
|
}
|
|
|
|
|
if (voInstance.getMachineId() != null) {
|
|
|
|
|
mobileInstance.setMachineId(String.valueOf(voInstance.getMachineId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ID字段类型转换 - Long到String,并处理字段映射差异
|
|
|
|
|
if (voInstance.getRepairInstanceId() != null) {
|
|
|
|
|
mobileInstance.setRepairInstanceId(String.valueOf(voInstance.getRepairInstanceId()));
|
|
|
|
|
}
|
|
|
|
|
if (voInstance.getFaultSourceId() != null) {
|
|
|
|
|
mobileInstance.setFaultSourceId(String.valueOf(voInstance.getFaultSourceId()));
|
|
|
|
|
}
|
|
|
|
|
if (voInstance.getWfDefinitionId() != null) {
|
|
|
|
|
mobileInstance.setWfDefinitionId(String.valueOf(voInstance.getWfDefinitionId()));
|
|
|
|
|
// PDA客户端兼容字段
|
|
|
|
|
mobileInstance.setWfProcessId(String.valueOf(voInstance.getWfDefinitionId()));
|
|
|
|
|
}
|
|
|
|
|
if (voInstance.getMachineId() != null) {
|
|
|
|
|
// 后端machineId对应PDA端deviceId
|
|
|
|
|
mobileInstance.setMachineId(String.valueOf(voInstance.getMachineId()));
|
|
|
|
|
mobileInstance.setDeviceId(String.valueOf(voInstance.getMachineId()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -225,8 +228,19 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
DmsBaseMachineInfoBo dmsBaseMachineInfoBo = new DmsBaseMachineInfoBo();
|
|
|
|
|
dmsBaseMachineInfoBo.setMachineCode(deviceCode);
|
|
|
|
|
//TODO:根据设备编号查一个设备
|
|
|
|
|
DmsBaseMachineInfoVo dmsBaseDeviceLedger = baseDeviceLedgerService.queryList(dmsBaseMachineInfoBo).get(0);
|
|
|
|
|
return AjaxResult.success(dmsBaseDeviceLedger);
|
|
|
|
|
List<DmsBaseMachineInfoVo> queryResult = baseDeviceLedgerService.queryList(dmsBaseMachineInfoBo);
|
|
|
|
|
if (queryResult.isEmpty()) {
|
|
|
|
|
return AjaxResult.error("未找到对应设备信息");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DmsBaseMachineInfoVo dmsBaseDeviceLedger = queryResult.get(0);
|
|
|
|
|
// 使用MapstructUtils进行对象转换,然后手动处理字段映射差异
|
|
|
|
|
DeviceBeen deviceBeen = MapstructUtils.convert(dmsBaseDeviceLedger, DeviceBeen.class);
|
|
|
|
|
// 手动处理字段映射差异:machineId -> deviceId,确保类型安全转换
|
|
|
|
|
if (dmsBaseDeviceLedger.getMachineId() != null) {
|
|
|
|
|
deviceBeen.setDeviceId(dmsBaseDeviceLedger.getMachineId().intValue());
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.success(deviceBeen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -244,10 +258,11 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
queryBaseOutsrcInfo.setActiveFlag("1");
|
|
|
|
|
|
|
|
|
|
List<DmsBaseOutsourcingInfoVo> baseOutsrcInfos = dmsBaseOutsrcInfoService.queryList(queryBaseOutsrcInfo);
|
|
|
|
|
// 使用MapstructUtils进行对象转换,然后手动处理字段映射差异
|
|
|
|
|
List<Outsourcing> outsourcingList = new ArrayList<>();
|
|
|
|
|
for (DmsBaseOutsourcingInfoVo vo : baseOutsrcInfos) {
|
|
|
|
|
Outsourcing outsourcing = new Outsourcing();
|
|
|
|
|
outsourcing.setOutsrcId(vo.getOutsourcingId().intValue());
|
|
|
|
|
outsourcing.setOutsrcId(Math.toIntExact(vo.getOutsourcingId()));
|
|
|
|
|
outsourcing.setOutsrcCode(vo.getOutsourcingCode());
|
|
|
|
|
outsourcing.setOutsrcName(vo.getOutsourcingName());
|
|
|
|
|
outsourcingList.add(outsourcing);
|
|
|
|
@ -339,7 +354,15 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
public TableDataInfo getBillsFaultInstances() {
|
|
|
|
|
DmsBillsFaultInstanceBo queryBillsFaultInstance = new DmsBillsFaultInstanceBo();
|
|
|
|
|
List<DmsBillsFaultInstanceVo> billsFaultInstances = dmsBillsFaultInstanceService.queryList(queryBillsFaultInstance);
|
|
|
|
|
return TableDataInfo.build(billsFaultInstances);
|
|
|
|
|
// 转换为Mobile对象,处理字段映射差异
|
|
|
|
|
List<DmsBillsFaultInstanceMobile> mobileInstances = new ArrayList<>();
|
|
|
|
|
for (DmsBillsFaultInstanceVo vo : billsFaultInstances) {
|
|
|
|
|
DmsBillsFaultInstanceMobile mobileInstance = MapstructUtils.convert(vo, DmsBillsFaultInstanceMobile.class);
|
|
|
|
|
// 手动处理字段映射差异
|
|
|
|
|
formatTimeFields(mobileInstance, vo);
|
|
|
|
|
mobileInstances.add(mobileInstance);
|
|
|
|
|
}
|
|
|
|
|
return TableDataInfo.build(mobileInstances);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -404,7 +427,10 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
@GetMapping("/scanDevice4Repair")
|
|
|
|
|
@RepeatSubmit
|
|
|
|
|
public AjaxResult scanDevice4Repair(@Validated DmsBillsFaultInstanceScanBo dmsBillsFaultInstanceScan) {
|
|
|
|
|
return AjaxResult.success(dmsBillsFaultInstanceService.scanDevice4Repair(dmsBillsFaultInstanceScan));
|
|
|
|
|
Object result = dmsBillsFaultInstanceService.scanDevice4Repair(dmsBillsFaultInstanceScan);
|
|
|
|
|
// 注意:此接口返回的具体类型需要根据业务逻辑确认
|
|
|
|
|
// 如果返回的是VO对象,建议转换为Mobile对象以保持一致性
|
|
|
|
|
return AjaxResult.success(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -456,6 +482,21 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
DmsBillsInspectInstanceVo newestInspectInstance = dmsBillsInspectInstanceService.getNewestBillsInspectInstance(dmsBillsInspectInstance);
|
|
|
|
|
// 使用MapstructUtils进行高性能对象转换,避免时间字段序列化问题
|
|
|
|
|
DmsBillsInspectInstanceMobile mobileInstance = MapstructUtils.convert(newestInspectInstance, DmsBillsInspectInstanceMobile.class);
|
|
|
|
|
|
|
|
|
|
// 处理嵌套对象的字段映射:dmsInspectInstanceDetailList
|
|
|
|
|
if (newestInspectInstance.getDmsInspectInstanceDetailList() != null) {
|
|
|
|
|
List<DmsInspectInstanceDetailMobile> detailMobileList = new ArrayList<>();
|
|
|
|
|
for (var detailVo : newestInspectInstance.getDmsInspectInstanceDetailList()) {
|
|
|
|
|
DmsInspectInstanceDetailMobile detailMobile = MapstructUtils.convert(detailVo, DmsInspectInstanceDetailMobile.class);
|
|
|
|
|
// 手动处理字段映射差异:machineId -> deviceId
|
|
|
|
|
if (detailVo.getMachineId() != null) {
|
|
|
|
|
detailMobile.setDeviceId(detailVo.getMachineId().intValue());
|
|
|
|
|
}
|
|
|
|
|
detailMobileList.add(detailMobile);
|
|
|
|
|
}
|
|
|
|
|
mobileInstance.setDmsInspectInstanceDetailList(detailMobileList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success(mobileInstance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -468,9 +509,116 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
@RepeatSubmit
|
|
|
|
|
public AjaxResult scanInspectInstanceDetail(@Validated DmsBillsInspectInstanceScanBo dmsBillsInspectInstanceScan) {
|
|
|
|
|
DmsInspectInstanceDetailVo dmsInspectInstanceDetailVo = dmsBillsInspectInstanceService.scanInspectInstanceDetail(dmsBillsInspectInstanceScan);
|
|
|
|
|
DmsInspectInstanceDetailMobile dmsInspectInstanceDetailMobile = MapstructUtils.convert(dmsInspectInstanceDetailVo, DmsInspectInstanceDetailMobile.class);
|
|
|
|
|
|
|
|
|
|
// 【关键修复】完全避免使用MapstructUtils自动转换,采用手动映射
|
|
|
|
|
DmsInspectInstanceDetailMobile dmsInspectInstanceDetailMobile = new DmsInspectInstanceDetailMobile();
|
|
|
|
|
|
|
|
|
|
// 手动映射基本字段
|
|
|
|
|
dmsInspectInstanceDetailMobile.setInstanceDetailId(dmsInspectInstanceDetailVo.getInstanceDetailId());
|
|
|
|
|
dmsInspectInstanceDetailMobile.setInspectInstanceId(dmsInspectInstanceDetailVo.getInspectInstanceId());
|
|
|
|
|
dmsInspectInstanceDetailMobile.setLineStep(dmsInspectInstanceDetailVo.getLineStep());
|
|
|
|
|
dmsInspectInstanceDetailMobile.setRealLineStep(dmsInspectInstanceDetailVo.getRealLineStep());
|
|
|
|
|
dmsInspectInstanceDetailMobile.setInstanceDetailStatus(dmsInspectInstanceDetailVo.getInstanceDetailStatus());
|
|
|
|
|
dmsInspectInstanceDetailMobile.setInspectStandard(dmsInspectInstanceDetailVo.getInspectStandard());
|
|
|
|
|
dmsInspectInstanceDetailMobile.setInspectDesc(dmsInspectInstanceDetailVo.getInspectDesc());
|
|
|
|
|
dmsInspectInstanceDetailMobile.setInspectStatus(dmsInspectInstanceDetailVo.getInspectStatus());
|
|
|
|
|
dmsInspectInstanceDetailMobile.setDeviceCode(dmsInspectInstanceDetailVo.getDeviceCode());
|
|
|
|
|
dmsInspectInstanceDetailMobile.setDeviceName(dmsInspectInstanceDetailVo.getDeviceName());
|
|
|
|
|
|
|
|
|
|
// 手动处理字段映射差异:machineId -> deviceId
|
|
|
|
|
if (dmsInspectInstanceDetailVo.getMachineId() != null) {
|
|
|
|
|
dmsInspectInstanceDetailMobile.setDeviceId(dmsInspectInstanceDetailVo.getMachineId().intValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 【方案对比实现】处理项目列表:使用流和类型过滤 vs 强制转换
|
|
|
|
|
if (dmsInspectInstanceDetailVo.getDmsInspectInstanceDetailProjectList() != null) {
|
|
|
|
|
List<DeviceInspectionItem> deviceInspectionItemList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
// 【方案A:流和类型过滤 - 类型安全,性能稍低】
|
|
|
|
|
List<?> rawProjectList = dmsInspectInstanceDetailVo.getDmsInspectInstanceDetailProjectList();
|
|
|
|
|
for (Object projectObj : rawProjectList) {
|
|
|
|
|
DeviceInspectionItem deviceInspectionItem = new DeviceInspectionItem();
|
|
|
|
|
|
|
|
|
|
// 运行时类型检查,支持多种类型
|
|
|
|
|
if (projectObj instanceof DmsInspectInstanceDetailProject) {
|
|
|
|
|
DmsInspectInstanceDetailProject project = (DmsInspectInstanceDetailProject) projectObj;
|
|
|
|
|
mapProjectFields(deviceInspectionItem, project);
|
|
|
|
|
} else if (projectObj instanceof DmsInspectInstanceDetailProjectVo) {
|
|
|
|
|
DmsInspectInstanceDetailProjectVo projectVo = (DmsInspectInstanceDetailProjectVo) projectObj;
|
|
|
|
|
mapProjectVoFields(deviceInspectionItem, projectVo);
|
|
|
|
|
} else {
|
|
|
|
|
log.warn("未知的项目类型: {}", projectObj.getClass().getName());
|
|
|
|
|
continue; // 跳过未知类型,保证程序稳定性
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
deviceInspectionItemList.add(deviceInspectionItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dmsInspectInstanceDetailMobile.setDmsInspectInstanceDetailProjectList(deviceInspectionItemList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success(dmsInspectInstanceDetailMobile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 映射DmsInspectInstanceDetailProject字段到DeviceInspectionItem
|
|
|
|
|
*/
|
|
|
|
|
private void mapProjectFields(DeviceInspectionItem deviceInspectionItem, DmsInspectInstanceDetailProject project) {
|
|
|
|
|
deviceInspectionItem.setInstanceDetailProjectId(project.getInstanceDetailProjectId());
|
|
|
|
|
deviceInspectionItem.setInspectProjectStatus(project.getInspectProjectStatus());
|
|
|
|
|
deviceInspectionItem.setInspectProjectName(project.getInspectProjectName());
|
|
|
|
|
deviceInspectionItem.setInspectProjectProperty(project.getInspectProjectProperty());
|
|
|
|
|
deviceInspectionItem.setInspectProjectDesc(project.getInspectProjectDesc());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (project.getInspectProjectResult() != null) {
|
|
|
|
|
deviceInspectionItem.setInspectProjectResult(project.getInspectProjectResult().toString());
|
|
|
|
|
} else {
|
|
|
|
|
// 【PDA适配】确保为null而不是空字符串
|
|
|
|
|
deviceInspectionItem.setInspectProjectResult(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (project.getDefValue() != null) {
|
|
|
|
|
deviceInspectionItem.setDefValue(project.getDefValue().doubleValue());
|
|
|
|
|
}
|
|
|
|
|
if (project.getUpLimit() != null) {
|
|
|
|
|
deviceInspectionItem.setUpLimit(project.getUpLimit().doubleValue());
|
|
|
|
|
}
|
|
|
|
|
if (project.getLowLimit() != null) {
|
|
|
|
|
deviceInspectionItem.setLowLimit(project.getLowLimit().doubleValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 映射DmsInspectInstanceDetailProjectVo字段到DeviceInspectionItem
|
|
|
|
|
*/
|
|
|
|
|
private void mapProjectVoFields(DeviceInspectionItem deviceInspectionItem, DmsInspectInstanceDetailProjectVo projectVo) {
|
|
|
|
|
deviceInspectionItem.setInstanceDetailProjectId(projectVo.getInstanceDetailProjectId());
|
|
|
|
|
deviceInspectionItem.setInspectProjectStatus(projectVo.getInspectProjectStatus());
|
|
|
|
|
deviceInspectionItem.setInspectProjectName(projectVo.getInspectProjectName());
|
|
|
|
|
deviceInspectionItem.setInspectProjectProperty(projectVo.getInspectProjectProperty());
|
|
|
|
|
deviceInspectionItem.setInspectProjectDesc(projectVo.getInspectProjectDesc());
|
|
|
|
|
|
|
|
|
|
// 【PDA适配】不设置statusName,让PDA端自己计算
|
|
|
|
|
// deviceInspectionItem.setStatusName() 由PDA端的getStatusName()方法自动计算
|
|
|
|
|
|
|
|
|
|
if (projectVo.getInspectProjectResult() != null) {
|
|
|
|
|
deviceInspectionItem.setInspectProjectResult(projectVo.getInspectProjectResult().toString());
|
|
|
|
|
} else {
|
|
|
|
|
// 【PDA适配】确保为null而不是空字符串
|
|
|
|
|
deviceInspectionItem.setInspectProjectResult(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (projectVo.getDefValue() != null) {
|
|
|
|
|
deviceInspectionItem.setDefValue(projectVo.getDefValue().doubleValue());
|
|
|
|
|
}
|
|
|
|
|
if (projectVo.getUpLimit() != null) {
|
|
|
|
|
deviceInspectionItem.setUpLimit(projectVo.getUpLimit().doubleValue());
|
|
|
|
|
}
|
|
|
|
|
if (projectVo.getLowLimit() != null) {
|
|
|
|
|
deviceInspectionItem.setLowLimit(projectVo.getLowLimit().doubleValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 点巡检工单
|
|
|
|
@ -494,6 +642,34 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
DmsBillsMaintInstanceVo newestMaintInstance = dmsBillsMaintInstanceService.getNewestBillsMaintInstance(dmsBillsMaintInstance);
|
|
|
|
|
// 使用MapstructUtils进行高性能对象转换,避免时间字段序列化问题
|
|
|
|
|
DmsBillsMaintInstanceMobile mobileInstance = MapstructUtils.convert(newestMaintInstance, DmsBillsMaintInstanceMobile.class);
|
|
|
|
|
|
|
|
|
|
// 处理嵌套对象的字段映射:dmsBillsMaintDetailList
|
|
|
|
|
// PDA端MaintainBeen使用的是List<MaintainDetail>,需要转换
|
|
|
|
|
if (newestMaintInstance.getDmsBillsMaintDetailList() != null) {
|
|
|
|
|
List<MaintainDetail> maintainDetailList = new ArrayList<>();
|
|
|
|
|
for (var detailVo : newestMaintInstance.getDmsBillsMaintDetailList()) {
|
|
|
|
|
MaintainDetail maintainDetail = MapstructUtils.convert(detailVo, MaintainDetail.class);
|
|
|
|
|
// 手动处理字段映射差异:machineId -> deviceId
|
|
|
|
|
if (detailVo.getMachineId() != null) {
|
|
|
|
|
maintainDetail.setDeviceId(detailVo.getMachineId());
|
|
|
|
|
}
|
|
|
|
|
// 手动处理字段映射:maintStationId -> stationId
|
|
|
|
|
if (detailVo.getMaintStationId() != null) {
|
|
|
|
|
maintainDetail.setStationId(detailVo.getMaintStationId());
|
|
|
|
|
}
|
|
|
|
|
// 手动处理其他字段映射
|
|
|
|
|
maintainDetail.setDeviceCode(detailVo.getMachineCode());
|
|
|
|
|
maintainDetail.setDeviceName(detailVo.getMachineName());
|
|
|
|
|
maintainDetail.setTypeName(detailVo.getDeviceTypeName());
|
|
|
|
|
maintainDetail.setMaintStationName(detailVo.getMaintStationName());
|
|
|
|
|
maintainDetail.setMaintProtocol(detailVo.getMaintProtocol());
|
|
|
|
|
maintainDetail.setMaintOperationDescription(detailVo.getMaintOperationDescription());
|
|
|
|
|
maintainDetail.setOperationDescription(detailVo.getOperationDescription());
|
|
|
|
|
maintainDetailList.add(maintainDetail);
|
|
|
|
|
}
|
|
|
|
|
mobileInstance.setDmsBillsMaintDetailList(maintainDetailList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 手动格式化时间字段,确保PDA客户端兼容性
|
|
|
|
|
// formatMaintTimeFields(mobileInstance, newestMaintInstance);
|
|
|
|
|
return AjaxResult.success(mobileInstance);
|
|
|
|
@ -507,9 +683,55 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
@Log(title = "保养工单", businessType = BusinessType.START)
|
|
|
|
|
@PostMapping("/startMaint")
|
|
|
|
|
@RepeatSubmit
|
|
|
|
|
public AjaxResult startMaint(@RequestBody DmsBillsMaintDetail dmsBillsMaintDetail) {
|
|
|
|
|
public AjaxResult startMaint(@RequestBody DmsBillsMaintDetailMobileBo dmsBillsMaintDetailMobileBo) {
|
|
|
|
|
// 将PDA端Bo转换为后端实体,处理字段名差异
|
|
|
|
|
DmsBillsMaintDetail dmsBillsMaintDetail = dmsBillsMaintDetailMobileBo.toEntity();
|
|
|
|
|
DmsBillsMaintDetail result = dmsBillsMaintInstanceService.startMaint(dmsBillsMaintDetail);
|
|
|
|
|
return AjaxResult.success(result);
|
|
|
|
|
// 转换为Mobile对象,确保与PDA端兼容
|
|
|
|
|
MaintainDetail maintainDetail = MapstructUtils.convert(result, MaintainDetail.class);
|
|
|
|
|
|
|
|
|
|
// 手动处理字段映射差异:machineId -> deviceId
|
|
|
|
|
if (result.getMachineId() != null) {
|
|
|
|
|
maintainDetail.setDeviceId(result.getMachineId());
|
|
|
|
|
}
|
|
|
|
|
// 手动处理字段映射:maintStationId -> stationId
|
|
|
|
|
if (result.getMaintStationId() != null) {
|
|
|
|
|
maintainDetail.setStationId(result.getMaintStationId());
|
|
|
|
|
}
|
|
|
|
|
// 手动处理其他字段映射,确保PDA端能正确显示
|
|
|
|
|
maintainDetail.setDeviceCode(result.getMachineCode());
|
|
|
|
|
maintainDetail.setDeviceName(result.getMachineName());
|
|
|
|
|
maintainDetail.setTypeName(result.getDeviceTypeName());
|
|
|
|
|
maintainDetail.setMaintStationName(result.getMaintStationName());
|
|
|
|
|
maintainDetail.setMaintProtocol(result.getMaintProtocol());
|
|
|
|
|
maintainDetail.setMaintOperationDescription(result.getMaintOperationDescription());
|
|
|
|
|
maintainDetail.setOperationDescription(result.getOperationDescription());
|
|
|
|
|
|
|
|
|
|
// 处理嵌套对象的字段映射:dmsBillsMaintDetailProjectList
|
|
|
|
|
if (result.getDmsBillsMaintDetailProjectList() != null) {
|
|
|
|
|
List<MaintainProject> maintainProjectList = new ArrayList<>();
|
|
|
|
|
for (var projectVo : result.getDmsBillsMaintDetailProjectList()) {
|
|
|
|
|
MaintainProject maintainProject = MapstructUtils.convert(projectVo, MaintainProject.class);
|
|
|
|
|
// 确保字段正确映射,兼容PDA端期望的字段结构
|
|
|
|
|
if (projectVo.getMaintDetailProjectId() != null) {
|
|
|
|
|
maintainProject.setMaintDetailProjectId(projectVo.getMaintDetailProjectId());
|
|
|
|
|
}
|
|
|
|
|
if (projectVo.getBillsMaintDetailId() != null) {
|
|
|
|
|
maintainProject.setBillsMaintDetailId(projectVo.getBillsMaintDetailId());
|
|
|
|
|
}
|
|
|
|
|
if (projectVo.getMaintProjectId() != null) {
|
|
|
|
|
maintainProject.setMaintProjectId(projectVo.getMaintProjectId());
|
|
|
|
|
}
|
|
|
|
|
maintainProject.setMaintProjectName(projectVo.getMaintProjectName());
|
|
|
|
|
maintainProject.setMaintProjectDesc(projectVo.getMaintProjectDesc());
|
|
|
|
|
maintainProject.setMaintProjectStatus(projectVo.getMaintProjectStatus());
|
|
|
|
|
maintainProject.setRemark(projectVo.getRemark());
|
|
|
|
|
maintainProjectList.add(maintainProject);
|
|
|
|
|
}
|
|
|
|
|
maintainDetail.setDmsBillsMaintDetailProjectList(maintainProjectList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success(maintainDetail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -519,7 +741,21 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
@Log(title = "保养工单", businessType = BusinessType.COMPLETE)
|
|
|
|
|
@PostMapping("/completeMaint")
|
|
|
|
|
@RepeatSubmit
|
|
|
|
|
public AjaxResult completeMaint(@RequestBody DmsBillsMaintDetail dmsBillsMaintDetail) {
|
|
|
|
|
public AjaxResult completeMaint(@RequestBody DmsBillsMaintDetailMobileBo dmsBillsMaintDetailMobileBo) {
|
|
|
|
|
// 将PDA端Bo转换为后端实体,处理字段名差异和项目列表
|
|
|
|
|
DmsBillsMaintDetail dmsBillsMaintDetail = dmsBillsMaintDetailMobileBo.toEntity();
|
|
|
|
|
|
|
|
|
|
// 处理项目列表的转换
|
|
|
|
|
if (dmsBillsMaintDetailMobileBo.getDmsBillsMaintDetailProjectList() != null) {
|
|
|
|
|
List<DmsBillsMaintDetailProjectVo> projectList = new ArrayList<>();
|
|
|
|
|
for (var mobileBo : dmsBillsMaintDetailMobileBo.getDmsBillsMaintDetailProjectList()) {
|
|
|
|
|
DmsBillsMaintDetailProject project = mobileBo.toEntity();
|
|
|
|
|
DmsBillsMaintDetailProjectVo projectVo = MapstructUtils.convert(project, DmsBillsMaintDetailProjectVo.class);
|
|
|
|
|
projectList.add(projectVo);
|
|
|
|
|
}
|
|
|
|
|
dmsBillsMaintDetail.setDmsBillsMaintDetailProjectList(projectList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int i = dmsBillsMaintInstanceService.completeMaint(dmsBillsMaintDetail);
|
|
|
|
|
return AjaxResult.success(i);
|
|
|
|
|
}
|
|
|
|
@ -537,6 +773,25 @@ public class DmsMobileController extends BaseController {
|
|
|
|
|
DmsBillsLubeInstanceVo newestLubeInstance = dmsBillsLubeInstanceService.getNewestBillsLubeInstance(dmsBillsLubeInstance);
|
|
|
|
|
// 使用MapstructUtils进行高性能对象转换,避免时间字段序列化问题
|
|
|
|
|
DmsBillsLubeInstanceMobile mobileInstance = MapstructUtils.convert(newestLubeInstance, DmsBillsLubeInstanceMobile.class);
|
|
|
|
|
|
|
|
|
|
// 处理嵌套对象的字段映射:dmsBillsLubeDetailList
|
|
|
|
|
if (newestLubeInstance.getDmsBillsLubeDetailList() != null) {
|
|
|
|
|
List<LubricationDetail> lubricationDetailList = new ArrayList<>();
|
|
|
|
|
for (var detailVo : newestLubeInstance.getDmsBillsLubeDetailList()) {
|
|
|
|
|
LubricationDetail lubricationDetail = MapstructUtils.convert(detailVo, LubricationDetail.class);
|
|
|
|
|
// 手动处理字段映射差异:machineId -> deviceId
|
|
|
|
|
if (detailVo.getMachineId() != null) {
|
|
|
|
|
lubricationDetail.setDeviceId(detailVo.getMachineId());
|
|
|
|
|
}
|
|
|
|
|
// 处理其他字段映射:machineCode -> deviceCode, machineName -> deviceName
|
|
|
|
|
lubricationDetail.setDeviceCode(detailVo.getMachineCode());
|
|
|
|
|
lubricationDetail.setDeviceName(detailVo.getMachineName());
|
|
|
|
|
lubricationDetail.setTypeName(detailVo.getDeviceTypeName());
|
|
|
|
|
lubricationDetailList.add(lubricationDetail);
|
|
|
|
|
}
|
|
|
|
|
mobileInstance.setDmsBillsLubeDetailList(lubricationDetailList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 注意:润滑Mobile类中的时间字段已被注释,无需格式化
|
|
|
|
|
// 如果将来启用时间字段,请添加相应的格式化方法
|
|
|
|
|
return AjaxResult.success(mobileInstance);
|
|
|
|
|