调整设备类型
This commit is contained in:
@@ -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<String, String> 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}", "管理员");
|
||||
// 调试日期
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<PqDevMapper, PqDev> 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<PqDevMapper, PqDev> 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<PqDevMapper, PqDev> 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())) {
|
||||
|
||||
@@ -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<PqSourceMapper, PqSource> implements IPqSourceService {
|
||||
|
||||
private final IDictDataService dictDataService;
|
||||
private final IDevTypeService devTypeService;
|
||||
|
||||
@Override
|
||||
public Page<PqSource> listPqSource(PqSourceParam.QueryParam param) {
|
||||
@@ -196,20 +199,20 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user