diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/ReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/ReportServiceImpl.java index 8a2feaf2..599caf28 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/ReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/ReportServiceImpl.java @@ -17,6 +17,8 @@ import com.njcn.gather.device.script.pojo.po.PqScriptCheckData; import com.njcn.gather.device.script.pojo.po.PqScriptDtls; import com.njcn.gather.device.script.service.IPqScriptCheckDataService; import com.njcn.gather.device.script.service.IPqScriptDtlsService; +import com.njcn.gather.device.type.entity.DevType; +import com.njcn.gather.device.type.service.IDevTypeService; import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.plan.service.IAdPlanService; import com.njcn.gather.report.pojo.DevReportParam; @@ -67,6 +69,8 @@ public class ReportServiceImpl implements IReportService { private final AdHarmonicService adHarmonicService; + private final IDevTypeService devTypeService; + @Override public void generateReport(DevReportParam devReportParam, HttpServletResponse response) { @@ -128,8 +132,8 @@ public class ReportServiceImpl implements IReportService { Map baseModelMap = new HashMap<>(16); PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId()); // 获取设备型号 - DictData devTypeDictData = dictDataService.getDictDataById(pqDevVO.getDevType()); - baseModelMap.put("${devType}", devTypeDictData.getName()); + DevType devType = devTypeService.getById(pqDevVO.getDevType()); + baseModelMap.put("${devType}", devType.getName()); // 调试人员,todo... 待咨询曹泽辉如何获取当前用户信息,目前先写死 baseModelMap.put("${userName}", "管理员"); // 调试日期 diff --git a/device/src/main/java/com/njcn/gather/device/device/mapper/mapping/PqDevMapper.xml b/device/src/main/java/com/njcn/gather/device/device/mapper/mapping/PqDevMapper.xml index 41bba675..8f271994 100644 --- a/device/src/main/java/com/njcn/gather/device/device/mapper/mapping/PqDevMapper.xml +++ b/device/src/main/java/com/njcn/gather/device/device/mapper/mapping/PqDevMapper.xml @@ -28,7 +28,7 @@ d.Id, d.Name, d.IP, - ( select name from sys_dict_data sd where d.Dev_Type= sd.id) as Dev_Type, + ( select name from pq_dev_type sd where d.Dev_Type= sd.id) as Dev_Type, d.Port, d.Dev_Chns as devChns, d.Series, diff --git a/device/src/main/java/com/njcn/gather/device/device/service/impl/PqDevServiceImpl.java b/device/src/main/java/com/njcn/gather/device/device/service/impl/PqDevServiceImpl.java index 46bfd9c5..fc3c49c9 100644 --- a/device/src/main/java/com/njcn/gather/device/device/service/impl/PqDevServiceImpl.java +++ b/device/src/main/java/com/njcn/gather/device/device/service/impl/PqDevServiceImpl.java @@ -26,6 +26,8 @@ import com.njcn.gather.device.monitor.pojo.po.PqMonitor; import com.njcn.gather.device.monitor.pojo.vo.PqMonitorExcel; import com.njcn.gather.device.monitor.service.IPqMonitorService; import com.njcn.gather.device.pojo.enums.*; +import com.njcn.gather.device.type.entity.DevType; +import com.njcn.gather.device.type.service.IDevTypeService; import com.njcn.gather.storage.service.DetectionDataDealService; import com.njcn.gather.system.dictionary.pojo.po.DictData; import com.njcn.gather.system.dictionary.service.IDictDataService; @@ -52,6 +54,7 @@ public class PqDevServiceImpl extends ServiceImpl implements private final IDictDataService dictDataService; private final IPqMonitorService pqMonitorService; private final DetectionDataDealService detectionDataDealService; + private final IDevTypeService devTypeService; @Override @@ -324,9 +327,9 @@ public class PqDevServiceImpl extends ServiceImpl implements } } if (StrUtil.isNotBlank(pqDev.getDevType())) { - DictData dictData = dictDataService.getDictDataById(pqDev.getDevType()); - if (ObjectUtil.isNotNull(dictData)) { - pqDev.setDevType(dictData.getName()); + DevType devType = devTypeService.getById(pqDev.getDevType()); + if (ObjectUtil.isNotNull(devType)) { + pqDev.setDevType(devType.getName()); } } if (StrUtil.isNotBlank(pqDev.getManufacturer())) { @@ -360,9 +363,9 @@ public class PqDevServiceImpl extends ServiceImpl implements // } // } if (StrUtil.isNotBlank(pqDev.getDevType())) { - DictData dictData = dictDataService.getDictDataByName(pqDev.getDevType()); - if (ObjectUtil.isNotNull(dictData)) { - pqDev.setDevType(dictData.getId()); + DevType devType = devTypeService.getById(pqDev.getDevType()); + if (ObjectUtil.isNotNull(devType)) { + pqDev.setDevType(devType.getName()); } } if (StrUtil.isNotBlank(pqDev.getManufacturer())) { diff --git a/device/src/main/java/com/njcn/gather/device/source/service/impl/PqSourceServiceImpl.java b/device/src/main/java/com/njcn/gather/device/source/service/impl/PqSourceServiceImpl.java index 212fb3ab..89e400e9 100644 --- a/device/src/main/java/com/njcn/gather/device/source/service/impl/PqSourceServiceImpl.java +++ b/device/src/main/java/com/njcn/gather/device/source/service/impl/PqSourceServiceImpl.java @@ -18,6 +18,8 @@ import com.njcn.gather.device.source.pojo.po.PqSource; import com.njcn.gather.device.source.pojo.po.SourceInitialize; import com.njcn.gather.device.source.pojo.po.SourceParam; import com.njcn.gather.device.source.service.IPqSourceService; +import com.njcn.gather.device.type.entity.DevType; +import com.njcn.gather.device.type.service.IDevTypeService; import com.njcn.gather.system.dictionary.pojo.po.DictData; import com.njcn.gather.system.dictionary.service.IDictDataService; import com.njcn.web.factory.PageFactory; @@ -39,6 +41,7 @@ import java.util.stream.Collectors; public class PqSourceServiceImpl extends ServiceImpl implements IPqSourceService { private final IDictDataService dictDataService; + private final IDevTypeService devTypeService; @Override public Page listPqSource(PqSourceParam.QueryParam param) { @@ -196,20 +199,20 @@ public class PqSourceServiceImpl extends ServiceImpl i * @return 检测源名称 */ private String generatePqSourceName(PqSourceParam param, boolean isAdd) { - DictData devTypeDictData = dictDataService.getDictDataById(param.getDevType()); + DevType devType = devTypeService.getById(param.getDevType()); DictData typeDictData = dictDataService.getDictDataById(param.getType()); - if (ObjectUtil.isNotNull(devTypeDictData) && ObjectUtil.isNotNull(typeDictData)) { + if (ObjectUtil.isNotNull(devType) && ObjectUtil.isNotNull(typeDictData)) { if (isAdd) { int count = this.lambdaQuery().eq(PqSource::getPattern, param.getPattern()).count(); - return typeDictData.getName() + "-" + devTypeDictData.getName() + "-" + (count + 1); + return typeDictData.getName() + "-" + devType.getName() + "-" + (count + 1); } else { PqSource pqSource = this.lambdaQuery().eq(PqSource::getId, ((PqSourceParam.UpdateParam) param).getId()).one(); if (ObjectUtil.isNotNull(pqSource)) { String name = pqSource.getName(); if (StrUtil.isNotBlank(name)) { int index = name.lastIndexOf("-"); - return typeDictData.getName() + "-" + devTypeDictData.getName() + "-" + name.substring(index + 1); + return typeDictData.getName() + "-" + devType.getName() + "-" + name.substring(index + 1); } } }