调整设备类型

This commit is contained in:
2025-01-13 20:15:37 +08:00
parent 173aa100bd
commit 9b6543bbb6
4 changed files with 23 additions and 13 deletions

View File

@@ -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.pojo.po.PqScriptDtls;
import com.njcn.gather.device.script.service.IPqScriptCheckDataService; import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
import com.njcn.gather.device.script.service.IPqScriptDtlsService; 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.pojo.po.AdPlan;
import com.njcn.gather.plan.service.IAdPlanService; import com.njcn.gather.plan.service.IAdPlanService;
import com.njcn.gather.report.pojo.DevReportParam; import com.njcn.gather.report.pojo.DevReportParam;
@@ -67,6 +69,8 @@ public class ReportServiceImpl implements IReportService {
private final AdHarmonicService adHarmonicService; private final AdHarmonicService adHarmonicService;
private final IDevTypeService devTypeService;
@Override @Override
public void generateReport(DevReportParam devReportParam, HttpServletResponse response) { public void generateReport(DevReportParam devReportParam, HttpServletResponse response) {
@@ -128,8 +132,8 @@ public class ReportServiceImpl implements IReportService {
Map<String, String> baseModelMap = new HashMap<>(16); Map<String, String> baseModelMap = new HashMap<>(16);
PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId()); PqDevVO pqDevVO = iPqDevService.getPqDevById(devReportParam.getDevId());
// 获取设备型号 // 获取设备型号
DictData devTypeDictData = dictDataService.getDictDataById(pqDevVO.getDevType()); DevType devType = devTypeService.getById(pqDevVO.getDevType());
baseModelMap.put("${devType}", devTypeDictData.getName()); baseModelMap.put("${devType}", devType.getName());
// 调试人员todo... 待咨询曹泽辉如何获取当前用户信息,目前先写死 // 调试人员todo... 待咨询曹泽辉如何获取当前用户信息,目前先写死
baseModelMap.put("${userName}", "管理员"); baseModelMap.put("${userName}", "管理员");
// 调试日期 // 调试日期

View File

@@ -28,7 +28,7 @@
d.Id, d.Id,
d.Name, d.Name,
d.IP, 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.Port,
d.Dev_Chns as devChns, d.Dev_Chns as devChns,
d.Series, d.Series,

View File

@@ -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.pojo.vo.PqMonitorExcel;
import com.njcn.gather.device.monitor.service.IPqMonitorService; import com.njcn.gather.device.monitor.service.IPqMonitorService;
import com.njcn.gather.device.pojo.enums.*; 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.storage.service.DetectionDataDealService;
import com.njcn.gather.system.dictionary.pojo.po.DictData; import com.njcn.gather.system.dictionary.pojo.po.DictData;
import com.njcn.gather.system.dictionary.service.IDictDataService; import com.njcn.gather.system.dictionary.service.IDictDataService;
@@ -52,6 +54,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
private final IDictDataService dictDataService; private final IDictDataService dictDataService;
private final IPqMonitorService pqMonitorService; private final IPqMonitorService pqMonitorService;
private final DetectionDataDealService detectionDataDealService; private final DetectionDataDealService detectionDataDealService;
private final IDevTypeService devTypeService;
@Override @Override
@@ -324,9 +327,9 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
} }
} }
if (StrUtil.isNotBlank(pqDev.getDevType())) { if (StrUtil.isNotBlank(pqDev.getDevType())) {
DictData dictData = dictDataService.getDictDataById(pqDev.getDevType()); DevType devType = devTypeService.getById(pqDev.getDevType());
if (ObjectUtil.isNotNull(dictData)) { if (ObjectUtil.isNotNull(devType)) {
pqDev.setDevType(dictData.getName()); pqDev.setDevType(devType.getName());
} }
} }
if (StrUtil.isNotBlank(pqDev.getManufacturer())) { if (StrUtil.isNotBlank(pqDev.getManufacturer())) {
@@ -360,9 +363,9 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
// } // }
// } // }
if (StrUtil.isNotBlank(pqDev.getDevType())) { if (StrUtil.isNotBlank(pqDev.getDevType())) {
DictData dictData = dictDataService.getDictDataByName(pqDev.getDevType()); DevType devType = devTypeService.getById(pqDev.getDevType());
if (ObjectUtil.isNotNull(dictData)) { if (ObjectUtil.isNotNull(devType)) {
pqDev.setDevType(dictData.getId()); pqDev.setDevType(devType.getName());
} }
} }
if (StrUtil.isNotBlank(pqDev.getManufacturer())) { if (StrUtil.isNotBlank(pqDev.getManufacturer())) {

View File

@@ -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.SourceInitialize;
import com.njcn.gather.device.source.pojo.po.SourceParam; import com.njcn.gather.device.source.pojo.po.SourceParam;
import com.njcn.gather.device.source.service.IPqSourceService; 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.pojo.po.DictData;
import com.njcn.gather.system.dictionary.service.IDictDataService; import com.njcn.gather.system.dictionary.service.IDictDataService;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
@@ -39,6 +41,7 @@ import java.util.stream.Collectors;
public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> implements IPqSourceService { public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> implements IPqSourceService {
private final IDictDataService dictDataService; private final IDictDataService dictDataService;
private final IDevTypeService devTypeService;
@Override @Override
public Page<PqSource> listPqSource(PqSourceParam.QueryParam param) { public Page<PqSource> listPqSource(PqSourceParam.QueryParam param) {
@@ -196,20 +199,20 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
* @return 检测源名称 * @return 检测源名称
*/ */
private String generatePqSourceName(PqSourceParam param, boolean isAdd) { 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()); DictData typeDictData = dictDataService.getDictDataById(param.getType());
if (ObjectUtil.isNotNull(devTypeDictData) && ObjectUtil.isNotNull(typeDictData)) { if (ObjectUtil.isNotNull(devType) && ObjectUtil.isNotNull(typeDictData)) {
if (isAdd) { if (isAdd) {
int count = this.lambdaQuery().eq(PqSource::getPattern, param.getPattern()).count(); 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 { } else {
PqSource pqSource = this.lambdaQuery().eq(PqSource::getId, ((PqSourceParam.UpdateParam) param).getId()).one(); PqSource pqSource = this.lambdaQuery().eq(PqSource::getId, ((PqSourceParam.UpdateParam) param).getId()).one();
if (ObjectUtil.isNotNull(pqSource)) { if (ObjectUtil.isNotNull(pqSource)) {
String name = pqSource.getName(); String name = pqSource.getName();
if (StrUtil.isNotBlank(name)) { if (StrUtil.isNotBlank(name)) {
int index = name.lastIndexOf("-"); int index = name.lastIndexOf("-");
return typeDictData.getName() + "-" + devTypeDictData.getName() + "-" + name.substring(index + 1); return typeDictData.getName() + "-" + devType.getName() + "-" + name.substring(index + 1);
} }
} }
} }