项目结构调整
This commit is contained in:
@@ -19,8 +19,8 @@ import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
||||
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.pojo.constant.DevConst;
|
||||
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.service.IDictDataService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -62,7 +62,7 @@ public class PqDevController extends BaseController {
|
||||
@GetMapping("/aaa")
|
||||
@ApiOperation("分页查询被检设备")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<List<PreDetection> > aaa() {
|
||||
public HttpResult<List<PreDetection>> aaa() {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
List<PreDetection> devInfo = pqDevService.getDevInfo(Arrays.asList("578c142b7e4e4978a35bd6225aa62a23", "393504f55f1f79bce255bfc195cfdb56"));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devInfo, methodDescribe);
|
||||
@@ -147,8 +147,9 @@ public class PqDevController extends BaseController {
|
||||
@PostMapping(value = "/import")
|
||||
@ApiOperation("批量导入被检设备数据")
|
||||
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true)
|
||||
public HttpResult<String> importPqDevData(@RequestParam("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importPqDevData");
|
||||
public HttpResult<Object> importData(@RequestParam("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importData");
|
||||
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||
ImportParams params = new ImportParams();
|
||||
params.setHeadRows(1);
|
||||
params.setNeedVerify(true);
|
||||
@@ -164,7 +165,7 @@ public class PqDevController extends BaseController {
|
||||
} else {
|
||||
//批量录入数据
|
||||
List<PqDevExcel.ContrastImportData> list = excelImportResult.getList();
|
||||
pqDevService.importPqDevData(list);
|
||||
pqDevService.importContrastData(list);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL);
|
||||
@@ -181,12 +182,12 @@ public class PqDevController extends BaseController {
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
DictData dictData = dictDataService.getDictDataById(queryParam.getPattern());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
if (DevConst.PATTERN_CONTRAST.equals(dictData.getCode())) {
|
||||
List<Map<String, Object>> sheetList = pqDevService.getContrastExportSheetList(queryParam);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", sheetList);
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||
List<PqDevExcel.ContrastExportData> data = pqDevService.getContrastExportData(queryParam);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", PqDevExcel.ContrastExportData.class, data);
|
||||
} else {
|
||||
List<Map<String, Object>> sheetList = pqDevService.getSimOrDigitExportSheetList(queryParam);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", sheetList);
|
||||
List<PqDevExcel.SimulateOrDigitalExportData> data = pqDevService.getSimulateOrDigitExportData(queryParam);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", PqDevExcel.SimulateOrDigitalExportData.class, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,6 +214,21 @@ public class PqDevController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/bindDev")
|
||||
@ApiOperation("检测计划绑定设备")
|
||||
@ApiImplicitParam(name = "bindPlanParam", value = "绑定参数", required = true)
|
||||
public HttpResult<Object> bindDev(@RequestBody @Validated PqDevParam.BindPlanParam bindPlanParam) {
|
||||
String methodDescribe = getMethodDescribe("bindDev");
|
||||
LogUtil.njcnDebug(log, "{},绑定计划数据为:planId={}, pqDevIds={}", methodDescribe, bindPlanParam.getPlanId(), String.join(StrUtil.COMMA, bindPlanParam.getPqDevIds()));
|
||||
boolean result = pqDevService.bind(bindPlanParam.getPlanId(), bindPlanParam.getPqDevIds());
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
// @PostMapping("/listUnDocumentByPlanId")
|
||||
// @ApiOperation("根据检测计划id查询出所有已绑定(未归档)的设备")
|
||||
|
||||
@@ -114,18 +114,6 @@ public class PqDevParam {
|
||||
@ApiModelProperty("所属电站名称")
|
||||
private String subName;
|
||||
|
||||
// @ApiModelProperty("检测状态")
|
||||
// private Integer checkState;
|
||||
|
||||
// @ApiModelProperty("检测结果")
|
||||
// private Integer checkResult;
|
||||
|
||||
// @ApiModelProperty("报告状态")
|
||||
// private Integer reportState;
|
||||
|
||||
// @ApiModelProperty("归档状态")
|
||||
// private Integer documentState;
|
||||
|
||||
@ApiModelProperty("报告路径")
|
||||
private String reportPath;
|
||||
|
||||
@@ -170,7 +158,7 @@ public class PqDevParam {
|
||||
|
||||
@ApiModelProperty("报告状态")
|
||||
@Min(value = 0, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
@Max(value = 1, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
@Max(value = 2, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
private Integer reportState;
|
||||
|
||||
@ApiModelProperty("归档状态")
|
||||
@@ -221,4 +209,16 @@ public class PqDevParam {
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class BindPlanParam {
|
||||
@ApiModelProperty("检测计划ID")
|
||||
@NotNull(message = DevValidMessage.PLAN_ID_NOT_NULL)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PLAN_ID_FORMAT_ERROR)
|
||||
private String planId;
|
||||
|
||||
@ApiModelProperty("被检设备ID列表")
|
||||
@NotNull(message = DevValidMessage.PQ_DEV_IDS_NOT_NULL)
|
||||
private List<String> pqDevIds;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.njcn.gather.device.device.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.monitor.pojo.vo.PqMonitorExcel;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import lombok.Data;
|
||||
@@ -13,6 +15,7 @@ import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -23,118 +26,126 @@ public class PqDevExcel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "名称", width = 20)
|
||||
@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")
|
||||
@Excel(name = "设备模式", width = 20, orderNum = "1", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
private String pattern;
|
||||
|
||||
@Excel(name = "设备类型", width = 20, orderNum = "2")
|
||||
@Excel(name = "设备类型", width = 20, orderNum = "2", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK)
|
||||
private String devType;
|
||||
|
||||
@Excel(name = "设备通道数", width = 20, orderNum = "3")
|
||||
@Excel(name = "设备通道数", width = 20, orderNum = "3", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.DEV_CHNS_NOT_NULL)
|
||||
private Integer devChns;
|
||||
|
||||
@Excel(name = "额定电压(V)", width = 15, orderNum = "4")
|
||||
@Excel(name = "额定电压(V)", width = 15, orderNum = "4", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.DEV_VOLT_NOT_NULL)
|
||||
private Float devVolt;
|
||||
|
||||
@Excel(name = "额定电流(A)", width = 15, orderNum = "5")
|
||||
@Excel(name = "额定电流(A)", width = 15, orderNum = "5", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.DEV_CURR_NOT_NULL)
|
||||
private Float devCurr;
|
||||
|
||||
@Excel(name = "设备厂家", width = 20, orderNum = "6")
|
||||
@Excel(name = "设备厂家", width = 20, orderNum = "6", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.MANUFACTURER_NOT_BLANK)
|
||||
private String manufacturer;
|
||||
|
||||
@Excel(name = "设备序列号", width = 40, orderNum = "8")
|
||||
@Excel(name = "设备序列号", width = 40, orderNum = "8", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.FACTORYNO_NOT_BLANK)
|
||||
private String createId;
|
||||
|
||||
@Excel(name = "固件版本", width = 15, orderNum = "9")
|
||||
@Excel(name = "固件版本", width = 15, orderNum = "9", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.FIRMWARE_NOT_BLANK)
|
||||
private String hardwareVersion;
|
||||
|
||||
@Excel(name = "软件版本", width = 15, orderNum = "10")
|
||||
@Excel(name = "软件版本", width = 15, orderNum = "10", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.SOFTWARE_NOT_BLANK)
|
||||
private String softwareVersion;
|
||||
|
||||
@Excel(name = "通讯协议", width = 15, orderNum = "11")
|
||||
@Excel(name = "通讯协议", width = 15, orderNum = "11", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK)
|
||||
private String protocol;
|
||||
|
||||
@Excel(name = "IP地址", width = 20, orderNum = "12")
|
||||
@Excel(name = "IP地址", width = 20, orderNum = "12", needMerge = true)
|
||||
@NotBlank(message = DevValidMessage.IP_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR)
|
||||
private String ip;
|
||||
|
||||
@Excel(name = "端口号", orderNum = "13")
|
||||
@Excel(name = "端口号", orderNum = "13", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.PORT_NOT_NULL)
|
||||
@Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR)
|
||||
private Integer port;
|
||||
|
||||
@Excel(name = "是否为加密版本(0:否、1:是)", width = 20, replace = {"否_0", "是_1"}, orderNum = "14")
|
||||
@Excel(name = "是否为加密版本(0:否、1:是)", width = 20, replace = {"否_0", "是_1"}, orderNum = "14", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL)
|
||||
private Integer encryptionFlag;
|
||||
|
||||
@Excel(name = "识别码", width = 30, orderNum = "15")
|
||||
@Excel(name = "识别码", width = 30, orderNum = "15", needMerge = true)
|
||||
private String series;
|
||||
|
||||
@Excel(name = "秘钥", width = 30, orderNum = "16")
|
||||
@Excel(name = "秘钥", width = 30, orderNum = "16", needMerge = true)
|
||||
private String devKey;
|
||||
|
||||
@Excel(name = "所属地市名称", width = 20, orderNum = "19")
|
||||
@Excel(name = "所属地市名称", width = 20, orderNum = "19", needMerge = true)
|
||||
private String cityName;
|
||||
|
||||
@Excel(name = "所属供电公司名称", width = 20, orderNum = "20")
|
||||
@Excel(name = "所属供电公司名称", width = 20, orderNum = "20", needMerge = true)
|
||||
private String gdName;
|
||||
|
||||
@Excel(name = "所属电站名称", width = 20, orderNum = "21")
|
||||
@Excel(name = "所属电站名称", width = 20, orderNum = "21", needMerge = true)
|
||||
private String subName;
|
||||
|
||||
@Excel(name = "报告路径", width = 20, orderNum = "26")
|
||||
@Excel(name = "检测状态(0:未检、1:检测中、2:检测完成、3:归档)", width = 15, replace = {"未检_0", "检测中_1", "检测完成_2", "归档_3"}, orderNum = "22", needMerge = true)
|
||||
private Integer checkState;
|
||||
|
||||
@Excel(name = "检测结果(0:不符合、1:符合、2:/)", width = 15, replace = {"不符合_0", "符合_1", "/_2"}, orderNum = "23", needMerge = true)
|
||||
private Integer checkResult;
|
||||
|
||||
@Excel(name = "报告状态(0:未生成、1:已生成、2:未检)", width = 15, replace = {"未生成_0", "已生成_1", "未检_2"}, orderNum = "24", needMerge = true)
|
||||
private Integer reportState;
|
||||
|
||||
@Excel(name = "归档状态(0:未归档、1:归档)", 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")
|
||||
@Excel(name = "关键信息二维码", width = 20, orderNum = "27", needMerge = true)
|
||||
private String qrCode;
|
||||
|
||||
@Excel(name = "检测次数", width = 15, orderNum = "28")
|
||||
@Excel(name = "检测次数", width = 15, orderNum = "28", 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 SimulateAndDigitalExportData extends PqDevExcel {
|
||||
|
||||
@Excel(name = "出厂日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "7")
|
||||
public static class ExportData extends PqDevExcel {
|
||||
@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 = 40, orderNum = "17")
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟式和比对式设备导出数据
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class SimulateOrDigitalExportData extends ExportData {
|
||||
@Excel(name = "样品编号", width = 40, orderNum = "17", needMerge = true)
|
||||
private String sampleId;
|
||||
|
||||
@Excel(name = "送样日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "18")
|
||||
@Excel(name = "送样日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "18", needMerge = true)
|
||||
private LocalDate arrivedDate;
|
||||
|
||||
@Excel(name = "检测状态(0:未检、1:检测中、2:检测完成、3:归档)", width = 15, replace = {"未检_0", "检测中_1", "检测完成_2", "归档_3", "_null"}, orderNum = "22")
|
||||
private Integer checkState;
|
||||
|
||||
@Excel(name = "检测结果(0:不符合、1:符合、2:/)", width = 15, replace = {"不符合_0", "符合_1", "/_2", "_null"}, orderNum = "23")
|
||||
private Integer checkResult;
|
||||
|
||||
@Excel(name = "报告状态(0:未生成、1:已生成)", width = 15, replace = {"未生成_0", "已生成_1", "_null"}, orderNum = "24")
|
||||
private Integer reportState;
|
||||
|
||||
@Excel(name = "归档状态(0:未归档、1:归档)", width = 15, replace = {"未归档_0", "归档_1", "_null"}, orderNum = "25")
|
||||
private Integer documentState;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,22 +153,37 @@ public class PqDevExcel implements Serializable {
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ContrastExportData extends PqDevExcel {
|
||||
@Excel(name = "出厂日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "7")
|
||||
public static class ContrastExportData extends ExportData {
|
||||
@ExcelCollection(name = "检测点台账", orderNum = "29")
|
||||
List<PqMonitorExcel.ExportData> monitorList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 被检设备导入数据
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ImportData extends PqDevExcel {
|
||||
|
||||
@Excel(name = "出厂日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "7", needMerge = true)
|
||||
@NotNull(message = DevValidMessage.CREATEDATETIME_NOT_NULL)
|
||||
private LocalDate createDate;
|
||||
@DateTimeStrValid(message = DevValidMessage.CREATEDATETIME_FORMAT_ERROR)
|
||||
private String createDate;
|
||||
|
||||
@Excel(name = "检测状态(0:未检、1:检测中、2:检测完成、3:归档)", width = 15, replace = {"未检_0", "检测中_1", "检测完成_2", "归档_3", "_null"}, orderNum = "22")
|
||||
private Integer checkState;
|
||||
}
|
||||
|
||||
@Excel(name = "检测结果(0:不符合、1:符合、2:/)", width = 15, replace = {"不符合_0", "符合_1", "/_2", "_null"}, orderNum = "23")
|
||||
private Integer checkResult;
|
||||
/**
|
||||
* 模拟式和比对式设备导入数据
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SimulateOrDigitalImportData extends ImportData {
|
||||
@Excel(name = "样品编号", width = 40, orderNum = "17", needMerge = true)
|
||||
private String sampleId;
|
||||
|
||||
@Excel(name = "报告状态(0:未生成、1:已生成)", width = 15, replace = {"未生成_0", "已生成_1", "_null"}, orderNum = "24")
|
||||
private Integer reportState;
|
||||
|
||||
@Excel(name = "归档状态(0:未归档、1:归档)", width = 15, replace = {"未归档_0", "归档_1", "_null"}, orderNum = "25")
|
||||
private Integer documentState;
|
||||
@Excel(name = "送样日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "18", needMerge = true)
|
||||
@DateTimeStrValid(message = DevValidMessage.ARRIVE_DATE_FORMAT_ERROR)
|
||||
private String arrivedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,27 +191,8 @@ public class PqDevExcel implements Serializable {
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ContrastImportData extends PqDevExcel {
|
||||
@Excel(name = "设备Id", width = 20, orderNum = "1")
|
||||
@NotBlank(message = DevValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SERIES_REGEX, message = DevValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "出厂日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "7")
|
||||
@NotNull(message = DevValidMessage.CREATEDATETIME_NOT_NULL)
|
||||
@DateTimeStrValid(message = DevValidMessage.CREATEDATETIME_FORMAT_ERROR)
|
||||
private String createDate;
|
||||
|
||||
@Excel(name = "检测状态(0:未检、1:检测中、2:检测完成、3:归档)", width = 15, replace = {"未检_0", "检测中_1", "检测完成_2", "归档_3"}, orderNum = "22")
|
||||
private Integer checkState;
|
||||
|
||||
@Excel(name = "检测结果(0:不符合、1:符合、2:/)", width = 15, replace = {"不符合_0", "符合_1", "/_2"}, orderNum = "23")
|
||||
private Integer checkResult;
|
||||
|
||||
@Excel(name = "报告状态(0:未生成、1:已生成)", width = 15, replace = {"未生成_0", "已生成_1"}, orderNum = "24")
|
||||
private Integer reportState;
|
||||
|
||||
@Excel(name = "归档状态(0:未归档、1:归档)", width = 15, replace = {"未归档_0", "归档_1"}, orderNum = "25")
|
||||
private Integer documentState;
|
||||
public static class ContrastImportData extends ImportData {
|
||||
@ExcelCollection(name = "检测点台账", orderNum = "29")
|
||||
List<PqMonitorExcel.ExportData> monitorList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
||||
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.plan.pojo.param.AdPlanParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -61,6 +60,22 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
*/
|
||||
boolean deletePqDev(PqDevParam.DeleteParam param);
|
||||
|
||||
/**
|
||||
* 获取模拟式||数字式设备导出时所需的数据
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return
|
||||
*/
|
||||
List<PqDevExcel.SimulateOrDigitalExportData> getSimulateOrDigitExportData(PqDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取比对式设备导出时所需的数据
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return 比对式设备导出时所需的数据
|
||||
*/
|
||||
List<PqDevExcel.ContrastExportData> getContrastExportData(PqDevParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 下载模板文件
|
||||
*/
|
||||
@@ -71,7 +86,14 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
*
|
||||
* @param sgEventExcels 批量导入的数据
|
||||
*/
|
||||
void importPqDevData(List<PqDevExcel.ContrastImportData> sgEventExcels);
|
||||
void importContrastData(List<PqDevExcel.ContrastImportData> sgEventExcels);
|
||||
|
||||
/**
|
||||
* 批量导入被检设备信息
|
||||
*
|
||||
* @param sgEventExcels 批量导入的数据
|
||||
*/
|
||||
void importSimulateAndDigitalData(List<PqDevExcel.SimulateOrDigitalImportData> sgEventExcels);
|
||||
|
||||
/**
|
||||
* 根据检测计划planIds获取被检设备设备导出时所需的SheetMap
|
||||
@@ -116,10 +138,11 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
/**
|
||||
* 绑定计划
|
||||
*
|
||||
* @param bindPlanParam 检测计划绑定被检设备参数
|
||||
* @param planId 计划id
|
||||
* @param devIds 设备id列表
|
||||
* @return 绑定成功返回true,否则返回false
|
||||
*/
|
||||
boolean bind(AdPlanParam.BindPlanParam bindPlanParam);
|
||||
boolean bind(String planId, List<String> devIds);
|
||||
|
||||
/**
|
||||
* 获取饼图数据
|
||||
@@ -146,6 +169,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
|
||||
/**
|
||||
* 获取装置信息和装置下监测点信息
|
||||
*
|
||||
* @param devIds
|
||||
* @return: java.util.List<com.njcn.gather.device.device.pojo.vo.PreDetection>
|
||||
* @Author: wr
|
||||
|
||||
@@ -23,8 +23,6 @@ import com.njcn.gather.device.device.util.DeviceUtil;
|
||||
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.plan.pojo.param.AdPlanParam;
|
||||
import com.njcn.gather.device.pojo.constant.DevConst;
|
||||
import com.njcn.gather.device.pojo.enums.*;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
@@ -80,13 +78,13 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
// 新增时默认设置为未检验、未生成报告、未归档、未出检测结果
|
||||
pqDev.setCheckState(CheckStateEnum.UNCHECKED.getValue());
|
||||
pqDev.setReportState(DevReportStateEnum.REPORT_STATE_NOT_GENERATED.getValue());
|
||||
pqDev.setReportState(DevReportStateEnum.UNCHECKED.getValue());
|
||||
pqDev.setDocumentState(DevDocumentStateEnum.UNDOCUMENTED.getValue());
|
||||
pqDev.setCheckResult(CheckResultEnum.UNKNOWN.getValue());
|
||||
pqDev.setCheckResult(CheckResultEnum.UNCHECKED.getValue());
|
||||
String id = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
pqDev.setId(id);
|
||||
// 比对式设备添加监测点
|
||||
if (DevConst.PATTERN_CONTRAST.equals(dictDataService.getDictDataById(pqDevParam.getPattern()).getCode())) {
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(pqDevParam.getPattern()).getCode())) {
|
||||
if (ObjectUtil.isNotEmpty(pqDevParam.getMonitorList())) {
|
||||
pqMonitorService.addPqMonitorByDevId(id, pqDevParam.getMonitorList());
|
||||
}
|
||||
@@ -108,7 +106,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
pqDev.setDevKey(DeviceUtil.encodeString(1, pqDev.getDevKey()));
|
||||
}
|
||||
// 比对式设备修改监测点
|
||||
if (DevConst.PATTERN_CONTRAST.equals(dictDataService.getDictDataById(updateParam.getPattern()).getCode())) {
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(updateParam.getPattern()).getCode())) {
|
||||
if (ObjectUtil.isNotEmpty(updateParam.getMonitorList())) {
|
||||
pqMonitorService.updatePqMonitorByDevId(updateParam.getId(), updateParam.getMonitorList());
|
||||
}
|
||||
@@ -123,7 +121,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
|
||||
@Override
|
||||
public boolean deletePqDev(PqDevParam.DeleteParam param) {
|
||||
if (DevConst.PATTERN_CONTRAST.equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
|
||||
for (String id : param.getIds()) {
|
||||
if (ObjectUtils.isEmpty(pqMonitorService.listPqMonitorByDevId(id))) {
|
||||
throw new BusinessException(DevResponseEnum.PQ_DEV_HAS_MONITOR);
|
||||
@@ -134,30 +132,51 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadTemplate() {
|
||||
Map<String, Object> sheet1 = new HashMap<>();
|
||||
ExportParams exportParams1 = new ExportParams();
|
||||
exportParams1.setSheetName("被检设备");
|
||||
sheet1.put("title", exportParams1);
|
||||
sheet1.put("data", Collections.emptyList());
|
||||
sheet1.put("entity", PqDevExcel.ContrastImportData.class);
|
||||
|
||||
Map<String, Object> sheet2 = new HashMap<>();
|
||||
ExportParams exportParams2 = new ExportParams();
|
||||
exportParams2.setSheetName("监测点台账");
|
||||
sheet2.put("title", exportParams2);
|
||||
sheet2.put("data", Collections.emptyList());
|
||||
sheet2.put("entity", PqMonitorExcel.ImportData.class);
|
||||
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<>();
|
||||
sheetsList.add(sheet1);
|
||||
sheetsList.add(sheet2);
|
||||
|
||||
ExcelUtil.exportExcel("被检设备模板.xlsx", sheetsList);
|
||||
public List<PqDevExcel.SimulateOrDigitalExportData> getSimulateOrDigitExportData(PqDevParam.QueryParam queryParam) {
|
||||
List<PqDev> pqDevs = this.list(this.getQueryWrapper(queryParam));
|
||||
if (ObjectUtil.isNotNull(pqDevs)) {
|
||||
this.visualize(pqDevs);
|
||||
List<PqDevExcel.SimulateOrDigitalExportData> pqDevExcels = BeanUtil.copyToList(pqDevs, PqDevExcel.SimulateOrDigitalExportData.class);
|
||||
return pqDevExcels;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importPqDevData(List<PqDevExcel.ContrastImportData> pqDevExcelList) {
|
||||
public List<PqDevExcel.ContrastExportData> getContrastExportData(PqDevParam.QueryParam queryParam) {
|
||||
List<PqDev> pqDevs = this.list(this.getQueryWrapper(queryParam));
|
||||
if (ObjectUtil.isNotNull(pqDevs)) {
|
||||
this.visualize(pqDevs);
|
||||
List<PqDevExcel.ContrastExportData> pqDevExcels = BeanUtil.copyToList(pqDevs, PqDevExcel.ContrastExportData.class);
|
||||
for (int i = 0; i < pqDevs.size(); i++) {
|
||||
List<PqMonitorExcel.ExportData> monitorExportList = BeanUtil.copyToList(pqMonitorService.listPqMonitorByDevId(pqDevs.get(i).getId()), PqMonitorExcel.ExportData.class);
|
||||
monitorExportList.forEach(monitor -> {
|
||||
monitor.setPtType(dictDataService.getDictDataById(monitor.getPtType()).getName());
|
||||
});
|
||||
pqDevExcels.get(i).setMonitorList(monitorExportList);
|
||||
}
|
||||
return pqDevExcels;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadTemplate() {
|
||||
ExcelUtil.exportExcel("被检设备模板.xlsx", PqDevExcel.ContrastImportData.class, Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importContrastData(List<PqDevExcel.ContrastImportData> pqDevExcelList) {
|
||||
List<PqDev> pqDevList = BeanUtil.copyToList(pqDevExcelList, PqDev.class);
|
||||
//逆向可视化
|
||||
this.reverseVisualize(pqDevList);
|
||||
this.saveBatch(pqDevList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importSimulateAndDigitalData(List<PqDevExcel.SimulateOrDigitalImportData> pqDevExcelList) {
|
||||
List<PqDev> pqDevList = BeanUtil.copyToList(pqDevExcelList, PqDev.class);
|
||||
//逆向可视化
|
||||
this.reverseVisualize(pqDevList);
|
||||
@@ -178,7 +197,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
exportParams.setSheetName("被检设备");
|
||||
sheetMap.put("title", exportParams);
|
||||
sheetMap.put("data", pqDevExcels);
|
||||
sheetMap.put("entity", PqDevExcel.ContrastExportData.class);
|
||||
sheetMap.put("entity", clazz);
|
||||
|
||||
return sheetMap;
|
||||
}
|
||||
@@ -187,14 +206,14 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
public List<Map<String, Object>> getSimOrDigitExportSheetList(PqDevParam.QueryParam queryParam) {
|
||||
List<PqDev> pqDevs = this.list(this.getQueryWrapper(queryParam));
|
||||
this.visualize(pqDevs);
|
||||
List<PqDevExcel.SimulateAndDigitalExportData> pqDevExcels = BeanUtil.copyToList(pqDevs, PqDevExcel.SimulateAndDigitalExportData.class);
|
||||
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.SimulateAndDigitalExportData.class);
|
||||
sheetMap.put("entity", PqDevExcel.SimulateOrDigitalExportData.class);
|
||||
return Collections.singletonList(sheetMap);
|
||||
}
|
||||
|
||||
@@ -249,18 +268,14 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
return pqDevList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean bind(AdPlanParam.BindPlanParam bindPlanParam) {
|
||||
String planId = bindPlanParam.getPlanId();
|
||||
List<String> pqDevIds = bindPlanParam.getPqDevIds();
|
||||
|
||||
public boolean bind(String planId, List<String> devIds) {
|
||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||
queryParam.setPlanId(planId);
|
||||
List<String> existedBoundPqDevIds = this.listByPlanId(queryParam).stream().map(PqDev::getId).collect(Collectors.toList());
|
||||
|
||||
//共有的(交集)
|
||||
List<String> intersection = existedBoundPqDevIds.stream().filter(pqDevIds::contains).collect(Collectors.toList());
|
||||
List<String> intersection = existedBoundPqDevIds.stream().filter(devIds::contains).collect(Collectors.toList());
|
||||
|
||||
//移除 已有的历史绑定而此次不绑定的
|
||||
existedBoundPqDevIds.removeAll(intersection);
|
||||
@@ -269,9 +284,9 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
//绑定 没有的历史绑定而此次绑定的
|
||||
pqDevIds.removeAll(existedBoundPqDevIds);
|
||||
if (ObjectUtils.isNotEmpty(pqDevIds)) {
|
||||
this.lambdaUpdate().set(PqDev::getPlanId, planId).in(PqDev::getId, pqDevIds).update();
|
||||
devIds.removeAll(existedBoundPqDevIds);
|
||||
if (ObjectUtils.isNotEmpty(devIds)) {
|
||||
this.lambdaUpdate().set(PqDev::getPlanId, planId).in(PqDev::getId, devIds).update();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -340,6 +355,15 @@ 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;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取检测状态饼状图数据
|
||||
*
|
||||
@@ -433,7 +457,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
if (ObjectUtil.isNotNull(pqDev.getPattern())) {
|
||||
DictData dictData = dictDataService.getDictDataByName(pqDev.getPattern());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
pqDev.setPattern(dictData.getName());
|
||||
pqDev.setPattern(dictData.getId());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(pqDev.getDevType())) {
|
||||
|
||||
@@ -21,10 +21,6 @@ public class PqMonitorExcel {
|
||||
@NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
// @Excel(name = "监测点序号", width = 20)
|
||||
// @NotBlank(message = DevValidMessage.MONITOR_NUM_NOT_BLANK)
|
||||
// private Integer num;
|
||||
|
||||
@Excel(name = "PT变比", width = 20, orderNum = "4")
|
||||
@NotNull(message = DevValidMessage.PT_NOT_NULL)
|
||||
private Float pt;
|
||||
@@ -41,22 +37,14 @@ public class PqMonitorExcel {
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ImportData extends PqMonitorExcel {
|
||||
@Excel(name = "所属设备Id", width = 20, orderNum = "1")
|
||||
@NotBlank(message = DevValidMessage.DEV_ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_ID_FORMAT_ERROR)
|
||||
private String devId;
|
||||
|
||||
@Excel(name = "监测点编号", width = 20, isImportField = "true", orderNum = "1")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MONITOR_CODE_FORMAT_ERROR)
|
||||
private String code;
|
||||
@Excel(name = "监测点序号", width = 20)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MONITOR_NUM_FORMAT_ERROR)
|
||||
private Integer num;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ExportData extends PqMonitorExcel {
|
||||
@Excel(name = "所属设备名称", width = 20)
|
||||
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
||||
private String devName;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
int finalI = i;
|
||||
exportData.forEach(data -> {
|
||||
// 给监测点台账添加设备名称
|
||||
data.setDevName(devList.get(finalI).getName());
|
||||
// data.setDevName(devList.get(finalI).getName());
|
||||
data.setPtType(dictDataService.getDictDataById(data.getPtType()).getName());
|
||||
});
|
||||
pqMonitorExcels.addAll(exportData);
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
package com.njcn.gather.device.plan.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.plan.pojo.param.AdPlanParam;
|
||||
import com.njcn.gather.device.plan.pojo.vo.AdPlanVO;
|
||||
import com.njcn.gather.device.plan.service.IAdPlanService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-09
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "检测计划管理")
|
||||
@RestController
|
||||
@RequestMapping("/adPlan")
|
||||
@RequiredArgsConstructor
|
||||
public class AdPlanController extends BaseController {
|
||||
|
||||
private final IAdPlanService adPlanService;
|
||||
private final IPqDevService pqDevService;
|
||||
|
||||
@OperateInfo
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("分页查询检测计划")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<AdPlanVO>> list(@RequestBody @Validated AdPlanParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
Page<AdPlanVO> result = adPlanService.listAdPlan(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增检测计划")
|
||||
@ApiImplicitParam(name = "pqDevParam", value = "检测计划", required = true)
|
||||
public HttpResult<Object> add(@RequestBody @Validated AdPlanParam param) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||
boolean result = adPlanService.addAdPlan(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改检测计划")
|
||||
@ApiImplicitParam(name = "updateParam", value = "检测计划", required = true)
|
||||
public HttpResult<Object> update(@RequestBody @Validated AdPlanParam.UpdateParam updateParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, updateParam);
|
||||
boolean result = adPlanService.updateAdPlan(updateParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除检测计划")
|
||||
@ApiImplicitParam(name = "ids", value = "检测计划id", required = true)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = adPlanService.deleteAdPlan(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/bindDev")
|
||||
@ApiOperation("检测计划绑定设备")
|
||||
@ApiImplicitParam(name = "bindPlanParam", value = "绑定参数", required = true)
|
||||
public HttpResult<Object> bindDev(@RequestBody @Validated AdPlanParam.BindPlanParam bindPlanParam) {
|
||||
String methodDescribe = getMethodDescribe("bindDev");
|
||||
LogUtil.njcnDebug(log, "{},绑定计划数据为:planId={}, pqDevIds={}", methodDescribe, bindPlanParam.getPlanId(), String.join(StrUtil.COMMA, bindPlanParam.getPqDevIds()));
|
||||
boolean result = pqDevService.bind(bindPlanParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/listByPattern")
|
||||
@ApiOperation("按照模式查询检测计划")
|
||||
@ApiImplicitParam(name = "pattern", value = "模式Id", required = true)
|
||||
public HttpResult<List<Map<String, Object>>> listByPattern(@RequestParam("pattern") String pattern) {
|
||||
String methodDescribe = getMethodDescribe("listByPattern");
|
||||
LogUtil.njcnDebug(log, "{},模式Id为:{}", methodDescribe, pattern);
|
||||
List<Map<String, Object>> result = adPlanService.listByPattern(pattern);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出检测计划")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public void export(@RequestBody @Validated AdPlanParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("download");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
List<Map<String, Object>> sheetList = adPlanService.getAdPlanEexportSheetList(queryParam);
|
||||
ExcelUtil.exportExcel("检测计划导出数据.xlsx", sheetList);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getPieData")
|
||||
@ApiOperation("获取饼状图数据")
|
||||
@ApiImplicitParam(name = "id", value = "检测计划id", required = true)
|
||||
public HttpResult<List<List<Map<String, Object>>>> getPieData(@RequestParam("planId") String planId) {
|
||||
String methodDescribe = getMethodDescribe("getPieData");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, planId);
|
||||
List<List<Map<String, Object>>> result = pqDevService.getPieData(planId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.njcn.gather.device.plan.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.plan.pojo.po.AdPlan;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-09
|
||||
*/
|
||||
public interface AdPlanMapper extends MPJBaseMapper<AdPlan> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.njcn.gather.device.plan.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.plan.pojo.po.AdPlanSource;
|
||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-09
|
||||
*/
|
||||
public interface AdPlanSourceMapper extends MPJBaseMapper<AdPlanSource> {
|
||||
|
||||
/**
|
||||
* 根据检测计划id获取检测源
|
||||
*
|
||||
* @param planId 检测计划id
|
||||
* @return 检测源列表
|
||||
*/
|
||||
List<PqSource> selectPqSourceByPlanId(String planId);
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.gather.device.plan.mapper.AdPlanMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.gather.device.plan.mapper.AdPlanSourceMapper">
|
||||
|
||||
|
||||
<select id="selectPqSourceByPlanId" resultType="com.njcn.gather.device.source.pojo.po.PqSource">
|
||||
SELECT pq_source.*
|
||||
FROM pq_source,
|
||||
ad_plan_source
|
||||
WHERE pq_source.id = ad_plan_source.Source_Id
|
||||
AND ad_plan_source.Plan_Id = #{planId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.njcn.gather.device.plan.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-12
|
||||
*/
|
||||
@Getter
|
||||
public enum DataSourceEnum {
|
||||
THREE_SENSE_ACTUAL_TIME_DATA("0", "3秒实时数据"),
|
||||
|
||||
MINUTE_STATISTICS_MAX("1", "分钟统计数据-最大"),
|
||||
MINUTE_STATISTICS_MIN("2", "分钟统计数据-最小"),
|
||||
MINUTE_STATISTICS_AVG("3", "分钟统计数据-平均"),
|
||||
MINUTE_STATISTICS_CP95("4", "分钟统计数据-CP95"),
|
||||
RECORDED_DATA("5", "录播数据");
|
||||
|
||||
private String value;
|
||||
private String msg;
|
||||
|
||||
DataSourceEnum(String value, String msg) {
|
||||
this.value = value;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static String getMsgByValue(String value) {
|
||||
for (DataSourceEnum dataSourceEnum : DataSourceEnum.values()) {
|
||||
if (dataSourceEnum.getValue().equals(value)) {
|
||||
return dataSourceEnum.getMsg();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
package com.njcn.gather.device.plan.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
public class AdPlanParam {
|
||||
|
||||
@ApiModelProperty(value = "名称", required = true)
|
||||
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.PLAN_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "模式", required = true)
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
|
||||
// @ApiModelProperty(value = "父计划ID")
|
||||
// @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DeviceValidMessage.PATTERN_FORMAT_ERROR)
|
||||
// private String fatherPlanId;
|
||||
|
||||
@ApiModelProperty(value = "检测源ID列表",required = true)
|
||||
@NotEmpty(message = DevValidMessage.SOURCE_IDS_NOT_EMPTY)
|
||||
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.SOURCE_ID_FORMAT_ERROR)String> sourceIds;
|
||||
|
||||
@ApiModelProperty(value = "数据源ID列表", required = true)
|
||||
@NotEmpty(message = DevValidMessage.DATASOURCE_ID_NOT_EMPTY)
|
||||
private List<String> datasourceIds;
|
||||
|
||||
@ApiModelProperty(value = "检测脚本ID", required = true)
|
||||
@NotBlank(message = DevValidMessage.SCRIPT_ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.SCRIPT_ID_FORMAT_ERROR)
|
||||
private String scriptId;
|
||||
|
||||
@ApiModelProperty(value = "误差体系ID", required = true)
|
||||
@NotBlank(message = DevValidMessage.ERROR_SYS_ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERROR_SYS_ID_FORMAT_ERROR)
|
||||
private String errorSysId;
|
||||
|
||||
@ApiModelProperty(value = "守时检测")
|
||||
@NotNull(message = DevValidMessage.TIME_CHECK_NOT_NULL)
|
||||
@Min(value = 0, message = DevValidMessage.TIME_CHECK_FORMAT_ERROR)
|
||||
@Max(value = 1, message = DevValidMessage.TIME_CHECK_FORMAT_ERROR)
|
||||
private Integer timeCheck;
|
||||
|
||||
@ApiModelProperty("被检设备ID列表")
|
||||
@NotNull(message = DevValidMessage.PQ_DEV_IDS_NOT_NULL)
|
||||
private List<String> devIds;
|
||||
|
||||
/**
|
||||
* 分页查询实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class QueryParam extends BaseParam {
|
||||
@ApiModelProperty("名称")
|
||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "模式,字典表(数字、模拟、比对)")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
private String pattern;
|
||||
|
||||
@ApiModelProperty(value = "检测状态")
|
||||
@Min(value = 0, message = DevValidMessage.TEST_STATE_FORMAT_ERROR)
|
||||
@Max(value = 2, message = DevValidMessage.TEST_STATE_FORMAT_ERROR)
|
||||
private Integer testState;
|
||||
|
||||
@ApiModelProperty(value = "报告生成状态")
|
||||
@Min(value = 0, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
@Max(value = 2, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
private Integer reportState;
|
||||
|
||||
@ApiModelProperty(value = "检测结果")
|
||||
@Min(value = 0, message = DevValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
|
||||
@Max(value = 2, message = DevValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
|
||||
private Integer result;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdateParam extends AdPlanParam {
|
||||
@ApiModelProperty(value = "id", required = true)
|
||||
@NotBlank(message = DevValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 检测状态,字典表(未检、检测中、检测完成)
|
||||
*/
|
||||
// @ApiModelProperty(value = "检测状态")
|
||||
// @NotNull(message = DeviceValidMessage.TEST_STATE_NOT_NULL)
|
||||
// @Min(value = 0, message = DeviceValidMessage.TEST_STATE_FORMAT_ERROR)
|
||||
// @Max(value = 2, message = DeviceValidMessage.TEST_STATE_FORMAT_ERROR)
|
||||
// private Integer testState;
|
||||
|
||||
/**
|
||||
* 报告生成状态,字典表(未生成、部分生成、全部生成)
|
||||
*/
|
||||
// @ApiModelProperty(value = "报告生成状态")
|
||||
// @NotNull(message = DeviceValidMessage.REPORT_STATE_NOT_NULL)
|
||||
// @Min(value = 0, message = DeviceValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
// @Max(value = 2, message = DeviceValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||
// private Integer reportState;
|
||||
|
||||
/**
|
||||
* 检测结果,字典表(符合、不符合、/)
|
||||
*/
|
||||
// @ApiModelProperty(value = "检测结果")
|
||||
// @NotNull(message = DeviceValidMessage.CHECK_RESULT_STATE_NOT_NULL)
|
||||
// @Min(value = 0, message = DeviceValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
|
||||
// @Max(value = 2, message = DeviceValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
|
||||
// private Integer result;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class BindPlanParam {
|
||||
@ApiModelProperty("检测计划ID")
|
||||
@NotNull(message = DevValidMessage.PLAN_ID_NOT_NULL)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PLAN_ID_FORMAT_ERROR)
|
||||
private String planId;
|
||||
|
||||
@ApiModelProperty("被检设备ID列表")
|
||||
@NotNull(message = DevValidMessage.PQ_DEV_IDS_NOT_NULL)
|
||||
private List<String> pqDevIds;
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.njcn.gather.device.plan.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ad_plan")
|
||||
public class AdPlan extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = 923200973006628094L;
|
||||
|
||||
/**
|
||||
* 检测计划ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 检测计划名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 模式,字典表(数字、模拟、比对)
|
||||
*/
|
||||
private String pattern;
|
||||
|
||||
/**
|
||||
* 父计划ID
|
||||
*/
|
||||
private String fatherPlanId;
|
||||
|
||||
/**
|
||||
* 数据源ID,字典表
|
||||
*/
|
||||
private String datasourceId;
|
||||
|
||||
/**
|
||||
* 检测脚本ID,关联PQ_Script表
|
||||
*/
|
||||
private String scriptId;
|
||||
|
||||
/**
|
||||
* 误差体系ID,关联PQ_Error_Sys表
|
||||
*/
|
||||
private String errorSysId;
|
||||
|
||||
/**
|
||||
* 守时检测
|
||||
*/
|
||||
private Integer timeCheck;
|
||||
|
||||
/**
|
||||
* 检测状态,字典表(未检、检测中、检测完成)
|
||||
*/
|
||||
private Integer testState;
|
||||
|
||||
/**
|
||||
* 报告生成状态,字典表(未生成、部分生成、全部生成)
|
||||
*/
|
||||
private Integer reportState;
|
||||
|
||||
/**
|
||||
* 检测结果,字典表(符合、不符合)
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 自动生成,用于生成数据表后缀
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
private Integer state;
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.njcn.gather.device.plan.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
@TableName("ad_plan_source")
|
||||
@AllArgsConstructor
|
||||
public class AdPlanSource implements Serializable {
|
||||
private static final long serialVersionUID = -76292730578149530L;
|
||||
/**
|
||||
* 检测计划表Id
|
||||
*/
|
||||
private String planId;
|
||||
|
||||
/**
|
||||
* 检测源表Id
|
||||
*/
|
||||
private String sourceId;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.njcn.gather.device.plan.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-11
|
||||
*/
|
||||
@Data
|
||||
public class AdPlanExcel {
|
||||
@Excel(name = "名称", width = 40)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "模式", width = 20)
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
private String pattern;
|
||||
|
||||
@Excel(name = "父计划id", width = 25)
|
||||
private String fatherPlanId;
|
||||
|
||||
@Excel(name = "数据源", width = 20)
|
||||
private String datasource;
|
||||
|
||||
@Excel(name = "脚本", width = 50)
|
||||
private String script;
|
||||
|
||||
@Excel(name = "误差体系", width = 30)
|
||||
private String errorSys;
|
||||
|
||||
@Excel(name = "是否做守时检测", width = 15, replace = {"否_0", "是_1"})
|
||||
private Integer timeCheck;
|
||||
|
||||
@Excel(name = "检测状态", width = 10, replace = {"未检_0", "检测中_1", "检测完成_2"})
|
||||
private Integer testState;
|
||||
|
||||
@Excel(name = "报告生成状态", width = 15, replace = {"未生成_0", "部分生成_1", "全部生成_2"})
|
||||
private Integer reportState;
|
||||
|
||||
@Excel(name = "检测结果", width = 10, replace = {"不符合_0", "符合_1", "/_2"})
|
||||
private Integer result;
|
||||
|
||||
@Excel(name = "数据表后缀", width = 20)
|
||||
private Integer code;
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package com.njcn.gather.device.plan.pojo.vo;
|
||||
|
||||
import com.njcn.gather.device.plan.pojo.po.AdPlan;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class AdPlanVO {
|
||||
|
||||
/**
|
||||
* 检测计划ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 检测计划名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 模式,字典表(数字、模拟、比对)
|
||||
*/
|
||||
private String pattern;
|
||||
|
||||
/**
|
||||
* 父计划ID
|
||||
*/
|
||||
private String fatherPlanId;
|
||||
|
||||
/**
|
||||
* 数据源ID列表
|
||||
*/
|
||||
private List<String> datasourceIds;
|
||||
|
||||
/**
|
||||
* 检测源id
|
||||
*/
|
||||
private List<String> sourceIds;
|
||||
|
||||
/**
|
||||
* 检测源名称
|
||||
*/
|
||||
private List<String> sourceName;
|
||||
|
||||
/**
|
||||
* 检测脚本ID,关联PQ_Script表
|
||||
*/
|
||||
private String scriptId;
|
||||
|
||||
/**
|
||||
* 检测脚本名称
|
||||
*/
|
||||
private String scriptName;
|
||||
|
||||
/**
|
||||
* 误差体系ID,关联PQ_Error_Sys表
|
||||
*/
|
||||
private String errorSysId;
|
||||
|
||||
/**
|
||||
* 误差体系名称
|
||||
*/
|
||||
private String errorSysName;
|
||||
|
||||
/**
|
||||
* 守时检测
|
||||
*/
|
||||
private Integer timeCheck;
|
||||
|
||||
/**
|
||||
* 检测状态,字典表(未检、检测中、检测完成)
|
||||
*/
|
||||
private Integer testState;
|
||||
|
||||
/**
|
||||
* 报告生成状态,字典表(未生成、部分生成、全部生成)
|
||||
*/
|
||||
private Integer reportState;
|
||||
|
||||
/**
|
||||
* 检测结果,字典表(符合、不符合)
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 自动生成,用于生成数据表后缀
|
||||
*/
|
||||
private Integer code;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.njcn.gather.device.plan.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.device.plan.pojo.param.AdPlanParam;
|
||||
import com.njcn.gather.device.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.device.plan.pojo.vo.AdPlanVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-09
|
||||
*/
|
||||
public interface IAdPlanService extends IService<AdPlan> {
|
||||
|
||||
/**
|
||||
* 分页查询检测计划
|
||||
*
|
||||
* @param queryParam 分页查询参数
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
Page<AdPlanVO> listAdPlan(AdPlanParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 新增检测计划
|
||||
*
|
||||
* @param param 检测计划参数
|
||||
* @return 新增成功则返回true,否则返回false
|
||||
*/
|
||||
boolean addAdPlan(AdPlanParam param);
|
||||
|
||||
/**
|
||||
* 更新检测计划
|
||||
*
|
||||
* @param param 更新参数
|
||||
* @return 更新成功则返回true,否则返回false
|
||||
*/
|
||||
boolean updateAdPlan(AdPlanParam.UpdateParam param);
|
||||
|
||||
/**
|
||||
* 删除检测计划
|
||||
*
|
||||
* @param ids 检测计划id列表
|
||||
* @return 删除成功则返回true,否则返回false
|
||||
*/
|
||||
boolean deleteAdPlan(List<String> ids);
|
||||
|
||||
/**
|
||||
* 根据模式查询检测计划
|
||||
*
|
||||
* @param pattern 模式Id
|
||||
* @return 检测计划列表
|
||||
*/
|
||||
List<Map<String, Object>> listByPattern(String pattern);
|
||||
|
||||
/**
|
||||
* 获取检测计划导出时所需的SheetList (包含与之关联的设备信息)
|
||||
*
|
||||
* @param queryParam 查询参数
|
||||
* @return SheetList
|
||||
*/
|
||||
List<Map<String, Object>> getAdPlanEexportSheetList(AdPlanParam.QueryParam queryParam);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.njcn.gather.device.plan.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.device.plan.pojo.po.AdPlanSource;
|
||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-09
|
||||
*/
|
||||
public interface IAdPlanSourceService extends IService<AdPlanSource> {
|
||||
/**
|
||||
* 根据检测计划id获取检测源
|
||||
*
|
||||
* @param planId 检测计划id
|
||||
* @return 检测源列表
|
||||
*/
|
||||
List<PqSource> listPqSourceByPlanId(String planId);
|
||||
|
||||
/**
|
||||
* 新增检测计划关联检测源数据
|
||||
*
|
||||
* @param planId 检测计划id
|
||||
* @param sourceIds 检测源id列表
|
||||
* @return 新增成功返回true,否则返回false
|
||||
*/
|
||||
boolean addAdPlanSource(String planId, List<String> sourceIds);
|
||||
|
||||
/**
|
||||
* 根据检测计划id删除关联的检测源数据
|
||||
*
|
||||
* @param planIds 检测计划id列表
|
||||
* @return 删除成功返回true,否则返回false
|
||||
*/
|
||||
boolean deleteAdPlanSourceByPlanIds(List<String> planIds);
|
||||
|
||||
/**
|
||||
* 更新检测计划关联的检测源数据
|
||||
*
|
||||
* @param planId 检测计划id
|
||||
* @param sourceIds 检测源id列表
|
||||
* @return 更新成功返回true,否则返回false
|
||||
*/
|
||||
boolean updateAdPlanSource(String planId, List<String> sourceIds);
|
||||
}
|
||||
@@ -1,264 +0,0 @@
|
||||
package com.njcn.gather.device.plan.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;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.device.device.pojo.enums.TimeCheckResultEnum;
|
||||
import com.njcn.gather.device.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.err.service.IPqErrSysService;
|
||||
import com.njcn.gather.device.plan.mapper.AdPlanMapper;
|
||||
import com.njcn.gather.device.plan.pojo.enums.DataSourceEnum;
|
||||
import com.njcn.gather.device.plan.pojo.param.AdPlanParam;
|
||||
import com.njcn.gather.device.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.device.plan.pojo.vo.AdPlanExcel;
|
||||
import com.njcn.gather.device.plan.pojo.vo.AdPlanVO;
|
||||
import com.njcn.gather.device.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.device.plan.service.IAdPlanSourceService;
|
||||
import com.njcn.gather.device.pojo.constant.DevConst;
|
||||
import com.njcn.gather.device.pojo.enums.CheckResultEnum;
|
||||
import com.njcn.gather.device.pojo.enums.CheckStateEnum;
|
||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||
import com.njcn.gather.device.pojo.enums.PlanReportStateEnum;
|
||||
import com.njcn.gather.device.script.service.IPqScriptService;
|
||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-09
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> implements IAdPlanService {
|
||||
|
||||
private final IPqScriptService pqScriptService;
|
||||
private final IPqErrSysService pqErrSysService;
|
||||
private final IAdPlanSourceService adPlanSourceService;
|
||||
private final IPqDevService pqDevService;
|
||||
private final IDictDataService dictDataService;
|
||||
|
||||
@Override
|
||||
public Page<AdPlanVO> listAdPlan(AdPlanParam.QueryParam queryParam) {
|
||||
Page<AdPlan> page1 = this.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), this.getQueryWrapper(queryParam));
|
||||
List<AdPlan> adPlans = page1.getRecords();
|
||||
List<AdPlanVO> adPlanVOList = adPlans.stream().map(adPlan -> {
|
||||
AdPlanVO adPlanVO = new AdPlanVO();
|
||||
BeanUtil.copyProperties(adPlan, adPlanVO);
|
||||
adPlanVO.setDatasourceIds(Arrays.asList(adPlan.getDatasourceId().split(StrUtil.COMMA)));
|
||||
return adPlanVO;
|
||||
}).collect(Collectors.toList());
|
||||
adPlanVOList.forEach(adPlanVO -> {
|
||||
adPlanVO.setScriptName(pqScriptService.getPqScriptById(adPlanVO.getScriptId()).getName());
|
||||
adPlanVO.setErrorSysName(pqErrSysService.getPqErrSysById(adPlanVO.getErrorSysId()).getName());
|
||||
|
||||
List<PqSource> pqSourceList = adPlanSourceService.listPqSourceByPlanId(adPlanVO.getId());
|
||||
adPlanVO.setSourceIds(pqSourceList.stream().map(PqSource::getId).collect(Collectors.toList()));
|
||||
adPlanVO.setSourceName(pqSourceList.stream().map(PqSource::getName).collect(Collectors.toList()));
|
||||
});
|
||||
|
||||
Page<AdPlanVO> page2 = new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam));
|
||||
page2.setTotal(page1.getTotal());
|
||||
page2.setOrders(page1.orders());
|
||||
page2.setPages(page1.getPages());
|
||||
page2.setRecords(adPlanVOList);
|
||||
return page2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAdPlan(AdPlanParam param) {
|
||||
AdPlan adPlan = new AdPlan();
|
||||
BeanUtil.copyProperties(param, adPlan);
|
||||
|
||||
String planId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
adPlan.setId(planId);
|
||||
adPlan.setState(DataStateEnum.ENABLE.getCode());
|
||||
// 默认为顶级检测计划
|
||||
adPlan.setFatherPlanId(DevConst.FATHER_ID);
|
||||
adPlan.setDatasourceId(String.join(StrUtil.COMMA, param.getDatasourceIds()));
|
||||
adPlan.setTestState(CheckStateEnum.UNCHECKED.getValue());
|
||||
adPlan.setReportState(PlanReportStateEnum.REPORT_STATE_NOT_GENERATED.getValue());
|
||||
adPlan.setResult(CheckResultEnum.UNKNOWN.getValue());
|
||||
// todo code 生成
|
||||
// 日期生成 MMdd
|
||||
//String dateStr = DateFormatUtils.format(new Date(), "MMdd");
|
||||
adPlan.setCode(this.count() + 1);
|
||||
|
||||
// 新增检测计划、检测源关联
|
||||
adPlanSourceService.addAdPlanSource(planId, param.getSourceIds());
|
||||
if (ObjectUtil.isNotEmpty(param.getDevIds())) {
|
||||
AdPlanParam.BindPlanParam bindPlanParam = new AdPlanParam.BindPlanParam();
|
||||
bindPlanParam.setPlanId(planId);
|
||||
bindPlanParam.setPqDevIds(param.getDevIds());
|
||||
// 新增时,绑定设备
|
||||
pqDevService.bind(bindPlanParam);
|
||||
|
||||
// 守时检测
|
||||
pqDevService.updatePqDevTimeCheckResult(param.getDevIds(), TimeCheckResultEnum.UNKNOWN);
|
||||
}
|
||||
|
||||
return this.save(adPlan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateAdPlan(AdPlanParam.UpdateParam param) {
|
||||
AdPlan adPlan = new AdPlan();
|
||||
BeanUtil.copyProperties(param, adPlan);
|
||||
|
||||
adPlan.setDatasourceId(String.join(StrUtil.COMMA, param.getDatasourceIds()));
|
||||
|
||||
// 修改检测计划、检测源关联
|
||||
adPlanSourceService.updateAdPlanSource(param.getId(), param.getSourceIds());
|
||||
if (ObjectUtil.isNotEmpty(param.getDevIds())) {
|
||||
// 修改时,只有未检测过的设备才可以修改绑定设备
|
||||
List<String> notUnCheckedIds = pqDevService.listNotUnchecked().stream().map(PqDev::getId).collect(Collectors.toList());
|
||||
List<String> intersection = new ArrayList<>(notUnCheckedIds);
|
||||
intersection.retainAll(param.getDevIds());
|
||||
if (ObjectUtil.isEmpty(intersection)) {
|
||||
AdPlanParam.BindPlanParam bindPlanParam = new AdPlanParam.BindPlanParam();
|
||||
bindPlanParam.setPlanId(param.getId());
|
||||
bindPlanParam.setPqDevIds(param.getDevIds());
|
||||
pqDevService.bind(bindPlanParam);
|
||||
} else {
|
||||
throw new BusinessException(DevResponseEnum.HAS_NOT_UNCHECKED_DEVICE);
|
||||
}
|
||||
}
|
||||
|
||||
return this.updateById(adPlan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteAdPlan(List<String> ids) {
|
||||
for (String id : ids) {
|
||||
PqDevParam.QueryParam queryParam = new PqDevParam.QueryParam();
|
||||
queryParam.setPlanId(id);
|
||||
if (ObjectUtils.isNotEmpty(pqDevService.listByPlanId(queryParam))) {
|
||||
throw new BusinessException(DevResponseEnum.PLAN_HAS_DEVICE_BIND);
|
||||
}
|
||||
}
|
||||
// 删除检测计划、检测源关联
|
||||
adPlanSourceService.deleteAdPlanSourceByPlanIds(ids);
|
||||
|
||||
return this.lambdaUpdate().in(AdPlan::getId, ids).set(AdPlan::getState, DataStateEnum.DELETED.getCode()).update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> listByPattern(String pattern) {
|
||||
List<AdPlan> adPlanList = this.lambdaQuery().eq(AdPlan::getPattern, pattern).eq(AdPlan::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||
Map<Integer, List<AdPlan>> map1 = adPlanList.stream().collect(Collectors.groupingBy(AdPlan::getTestState));
|
||||
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
|
||||
for (CheckStateEnum checkStateEnum : CheckStateEnum.values()) {
|
||||
// 检测计划的检测状态中没有 归档 状态
|
||||
if (checkStateEnum.getValue() == CheckStateEnum.DOCUMENTED.getValue()) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("name", checkStateEnum.getMsg());
|
||||
List<Map<String, Object>> children = new ArrayList<>();
|
||||
if (map1.containsKey(checkStateEnum.getValue())) {
|
||||
map1.get(checkStateEnum.getValue()).forEach(adPlan -> {
|
||||
Map<String, Object> child = new HashMap<>();
|
||||
child.put("id", adPlan.getId());
|
||||
child.put("pid", adPlan.getFatherPlanId());
|
||||
child.put("name", adPlan.getName());
|
||||
children.add(child);
|
||||
});
|
||||
}
|
||||
map.put("children", children);
|
||||
result.add(map);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getAdPlanEexportSheetList(AdPlanParam.QueryParam queryParam) {
|
||||
List<AdPlan> adPlans = this.list(this.getQueryWrapper(queryParam));
|
||||
|
||||
List<AdPlanExcel> adPlanExcelList = this.getAdPlanExcelList(adPlans);
|
||||
Map<String, Object> sheetMap1 = new HashMap<>();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setSheetName("检测计划");
|
||||
sheetMap1.put("title", exportParams);
|
||||
sheetMap1.put("entity", AdPlanExcel.class);
|
||||
sheetMap1.put("data", adPlanExcelList);
|
||||
|
||||
List<Map<String, Object>> sheetList = new ArrayList<>();
|
||||
sheetList.add(sheetMap1);
|
||||
DictData dictData = dictDataService.getDictDataById(queryParam.getPattern());
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
if (DevConst.PATTERN_CONTRAST.equals(dictData.getCode())) {
|
||||
sheetList.add(pqDevService.getExportSheetMap(adPlans.stream().map(AdPlan::getId).collect(Collectors.toList()), PqDevExcel.ContrastExportData.class));
|
||||
} else {
|
||||
sheetList.add(pqDevService.getExportSheetMap(adPlans.stream().map(AdPlan::getId).collect(Collectors.toList()), PqDevExcel.SimulateAndDigitalExportData.class));
|
||||
}
|
||||
}
|
||||
|
||||
return sheetList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询条件wrapper
|
||||
*
|
||||
* @param queryParam 查询条件
|
||||
* @return
|
||||
*/
|
||||
private Wrapper getQueryWrapper(AdPlanParam.QueryParam queryParam) {
|
||||
QueryWrapper<AdPlan> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
queryWrapper.eq(StrUtil.isNotBlank(queryParam.getPattern()), "ad_plan.pattern", queryParam.getPattern()).eq(StrUtil.isNotBlank(queryParam.getName()), "ad_plan.name", queryParam.getName()).eq(ObjectUtil.isNotNull(queryParam.getTestState()), "ad_plan.Test_State", queryParam.getTestState()).eq(ObjectUtil.isNotNull(queryParam.getReportState()), "ad_plan.Report_State", queryParam.getReportState()).eq(ObjectUtil.isNotNull(queryParam.getResult()), "ad_plan.result", queryParam.getResult());
|
||||
}
|
||||
queryWrapper.eq("ad_plan.state", DataStateEnum.ENABLE.getCode()).orderBy(true, true, "Create_Time");
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取检测计划excel数据
|
||||
*
|
||||
* @param adPlans 检测计划列表
|
||||
* @return 检测计划excel数据
|
||||
*/
|
||||
private List<AdPlanExcel> getAdPlanExcelList(List<AdPlan> adPlans) {
|
||||
return adPlans.stream().map(adPlan -> {
|
||||
AdPlanExcel adPlanExcel = new AdPlanExcel();
|
||||
BeanUtil.copyProperties(adPlan, adPlanExcel);
|
||||
adPlanExcel.setPattern(dictDataService.getDictDataById(adPlan.getPattern()).getName());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String datasourceId : adPlan.getDatasourceId().split(StrUtil.COMMA)) {
|
||||
sb.append(DataSourceEnum.getMsgByValue(datasourceId)).append(StrUtil.COMMA);
|
||||
}
|
||||
adPlanExcel.setDatasource(sb.toString().substring(0, sb.length() - 1));
|
||||
adPlanExcel.setScript(pqScriptService.getPqScriptById(adPlan.getScriptId()).getName());
|
||||
|
||||
sb.delete(0, sb.length());
|
||||
|
||||
for (String errorSysId : adPlan.getErrorSysId().split(StrUtil.COMMA)) {
|
||||
sb.append(pqErrSysService.getPqErrSysById(errorSysId).getName()).append(StrUtil.COMMA);
|
||||
}
|
||||
adPlanExcel.setErrorSys(sb.toString().substring(0, sb.length() - 1));
|
||||
|
||||
return adPlanExcel;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.njcn.gather.device.plan.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.gather.device.plan.mapper.AdPlanSourceMapper;
|
||||
import com.njcn.gather.device.plan.pojo.po.AdPlanSource;
|
||||
import com.njcn.gather.device.plan.service.IAdPlanSourceService;
|
||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-12-09
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AdPlanSourceServiceImpl extends ServiceImpl<AdPlanSourceMapper, AdPlanSource> implements IAdPlanSourceService {
|
||||
|
||||
private final AdPlanSourceMapper adPlanSourceMapper;
|
||||
|
||||
@Override
|
||||
public List<PqSource> listPqSourceByPlanId(String planId) {
|
||||
return adPlanSourceMapper.selectPqSourceByPlanId(planId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAdPlanSource(String planId, List<String> sourceIds) {
|
||||
List<AdPlanSource> adPlanSourceList = new ArrayList<>();
|
||||
for (String sourceId : sourceIds) {
|
||||
adPlanSourceList.add(new AdPlanSource(planId, sourceId));
|
||||
}
|
||||
return this.saveBatch(adPlanSourceList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteAdPlanSourceByPlanIds(List<String> planIds) {
|
||||
QueryWrapper<AdPlanSource> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("ad_plan_source.Plan_Id", planIds);
|
||||
return this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateAdPlanSource(String planId, List<String> sourceIds) {
|
||||
this.deleteAdPlanSourceByPlanIds(Collections.singletonList(planId));
|
||||
this.addAdPlanSource(planId, sourceIds);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -9,19 +9,4 @@ public interface DevConst {
|
||||
* 顶层父节点ID
|
||||
*/
|
||||
String FATHER_ID = "0";
|
||||
|
||||
/**
|
||||
* 模拟式
|
||||
*/
|
||||
String PATTERN_SIMULATE = "Simulate";
|
||||
|
||||
/**
|
||||
* 数字式
|
||||
*/
|
||||
String PATTERN_DIGITAL = "Digital";
|
||||
|
||||
/**
|
||||
* 对比式
|
||||
*/
|
||||
String PATTERN_CONTRAST = "Contrast";
|
||||
}
|
||||
|
||||
@@ -185,4 +185,6 @@ public interface DevValidMessage {
|
||||
String MONITOR_NUM_NOT_NULL = "监测点序号不能为空";
|
||||
|
||||
String FACTOR_FLAG_FORMAT_ERROR = "是否支持系数校准格式错误";
|
||||
|
||||
String MONITOR_NUM_FORMAT_ERROR = "监测点序号格式错误";
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
public enum CheckResultEnum {
|
||||
NOT_ACCORD("不符合", 0),
|
||||
ACCORD("符合", 1),
|
||||
UNKNOWN("/", 2);
|
||||
UNCHECKED("未检", 2);
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
@@ -8,8 +8,9 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
public enum DevReportStateEnum {
|
||||
REPORT_STATE_NOT_GENERATED("未生成", 0),
|
||||
REPORT_STATE_GENERATED("已生成", 1);
|
||||
NOT_GENERATED("未生成", 0),
|
||||
GENERATED("已生成", 1),
|
||||
UNCHECKED("未检", 2);
|
||||
|
||||
private final Integer value;
|
||||
private final String msg;
|
||||
|
||||
@@ -14,7 +14,10 @@ public enum DevResponseEnum {
|
||||
PLAN_HAS_DEVICE_BIND("A001006", "检测计划下已绑定设备,请先解绑设备"),
|
||||
PQ_DEV_REPEAT("A001007", "重复的被检设备"),
|
||||
PQ_DEV_HAS_MONITOR("A001008", "该设备下关联有监测点,请先移除监测点"),
|
||||
HAS_NOT_UNCHECKED_DEVICE("A001009", "设备在检测中或已被检测过,请勿解除绑定"),;
|
||||
HAS_NOT_UNCHECKED_DEVICE("A001009", "设备在检测中或已被检测过,请勿解除绑定"),
|
||||
IMPORT_PLAN_DATA_FAIL("A001010", "导入的检测计划为空"),
|
||||
IMPORT_DATA_FORMAT_FAIL("A001011", "导入数据格式错误"),
|
||||
;
|
||||
|
||||
private final String message;
|
||||
private final String code;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.gather.device.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-12
|
||||
*/
|
||||
@Getter
|
||||
public enum PatternEnum {
|
||||
SIMULATE("Simulate", "模拟式"),
|
||||
DIGITAL("Digital", "数字式"),
|
||||
CONTRAST("Contrast", "比对式");
|
||||
|
||||
private String value;
|
||||
private String msg;
|
||||
|
||||
PatternEnum(String value, String msg) {
|
||||
this.value = value;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -119,14 +118,11 @@ public class PqSourceController extends BaseController {
|
||||
@OperateInfo
|
||||
@GetMapping("/getSourceParam")
|
||||
@ApiOperation("按照检测源ID、源参数Type、获取源参数")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pqSourceId", value = "检测源ID", required = true),
|
||||
@ApiImplicitParam(name = "paramType", value = "源参数Type", required = true)
|
||||
})
|
||||
public HttpResult<List<SourceParam>> getSourceParam(@RequestParam("pqSourceId") String pqSourceId, @RequestParam("paramType") String paramType) {
|
||||
@ApiImplicitParam(name = "pqSourceId", value = "检测源ID", required = true)
|
||||
public HttpResult<List<SourceParam>> getSourceParam(@RequestParam("pqSourceId") String pqSourceId) {
|
||||
String methodDescribe = getMethodDescribe("getParam");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, pqSourceId + " " + paramType);
|
||||
List<SourceParam> result = pqSourceService.getSourceParam(pqSourceId, paramType);
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, pqSourceId);
|
||||
List<SourceParam> result = pqSourceService.getSourceParam(pqSourceId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@ public class SourceParam {
|
||||
|
||||
private String pId;
|
||||
|
||||
private String sourceParamType;
|
||||
private String type;
|
||||
|
||||
private String sourceParamDesc;
|
||||
private String desc;
|
||||
|
||||
private String sourceParamValue;
|
||||
private String value;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
|
||||
@@ -67,8 +67,7 @@ public interface IPqSourceService extends IService<PqSource> {
|
||||
* 获取指定检测源的指定参数
|
||||
*
|
||||
* @param pqSourceId 检测源Id
|
||||
* @param paramType 参数类型
|
||||
* @return 源参数
|
||||
*/
|
||||
List<SourceParam> getSourceParam(String pqSourceId, String paramType);
|
||||
List<SourceParam> getSourceParam(String pqSourceId);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
@@ -96,7 +95,7 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SourceParam> getSourceParam(String pqSourceId, String paramType) {
|
||||
public List<SourceParam> getSourceParam(String pqSourceId) {
|
||||
PqSource pqSource = this.lambdaQuery().eq(PqSource::getId, pqSourceId).eq(PqSource::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||
if (ObjectUtil.isNotNull(pqSource)) {
|
||||
String parameter = pqSource.getParameter();
|
||||
@@ -106,7 +105,7 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
.peek(p -> p.setChildren(getChildren(p, list)))
|
||||
.sorted(Comparator.comparingInt(SourceParam::getSort))
|
||||
.collect(Collectors.toList());
|
||||
return filterTree(sourceParams, paramType);
|
||||
return sourceParams;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -120,33 +119,33 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<SourceParam> filterTree(List<SourceParam> tree, String keyword) {
|
||||
if (CollectionUtils.isEmpty(tree) || StrUtil.isBlank(keyword)) {
|
||||
return tree;
|
||||
}
|
||||
filter(tree, keyword);
|
||||
return tree;
|
||||
}
|
||||
// private List<SourceParam> filterTree(List<SourceParam> tree, String keyword) {
|
||||
// if (CollectionUtils.isEmpty(tree) || StrUtil.isBlank(keyword)) {
|
||||
// return tree;
|
||||
// }
|
||||
// filter(tree, keyword);
|
||||
// return tree;
|
||||
// }
|
||||
|
||||
private void filter(List<SourceParam> list, String keyword) {
|
||||
for (int i = list.size() - 1; i >= 0; i--) {
|
||||
SourceParam sourceParam = list.get(i);
|
||||
List<SourceParam> children = sourceParam.getChildren();
|
||||
if (!keyword.equals(sourceParam.getSourceParamType())) {
|
||||
if (!CollectionUtils.isEmpty(children)) {
|
||||
filter(children, keyword);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(sourceParam.getChildren())) {
|
||||
list.remove(i);
|
||||
}
|
||||
}
|
||||
// private void filter(List<SourceParam> list, String keyword) {
|
||||
// for (int i = list.size() - 1; i >= 0; i--) {
|
||||
// SourceParam sourceParam = list.get(i);
|
||||
// List<SourceParam> children = sourceParam.getChildren();
|
||||
// if (!keyword.equals(sourceParam.getType())) {
|
||||
// if (!CollectionUtils.isEmpty(children)) {
|
||||
// filter(children, keyword);
|
||||
// }
|
||||
// if (CollectionUtils.isEmpty(sourceParam.getChildren())) {
|
||||
// list.remove(i);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// if (!CollectionUtils.isEmpty(children)) {
|
||||
// filter(children, keyword);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user