导出检测计划
This commit is contained in:
@@ -39,6 +39,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -143,6 +144,25 @@ public class PqDevController extends BaseController {
|
||||
pqDevService.downloadTemplate();
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出被检设备数据")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public void export(@RequestBody @Validated PqDevParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("export");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
DictData dictData = dictDataService.getDictDataById(queryParam.getPattern());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||
List<PqDevExcel.ContrastExportData> data = pqDevService.getContrastExportData(queryParam);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", PqDevExcel.ContrastExportData.class, data);
|
||||
} else {
|
||||
List<PqDevExcel.SimulateOrDigitalExportData> data = pqDevService.getSimulateOrDigitExportData(queryParam);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", PqDevExcel.SimulateOrDigitalExportData.class, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@PostMapping(value = "/import")
|
||||
@ApiOperation("批量导入被检设备数据")
|
||||
@@ -151,7 +171,7 @@ public class PqDevController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("importData");
|
||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
ImportParams params = new ImportParams();
|
||||
params.setHeadRows(1);
|
||||
params.setHeadRows(2);
|
||||
params.setNeedVerify(true);
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
@@ -173,25 +193,6 @@ public class PqDevController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出被检设备数据")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public void export(@RequestBody @Validated PqDevParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("export");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
DictData dictData = dictDataService.getDictDataById(queryParam.getPattern());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||
List<PqDevExcel.ContrastExportData> data = pqDevService.getContrastExportData(queryParam);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", PqDevExcel.ContrastExportData.class, data);
|
||||
} else {
|
||||
List<PqDevExcel.SimulateOrDigitalExportData> data = pqDevService.getSimulateOrDigitExportData(queryParam);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", PqDevExcel.SimulateOrDigitalExportData.class, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/listUnbound")
|
||||
@ApiOperation("获取指定模式下所有未绑定的设备")
|
||||
@@ -205,7 +206,7 @@ public class PqDevController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/listByPlanId")
|
||||
@ApiOperation("根据检测计划id查询出所有已绑定的设备")
|
||||
@ApiOperation("根据查询参数查询出所有已绑定的设备")
|
||||
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
||||
public HttpResult<List<PqDev>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||
|
||||
@@ -146,25 +146,25 @@ public class PqDevParam {
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("检测状态")
|
||||
@Min(value = 0, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR)
|
||||
@Max(value = 3, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR)
|
||||
private Integer checkState;
|
||||
|
||||
@ApiModelProperty("检测结果")
|
||||
@Min(value = 0, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||
@Max(value = 2, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||
private Integer checkResult;
|
||||
|
||||
@ApiModelProperty("报告状态")
|
||||
@Min(value = 0, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
@Max(value = 2, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
private Integer reportState;
|
||||
|
||||
@ApiModelProperty("归档状态")
|
||||
@Min(value = 0, message = DevValidMessage.DOCUMENT_STATE_FORMAT_ERROR)
|
||||
@Max(value = 1, message = DevValidMessage.DOCUMENT_STATE_FORMAT_ERROR)
|
||||
private Integer documentState;
|
||||
// @ApiModelProperty("检测状态")
|
||||
// @Min(value = 0, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR)
|
||||
// @Max(value = 3, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR)
|
||||
// private Integer checkState;
|
||||
//
|
||||
// @ApiModelProperty("检测结果")
|
||||
// @Min(value = 0, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||
// @Max(value = 2, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||
// private Integer checkResult;
|
||||
//
|
||||
// @ApiModelProperty("报告状态")
|
||||
// @Min(value = 0, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
// @Max(value = 2, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
// private Integer reportState;
|
||||
//
|
||||
// @ApiModelProperty("归档状态")
|
||||
// @Min(value = 0, message = DevValidMessage.DOCUMENT_STATE_FORMAT_ERROR)
|
||||
// @Max(value = 1, message = DevValidMessage.DOCUMENT_STATE_FORMAT_ERROR)
|
||||
// private Integer documentState;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,10 +31,6 @@ public class PqDevExcel implements Serializable {
|
||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "设备模式", width = 20, orderNum = "1", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
private String pattern;
|
||||
|
||||
@Excel(name = "设备类型", width = 20, orderNum = "2", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
private String devType;
|
||||
@@ -100,39 +96,50 @@ public class PqDevExcel implements Serializable {
|
||||
@Excel(name = "所属电站名称", width = 20, orderNum = "21", needMerge = true)
|
||||
private String subName;
|
||||
|
||||
@Excel(name = "检测状态(未检\\检测中\\检测完成\\归档)", width = 15, replace = {"未检_0", "检测中_1", "检测完成_2", "归档_3"}, orderNum = "22", needMerge = true)
|
||||
private Integer checkState;
|
||||
|
||||
@Excel(name = "检测结果(不符合\\符合\\未检)", width = 15, replace = {"不符合_0", "符合_1", "未检_2"}, orderNum = "23", needMerge = true)
|
||||
private Integer checkResult;
|
||||
|
||||
@Excel(name = "报告状态(未生成\\已生成\\未检)", width = 15, replace = {"未生成_0", "已生成_1", "未检_2"}, orderNum = "24", needMerge = true)
|
||||
private Integer reportState;
|
||||
|
||||
@Excel(name = "归档状态(未归档\\归档)", width = 15, replace = {"未归档_0", "归档_1"}, orderNum = "25", needMerge = true)
|
||||
private Integer documentState;
|
||||
|
||||
@Excel(name = "报告路径", width = 20, orderNum = "26", needMerge = true)
|
||||
private String reportPath;
|
||||
|
||||
@Excel(name = "关键信息二维码", width = 20, orderNum = "27", needMerge = true)
|
||||
@Excel(name = "关键信息二维码", width = 20, orderNum = "30", needMerge = true)
|
||||
private String qrCode;
|
||||
|
||||
@Excel(name = "检测次数", width = 15, orderNum = "28", needMerge = true)
|
||||
@Excel(name = "检测次数", width = 15, orderNum = "31", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.RECHECK_NUM_NOT_NULL)
|
||||
private Integer reCheckNum;
|
||||
|
||||
// @Excel(name = "出厂日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "7")
|
||||
// @NotNull(message = DevValidMessage.CREATEDATETIME_NOT_NULL)
|
||||
// private LocalDate createDate;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ExportData extends PqDevExcel {
|
||||
|
||||
@Excel(name = "设备模式", width = 20, orderNum = "1", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
private String pattern;
|
||||
|
||||
@Excel(name = "出厂日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "7", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.CREATEDATETIME_NOT_NULL)
|
||||
private LocalDate createDate;
|
||||
|
||||
@Excel(name = "是否支持系数校准(否\\是)", width = 15, replace = {"否_0", "是_1"}, orderNum = "22", needMerge = true)
|
||||
private Integer factorFlag;
|
||||
|
||||
@Excel(name = "守时检测结果(不合格\\合格\\/)", replace = {"不合格_0", "合格_1", "/_2"}, width = 15, orderNum = "23", needMerge = true)
|
||||
private Integer timeCheckResult;
|
||||
|
||||
@Excel(name = "系数校准结果(不合格\\合格\\/)", width = 15, replace = {"不合格_0", "合格_1", "/_2"}, orderNum = "24", needMerge = true)
|
||||
private Integer factorCheckResult;
|
||||
|
||||
@Excel(name = "检测状态(未检\\检测中\\检测完成\\归档)", width = 15, replace = {"未检_0", "检测中_1", "检测完成_2", "归档_3"}, orderNum = "25", needMerge = true)
|
||||
private Integer checkState;
|
||||
|
||||
@Excel(name = "检测结果(不符合\\符合\\未检)", width = 15, replace = {"不符合_0", "符合_1", "未检_2"}, orderNum = "26", needMerge = true)
|
||||
private Integer checkResult;
|
||||
|
||||
@Excel(name = "报告状态(未生成\\已生成\\未检)", width = 15, replace = {"未生成_0", "已生成_1", "未检_2"}, orderNum = "27", needMerge = true)
|
||||
private Integer reportState;
|
||||
|
||||
@Excel(name = "归档状态(未归档\\归档)", width = 15, replace = {"未归档_0", "归档_1"}, orderNum = "28", needMerge = true)
|
||||
private Integer documentState;
|
||||
|
||||
@Excel(name = "报告路径", width = 20, orderNum = "29", needMerge = true)
|
||||
private String reportPath;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,7 +161,7 @@ public class PqDevExcel implements Serializable {
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ContrastExportData extends ExportData {
|
||||
@ExcelCollection(name = "检测点台账", orderNum = "29")
|
||||
@ExcelCollection(name = "检测点台账", orderNum = "32")
|
||||
List<PqMonitorExcel.ExportData> monitorList;
|
||||
}
|
||||
|
||||
@@ -170,6 +177,11 @@ public class PqDevExcel implements Serializable {
|
||||
@DateTimeStrValid(message = DevValidMessage.CREATEDATETIME_FORMAT_ERROR)
|
||||
private String createDate;
|
||||
|
||||
|
||||
@Excel(name = "是否支持系数校准(否\\是)", width = 15, replace = {"否_0", "是_1"}, orderNum = "22", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.FACTOR_FLAG_NOT_BLANK)
|
||||
private String factorFlag;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,7 +189,7 @@ public class PqDevExcel implements Serializable {
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SimulateOrDigitalImportData extends ImportData {
|
||||
public static class SimulateOrDigitalImportData extends ImportData {
|
||||
@Excel(name = "样品编号", width = 40, orderNum = "17", needMerge = true)
|
||||
private String sampleId;
|
||||
|
||||
@@ -192,75 +204,8 @@ public class PqDevExcel implements Serializable {
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ContrastImportData extends ImportData {
|
||||
@ExcelCollection(name = "检测点台账", orderNum = "29")
|
||||
List<PqMonitorExcel.ExportData> monitorList;
|
||||
@ExcelCollection(name = "检测点台账", orderNum = "32")
|
||||
List<PqMonitorExcel.ImportData> monitorList;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class PlanBindDevice {
|
||||
@Excel(name = "名称", width = 20, needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "设备模式", width = 20, orderNum = "1")
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
private String pattern;
|
||||
|
||||
@Excel(name = "设备类型", width = 20, orderNum = "2")
|
||||
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
private String devType;
|
||||
|
||||
@Excel(name = "设备通道数", width = 20, orderNum = "3")
|
||||
@NotNull(message = DevValidMessage.DEV_CHNS_NOT_NULL)
|
||||
private Integer devChns;
|
||||
|
||||
@Excel(name = "额定电压(V)", width = 15, orderNum = "4")
|
||||
@NotNull(message = DevValidMessage.DEV_VOLT_NOT_NULL)
|
||||
private Float devVolt;
|
||||
|
||||
@Excel(name = "额定电流(A)", width = 15, orderNum = "5")
|
||||
@NotNull(message = DevValidMessage.DEV_CURR_NOT_NULL)
|
||||
private Float devCurr;
|
||||
|
||||
@Excel(name = "设备厂家", width = 20, orderNum = "6")
|
||||
@NotBlank(message = DevValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
private String manufacturer;
|
||||
|
||||
@Excel(name = "设备序列号", width = 40, orderNum = "8")
|
||||
@NotBlank(message = DevValidMessage.FACTORYNO_NOT_BLANK)
|
||||
private String createId;
|
||||
|
||||
@Excel(name = "固件版本", width = 15, orderNum = "9")
|
||||
@NotBlank(message = DevValidMessage.FIRMWARE_NOT_BLANK)
|
||||
private String hardwareVersion;
|
||||
|
||||
@Excel(name = "软件版本", width = 15, orderNum = "10")
|
||||
@NotBlank(message = DevValidMessage.SOFTWARE_NOT_BLANK)
|
||||
private String softwareVersion;
|
||||
|
||||
@Excel(name = "通讯协议", width = 15, orderNum = "11")
|
||||
@NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK)
|
||||
private String protocol;
|
||||
|
||||
@Excel(name = "IP地址", width = 20, orderNum = "12")
|
||||
@NotBlank(message = DevValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@Excel(name = "端口号", orderNum = "13")
|
||||
@NotNull(message = DevValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
|
||||
@Excel(name = "是否为加密版本(否\\是)", width = 20, replace = {"否_0", "是_1"}, orderNum = "14")
|
||||
@NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@Excel(name = "识别码(当为加密版本时必填)", width = 30, orderNum = "15", needMerge = true)
|
||||
private String series;
|
||||
|
||||
@Excel(name = "秘钥", width = 30, orderNum = "16", needMerge = true)
|
||||
private String devKey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,14 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
*/
|
||||
boolean updatePqDev(PqDevParam.UpdateParam updateParam);
|
||||
|
||||
/**
|
||||
* 删除被检设备信息
|
||||
*
|
||||
* @param param 被检设备信息
|
||||
* @return 删除成功返回true,否则返回false
|
||||
*/
|
||||
boolean deletePqDev(PqDevParam.DeleteParam param);
|
||||
|
||||
/**
|
||||
* 批量更新被检设备守时检测结果
|
||||
*
|
||||
@@ -52,14 +60,6 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
*/
|
||||
boolean updatePqDevTimeCheckResult(List<String> ids, TimeCheckResultEnum result);
|
||||
|
||||
/**
|
||||
* 删除被检设备信息
|
||||
*
|
||||
* @param param 被检设备信息
|
||||
* @return 删除成功返回true,否则返回false
|
||||
*/
|
||||
boolean deletePqDev(PqDevParam.DeleteParam param);
|
||||
|
||||
/**
|
||||
* 获取模拟式||数字式设备导出时所需的数据
|
||||
*
|
||||
@@ -95,30 +95,6 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
*/
|
||||
void importSimulateAndDigitalData(List<PqDevExcel.SimulateOrDigitalImportData> sgEventExcels);
|
||||
|
||||
/**
|
||||
* 根据检测计划planIds获取被检设备设备导出时所需的SheetMap
|
||||
*
|
||||
* @param planIds
|
||||
* @return SheetMap
|
||||
*/
|
||||
Map<String, Object> getExportSheetMap(List<String> planIds, Class clazz);
|
||||
|
||||
/**
|
||||
* 获取模拟式||数字式设备导出时所需的SheetList
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return SheetList
|
||||
*/
|
||||
List<Map<String, Object>> getSimOrDigitExportSheetList(PqDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取比对式设备导出时所需的SheetList (包含与之关联的监控点信息)
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return SheetList
|
||||
*/
|
||||
List<Map<String, Object>> getContrastExportSheetList(PqDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取所有未绑定的设备
|
||||
*
|
||||
@@ -167,6 +143,18 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
*/
|
||||
List<PqDev> listUnchecked();
|
||||
|
||||
/**
|
||||
* 可视化,各种id回显字典值,解码等操作
|
||||
*
|
||||
* @param sourceList
|
||||
*/
|
||||
void visualize(List<PqDev> sourceList);
|
||||
|
||||
/**
|
||||
* 逆向可视化
|
||||
*/
|
||||
void reverseVisualize(List<PqDev> sourceList);
|
||||
|
||||
/**
|
||||
* 获取装置信息和装置下监测点信息
|
||||
*
|
||||
@@ -176,4 +164,5 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @Date: 2024/12/12 15:50
|
||||
*/
|
||||
List<PreDetection> getDevInfo(@Param("devIds") List<String> devIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.gather.device.device.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -76,7 +75,9 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
throw new BusinessException(DevResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
// 新增时默认设置为未检验、未生成报告、未归档、未出检测结果
|
||||
// 新增时默认设置
|
||||
pqDev.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setCheckState(CheckStateEnum.UNCHECKED.getValue());
|
||||
pqDev.setReportState(DevReportStateEnum.UNCHECKED.getValue());
|
||||
pqDev.setDocumentState(DevDocumentStateEnum.UNDOCUMENTED.getValue());
|
||||
@@ -114,11 +115,6 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
return this.updateById(pqDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updatePqDevTimeCheckResult(List<String> ids, TimeCheckResultEnum result) {
|
||||
return this.lambdaUpdate().set(PqDev::getTimeCheckResult, result.getValue()).in(PqDev::getId, ids).update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deletePqDev(PqDevParam.DeleteParam param) {
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
|
||||
@@ -131,6 +127,11 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
return this.lambdaUpdate().set(PqDev::getState, DataStateEnum.DELETED.getCode()).in(PqDev::getId, param.getIds()).update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updatePqDevTimeCheckResult(List<String> ids, TimeCheckResultEnum result) {
|
||||
return this.lambdaUpdate().set(PqDev::getTimeCheckResult, result.getValue()).in(PqDev::getId, ids).update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqDevExcel.SimulateOrDigitalExportData> getSimulateOrDigitExportData(PqDevParam.QueryParam queryParam) {
|
||||
List<PqDev> pqDevs = this.list(this.getQueryWrapper(queryParam));
|
||||
@@ -169,10 +170,40 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
|
||||
@Override
|
||||
public void importContrastData(List<PqDevExcel.ContrastImportData> pqDevExcelList) {
|
||||
List<PqDev> pqDevList = BeanUtil.copyToList(pqDevExcelList, PqDev.class);
|
||||
List<PqDev> devList = new ArrayList<>();
|
||||
List<PqMonitor> monitorList = new ArrayList<>();
|
||||
String patternId = dictDataService.getDictDataByName(PatternEnum.CONTRAST.getMsg()).getId();
|
||||
pqDevExcelList.forEach(pqDevExcel -> {
|
||||
PqDev pqDev = new PqDev();
|
||||
BeanUtil.copyProperties(pqDevExcel, pqDev);
|
||||
pqDev.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
pqDev.setPattern(patternId);
|
||||
// pqDev.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
|
||||
// pqDev.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
|
||||
// pqDev.setCheckState(CheckStateEnum.UNCHECKED.getValue());
|
||||
// pqDev.setReportState(DevReportStateEnum.UNCHECKED.getValue());
|
||||
// pqDev.setDocumentState(DevDocumentStateEnum.UNDOCUMENTED.getValue());
|
||||
// pqDev.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
|
||||
devList.add(pqDev);
|
||||
|
||||
// 新增与被检设备绑定的监测点
|
||||
List<PqMonitor> monitors = pqDevExcel.getMonitorList().stream()
|
||||
.map(monitor -> {
|
||||
PqMonitor monitorPo = new PqMonitor();
|
||||
BeanUtil.copyProperties(monitor, monitorPo);
|
||||
monitorPo.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
monitorPo.setDevId(pqDev.getId());
|
||||
monitorPo.setPtType(dictDataService.getDictDataByName(monitor.getPtType()).getId());
|
||||
return monitorPo;
|
||||
}).collect(Collectors.toList());
|
||||
monitorList.addAll(monitors);
|
||||
});
|
||||
|
||||
//逆向可视化
|
||||
this.reverseVisualize(pqDevList);
|
||||
this.saveBatch(pqDevList);
|
||||
this.reverseVisualize(devList);
|
||||
this.saveBatch(devList);
|
||||
|
||||
pqMonitorService.saveBatch(monitorList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -183,62 +214,6 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
this.saveBatch(pqDevList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getExportSheetMap(List<String> planIds, Class clazz) {
|
||||
List<PqDev> devList = new ArrayList<>();
|
||||
if (ObjectUtil.isNotEmpty(planIds)) {
|
||||
devList.addAll(this.lambdaQuery().in(PqDev::getPlanId, planIds).eq(PqDev::getState, DataStateEnum.ENABLE.getCode()).orderBy(true, true, PqDev::getCreateTime).list());
|
||||
}
|
||||
this.visualize(devList);
|
||||
|
||||
List<Object> pqDevExcels = BeanUtil.copyToList(devList, clazz);
|
||||
Map<String, Object> sheetMap = new HashMap<>();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setSheetName("被检设备");
|
||||
sheetMap.put("title", exportParams);
|
||||
sheetMap.put("data", pqDevExcels);
|
||||
sheetMap.put("entity", clazz);
|
||||
|
||||
return sheetMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getSimOrDigitExportSheetList(PqDevParam.QueryParam queryParam) {
|
||||
List<PqDev> pqDevs = this.list(this.getQueryWrapper(queryParam));
|
||||
this.visualize(pqDevs);
|
||||
List<PqDevExcel.SimulateOrDigitalExportData> pqDevExcels = BeanUtil.copyToList(pqDevs, PqDevExcel.SimulateOrDigitalExportData.class);
|
||||
|
||||
Map<String, Object> sheetMap = new HashMap<>();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setSheetName("被检设备");
|
||||
sheetMap.put("title", exportParams);
|
||||
sheetMap.put("data", pqDevExcels);
|
||||
sheetMap.put("entity", PqDevExcel.SimulateOrDigitalExportData.class);
|
||||
return Collections.singletonList(sheetMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getContrastExportSheetList(PqDevParam.QueryParam queryParam) {
|
||||
List<PqDev> pqDevs = this.list(this.getQueryWrapper(queryParam));
|
||||
this.visualize(pqDevs);
|
||||
|
||||
List<PqDevExcel.ContrastExportData> pqDevExcels = BeanUtil.copyToList(pqDevs, PqDevExcel.ContrastExportData.class);
|
||||
Map<String, Object> sheetMap1 = new HashMap<>();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setSheetName("被检设备");
|
||||
sheetMap1.put("title", exportParams);
|
||||
sheetMap1.put("data", pqDevExcels);
|
||||
sheetMap1.put("entity", PqDevExcel.ContrastExportData.class);
|
||||
|
||||
Map<String, Object> sheetMap2 = pqMonitorService.getExportSheetMap(pqDevs);
|
||||
|
||||
List<Map<String, Object>> sheetList = new ArrayList<>();
|
||||
sheetList.add(sheetMap1);
|
||||
sheetList.add(sheetMap2);
|
||||
|
||||
return sheetList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> listUnbound(String pattern) {
|
||||
List<PqDev> pqDevList = this.lambdaQuery().eq(PqDev::getPattern, pattern).eq(PqDev::getState, DataStateEnum.ENABLE.getCode()).isNull(PqDev::getPlanId).list();
|
||||
@@ -314,6 +289,85 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
return this.lambdaQuery().eq(PqDev::getCheckState, CheckStateEnum.UNCHECKED.getValue()).eq(PqDev::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualize(List<PqDev> sourceList) {
|
||||
sourceList.forEach(pqDev -> {
|
||||
if (StrUtil.isNotBlank(pqDev.getPattern())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getPattern());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setPattern(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getDevType())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getDevType());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setDevType(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getManufacturer())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getManufacturer());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setManufacturer(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getProtocol())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getProtocol());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setProtocol(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getSeries())) {
|
||||
pqDev.setSeries(DeviceUtil.decoderString(1, pqDev.getSeries()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getDevKey())) {
|
||||
pqDev.setDevKey(DeviceUtil.decoderString(1, pqDev.getDevKey()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reverseVisualize(List<PqDev> sourceList) {
|
||||
sourceList.forEach(pqDev -> {
|
||||
// if (StrUtil.isNotBlank(pqDev.getPattern())) {
|
||||
// DictData dictData = dictDataService.getDictDataByName(pqDev.getPattern());
|
||||
// if (ObjectUtil.isNotNull(dictData)) {
|
||||
// pqDev.setPattern(dictData.getId());
|
||||
// }
|
||||
// }
|
||||
if (StrUtil.isNotBlank(pqDev.getDevType())) {
|
||||
DictData dictData = dictDataService.getDictDataByName(pqDev.getDevType());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setDevType(dictData.getId());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getManufacturer())) {
|
||||
DictData dictData = dictDataService.getDictDataByName(pqDev.getManufacturer());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setManufacturer(dictData.getId());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getProtocol())) {
|
||||
DictData dictData = dictDataService.getDictDataByName(pqDev.getProtocol());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setProtocol(dictData.getId());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getSeries())) {
|
||||
pqDev.setSeries(DeviceUtil.encodeString(1, pqDev.getSeries()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(pqDev.getDevKey())) {
|
||||
pqDev.setDevKey(DeviceUtil.encodeString(1, pqDev.getDevKey()));
|
||||
}
|
||||
pqDev.setState(DataStateEnum.ENABLE.getCode());
|
||||
pqDev.setTimeCheckResult(TimeCheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setFactorCheckResult(FactorCheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setCheckState(CheckStateEnum.UNCHECKED.getValue());
|
||||
pqDev.setReportState(DevReportStateEnum.UNCHECKED.getValue());
|
||||
pqDev.setDocumentState(DevDocumentStateEnum.UNDOCUMENTED.getValue());
|
||||
pqDev.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询条件wrapper
|
||||
*
|
||||
@@ -342,15 +396,6 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
return this.baseMapper.selectDevInfo(devIds);
|
||||
}
|
||||
|
||||
// private <T> List<T> getExportData(PqDevParam.QueryParam queryParam, Class<T> clazz) {
|
||||
// List<PqDev> pqDevs = this.list(this.getQueryWrapper(queryParam));
|
||||
// this.visualize(pqDevs);
|
||||
// List<T> pqDevExcels = BeanUtil.copyToList(pqDevs, clazz);
|
||||
//
|
||||
//
|
||||
// return pqDevExcels;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取检测状态饼状图数据
|
||||
*
|
||||
@@ -402,79 +447,12 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
return result;
|
||||
}
|
||||
|
||||
//可视化,各种id回显字典值,解码等操作
|
||||
private void visualize(List<PqDev> sourceList) {
|
||||
sourceList.forEach(pqDev -> {
|
||||
if (ObjectUtil.isNotNull(pqDev.getPattern())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getPattern());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setPattern(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(pqDev.getDevType())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getDevType());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setDevType(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(pqDev.getManufacturer())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getManufacturer());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setManufacturer(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(pqDev.getProtocol())) {
|
||||
DictData dictData = dictDataService.getDictDataById(pqDev.getProtocol());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setProtocol(dictData.getName());
|
||||
}
|
||||
}
|
||||
if (Objects.nonNull(pqDev.getSeries())) {
|
||||
pqDev.setSeries(DeviceUtil.decoderString(1, pqDev.getSeries()));
|
||||
}
|
||||
if (Objects.nonNull(pqDev.getDevKey())) {
|
||||
pqDev.setDevKey(DeviceUtil.decoderString(1, pqDev.getDevKey()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//逆向可视化
|
||||
private void reverseVisualize(List<PqDev> sourceList) {
|
||||
sourceList.forEach(pqDev -> {
|
||||
if (ObjectUtil.isNotNull(pqDev.getPattern())) {
|
||||
DictData dictData = dictDataService.getDictDataByName(pqDev.getPattern());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setPattern(dictData.getId());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(pqDev.getDevType())) {
|
||||
DictData dictData = dictDataService.getDictDataByName(pqDev.getDevType());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setDevType(dictData.getId());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(pqDev.getManufacturer())) {
|
||||
DictData dictData = dictDataService.getDictDataByName(pqDev.getManufacturer());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setManufacturer(dictData.getId());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(pqDev.getProtocol())) {
|
||||
DictData dictData = dictDataService.getDictDataByName(pqDev.getProtocol());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setProtocol(dictData.getId());
|
||||
}
|
||||
}
|
||||
if (Objects.nonNull(pqDev.getSeries())) {
|
||||
pqDev.setSeries(DeviceUtil.encodeString(1, pqDev.getSeries()));
|
||||
}
|
||||
if (Objects.nonNull(pqDev.getDevKey())) {
|
||||
pqDev.setDevKey(DeviceUtil.encodeString(1, pqDev.getDevKey()));
|
||||
}
|
||||
pqDev.setState(DataStateEnum.ENABLE.getCode());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查设备是否重复
|
||||
*
|
||||
* @param param 设备参数
|
||||
* @param isExcludeSelf 是否排除自己
|
||||
*/
|
||||
private void checkRepeat(PqDevParam param, boolean isExcludeSelf) {
|
||||
QueryWrapper<PqDev> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.device.err.service;
|
||||
|
||||
import cn.hutool.core.date.StopWatch;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.device.err.pojo.param.PqErrSysParam;
|
||||
@@ -64,6 +65,14 @@ public interface IPqErrSysService extends IService<PqErrSys> {
|
||||
*/
|
||||
List<Map<String, Object>> listAllPqErrSys();
|
||||
|
||||
/**
|
||||
* 根据误差体系名称查询误差体系
|
||||
*
|
||||
* @param name 误差体系名称
|
||||
* @return 误差体系
|
||||
*/
|
||||
PqErrSys getPqErrSysByName(String name);
|
||||
|
||||
/**
|
||||
* 复制误差体系
|
||||
*
|
||||
|
||||
@@ -123,6 +123,11 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqErrSys getPqErrSysByName(String name) {
|
||||
return this.lambdaQuery().eq(PqErrSys::getName, name).eq(PqErrSys::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将检测项可视化
|
||||
*
|
||||
|
||||
@@ -17,34 +17,36 @@ import javax.validation.constraints.Pattern;
|
||||
@Data
|
||||
public class PqMonitorExcel {
|
||||
|
||||
@Excel(name = "所属母线", width = 20, orderNum = "3")
|
||||
@Excel(name = "监测点序号", width = 20, orderNum = "1")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MONITOR_NUM_FORMAT_ERROR)
|
||||
private Integer num;
|
||||
|
||||
@Excel(name = "所属母线", width = 20, orderNum = "2")
|
||||
@NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "PT变比", width = 20, orderNum = "4")
|
||||
@Excel(name = "PT变比", width = 20, orderNum = "3")
|
||||
@NotNull(message = DevValidMessage.PT_NOT_NULL)
|
||||
private Float pt;
|
||||
|
||||
@Excel(name = "CT变比", width = 20, orderNum = "5")
|
||||
@Excel(name = "CT变比", width = 20, orderNum = "4")
|
||||
@NotNull(message = DevValidMessage.CT_NOT_NULL)
|
||||
private Float ct;
|
||||
|
||||
@Excel(name = "接线方式", width = 20, orderNum = "6")
|
||||
@Excel(name = "接线方式", width = 20, orderNum = "5")
|
||||
@NotBlank(message = DevValidMessage.WIRING_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
||||
private String ptType;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ImportData extends PqMonitorExcel {
|
||||
@Excel(name = "监测点序号", width = 20)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MONITOR_NUM_FORMAT_ERROR)
|
||||
private Integer num;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ImportData extends PqMonitorExcel {
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ExportData extends PqMonitorExcel {
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ExportData extends PqMonitorExcel {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,12 +47,4 @@ public interface IPqMonitorService extends IService<PqMonitor> {
|
||||
* @return 修改成功返回true,否则返回false
|
||||
*/
|
||||
boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList);
|
||||
|
||||
/**
|
||||
* 根据被检设备获取导出监测点数据时所需的SheetMap
|
||||
*
|
||||
* @param devList 被检设备列表
|
||||
* @return SheetMap
|
||||
*/
|
||||
Map<String, Object> getExportSheetMap(List<PqDev> devList);
|
||||
}
|
||||
|
||||
@@ -61,31 +61,4 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
return this.saveBatch(pqMonitorList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getExportSheetMap(List<PqDev> devList) {
|
||||
List<PqMonitorExcel.ExportData> pqMonitorExcels = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < devList.size(); i++) {
|
||||
List<PqMonitor> pqMonitors = this.listPqMonitorByDevId(devList.get(i).getId());
|
||||
if (ObjectUtil.isNotEmpty(pqMonitors)) {
|
||||
List<PqMonitorExcel.ExportData> exportData = BeanUtil.copyToList(pqMonitors, PqMonitorExcel.ExportData.class);
|
||||
int finalI = i;
|
||||
exportData.forEach(data -> {
|
||||
// 给监测点台账添加设备名称
|
||||
// data.setDevName(devList.get(finalI).getName());
|
||||
data.setPtType(dictDataService.getDictDataById(data.getPtType()).getName());
|
||||
});
|
||||
pqMonitorExcels.addAll(exportData);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> sheetMap = new HashMap<>();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setSheetName("监测点台账");
|
||||
sheetMap.put("title", exportParams);
|
||||
sheetMap.put("data", pqMonitorExcels);
|
||||
sheetMap.put("entity", PqMonitorExcel.ExportData.class);
|
||||
|
||||
return sheetMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,4 +187,16 @@ public interface DevValidMessage {
|
||||
String FACTOR_FLAG_FORMAT_ERROR = "是否支持系数校准格式错误";
|
||||
|
||||
String MONITOR_NUM_FORMAT_ERROR = "监测点序号格式错误";
|
||||
|
||||
String SOURC_NOT_BLANK = "检测源不能为空";
|
||||
|
||||
String DATASOURCE_NOT_BLANK = "数据源不能为空";
|
||||
|
||||
String SCRIPT_NOT_BLANK = "检测脚本不能为空";
|
||||
|
||||
String ERRORSYS_NOT_BLANK = "误差体系不能为空";
|
||||
|
||||
String TIMECHECK_NOT_BLANK = "守时检测不能为空";
|
||||
|
||||
String FACTOR_FLAG_NOT_BLANK = "是否支持系数校准不能为空";
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum CommonEnum {
|
||||
FATHER_ID("0", "无"),
|
||||
|
||||
NO("0", "否"),
|
||||
YES("1", "是"),
|
||||
;
|
||||
|
||||
private String value;
|
||||
|
||||
@@ -17,7 +17,8 @@ public enum DevResponseEnum {
|
||||
HAS_NOT_UNCHECKED_DEVICE("A001009", "设备在检测中或已被检测过,请勿解除绑定"),
|
||||
IMPORT_PLAN_DATA_FAIL("A001010", "导入的检测计划为空"),
|
||||
IMPORT_DATA_FORMAT_FAIL("A001011", "导入数据格式错误"),
|
||||
;
|
||||
IMPORT_SOURCE_ERROR("A001012","当前模式下一个检测计划只能有一个检测源" ),
|
||||
IMPORT_DATASOURCE_ERROR("A001013","当前模式下一个检测计划只能有一个数据源" );
|
||||
|
||||
private final String message;
|
||||
private final String code;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-14
|
||||
*/
|
||||
@Getter
|
||||
public enum FactorCheckResultEnum {
|
||||
NOT_QUALIFY(0, "不合格"),
|
||||
QUALIFY(1, "合格"),
|
||||
UNKNOWN(2, "/");
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
FactorCheckResultEnum(Integer value, String msg) {
|
||||
this.value = value;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static String getMsgByValue(Integer value) {
|
||||
for (FactorCheckResultEnum e : FactorCheckResultEnum.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e.getMsg();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-14
|
||||
*/
|
||||
@Getter
|
||||
public enum TimeCheckResultEnum {
|
||||
NOT_QUALIFY(0, "不合格"),
|
||||
QUALIFY(1, "合格"),
|
||||
UNKNOWN(2, "/");
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
TimeCheckResultEnum(Integer value, String msg) {
|
||||
this.value = value;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static String getMsgByValue(Integer value) {
|
||||
for (TimeCheckResultEnum e : TimeCheckResultEnum.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e.getMsg();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptParam;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScript;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -58,6 +56,7 @@ public interface IPqScriptService extends IService<PqScript> {
|
||||
|
||||
/**
|
||||
* 将脚本升级为模板
|
||||
*
|
||||
* @param id 脚本id
|
||||
* @return 成功返回true, 失败返回false
|
||||
*/
|
||||
@@ -70,4 +69,12 @@ public interface IPqScriptService extends IService<PqScript> {
|
||||
* @return 检测脚本列表
|
||||
*/
|
||||
List<Map<String, Object>> listAllPqScript(String patternId);
|
||||
|
||||
/**
|
||||
* 根据脚本名称查询脚本
|
||||
*
|
||||
* @param name 脚本名称
|
||||
* @return 脚本列表
|
||||
*/
|
||||
PqScript getPqScriptByName(String name);
|
||||
}
|
||||
|
||||
@@ -101,4 +101,9 @@ public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> i
|
||||
}).collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqScript getPqScriptByName(String name) {
|
||||
return this.lambdaQuery().eq(PqScript::getName, name).eq(PqScript::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,12 +117,12 @@ public class PqSourceController extends BaseController {
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getSourceParam")
|
||||
@ApiOperation("按照检测源ID、源参数Type、获取源参数")
|
||||
@ApiOperation("按照检测源ID获取源参数")
|
||||
@ApiImplicitParam(name = "pqSourceId", value = "检测源ID", required = true)
|
||||
public HttpResult<List<SourceParam>> getSourceParam(@RequestParam("pqSourceId") String pqSourceId) {
|
||||
public HttpResult<List<SourceParam>> getSourceParam(@RequestParam("sourceId") String sourceId) {
|
||||
String methodDescribe = getMethodDescribe("getParam");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, pqSourceId);
|
||||
List<SourceParam> result = pqSourceService.getSourceParam(pqSourceId);
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceId);
|
||||
List<SourceParam> result = pqSourceService.getSourceParam(sourceId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,16 @@ public interface IPqSourceService extends IService<PqSource> {
|
||||
/**
|
||||
* 获取指定检测源的指定参数
|
||||
*
|
||||
* @param pqSourceId 检测源Id
|
||||
* @param sourceId 检测源Id
|
||||
* @return 源参数
|
||||
*/
|
||||
List<SourceParam> getSourceParam(String pqSourceId);
|
||||
List<SourceParam> getSourceParam(String sourceId);
|
||||
|
||||
/**
|
||||
* 根据名称获取检测源Id列表
|
||||
*
|
||||
* @param sourceNames 检测源名称列表
|
||||
* @return
|
||||
*/
|
||||
List<String> listPqSourceIdByName(String[] sourceNames);
|
||||
}
|
||||
|
||||
@@ -95,8 +95,8 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SourceParam> getSourceParam(String pqSourceId) {
|
||||
PqSource pqSource = this.lambdaQuery().eq(PqSource::getId, pqSourceId).eq(PqSource::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
public List<SourceParam> getSourceParam(String sourceId) {
|
||||
PqSource pqSource = this.lambdaQuery().eq(PqSource::getId, sourceId).eq(PqSource::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
if (ObjectUtil.isNotNull(pqSource)) {
|
||||
String parameter = pqSource.getParameter();
|
||||
if (StrUtil.isNotBlank(parameter)) {
|
||||
@@ -111,6 +111,11 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listPqSourceIdByName(String[] sourceNames) {
|
||||
return this.lambdaQuery().in(PqSource::getName, sourceNames).eq(PqSource::getState, DataStateEnum.ENABLE.getCode()).list().stream().map(PqSource::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<SourceParam> getChildren(SourceParam current, List<SourceParam> list) {
|
||||
return list.stream()
|
||||
.filter(p -> p.getPId().equals(current.getId()))
|
||||
|
||||
Reference in New Issue
Block a user