被检设备根据设备类型调整
This commit is contained in:
@@ -3,6 +3,7 @@ package com.njcn.gather.device.controller;
|
|||||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
@@ -14,6 +15,8 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.LogUtil;
|
import com.njcn.common.utils.LogUtil;
|
||||||
|
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||||
|
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
||||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||||
@@ -21,10 +24,10 @@ import com.njcn.gather.device.pojo.vo.PqDevExcel;
|
|||||||
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
|
||||||
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
|
||||||
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.gather.type.entity.DevType;
|
||||||
|
import com.njcn.gather.type.service.IDevTypeService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.ExcelUtil;
|
import com.njcn.web.utils.ExcelUtil;
|
||||||
import com.njcn.web.utils.FileUtil;
|
import com.njcn.web.utils.FileUtil;
|
||||||
@@ -60,6 +63,7 @@ public class PqDevController extends BaseController {
|
|||||||
|
|
||||||
private final IPqDevService pqDevService;
|
private final IPqDevService pqDevService;
|
||||||
private final IDictDataService dictDataService;
|
private final IDictDataService dictDataService;
|
||||||
|
private final IDevTypeService devTypeService;
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@@ -80,10 +84,10 @@ public class PqDevController extends BaseController {
|
|||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ApiOperation("分页查询被检设备")
|
@ApiOperation("分页查询被检设备")
|
||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
public HttpResult<Page<PqDev>> list(@RequestBody @Validated PqDevParam.QueryParam queryParam) {
|
public HttpResult<Page<PqDevVO>> list(@RequestBody @Validated PqDevParam.QueryParam queryParam) {
|
||||||
String methodDescribe = getMethodDescribe("list");
|
String methodDescribe = getMethodDescribe("list");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||||
Page<PqDev> result = pqDevService.listPqDevs(queryParam);
|
Page<PqDevVO> result = pqDevService.listPqDevs(queryParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,12 +287,22 @@ public class PqDevController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/listByPlanId")
|
@PostMapping("/listByPlanId")
|
||||||
@ApiOperation("根据查询参数查询出所有已绑定的设备")
|
@ApiOperation("查询出所有已绑定的设备")
|
||||||
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
||||||
public HttpResult<List<PqDev>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
public HttpResult<List<PqDevVO>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||||
String methodDescribe = getMethodDescribe("listByPlanId");
|
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||||
List<PqDev> result = pqDevService.listByPlanId(param);
|
List<PqDev> pqDevList = pqDevService.listByPlanId(param);
|
||||||
|
|
||||||
|
List<PqDevVO> result = BeanUtil.copyToList(pqDevList, PqDevVO.class);
|
||||||
|
result.forEach(pqDevVO -> {
|
||||||
|
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||||
|
if (ObjectUtil.isNotNull(devType)) {
|
||||||
|
pqDevVO.setDevChns(devType.getDevChns());
|
||||||
|
pqDevVO.setDevVolt(devType.getDevVolt());
|
||||||
|
pqDevVO.setDevCurr(devType.getDevCurr());
|
||||||
|
}
|
||||||
|
});
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,19 +36,6 @@ public class PqDevParam {
|
|||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_TYPE_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_TYPE_FORMAT_ERROR)
|
||||||
private String devType;
|
private String devType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备通道数", required = true)
|
|
||||||
@NotNull(message = DevValidMessage.DEV_CHNS_NOT_NULL)
|
|
||||||
@Min(value = 1, message = DevValidMessage.DEV_CHNS_RANGE_ERROR)
|
|
||||||
private Integer devChns;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "额定电压(V)", required = true)
|
|
||||||
@NotNull(message = DevValidMessage.DEV_VOLT_NOT_NULL)
|
|
||||||
private Float devVolt;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "额定电流(A)", required = true)
|
|
||||||
@NotNull(message = DevValidMessage.DEV_CURR_NOT_NULL)
|
|
||||||
private Float devCurr;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备厂家,字典表", required = true)
|
@ApiModelProperty(value = "设备厂家,字典表", required = true)
|
||||||
//@NotBlank(message = DevValidMessage.MANUFACTURER_NOT_BLANK)
|
//@NotBlank(message = DevValidMessage.MANUFACTURER_NOT_BLANK)
|
||||||
//@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MANUFACTURER_FORMAT_ERROR)
|
//@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MANUFACTURER_FORMAT_ERROR)
|
||||||
|
|||||||
@@ -47,21 +47,6 @@ public class PqDev extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String devType;
|
private String devType;
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备通道数
|
|
||||||
*/
|
|
||||||
private Integer devChns;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 额定电压(V)
|
|
||||||
*/
|
|
||||||
private Double devVolt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 额定电流(A)
|
|
||||||
*/
|
|
||||||
private Double devCurr;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备厂家,字典表
|
* 设备厂家,字典表
|
||||||
*/
|
*/
|
||||||
@@ -207,8 +192,6 @@ public class PqDev extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer factorCheckResult;
|
private Integer factorCheckResult;
|
||||||
|
|
||||||
private String icdId;
|
|
||||||
|
|
||||||
@TableField("Check_Time")
|
@TableField("Check_Time")
|
||||||
private LocalDateTime checkTime;
|
private LocalDateTime checkTime;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -17,75 +18,13 @@ import java.util.List;
|
|||||||
* @data 2024-12-13
|
* @data 2024-12-13
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class PqDevVO {
|
public class PqDevVO extends PqDev {
|
||||||
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private String pattern;
|
|
||||||
|
|
||||||
private String devType;
|
|
||||||
|
|
||||||
private Integer devChns;
|
private Integer devChns;
|
||||||
|
|
||||||
private Float devVolt;
|
private Double devVolt;
|
||||||
|
|
||||||
private Float devCurr;
|
private Double devCurr;
|
||||||
|
|
||||||
private String manufacturer;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
|
||||||
@JsonSerialize(using = LocalDateSerializer.class)
|
|
||||||
private LocalDate createDate;
|
|
||||||
|
|
||||||
private String createId;
|
|
||||||
|
|
||||||
private String hardwareVersion;
|
|
||||||
|
|
||||||
private String softwareVersion;
|
|
||||||
|
|
||||||
private String protocol;
|
|
||||||
|
|
||||||
private String ip;
|
|
||||||
|
|
||||||
private Integer port;
|
|
||||||
|
|
||||||
private Integer encryptionFlag;
|
|
||||||
|
|
||||||
private String series;
|
|
||||||
|
|
||||||
private String devKey;
|
|
||||||
|
|
||||||
private String sampleId;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
|
||||||
@JsonSerialize(using = LocalDateSerializer.class)
|
|
||||||
private LocalDate arrivedDate;
|
|
||||||
|
|
||||||
private String cityName;
|
|
||||||
|
|
||||||
private String gdName;
|
|
||||||
|
|
||||||
private String subName;
|
|
||||||
|
|
||||||
private Integer checkState;
|
|
||||||
|
|
||||||
private Integer checkResult;
|
|
||||||
|
|
||||||
private Integer reportState;
|
|
||||||
|
|
||||||
// private Integer documentState;
|
|
||||||
|
|
||||||
private String reportPath;
|
|
||||||
|
|
||||||
private String qrCode;
|
|
||||||
|
|
||||||
private Integer reCheckNum;
|
|
||||||
|
|
||||||
private List<PqMonitor> monitorList;
|
private List<PqMonitor> monitorList;
|
||||||
|
|
||||||
private LocalDateTime checkTime;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public interface IPqDevService extends IService<PqDev> {
|
|||||||
* @param queryParam 查询参数
|
* @param queryParam 查询参数
|
||||||
* @return 分页数据,包含被检设备列表
|
* @return 分页数据,包含被检设备列表
|
||||||
*/
|
*/
|
||||||
Page<PqDev> listPqDevs(PqDevParam.QueryParam queryParam);
|
Page<PqDevVO> listPqDevs(PqDevParam.QueryParam queryParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增被检设备信息
|
* 新增被检设备信息
|
||||||
@@ -168,15 +168,16 @@ public interface IPqDevService extends IService<PqDev> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备归档操作
|
* 设备归档操作
|
||||||
|
*
|
||||||
* @param id 设备id
|
* @param id 设备id
|
||||||
* @return 归档成功返回true,否则返回false
|
* @return 归档成功返回true,否则返回false
|
||||||
*/
|
*/
|
||||||
boolean documented(List<String> id);
|
boolean documented(List<String> id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 正式监测完成,修改中断状态
|
* 正式监测完成,修改中断状态
|
||||||
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
* @param valueType
|
* @param valueType
|
||||||
* @param code
|
* @param code
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PqDev> listPqDevs(PqDevParam.QueryParam queryParam) {
|
public Page<PqDevVO> listPqDevs(PqDevParam.QueryParam queryParam) {
|
||||||
Page<PqDev> page = this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), this.getQueryWrapper(queryParam));
|
Page<PqDev> page1 = this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), this.getQueryWrapper(queryParam));
|
||||||
page.getRecords().forEach(p -> {
|
page1.getRecords().forEach(p -> {
|
||||||
if (ObjectUtil.isNotNull(p.getSeries())) {
|
if (ObjectUtil.isNotNull(p.getSeries())) {
|
||||||
p.setSeries(DeviceUtil.decoderString(1, p.getSeries()));
|
p.setSeries(DeviceUtil.decoderString(1, p.getSeries()));
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,20 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
p.setDevKey(DeviceUtil.decoderString(1, p.getDevKey()));
|
p.setDevKey(DeviceUtil.decoderString(1, p.getDevKey()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return page;
|
|
||||||
|
Page<PqDevVO> page2 = new Page<>();
|
||||||
|
BeanUtil.copyProperties(page1, page2);
|
||||||
|
List<PqDevVO> voList = BeanUtil.copyToList(page1.getRecords(), PqDevVO.class);
|
||||||
|
page2.setRecords(voList);
|
||||||
|
page2.getRecords().forEach(p -> {
|
||||||
|
DevType devType = devTypeService.getById(p.getDevType());
|
||||||
|
if (ObjectUtil.isNotNull(devType)) {
|
||||||
|
p.setDevChns(devType.getDevChns());
|
||||||
|
p.setDevVolt(devType.getDevVolt());
|
||||||
|
p.setDevCurr(devType.getDevCurr());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return page2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -305,12 +318,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||||
.orderByAsc(PqDev::getCreateTime)
|
.orderByAsc(PqDev::getCreateTime)
|
||||||
.list();
|
.list();
|
||||||
// List<Map<String, Object>> result = pqDevList.stream().map(pqDev -> {
|
|
||||||
// Map<String, Object> map = new HashMap<>();
|
|
||||||
// map.put("id", pqDev.getId());
|
|
||||||
// map.put("name", pqDev.getName());
|
|
||||||
// return map;
|
|
||||||
// }).collect(Collectors.toList());
|
|
||||||
return pqDevList;
|
return pqDevList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,6 +381,14 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
PqDev pqDev = this.getById(id);
|
PqDev pqDev = this.getById(id);
|
||||||
PqDevVO pqDevVO = new PqDevVO();
|
PqDevVO pqDevVO = new PqDevVO();
|
||||||
BeanUtil.copyProperties(pqDev, pqDevVO);
|
BeanUtil.copyProperties(pqDev, pqDevVO);
|
||||||
|
|
||||||
|
DevType devType = devTypeService.getById(pqDev.getDevType());
|
||||||
|
if (ObjectUtil.isNotNull(devType)) {
|
||||||
|
pqDevVO.setDevChns(devType.getDevChns());
|
||||||
|
pqDevVO.setDevVolt(devType.getDevVolt());
|
||||||
|
pqDevVO.setDevCurr(devType.getDevCurr());
|
||||||
|
}
|
||||||
|
|
||||||
List<PqMonitor> monitorList = pqMonitorService.listPqMonitorByDevId(id);
|
List<PqMonitor> monitorList = pqMonitorService.listPqMonitorByDevId(id);
|
||||||
if (ObjectUtil.isNotEmpty(monitorList)) {
|
if (ObjectUtil.isNotEmpty(monitorList)) {
|
||||||
pqDevVO.setMonitorList(monitorList);
|
pqDevVO.setMonitorList(monitorList);
|
||||||
@@ -895,10 +911,10 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
pqDev.setPreinvestmentPlan(dictDataService.getDictDataByName(pqDev.getPreinvestmentPlan()).getId());
|
pqDev.setPreinvestmentPlan(dictDataService.getDictDataByName(pqDev.getPreinvestmentPlan()).getId());
|
||||||
DevType devType = devTypeService.getByName(pqDev.getDevType());
|
DevType devType = devTypeService.getByName(pqDev.getDevType());
|
||||||
pqDev.setDevType(devType.getId());
|
pqDev.setDevType(devType.getId());
|
||||||
pqDev.setIcdId(devType.getIcd());
|
// pqDev.setIcdId(devType.getIcd());
|
||||||
pqDev.setDevVolt(devType.getDevVolt());
|
// pqDev.setDevVolt(devType.getDevVolt());
|
||||||
pqDev.setDevCurr(devType.getDevCurr());
|
// pqDev.setDevCurr(devType.getDevCurr());
|
||||||
pqDev.setDevChns(devType.getDevChns());
|
// pqDev.setDevChns(devType.getDevChns());
|
||||||
pqDev.setProtocol(dictDataService.getDictDataByName(pqDev.getProtocol()).getId());
|
pqDev.setProtocol(dictDataService.getDictDataByName(pqDev.getProtocol()).getId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.gather.device.pojo.enums.*;
|
import com.njcn.gather.device.pojo.enums.*;
|
||||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
import com.njcn.gather.err.service.IPqErrSysService;
|
import com.njcn.gather.err.service.IPqErrSysService;
|
||||||
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
|||||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||||
import com.njcn.gather.script.util.ScriptDtlsDesc;
|
import com.njcn.gather.script.util.ScriptDtlsDesc;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||||
|
import com.njcn.gather.type.entity.DevType;
|
||||||
|
import com.njcn.gather.type.service.IDevTypeService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -69,6 +71,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
private final IPqDevService pqDevService;
|
private final IPqDevService pqDevService;
|
||||||
private final PqScriptMapper pqScriptMapper;
|
private final PqScriptMapper pqScriptMapper;
|
||||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||||
|
private final IDevTypeService devTypeService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
@@ -117,10 +120,14 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
.in(PqDev::getId, param.getDevIds())
|
.in(PqDev::getId, param.getDevIds())
|
||||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||||
);
|
);
|
||||||
|
Set<String> devTypeSet = list.stream().map(PqDev::getDevType).collect(Collectors.toSet());
|
||||||
|
List<DevType> devTypes = devTypeService.listByIds(devTypeSet);
|
||||||
|
|
||||||
//额定电压信息
|
//额定电压信息
|
||||||
Set<Double> voltSet = list.stream().map(PqDev::getDevVolt).collect(Collectors.toSet());
|
Set<Double> voltSet = devTypes.stream().map(DevType::getDevVolt).collect(Collectors.toSet());
|
||||||
//额定电流信息
|
//额定电流信息
|
||||||
Set<Double> currSet = list.stream().map(PqDev::getDevCurr).collect(Collectors.toSet());
|
Set<Double> currSet = devTypes.stream().map(DevType::getDevCurr).collect(Collectors.toSet());
|
||||||
|
|
||||||
if (voltSet.size() == 1 && currSet.size() == 1) {
|
if (voltSet.size() == 1 && currSet.size() == 1) {
|
||||||
Double volt = voltSet.stream().collect(Collectors.toList()).stream().findFirst().get();
|
Double volt = voltSet.stream().collect(Collectors.toList()).stream().findFirst().get();
|
||||||
Double curr = currSet.stream().collect(Collectors.toList()).stream().findFirst().get();
|
Double curr = currSet.stream().collect(Collectors.toList()).stream().findFirst().get();
|
||||||
|
|||||||
@@ -18,4 +18,8 @@ public interface IDevTypeService extends IService<DevType> {
|
|||||||
List<DevType> listAll();
|
List<DevType> listAll();
|
||||||
|
|
||||||
DevType getByName(String name);
|
DevType getByName(String name);
|
||||||
|
|
||||||
|
DevType getById(String id);
|
||||||
|
|
||||||
|
List<DevType> listByIds(List<String> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,4 +33,14 @@ public class DevTypeServiceImpl extends ServiceImpl<DevTypeMapper, DevType> impl
|
|||||||
public DevType getByName(String name) {
|
public DevType getByName(String name) {
|
||||||
return this.lambdaQuery().eq(DevType::getName, name).eq(DevType::getState, DataStateEnum.ENABLE.getCode()).one();
|
return this.lambdaQuery().eq(DevType::getName, name).eq(DevType::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DevType getById(String id) {
|
||||||
|
return this.lambdaQuery().eq(DevType::getId, id).eq(DevType::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DevType> listByIds(List<String> ids) {
|
||||||
|
return this.lambdaQuery().in(DevType::getId, ids).eq(DevType::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://127.0.0.1:13306/pqs9100?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
url: jdbc:mysql://192.168.1.24:13306/pqs9100?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||||
username: root
|
username: root
|
||||||
password: njcnpqs
|
password: njcnpqs
|
||||||
#初始化建立物理连接的个数、最小、最大连接数
|
#初始化建立物理连接的个数、最小、最大连接数
|
||||||
@@ -33,9 +33,9 @@ mybatis-plus:
|
|||||||
#驼峰命名
|
#驼峰命名
|
||||||
map-underscore-to-camel-case: true
|
map-underscore-to-camel-case: true
|
||||||
#配置sql日志输出
|
#配置sql日志输出
|
||||||
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
#关闭日志输出
|
#关闭日志输出
|
||||||
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||||
global-config:
|
global-config:
|
||||||
db-config:
|
db-config:
|
||||||
#指定主键生成策略
|
#指定主键生成策略
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ public class MenuController {
|
|||||||
MenuVO menuVO12 = getMenuVO("/machine/device","device","/machine/device/index","Cpu","被检设备");
|
MenuVO menuVO12 = getMenuVO("/machine/device","device","/machine/device/index","Cpu","被检设备");
|
||||||
MenuVO menuVO13 = getMenuVO("/machine/errorSystem","errorSystem","/machine/errorSystem/index","Tickets","误差体系");
|
MenuVO menuVO13 = getMenuVO("/machine/errorSystem","errorSystem","/machine/errorSystem/index","Tickets","误差体系");
|
||||||
MenuVO menuVO14 = getMenuVO("/machine/testSource","testSource","/machine/testSource/index","Help","检测源");
|
MenuVO menuVO14 = getMenuVO("/machine/testSource","testSource","/machine/testSource/index","Help","检测源");
|
||||||
menuVO1.setChildren(CollectionUtil.toList(menuVO11,menuVO12,menuVO13,menuVO14));
|
MenuVO menuVO15 = getMenuVO("/machine/devType","devType","/machine/devType/index","Cpu","设备类型");
|
||||||
|
menuVO1.setChildren(CollectionUtil.toList(menuVO11,menuVO12,menuVO13,menuVO14,menuVO15));
|
||||||
menuVOList.add(menuVO1);
|
menuVOList.add(menuVO1);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user