代码调整

This commit is contained in:
caozehui
2025-03-28 15:06:57 +08:00
parent 48408859b1
commit 71ba7fa139
31 changed files with 296 additions and 414 deletions

View File

@@ -1,8 +1,6 @@
package com.njcn.gather.detection.pojo.param; package com.njcn.gather.detection.pojo.param;
import com.njcn.gather.script.pojo.constant.PqScriptValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.gather.source.pojo.constant.PqSourceValidMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@@ -31,12 +29,12 @@ public class SimulateDetectionParam {
*/ */
private String scriptId; private String scriptId;
@NotNull(message = PqScriptValidMessage.INDEX_NOT_NULL) @NotNull(message = DetectionValidMessage.INDEX_NOT_NULL)
private Integer scriptIndex; private Integer scriptIndex;
/** /**
* 源id * 源id
*/ */
@NotBlank(message = PqSourceValidMessage.ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.SOURCE_ID_NOT_BLANK)
private String sourceId; private String sourceId;
} }

View File

@@ -2,7 +2,7 @@ package com.njcn.gather.device.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.monitor.pojo.param.PqMonitorParam; import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.web.pojo.annotation.DateTimeStrValid; import com.njcn.web.pojo.annotation.DateTimeStrValid;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -25,13 +25,13 @@ public class PqDevParam {
private String name; private String name;
@ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true) @ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true)
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
private String pattern; private String pattern;
@ApiModelProperty(value = "设备类型,字典表", required = true) @ApiModelProperty(value = "设备类型,字典表", required = true)
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_TYPE_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR)
private String devType; private String devType;
@ApiModelProperty(value = "设备厂家,字典表", required = true) @ApiModelProperty(value = "设备厂家,字典表", required = true)
@@ -41,7 +41,7 @@ public class PqDevParam {
private String createDate; private String createDate;
@ApiModelProperty(value = "设备序列号", required = true) @ApiModelProperty(value = "设备序列号", required = true)
@NotBlank(message = DevValidMessage.FACTORYNO_NOT_BLANK) @NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
private String createId; private String createId;
@ApiModelProperty(value = "固件版本", required = true) @ApiModelProperty(value = "固件版本", required = true)
@@ -51,24 +51,24 @@ public class PqDevParam {
private String softwareVersion; private String softwareVersion;
@ApiModelProperty(value = "通讯协议", required = true) @ApiModelProperty(value = "通讯协议", required = true)
@NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PROTOCOL_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PROTOCOL_FORMAT_ERROR)
private String protocol; private String protocol;
@ApiModelProperty(value = "IP地址", required = true) @ApiModelProperty(value = "IP地址", required = true)
@NotBlank(message = DevValidMessage.IP_NOT_BLANK) @NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
@Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR) @Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
private String ip; private String ip;
@ApiModelProperty(value = "端口号", required = true) @ApiModelProperty(value = "端口号", required = true)
@NotNull(message = DevValidMessage.PORT_NOT_NULL) @NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
@Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR) @Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
private Integer port; private Integer port;
@ApiModelProperty(value = "装置是否为加密版本", required = true) @ApiModelProperty(value = "装置是否为加密版本", required = true)
@NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL) @NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
@Min(value = 0, message = DevValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR)
@Max(value = 1, message = DevValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR) @Max(value = 1, message = DetectionValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR)
private Integer encryptionFlag; private Integer encryptionFlag;
@ApiModelProperty("装置识别码3ds加密") @ApiModelProperty("装置识别码3ds加密")
@@ -81,7 +81,7 @@ public class PqDevParam {
private String sampleId; private String sampleId;
@ApiModelProperty(value = "送样日期") @ApiModelProperty(value = "送样日期")
@DateTimeStrValid(message = DevValidMessage.ARRIVE_DATE_FORMAT_ERROR) @DateTimeStrValid(message = DetectionValidMessage.ARRIVE_DATE_FORMAT_ERROR)
private String arrivedDate; private String arrivedDate;
@ApiModelProperty("所属地市名称") @ApiModelProperty("所属地市名称")
@@ -100,13 +100,13 @@ public class PqDevParam {
private String qrCode; private String qrCode;
@ApiModelProperty(value = "检测次数,默认为0", required = true) @ApiModelProperty(value = "检测次数,默认为0", required = true)
@NotNull(message = DevValidMessage.RECHECK_NUM_NOT_NULL) @NotNull(message = DetectionValidMessage.RECHECK_NUM_NOT_NULL)
@Min(value = 0, message = DevValidMessage.RECHECK_NUM_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.RECHECK_NUM_FORMAT_ERROR)
private Integer reCheckNum; private Integer reCheckNum;
@ApiModelProperty("是否支持系数校准") @ApiModelProperty("是否支持系数校准")
@Min(value = 0, message = DevValidMessage.FACTOR_FLAG_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.FACTOR_FLAG_FORMAT_ERROR)
@Max(value = 1, message = DevValidMessage.FACTOR_FLAG_FORMAT_ERROR) @Max(value = 1, message = DetectionValidMessage.FACTOR_FLAG_FORMAT_ERROR)
private String factorFlag; private String factorFlag;
@ApiModelProperty("监测点台账列表") @ApiModelProperty("监测点台账列表")
@@ -127,8 +127,8 @@ public class PqDevParam {
public static class UpdateParam extends PqDevParam { public static class UpdateParam extends PqDevParam {
@ApiModelProperty(value = "id", required = true) @ApiModelProperty(value = "id", required = true)
@NotBlank(message = DevValidMessage.ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
private String id; private String id;
} }
@@ -152,17 +152,17 @@ public class PqDevParam {
@ApiModelProperty("检测状态列表") @ApiModelProperty("检测状态列表")
private List< private List<
@Min(value = 0, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.CHECK_STATE_FORMAT_ERROR)
@Max(value = 3, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR) Integer> checkStateList; @Max(value = 3, message = DetectionValidMessage.CHECK_STATE_FORMAT_ERROR) Integer> checkStateList;
@ApiModelProperty("检测结果") @ApiModelProperty("检测结果")
@Min(value = 0, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.CHECK_RESULT_FORMAT_ERROR)
@Max(value = 2, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR) @Max(value = 2, message = DetectionValidMessage.CHECK_RESULT_FORMAT_ERROR)
private Integer checkResult; private Integer checkResult;
@ApiModelProperty("报告状态") @ApiModelProperty("报告状态")
@Min(value = 0, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
@Max(value = 2, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR) @Max(value = 2, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
private Integer reportState; private Integer reportState;
} }
@@ -170,23 +170,23 @@ public class PqDevParam {
@Data @Data
public static class DeleteParam { public static class DeleteParam {
@ApiModelProperty(value = "ids") @ApiModelProperty(value = "ids")
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR) String> ids; private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR) String> ids;
@ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true) @ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true)
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
private String pattern; private String pattern;
} }
@Data @Data
public static class BindPlanParam { public static class BindPlanParam {
@ApiModelProperty("检测计划ID") @ApiModelProperty("检测计划ID")
@NotNull(message = DevValidMessage.PLAN_ID_NOT_NULL) @NotNull(message = DetectionValidMessage.PLAN_ID_NOT_NULL)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PLAN_ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
private String planId; private String planId;
@ApiModelProperty("被检设备ID列表") @ApiModelProperty("被检设备ID列表")
@NotNull(message = DevValidMessage.PQ_DEV_IDS_NOT_NULL) @NotNull(message = DetectionValidMessage.PQ_DEV_IDS_NOT_NULL)
private List<String> pqDevIds; private List<String> pqDevIds;
} }
} }

View File

@@ -2,9 +2,8 @@ package com.njcn.gather.device.pojo.vo;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Range; import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@@ -19,24 +18,24 @@ import javax.validation.constraints.Pattern;
public class CNDevExcel { public class CNDevExcel {
@Excel(name = "预投计划*", width = 20, orderNum = "1") @Excel(name = "预投计划*", width = 20, orderNum = "1")
@NotBlank(message = DevValidMessage.PREINVESTMENT_PLAN_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PREINVESTMENT_PLAN_NOT_BLANK)
private String preinvestmentPlan; private String preinvestmentPlan;
@Excel(name = "设备编号(开始编号-结束编号,编号为数字)*", width = 50, orderNum = "2") @Excel(name = "设备编号(开始编号-结束编号,编号为数字)*", width = 50, orderNum = "2")
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.CN_DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR) @Pattern(regexp = PatternRegex.CN_DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
private String name; private String name;
@Excel(name = "设备类型*", width = 20, orderNum = "3") @Excel(name = "设备类型*", width = 20, orderNum = "3")
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
private String devType; private String devType;
@Excel(name = "通讯协议*", width = 15, orderNum = "4") @Excel(name = "通讯协议*", width = 15, orderNum = "4")
@NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
private String protocol; private String protocol;
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "5") @Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "5")
@NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL) @NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
private Integer encryptionFlag; private Integer encryptionFlag;
@Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "6") @Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "6")
@@ -49,12 +48,12 @@ public class CNDevExcel {
private Integer factorFlag; private Integer factorFlag;
@Excel(name = "IP地址*", width = 20, orderNum = "9") @Excel(name = "IP地址*", width = 20, orderNum = "9")
@NotBlank(message = DevValidMessage.IP_NOT_BLANK) @NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
@Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR) @Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
private String ip; private String ip;
@Excel(name = "端口号*", width = 15, orderNum = "10") @Excel(name = "端口号*", width = 15, orderNum = "10")
@NotNull(message = DevValidMessage.PORT_NOT_NULL) @NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
@Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR) @Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
private Integer port; private Integer port;
} }

View File

@@ -2,8 +2,7 @@ package com.njcn.gather.device.pojo.vo;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.web.pojo.annotation.DateTimeStrValid;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Range; import org.hibernate.validator.constraints.Range;
@@ -24,24 +23,24 @@ public class ProvinceDevExcel implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Excel(name = "装置编号*", width = 20) @Excel(name = "装置编号*", width = 20)
@NotBlank(message = DevValidMessage.FACTORYNO_NOT_BLANK) @NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
private String createId; private String createId;
@Excel(name = "设备名称*", width = 20, orderNum = "2") @Excel(name = "设备名称*", width = 20, orderNum = "2")
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR) @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
private String name; private String name;
@Excel(name = "设备类型*", width = 20, orderNum = "3") @Excel(name = "设备类型*", width = 20, orderNum = "3")
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
private String devType; private String devType;
@Excel(name = "设备厂家*", width = 20, orderNum = "7") @Excel(name = "设备厂家*", width = 20, orderNum = "7")
@NotBlank(message = DevValidMessage.MANUFACTURER_NOT_BLANK) @NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
private String manufacturer; private String manufacturer;
@Excel(name = "出厂日期*", width = 25, format = "yyyy-MM-dd", orderNum = "8") @Excel(name = "出厂日期*", width = 25, format = "yyyy-MM-dd", orderNum = "8")
@NotNull(message = DevValidMessage.CREATEDATETIME_NOT_NULL) @NotNull(message = DetectionValidMessage.CREATEDATETIME_NOT_NULL)
private LocalDate createDate; private LocalDate createDate;
@Excel(name = "固件版本", width = 15, orderNum = "9") @Excel(name = "固件版本", width = 15, orderNum = "9")
@@ -51,11 +50,11 @@ public class ProvinceDevExcel implements Serializable {
private String softwareVersion; private String softwareVersion;
@Excel(name = "通讯协议*", width = 15, orderNum = "11") @Excel(name = "通讯协议*", width = 15, orderNum = "11")
@NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
private String protocol; private String protocol;
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "12") @Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "12")
@NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL) @NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
private Integer encryptionFlag; private Integer encryptionFlag;
@Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "13") @Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "13")
@@ -68,12 +67,12 @@ public class ProvinceDevExcel implements Serializable {
private Integer factorFlag; private Integer factorFlag;
@Excel(name = "IP地址*", width = 20, orderNum = "16") @Excel(name = "IP地址*", width = 20, orderNum = "16")
@NotBlank(message = DevValidMessage.IP_NOT_BLANK) @NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
@Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR) @Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
private String ip; private String ip;
@Excel(name = "端口号*", width = 15, orderNum = "17") @Excel(name = "端口号*", width = 15, orderNum = "17")
@NotNull(message = DevValidMessage.PORT_NOT_NULL) @NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
@Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR) @Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
private Integer port; private Integer port;
} }

View File

@@ -1,7 +1,7 @@
package com.njcn.gather.err.pojo.param; package com.njcn.gather.err.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -17,13 +17,13 @@ import javax.validation.constraints.Pattern;
public class PqErrSysDtlsParam { public class PqErrSysDtlsParam {
@ApiModelProperty(value = "误差项类型", required = true) @ApiModelProperty(value = "误差项类型", required = true)
@NotBlank(message = DevValidMessage.ERR_SYS_DTLS_ERROR_TYPE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ERR_SYS_DTLS_ERROR_TYPE_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERR_SYS_DTLS_ERROR_TYPE_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ERR_SYS_DTLS_ERROR_TYPE_FORMAT_ERROR)
private String errorType; private String errorType;
@ApiModelProperty(value = "脚本项类型", required = true) @ApiModelProperty(value = "脚本项类型", required = true)
@NotBlank(message = DevValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_FORMAT_ERROR)
private String scriptType; private String scriptType;
@ApiModelProperty(value = "误差判断起始值", required = true) @ApiModelProperty(value = "误差判断起始值", required = true)
@@ -47,15 +47,15 @@ public class PqErrSysDtlsParam {
private Integer conditionType; private Integer conditionType;
@ApiModelProperty(value = "最大值误差", required = true) @ApiModelProperty(value = "最大值误差", required = true)
@NotNull(message = DevValidMessage.MAX_ERROR_VALUE_NOT_NULL) @NotNull(message = DetectionValidMessage.MAX_ERROR_VALUE_NOT_NULL)
private Double maxErrorValue; private Double maxErrorValue;
@ApiModelProperty(value = "误差值类型", required = true) @ApiModelProperty(value = "误差值类型", required = true)
@NotNull(message = DevValidMessage.ERROR_VALUE_TYPE_NOT_BLANK) @NotNull(message = DetectionValidMessage.ERROR_VALUE_TYPE_NOT_BLANK)
private Integer errorValueType; private Integer errorValueType;
@ApiModelProperty("排序") @ApiModelProperty("排序")
@NotNull(message = DevValidMessage.SORT_NOT_NULL) @NotNull(message = DetectionValidMessage.SORT_NOT_NULL)
private Integer sort; private Integer sort;
} }

View File

@@ -1,7 +1,7 @@
package com.njcn.gather.err.pojo.param; package com.njcn.gather.err.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.web.pojo.annotation.DateTimeStrValid; import com.njcn.web.pojo.annotation.DateTimeStrValid;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -20,24 +20,24 @@ import java.util.List;
public class PqErrSysParam { public class PqErrSysParam {
@ApiModelProperty(value = "参照标准名称", required = true) @ApiModelProperty(value = "参照标准名称", required = true)
@NotBlank(message = DevValidMessage.STANDARD_NAME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.STANDARD_NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.ERR_SYS_NAME, message = DevValidMessage.STANDARD_NAME_FORMAT_ERROR) @Pattern(regexp = PatternRegex.ERR_SYS_NAME, message = DetectionValidMessage.STANDARD_NAME_FORMAT_ERROR)
private String standardName; private String standardName;
@ApiModelProperty(value = "标准实施年份", required = true) @ApiModelProperty(value = "标准实施年份", required = true)
@NotBlank(message = DevValidMessage.STANDARD_TIME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.STANDARD_TIME_NOT_BLANK)
@DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR) @DateTimeStrValid(format = "yyyy", message = DetectionValidMessage.STANDARD_TIME_FORMAT_ERROR)
private String standardTime; private String standardTime;
@ApiModelProperty(value = "设备等级", required = true) @ApiModelProperty(value = "设备等级", required = true)
@NotBlank(message = DevValidMessage.DEV_LEVEL_NOT_BLANK) @NotBlank(message = DetectionValidMessage.DEV_LEVEL_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_LEVEL_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_LEVEL_FORMAT_ERROR)
private String devLevel; private String devLevel;
@ApiModelProperty("状态") @ApiModelProperty("状态")
@NotNull(message = DevValidMessage.ENABLE_NOT_NULL) @NotNull(message = DetectionValidMessage.ENABLE_NOT_NULL)
@Min(value = 0, message = DevValidMessage.ENABLE_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.ENABLE_FORMAT_ERROR)
@Max(value = 1, message = DevValidMessage.ENABLE_FORMAT_ERROR) @Max(value = 1, message = DetectionValidMessage.ENABLE_FORMAT_ERROR)
private Integer enable; private Integer enable;
@ApiModelProperty(value = "误差详情列表", required = true) @ApiModelProperty(value = "误差详情列表", required = true)
@@ -48,11 +48,11 @@ public class PqErrSysParam {
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public static class QueryParam extends BaseParam { public static class QueryParam extends BaseParam {
@ApiModelProperty("标准实施年份") @ApiModelProperty("标准实施年份")
@DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR) @DateTimeStrValid(format = "yyyy", message = DetectionValidMessage.STANDARD_TIME_FORMAT_ERROR)
private String standardTime; private String standardTime;
@ApiModelProperty("设备等级") @ApiModelProperty("设备等级")
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_LEVEL_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_LEVEL_FORMAT_ERROR)
private String devLevel; private String devLevel;
} }
@@ -60,14 +60,14 @@ public class PqErrSysParam {
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public static class UpdateParam extends PqErrSysParam { public static class UpdateParam extends PqErrSysParam {
@ApiModelProperty("id") @ApiModelProperty("id")
@NotBlank(message = DevValidMessage.ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
private String id; private String id;
} }
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public static class DetectionParam{ public static class DetectionParam {
@ApiModelProperty("所属误差体系ID") @ApiModelProperty("所属误差体系ID")
private String errorSysId; private String errorSysId;

View File

@@ -68,6 +68,7 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
@Override @Override
@Transactional @Transactional
public boolean addPqErrSys(PqErrSysParam param) { public boolean addPqErrSys(PqErrSysParam param) {
this.checkRepeat(param, false);
PqErrSys pqErrSys = new PqErrSys(); PqErrSys pqErrSys = new PqErrSys();
BeanUtils.copyProperties(param, pqErrSys); BeanUtils.copyProperties(param, pqErrSys);
String id = UUID.randomUUID().toString().replaceAll("-", ""); String id = UUID.randomUUID().toString().replaceAll("-", "");
@@ -80,9 +81,11 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
return result1 && result2; return result1 && result2;
} }
@Override @Override
@Transactional @Transactional
public boolean updatePqErrSys(PqErrSysParam.UpdateParam param) { public boolean updatePqErrSys(PqErrSysParam.UpdateParam param) {
this.checkRepeat(param, true);
PqErrSys pqErrSys = new PqErrSys(); PqErrSys pqErrSys = new PqErrSys();
BeanUtils.copyProperties(param, pqErrSys); BeanUtils.copyProperties(param, pqErrSys);
pqErrSys.setName(generateErrSysName(param)); pqErrSys.setName(generateErrSysName(param));
@@ -123,7 +126,9 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
@Override @Override
public List<Map<String, Object>> listAllPqErrSys() { public List<Map<String, Object>> listAllPqErrSys() {
List<PqErrSys> pqErrSysList = this.lambdaQuery().eq(PqErrSys::getState, DataStateEnum.ENABLE.getCode()).list(); List<PqErrSys> pqErrSysList = this.lambdaQuery()
.eq(PqErrSys::getEnable,DataStateEnum.ENABLE.getCode())
.eq(PqErrSys::getState, DataStateEnum.ENABLE.getCode()).list();
List<Map<String, Object>> result = pqErrSysList.stream().map(pqErrSys -> { List<Map<String, Object>> result = pqErrSysList.stream().map(pqErrSys -> {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id", pqErrSys.getId()); map.put("id", pqErrSys.getId());
@@ -203,15 +208,25 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
} }
/** /**
* 生成误差体系名称(标准号+年份+设备等级) * 检查重复
* *
* @return 检测源名称 * @param param 检测参数
* @param isExcludeSelf 是否排除自己
*/ */
private String generatePqSourceName(PqErrSysParam param) { private void checkRepeat(PqErrSysParam param, boolean isExcludeSelf) {
DictData devLevel = dictDataService.getDictDataById(param.getDevLevel()); QueryWrapper<PqErrSys> wrapper = new QueryWrapper<>();
if (ObjectUtils.allNotNull(param.getStandardName(), param.getStandardTime(), devLevel)) { wrapper.eq("Standard_Name", param.getStandardName())
return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevel.getName(); .eq("Standard_Time",param.getStandardTime()+"-01-01")
.eq("Dev_Level",param.getDevLevel())
.eq("state", DataStateEnum.ENABLE.getCode());
if (isExcludeSelf) {
if(param instanceof PqErrSysParam.UpdateParam){
wrapper.ne("Id", ((PqErrSysParam.UpdateParam) param).getId());
}
}
int count = this.count(wrapper);
if (count > 0) {
throw new BusinessException(DetectionResponseEnum.ERR_SYS_REPEAT);
} }
throw new BusinessException(DetectionResponseEnum.ERR_SOURCE_GEN_NAME_ERROR);
} }
} }

View File

@@ -1,14 +0,0 @@
package com.njcn.gather.icd.pojo.constant;
/**
* @author caozehui
* @data 2025-02-11
*/
public interface PqIcdPathValidMessage {
String ID_NOT_BLANK = "id不能为空请检查id参数";
String ID_FORMAT_ERROR = "id格式错误请检查id参数";
String NAME_NOT_BLANK = "名称不能为空";
String PATH_NOT_BLANK = "icd存储路径不能为空";
String NAME_FORMAT_ERROR = "名称格式错误只能包含字母、数字、中文、下划线、中划线、点号长度为1-50个字符";
String PATH_FORMAT_ERROR = "ICD路径格式错误";
}

View File

@@ -1,8 +1,7 @@
package com.njcn.gather.icd.pojo.param; package com.njcn.gather.icd.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.icd.pojo.constant.PqIcdPathValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.gather.type.pojo.constant.DevTypeValidMessage;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -18,13 +17,13 @@ import javax.validation.constraints.Pattern;
@Data @Data
public class PqIcdPathParam { public class PqIcdPathParam {
@ApiModelProperty(value = "名称", required = true) @ApiModelProperty(value = "名称", required = true)
@NotBlank(message = PqIcdPathValidMessage.NAME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.ICD_NAME_REGEX, message = PqIcdPathValidMessage.NAME_FORMAT_ERROR) @Pattern(regexp = PatternRegex.ICD_NAME_REGEX, message = DetectionValidMessage.ICD_NAME_FORMAT_ERROR)
private String name; private String name;
@ApiModelProperty(value = "存储路径", required = true) @ApiModelProperty(value = "存储路径", required = true)
@NotBlank(message = PqIcdPathValidMessage.PATH_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ICD_PATH_NOT_BLANK)
@Pattern(regexp = PatternRegex.ICD_PATH_REGEX, message = PqIcdPathValidMessage.PATH_FORMAT_ERROR) @Pattern(regexp = PatternRegex.ICD_PATH_REGEX, message = DetectionValidMessage.ICD_PATH_FORMAT_ERROR)
private String path; private String path;
/** /**
@@ -45,8 +44,8 @@ public class PqIcdPathParam {
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public static class UpdateParam extends PqIcdPathParam { public static class UpdateParam extends PqIcdPathParam {
@ApiModelProperty(value = "id", required = true) @ApiModelProperty(value = "id", required = true)
@NotBlank(message = PqIcdPathValidMessage.ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = PqIcdPathValidMessage.ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
private String id; private String id;
} }
} }

View File

@@ -1,10 +1,9 @@
package com.njcn.gather.monitor.pojo.param; package com.njcn.gather.monitor.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@@ -21,24 +20,24 @@ public class PqMonitorParam {
private String code; private String code;
@ApiModelProperty(value = "所属母线") @ApiModelProperty(value = "所属母线")
@NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
private String name; private String name;
@ApiModelProperty(value = "监测点序号") @ApiModelProperty(value = "监测点序号")
@NotNull(message = DevValidMessage.MONITOR_NUM_NOT_NULL) @NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL)
private Integer num; private Integer num;
@ApiModelProperty(value = "PT变比") @ApiModelProperty(value = "PT变比")
@NotNull(message = DevValidMessage.PT_NOT_NULL) @NotNull(message = DetectionValidMessage.PT_NOT_NULL)
private Float pt; private Float pt;
@ApiModelProperty(value = "CT变比") @ApiModelProperty(value = "CT变比")
@NotNull(message = DevValidMessage.CT_NOT_NULL) @NotNull(message = DetectionValidMessage.CT_NOT_NULL)
private Float ct; private Float ct;
@ApiModelProperty(value = "接线方式") @ApiModelProperty(value = "接线方式")
@NotBlank(message = DevValidMessage.WIRING_TYPE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.WIRING_TYPE_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.WIRING_TYPE_FORMAT_ERROR)
private String ptType; private String ptType;
} }

View File

@@ -2,7 +2,7 @@ package com.njcn.gather.monitor.pojo.vo;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -18,24 +18,24 @@ import javax.validation.constraints.Pattern;
public class PqMonitorExcel { public class PqMonitorExcel {
@Excel(name = "监测点序号", width = 20, orderNum = "1") @Excel(name = "监测点序号", width = 20, orderNum = "1")
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MONITOR_NUM_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.MONITOR_NUM_FORMAT_ERROR)
private Integer num; private Integer num;
@Excel(name = "所属母线", width = 20, orderNum = "2") @Excel(name = "所属母线", width = 20, orderNum = "2")
@NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
private String name; private String name;
@Excel(name = "PT变比", width = 20, orderNum = "3") @Excel(name = "PT变比", width = 20, orderNum = "3")
@NotNull(message = DevValidMessage.PT_NOT_NULL) @NotNull(message = DetectionValidMessage.PT_NOT_NULL)
private Float pt; private Float pt;
@Excel(name = "CT变比", width = 20, orderNum = "4") @Excel(name = "CT变比", width = 20, orderNum = "4")
@NotNull(message = DevValidMessage.CT_NOT_NULL) @NotNull(message = DetectionValidMessage.CT_NOT_NULL)
private Float ct; private Float ct;
@Excel(name = "接线方式", width = 20, orderNum = "5") @Excel(name = "接线方式", width = 20, orderNum = "5")
@NotBlank(message = DevValidMessage.WIRING_TYPE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.WIRING_TYPE_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.WIRING_TYPE_FORMAT_ERROR)
private String ptType; private String ptType;
@Data @Data

View File

@@ -1,13 +1,11 @@
package com.njcn.gather.plan.pojo.param; package com.njcn.gather.plan.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.util.List; import java.util.List;
@@ -20,45 +18,45 @@ import java.util.List;
public class AdPlanParam { public class AdPlanParam {
@ApiModelProperty(value = "名称", required = true) @ApiModelProperty(value = "名称", required = true)
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.PLAN_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR) @Pattern(regexp = PatternRegex.PLAN_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
private String name; private String name;
@ApiModelProperty(value = "模式", required = true) @ApiModelProperty(value = "模式", required = true)
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
private String pattern; private String pattern;
// @ApiModelProperty(value = "父计划ID") // @ApiModelProperty(value = "父计划ID")
// @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DeviceValidMessage.PATTERN_FORMAT_ERROR) // @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DeviceValidMessage.PATTERN_FORMAT_ERROR)
// private String fatherPlanId; // private String fatherPlanId;
@ApiModelProperty(value = "检测源ID列表",required = true) @ApiModelProperty(value = "检测源ID列表", required = true)
@NotEmpty(message = DevValidMessage.SOURCE_IDS_NOT_EMPTY) @NotEmpty(message = DetectionValidMessage.SOURCE_IDS_NOT_EMPTY)
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.SOURCE_ID_FORMAT_ERROR)String> sourceIds; private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SOURCE_ID_FORMAT_ERROR) String> sourceIds;
@ApiModelProperty(value = "数据源ID列表", required = true) @ApiModelProperty(value = "数据源ID列表", required = true)
@NotEmpty(message = DevValidMessage.DATASOURCE_ID_NOT_EMPTY) @NotEmpty(message = DetectionValidMessage.DATASOURCE_ID_NOT_EMPTY)
private List<String> datasourceIds; private List<String> datasourceIds;
@ApiModelProperty(value = "检测脚本ID", required = true) @ApiModelProperty(value = "检测脚本ID", required = true)
@NotBlank(message = DevValidMessage.SCRIPT_ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.SCRIPT_ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.SCRIPT_ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SCRIPT_ID_FORMAT_ERROR)
private String scriptId; private String scriptId;
@ApiModelProperty(value = "误差体系ID", required = true) @ApiModelProperty(value = "误差体系ID", required = true)
@NotBlank(message = DevValidMessage.ERROR_SYS_ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ERROR_SYS_ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERROR_SYS_ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ERROR_SYS_ID_FORMAT_ERROR)
private String errorSysId; private String errorSysId;
@ApiModelProperty(value = "守时检测") @ApiModelProperty(value = "守时检测")
@NotNull(message = DevValidMessage.TIME_CHECK_NOT_NULL) @NotNull(message = DetectionValidMessage.TIME_CHECK_NOT_NULL)
@Min(value = 0, message = DevValidMessage.TIME_CHECK_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.TIME_CHECK_FORMAT_ERROR)
@Max(value = 1, message = DevValidMessage.TIME_CHECK_FORMAT_ERROR) @Max(value = 1, message = DetectionValidMessage.TIME_CHECK_FORMAT_ERROR)
private Integer timeCheck; private Integer timeCheck;
@ApiModelProperty("被检设备ID列表") @ApiModelProperty("被检设备ID列表")
@NotNull(message = DevValidMessage.PQ_DEV_IDS_NOT_NULL) @NotNull(message = DetectionValidMessage.PQ_DEV_IDS_NOT_NULL)
private List<String> devIds; private List<String> devIds;
@ApiModelProperty(value = "是否关联报告") @ApiModelProperty(value = "是否关联报告")
@@ -74,27 +72,27 @@ public class AdPlanParam {
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public static class QueryParam extends BaseParam { public static class QueryParam extends BaseParam {
@ApiModelProperty("名称") @ApiModelProperty("名称")
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR) @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
private String name; private String name;
@ApiModelProperty(value = "模式,字典表(数字、模拟、比对)") @ApiModelProperty(value = "模式,字典表(数字、模拟、比对)")
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
private String pattern; private String pattern;
@ApiModelProperty(value = "检测状态") @ApiModelProperty(value = "检测状态")
@Min(value = 0, message = DevValidMessage.TEST_STATE_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.TEST_STATE_FORMAT_ERROR)
@Max(value = 2, message = DevValidMessage.TEST_STATE_FORMAT_ERROR) @Max(value = 2, message = DetectionValidMessage.TEST_STATE_FORMAT_ERROR)
private Integer testState; private Integer testState;
@ApiModelProperty(value = "报告生成状态") @ApiModelProperty(value = "报告生成状态")
@Min(value = 0, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
@Max(value = 2, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR) @Max(value = 2, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
private Integer reportState; private Integer reportState;
@ApiModelProperty(value = "检测结果") @ApiModelProperty(value = "检测结果")
@Min(value = 0, message = DevValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
@Max(value = 2, message = DevValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR) @Max(value = 2, message = DetectionValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
private Integer result; private Integer result;
} }
@@ -102,13 +100,13 @@ public class AdPlanParam {
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public static class UpdateParam extends AdPlanParam { public static class UpdateParam extends AdPlanParam {
@ApiModelProperty(value = "id", required = true) @ApiModelProperty(value = "id", required = true)
@NotBlank(message = DevValidMessage.ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
private String id; private String id;
} }
@Data @Data
public static class CheckParam{ public static class CheckParam {
// 0:不合格项复检 1:全部复检 // 0:不合格项复检 1:全部复检
private Integer reCheckType; private Integer reCheckType;
private String planId; private String planId;

View File

@@ -1,20 +1,11 @@
package com.njcn.gather.plan.pojo.vo; package com.njcn.gather.plan.pojo.vo;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage;
import com.njcn.gather.device.pojo.vo.CNDevExcel;
import com.njcn.web.pojo.annotation.DateTimeStrValid;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDate;
import java.util.List;
/** /**
* @author caozehui * @author caozehui
@@ -23,38 +14,38 @@ import java.util.List;
@Data @Data
public class AdPlanExcel { public class AdPlanExcel {
@Excel(name = "名称*", width = 40, needMerge = true, orderNum = "0") @Excel(name = "名称*", width = 40, needMerge = true, orderNum = "0")
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
private String name; private String name;
@Excel(name = "检测源*", width = 40, needMerge = true, orderNum = "1") @Excel(name = "检测源*", width = 40, needMerge = true, orderNum = "1")
@NotBlank(message = DevValidMessage.SOURC_NOT_BLANK) @NotBlank(message = DetectionValidMessage.SOURC_NOT_BLANK)
private String source; private String source;
@Excel(name = "数据源*", width = 20, needMerge = true, orderNum = "2") @Excel(name = "数据源*", width = 20, needMerge = true, orderNum = "2")
@NotBlank(message = DevValidMessage.DATASOURCE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.DATASOURCE_NOT_BLANK)
private String datasourceId; private String datasourceId;
@Excel(name = "脚本*", width = 100, needMerge = true, orderNum = "3") @Excel(name = "脚本*", width = 100, needMerge = true, orderNum = "3")
@NotBlank(message = DevValidMessage.SCRIPT_NOT_BLANK) @NotBlank(message = DetectionValidMessage.SCRIPT_NOT_BLANK)
private String scriptId; private String scriptId;
@Excel(name = "误差体系*", width = 30, needMerge = true, orderNum = "4") @Excel(name = "误差体系*", width = 30, needMerge = true, orderNum = "4")
@NotBlank(message = DevValidMessage.ERRORSYS_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ERRORSYS_NOT_BLANK)
private String errorSysId; private String errorSysId;
@Excel(name = "是否做守时检测*", width = 15, replace = {"否_0", "是_1"}, needMerge = true, orderNum = "5") @Excel(name = "是否做守时检测*", width = 15, replace = {"否_0", "是_1"}, needMerge = true, orderNum = "5")
@NotNull(message = DevValidMessage.TIMECHECK_NOT_NULL) @NotNull(message = DetectionValidMessage.TIMECHECK_NOT_NULL)
private Integer timeCheck; private Integer timeCheck;
@Excel(name = "检测状态*", width = 10, replace = {"未检_0", "检测中_1", "检测完成_2"}, needMerge = true, orderNum = "6") @Excel(name = "检测状态*", width = 10, replace = {"未检_0", "检测中_1", "检测完成_2"}, needMerge = true, orderNum = "6")
@NotNull(message = DevValidMessage.TEST_STATE_NOT_NULL) @NotNull(message = DetectionValidMessage.TEST_STATE_NOT_NULL)
private Integer testState; private Integer testState;
@Excel(name = "报告生成状态*", width = 15, replace = {"未生成_0", "部分生成_1", "全部生成_2"}, needMerge = true, orderNum = "7") @Excel(name = "报告生成状态*", width = 15, replace = {"未生成_0", "部分生成_1", "全部生成_2"}, needMerge = true, orderNum = "7")
@NotNull(message = DevValidMessage.REPORT_STATE_NOT_NULL) @NotNull(message = DetectionValidMessage.REPORT_STATE_NOT_NULL)
private Integer reportState; private Integer reportState;
@Excel(name = "检测结果*", width = 10, replace = {"不符合_0", "符合_1", "未检_2"}, needMerge = true, orderNum = "8") @Excel(name = "检测结果*", width = 10, replace = {"不符合_0", "符合_1", "未检_2"}, needMerge = true, orderNum = "8")
@NotNull(message = DevValidMessage.CHECK_RESULT_STATE_NOT_NULL) @NotNull(message = DetectionValidMessage.CHECK_RESULT_STATE_NOT_NULL)
private Integer result; private Integer result;
} }

View File

@@ -1,43 +1,45 @@
package com.njcn.gather.device.pojo.constant; package com.njcn.gather.pojo.constant;
/** /**
* @author caozehui * @author caozehui
* @date 2024/11/06 * @data 2025-03-28
*/ */
public interface DevValidMessage { public interface DetectionValidMessage {
String SOURCE_ID_NOT_BLANK = "检测源id不能为空";
String ID_NOT_BLANK = "id不能为空请检查id参数"; String ID_NOT_BLANK = "id不能为空请检查id参数";
String ID_FORMAT_ERROR = "id格式错误请检查id参数"; String ID_FORMAT_ERROR = "id格式错误请检查id参数";
String NAME_NOT_BLANK = "名称不能为空";
String ICD_NAME_FORMAT_ERROR = "名称格式错误只能包含字母、数字、中文、下划线、中划线、点号长度为1-50个字符";
String ICD_PATH_NOT_BLANK = "icd存储路径不能为空";
String ICD_PATH_FORMAT_ERROR = "ICD路径格式错误";
String ICD_NOT_BLANK = "ICD不能为空";
String POWER_NOT_BLANK = "工作电源不能为空";
String VOLT_NOT_BLANK = "额定电压不能为空";
String CURR_NOT_BLANK = "额定电流不能为空";
String CHNS_NOT_BLANK = "通道数不能为空";
String DEV_CHNS_RANGE_ERROR = "通道数格式错误";
String INDEX_NOT_NULL = "index不能为空";
String VALUE_TYPE_NOT_BLANK = "脚本值类型不能为空";
String SCRIPT_NAME_FORMAT_ERROR = "脚本名称格式错误只能包含字母、数字、中文、下划线、中划线、点号长度为1-50个字符";
String SCRIPT_VOLT_FORMAT_ERROR = "检测脚本额定电压格式错误请检查ratedVolt参数";
String SCRIPT_CURR_FORMAT_ERROR = "检测脚本额定电流格式错误请检查ratedCurr参数";
String PORT_RANGE_ERROR = "端口号范围错误请检查port参数"; String PORT_RANGE_ERROR = "端口号范围错误请检查port参数";
String NAME_NOT_BLANK = "名称不能为空请检查name参数";
String NAME_FORMAT_ERROR = "名称格式错误请检查name参数"; String NAME_FORMAT_ERROR = "名称格式错误请检查name参数";
String PATTERN_NOT_BLANK = "模式不能为空请检查pattern参数"; String PATTERN_NOT_BLANK = "模式不能为空请检查pattern参数";
String DEV_TYPE_NOT_BLANK = "设备类型不能为空"; String DEV_TYPE_NOT_BLANK = "设备类型不能为空";
String DEV_CHNS_NOT_NULL = "设备通道系数不能为空请检查devChns参数";
String DEV_VOLT_NOT_NULL = "额定电压不能为空请检查devVolt参数";
String DEV_CURR_NOT_NULL = "额定电流不能为空请检查devCurr参数";
String MANUFACTURER_NOT_BLANK = "设备厂家不能为空请检查manufacturer参数"; String MANUFACTURER_NOT_BLANK = "设备厂家不能为空请检查manufacturer参数";
String CREATEDATETIME_NOT_NULL = "出厂日期不能为空请检查producedDate参数"; String CREATEDATETIME_NOT_NULL = "出厂日期不能为空请检查producedDate参数";
String CREATEDATETIME_FORMAT_ERROR = "出厂日期格式错误请检查createDate参数";
String FACTORYNO_NOT_BLANK = "出厂编号不能为空请检查factoryNo参数"; String FACTORYNO_NOT_BLANK = "出厂编号不能为空请检查factoryNo参数";
String FIRMWARE_NOT_BLANK = "固件版本不能为空请检查firmware参数";
String SOFTWARE_NOT_BLANK = "软件版本不能为空请检查software参数";
String PROTOCOL_NOT_BLANK = "通讯协议不能为空请检查protocol参数"; String PROTOCOL_NOT_BLANK = "通讯协议不能为空请检查protocol参数";
String IP_NOT_BLANK = "IP地址不能为空请检查ip参数"; String IP_NOT_BLANK = "IP地址不能为空请检查ip参数";
@@ -102,18 +104,6 @@ public interface DevValidMessage {
String ERR_SYS_DTLS_SCRIPT_TYPE_FORMAT_ERROR = "脚本项类型格式错误请检查scriptType参数"; String ERR_SYS_DTLS_SCRIPT_TYPE_FORMAT_ERROR = "脚本项类型格式错误请检查scriptType参数";
String START_VALUE_NOT_NULL = "起始值不能为空请检查startValue参数";
String START_FLAG_NOT_NULL = "是否包含起始值不能为空请检查startFlag参数";
String END_VALUE_NOT_NULL = "结束值不能为空请检查endValue参数";
String END_FLAG_NOT_NULL = "是否包含结束值不能为空请检查endFlag参数";
String CONDITION_TYPE_NOT_BLANK = "判断条件类型不能为空请检查conditionType参数";
String ERROR_VALUE_FORMAT_ERROR = "误差值格式错误请检查errorValue参数";
String MAX_ERROR_VALUE_NOT_NULL = "最大误差值不能为空请检查maxErrorValue参数"; String MAX_ERROR_VALUE_NOT_NULL = "最大误差值不能为空请检查maxErrorValue参数";
String ERROR_VALUE_TYPE_NOT_BLANK = "误差值类型不能为空请检查errorValueType参数"; String ERROR_VALUE_TYPE_NOT_BLANK = "误差值类型不能为空请检查errorValueType参数";
@@ -124,18 +114,6 @@ public interface DevValidMessage {
String ENABLE_NOT_NULL = "状态不能为空请检查enable参数"; String ENABLE_NOT_NULL = "状态不能为空请检查enable参数";
String PQ_SOURCE_NAME_FORMAT_ERROR = "检测源名称格式错误请检查pqSourceName参数";
String PQ_SOURCE_PARAMETER_ID_NOT_BLANK = "检测源参数ID不能为空请检查pqSourceParameterId参数";
String PQ_SOURCE_PARAMETER_PID_NOT_BLANK = "检测源参数PID不能为空请检查pqSourceParameterId参数";
String PQ_SOURCE_PARAMETER_TYPE_NOT_BLANK = "检测源参数类型不能为空请检查pqSourceParameterType参数";
String PQ_SOURCE_PARAMETER_REMARK_NOT_BLANK = "检测源参数描述不能为空请检查pqSourceParameterRemark参数";
String PQ_SOURCE_PARAMETER_VALUE_NOT_BLANK = "参数值不能为空请检查pqSourceParameterValue参数";
String DEV_ID_NOT_BLANK = "设备ID不能为空"; String DEV_ID_NOT_BLANK = "设备ID不能为空";
String DEV_ID_FORMAT_ERROR = "设备ID格式错误"; String DEV_ID_FORMAT_ERROR = "设备ID格式错误";
@@ -180,10 +158,6 @@ public interface DevValidMessage {
String CHECK_RESULT_FORMAT_ERROR = "检测结果格式错误"; String CHECK_RESULT_FORMAT_ERROR = "检测结果格式错误";
String DOCUMENT_STATE_FORMAT_ERROR = "归档状态格式错误";
String MONITOR_CODE_FORMAT_ERROR = "监测点编码格式错误";
String MONITOR_NUM_NOT_NULL = "监测点序号不能为空"; String MONITOR_NUM_NOT_NULL = "监测点序号不能为空";
String FACTOR_FLAG_FORMAT_ERROR = "是否支持系数校准格式错误"; String FACTOR_FLAG_FORMAT_ERROR = "是否支持系数校准格式错误";
@@ -195,18 +169,9 @@ public interface DevValidMessage {
String DATASOURCE_NOT_BLANK = "数据源不能为空"; String DATASOURCE_NOT_BLANK = "数据源不能为空";
String SCRIPT_NOT_BLANK = "检测脚本不能为空"; String SCRIPT_NOT_BLANK = "检测脚本不能为空";
String ERRORSYS_NOT_BLANK = "误差体系不能为空"; String ERRORSYS_NOT_BLANK = "误差体系不能为空";
String TIMECHECK_NOT_BLANK = "是否做守时检测不能为空";
String FACTOR_FLAG_NOT_BLANK = "是否支持系数校准不能为空";
String CONDITION_TYPE_FORMAT_ERROR = "判断条件类型格式错误请检查conditionType参数";
String SORT_NOT_NULL = "排序不能为空"; String SORT_NOT_NULL = "排序不能为空";
String PREINVESTMENT_PLAN_NOT_BLANK = "预投资计划不能为空"; String PREINVESTMENT_PLAN_NOT_BLANK = "预投资计划不能为空";
String TIMECHECK_NOT_NULL = "是否做守时检测不能为空"; String TIMECHECK_NOT_NULL = "是否做守时检测不能为空";
String CREATEID_NOT_BLANK = "设备序列号不能为空";
String ASSOCIATE_REPORT_NOT_NULL = "是否关联报告不能为空";
} }

View File

@@ -25,25 +25,26 @@ public enum DetectionResponseEnum {
CANNOT_CHANGE_REPORT_WHEN_CHECKING("A02011", "只有检测状态为未检时,才能修改绑定报告模板"), CANNOT_CHANGE_REPORT_WHEN_CHECKING("A02011", "只有检测状态为未检时,才能修改绑定报告模板"),
ICD_PATH_NAME_REPEAT("A02012", "icd名称重复"), ICD_PATH_NAME_REPEAT("A02012", "icd名称重复"),
ERR_SYS_BOUND_NOT_DELETE("A02013", "误差体系已被计划所绑定,无法删除!"), ERR_SYS_BOUND_NOT_DELETE("A02013", "误差体系已被计划所绑定,无法删除!"),
ERR_SYS_REPEAT("A02014", "已存在相同标准号、标准推行年份、适用设备等级的误差体系!"),
IMPORT_DATA_FAIL("A02014", "导入数据失败"), IMPORT_DATA_FAIL("A02040", "导入数据失败"),
SERIES_AND_DEVKEY_NOT_BLANK("A02015", "当为加密设备时,加密设备的序列号和设备密钥不能为空"), SERIES_AND_DEVKEY_NOT_BLANK("A02041", "当为加密设备时,加密设备的序列号和设备密钥不能为空"),
PQ_SOURCE_GEN_NAME_ERROR("A02016", "检测源生成名称出错"), PQ_SOURCE_GEN_NAME_ERROR("A02042", "检测源生成名称出错"),
ERR_SOURCE_GEN_NAME_ERROR("A02017", "误差体系生成名称出错"), ERR_SOURCE_GEN_NAME_ERROR("A02043", "误差体系生成名称出错"),
PQ_ERRSYS_GEN_NAME_ERROR("A02018", "误差体系生成名称出错"), PQ_ERRSYS_GEN_NAME_ERROR("A02044", "误差体系生成名称出错"),
PLAN_HAS_DEVICE_BIND("A02019", "检测计划下已绑定设备,请先解绑设备"), PLAN_HAS_DEVICE_BIND("A02045", "检测计划下已绑定设备,请先解绑设备"),
PQ_DEV_REPEAT("A02020", "重复的被检设备"), PQ_DEV_REPEAT("A02046", "重复的被检设备"),
PQ_DEV_HAS_MONITOR("A02021", "该设备下关联有监测点,请先移除监测点"), PQ_DEV_HAS_MONITOR("A02047", "该设备下关联有监测点,请先移除监测点"),
HAS_NOT_UNCHECKED_DEVICE("A02022", "设备在检测中或已被检测过,请勿解除绑定"), HAS_NOT_UNCHECKED_DEVICE("A02048", "设备在检测中或已被检测过,请勿解除绑定"),
IMPORT_PLAN_DATA_FAIL("A02023", "导入的检测计划为空"), IMPORT_PLAN_DATA_FAIL("A02049", "导入的检测计划为空"),
IMPORT_DATA_FORMAT_FAIL("A02024", "导入数据格式错误"), IMPORT_DATA_FORMAT_FAIL("A02050", "导入数据格式错误"),
IMPORT_SOURCE_ERROR("A02025", "当前模式下一个检测计划只能有一个检测源"), IMPORT_SOURCE_ERROR("A02051", "当前模式下一个检测计划只能有一个检测源"),
IMPORT_DATASOURCE_ERROR("A02026", "当前模式下一个检测计划只能有一个数据源"), IMPORT_DATASOURCE_ERROR("A02052", "当前模式下一个检测计划只能有一个数据源"),
DEV_UN_CHECKED("A02027", "装置还未检测完成!"), DEV_UN_CHECKED("A02053", "装置还未检测完成!"),
DEV_UN_REPORT("A02028", "装置报告未生成!"), DEV_UN_REPORT("A02054", "装置报告未生成!"),
DEVICE_DIS_ERROR("A02029", "装置配置异常"), DEVICE_DIS_ERROR("A02055", "装置配置异常"),
DEVICE_DELETE("A02030", "设备无法删除,已绑定计划!"); DEVICE_DELETE("A02056", "设备无法删除,已绑定计划!");
private final String code; private final String code;

View File

@@ -21,6 +21,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List; import java.util.List;
@@ -91,7 +92,7 @@ public class ReportController extends BaseController {
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新增报告模板") @ApiOperation("新增报告模板")
@ApiImplicitParam(name = "param", value = "报告模板参数", required = true) @ApiImplicitParam(name = "param", value = "报告模板参数", required = true)
public HttpResult<Boolean> add(@RequestBody @Validated ReportParam reportParam) { public HttpResult<Boolean> add(ReportParam reportParam) {
String methodDescribe = getMethodDescribe("add"); String methodDescribe = getMethodDescribe("add");
LogUtil.njcnDebug(log, "{},新增参数为:{}", methodDescribe, reportParam); LogUtil.njcnDebug(log, "{},新增参数为:{}", methodDescribe, reportParam);
boolean result = pqReportService.add(reportParam); boolean result = pqReportService.add(reportParam);
@@ -106,7 +107,7 @@ public class ReportController extends BaseController {
@PostMapping("/update") @PostMapping("/update")
@ApiOperation("更新报告模板") @ApiOperation("更新报告模板")
@ApiImplicitParam(name = "param", value = "报告模板参数", required = true) @ApiImplicitParam(name = "param", value = "报告模板参数", required = true)
public HttpResult<Boolean> update(@RequestBody @Validated ReportParam.UpdateParam reportParam) { public HttpResult<Boolean> update(ReportParam.UpdateParam reportParam) {
String methodDescribe = getMethodDescribe("update"); String methodDescribe = getMethodDescribe("update");
LogUtil.njcnDebug(log, "{},修改参数为:{}", methodDescribe, reportParam); LogUtil.njcnDebug(log, "{},修改参数为:{}", methodDescribe, reportParam);
boolean result = pqReportService.update(reportParam); boolean result = pqReportService.update(reportParam);

View File

@@ -1,13 +0,0 @@
package com.njcn.gather.report.pojo.constant;
/**
* @author caozehui
* @data 2025-03-20
*/
public interface ReportValidMessage {
String NAME_NOT_BLANK = "报告模板名称不能为空";
String VERSION_NOT_BLANK = "报告模板版本号不能为空";
String ENABLE_NOT_NULL = "报告模板的启用状态不能为空";
String NAME_PATTERN_NOT_MATCH = "报告模板名称格式不正确";
String VERSION_PATTERN_NOT_MATCH = "报告模板版本号格式不正确";
}

View File

@@ -19,7 +19,9 @@ public enum ReportResponseEnum {
DEVICE_TYPE_NOT_EXIST("A012008", "设备类型缺失,请联系管理员!"), DEVICE_TYPE_NOT_EXIST("A012008", "设备类型缺失,请联系管理员!"),
REPORT_TEMPLATE_NOT_EXIST("A012009", "报告模板缺失,请联系管理员!"), REPORT_TEMPLATE_NOT_EXIST("A012009", "报告模板缺失,请联系管理员!"),
NO_CHECK_DATA("A012010", "没有检测数据,无法生成报告!"), NO_CHECK_DATA("A012010", "没有检测数据,无法生成报告!"),
FILE_RENAME_FAILED("A012011", "文件重命名失败"); FILE_RENAME_FAILED("A012011", "文件重命名失败"),
REPORT_NAME_PATTERN_ERROR("A012012","报告名称格式错误可包含中文、字母、数字、中划线长度不能超过50个字符"),
REPORT_VERSION_PATTERN_ERROR("A012013","报告版本号格式错误可包含中文、字母、数字、中划线点号长度不能超过50个字符");
private String code; private String code;
private String message; private String message;

View File

@@ -1,17 +1,11 @@
package com.njcn.gather.report.pojo.param; package com.njcn.gather.report.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.report.pojo.constant.ReportValidMessage;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/** /**
* @author caozehui * @author caozehui
* @data 2025-03-19 * @data 2025-03-19
@@ -20,13 +14,9 @@ import javax.validation.constraints.Pattern;
public class ReportParam { public class ReportParam {
@ApiModelProperty(value = "报告模板名称", required = true) @ApiModelProperty(value = "报告模板名称", required = true)
@NotBlank(message = ReportValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.REPORT_NAME_REGEX, message = ReportValidMessage.NAME_PATTERN_NOT_MATCH)
private String name; private String name;
@ApiModelProperty(value = "版本号", required = true) @ApiModelProperty(value = "版本号", required = true)
@NotBlank(message = ReportValidMessage.VERSION_NOT_BLANK)
@Pattern(regexp = PatternRegex.REPORT_VERSION_REGEX, message = ReportValidMessage.VERSION_PATTERN_NOT_MATCH)
private String version; private String version;
@ApiModelProperty(value = "描述信息", required = true) @ApiModelProperty(value = "描述信息", required = true)

View File

@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.gather.detection.pojo.vo.DetectionData; import com.njcn.gather.detection.pojo.vo.DetectionData;
@@ -66,6 +67,7 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.FileSystemResource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -179,6 +181,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
@Override @Override
@Transactional @Transactional
public boolean add(ReportParam reportParam) { public boolean add(ReportParam reportParam) {
this.checkPattern(reportParam);
this.checkRepeat(reportParam, false); this.checkRepeat(reportParam, false);
PqReport pqReport = new PqReport(); PqReport pqReport = new PqReport();
BeanUtils.copyProperties(reportParam, pqReport); BeanUtils.copyProperties(reportParam, pqReport);
@@ -189,9 +192,21 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
return this.save(pqReport); return this.save(pqReport);
} }
private void checkPattern(ReportParam reportParam) {
String name = reportParam.getName();
String version = reportParam.getVersion();
if (!Pattern.matches(PatternRegex.REPORT_NAME_REGEX, name)) {
throw new BusinessException(ReportResponseEnum.REPORT_NAME_PATTERN_ERROR);
}
if (!Pattern.matches(PatternRegex.REPORT_VERSION_REGEX, version)) {
throw new BusinessException(ReportResponseEnum.REPORT_VERSION_PATTERN_ERROR);
}
}
@Override @Override
@Transactional @Transactional
public boolean update(ReportParam.UpdateParam reportParam) { public boolean update(ReportParam.UpdateParam reportParam) {
this.checkPattern(reportParam);
this.checkRepeat(reportParam, true); this.checkRepeat(reportParam, true);
PqReport pqReport = new PqReport(); PqReport pqReport = new PqReport();
BeanUtils.copyProperties(reportParam, pqReport); BeanUtils.copyProperties(reportParam, pqReport);

View File

@@ -1,7 +1,7 @@
package com.njcn.gather.result.pojo.param; package com.njcn.gather.result.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -49,16 +49,16 @@ public class ResultParam {
public static class QueryParam { public static class QueryParam {
@ApiModelProperty(value = "检测计划Id", required = true) @ApiModelProperty(value = "检测计划Id", required = true)
@NotBlank(message = DevValidMessage.PLAN_ID_NOT_NULL) @NotBlank(message = DetectionValidMessage.PLAN_ID_NOT_NULL)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PLAN_ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
private String planId; private String planId;
// 脚本类型当为null时表示查询所有脚本类型否则只查询指定脚本类型 // 脚本类型当为null时表示查询所有脚本类型否则只查询指定脚本类型
private String scriptType; private String scriptType;
@ApiModelProperty(value = "设备Id", required = true) @ApiModelProperty(value = "设备Id", required = true)
@NotBlank(message = DevValidMessage.DEV_ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.DEV_ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_ID_FORMAT_ERROR)
private String deviceId; private String deviceId;
// 通道号,当为-1时表示查询所有通道号否则只查询指定通道号 // 通道号,当为-1时表示查询所有通道号否则只查询指定通道号
@@ -68,22 +68,22 @@ public class ResultParam {
@Data @Data
public static class ChangeErrorSystemParam { public static class ChangeErrorSystemParam {
@ApiModelProperty(value = "检测计划Id", required = true) @ApiModelProperty(value = "检测计划Id", required = true)
@NotBlank(message = DevValidMessage.PLAN_ID_NOT_NULL) @NotBlank(message = DetectionValidMessage.PLAN_ID_NOT_NULL)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PLAN_ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
private String planId; private String planId;
@ApiModelProperty(value = "脚本Id", required = true) @ApiModelProperty(value = "脚本Id", required = true)
@NotBlank(message = DevValidMessage.SCRIPT_ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.SCRIPT_ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.SCRIPT_ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SCRIPT_ID_FORMAT_ERROR)
private String scriptId; private String scriptId;
@ApiModelProperty(value = "误差体系Id", required = true) @ApiModelProperty(value = "误差体系Id", required = true)
@NotBlank(message = DevValidMessage.ERROR_SYS_ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ERROR_SYS_ID_NOT_BLANK)
private String errorSysId; private String errorSysId;
@ApiModelProperty(value = "设备Id", required = true) @ApiModelProperty(value = "设备Id", required = true)
@NotBlank(message = DevValidMessage.DEV_ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.DEV_ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_ID_FORMAT_ERROR)
private String deviceId; private String deviceId;
private String code; private String code;

View File

@@ -1,17 +0,0 @@
package com.njcn.gather.script.pojo.constant;
/**
* @author caozehui
* @data 2025-03-10
*/
public interface PqScriptValidMessage {
String INDEX_NOT_NULL = "index不能为空";
String VALUE_TYPE_NOT_BLANK = "脚本值类型不能为空";
String NAME_FORMAT_ERROR = "脚本名称格式错误只能包含字母、数字、中文、下划线、中划线、点号长度为1-50个字符";
String SCRIPT_VOLT_FORMAT_ERROR = "检测脚本额定电压格式错误请检查ratedVolt参数";
String SCRIPT_CURR_FORMAT_ERROR = "检测脚本额定电流格式错误请检查ratedCurr参数";
}

View File

@@ -1,8 +1,7 @@
package com.njcn.gather.script.pojo.param; package com.njcn.gather.script.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.gather.script.pojo.constant.PqScriptValidMessage;
import com.njcn.gather.system.pojo.constant.SystemValidMessage; import com.njcn.gather.system.pojo.constant.SystemValidMessage;
import com.njcn.web.pojo.annotation.DateTimeStrValid; import com.njcn.web.pojo.annotation.DateTimeStrValid;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
@@ -20,22 +19,22 @@ import javax.validation.constraints.*;
public class PqScriptParam { public class PqScriptParam {
@ApiModelProperty("名称") @ApiModelProperty("名称")
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.SCRIPT_NAME_REGEX, message = PqScriptValidMessage.NAME_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SCRIPT_NAME_REGEX, message = DetectionValidMessage.SCRIPT_NAME_FORMAT_ERROR)
private String name; private String name;
@ApiModelProperty("类型") @ApiModelProperty("类型")
@NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) @NotNull(message = DetectionValidMessage.SCRIPT_TYPE_NOT_BLANK)
@Min(value = 0, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.SCRIPT_TYPE_FORMAT_ERROR)
@Max(value = 1, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) @Max(value = 1, message = DetectionValidMessage.SCRIPT_TYPE_FORMAT_ERROR)
private Integer type; private Integer type;
/** /**
* 检测脚本模式,字典表(数字、模拟、比对) * 检测脚本模式,字典表(数字、模拟、比对)
*/ */
@ApiModelProperty("模式") @ApiModelProperty("模式")
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
private String pattern; private String pattern;
/** /**
@@ -45,13 +44,13 @@ public class PqScriptParam {
private String valueType; private String valueType;
@ApiModelProperty("参照标准名称") @ApiModelProperty("参照标准名称")
@NotBlank(message = DevValidMessage.STANDARD_NAME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.STANDARD_NAME_NOT_BLANK)
private String standardName; private String standardName;
@ApiModelProperty("标准推行时间") @ApiModelProperty("标准推行时间")
@NotBlank(message = DevValidMessage.STANDARD_TIME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.STANDARD_TIME_NOT_BLANK)
@DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR) @DateTimeStrValid(format = "yyyy", message = DetectionValidMessage.STANDARD_TIME_FORMAT_ERROR)
private String standardTime; private String standardTime;
@@ -59,18 +58,18 @@ public class PqScriptParam {
* 额定电压 * 额定电压
*/ */
@ApiModelProperty("额定电压") @ApiModelProperty("额定电压")
@NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) @NotNull(message = DetectionValidMessage.SCRIPT_TYPE_NOT_BLANK)
@Min(value = 0, message = PqScriptValidMessage.SCRIPT_VOLT_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.SCRIPT_VOLT_FORMAT_ERROR)
@Max(value = 380, message = PqScriptValidMessage.SCRIPT_VOLT_FORMAT_ERROR) @Max(value = 380, message = DetectionValidMessage.SCRIPT_VOLT_FORMAT_ERROR)
private Double ratedVolt; private Double ratedVolt;
/** /**
* 额定电流 * 额定电流
*/ */
@ApiModelProperty("额定电流") @ApiModelProperty("额定电流")
@NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) @NotNull(message = DetectionValidMessage.SCRIPT_TYPE_NOT_BLANK)
@Min(value = 0, message = PqScriptValidMessage.SCRIPT_CURR_FORMAT_ERROR) @Min(value = 0, message = DetectionValidMessage.SCRIPT_CURR_FORMAT_ERROR)
@Max(value = 20, message = PqScriptValidMessage.SCRIPT_CURR_FORMAT_ERROR) @Max(value = 20, message = DetectionValidMessage.SCRIPT_CURR_FORMAT_ERROR)
private Double ratedCurr; private Double ratedCurr;
@@ -87,8 +86,8 @@ public class PqScriptParam {
private String valueType; private String valueType;
@ApiModelProperty("模式") @ApiModelProperty("模式")
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
private String pattern; private String pattern;
} }
@@ -96,7 +95,7 @@ public class PqScriptParam {
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public static class UpdateParam extends PqScriptParam { public static class UpdateParam extends PqScriptParam {
@ApiModelProperty("检测脚本ID") @ApiModelProperty("检测脚本ID")
@NotBlank(message = DevValidMessage.ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = SystemValidMessage.ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = SystemValidMessage.ID_FORMAT_ERROR)
private String id; private String id;
} }

View File

@@ -1,10 +1,10 @@
package com.njcn.gather.script.pojo.param; package com.njcn.gather.script.pojo.param;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.*; import javax.validation.constraints.NotBlank;
/** /**
* @author caozehui * @author caozehui
@@ -14,7 +14,7 @@ import javax.validation.constraints.*;
public class ScriptParam { public class ScriptParam {
@ApiModelProperty("检测脚本id") @ApiModelProperty("检测脚本id")
@NotBlank(message = DevValidMessage.ID_FORMAT_ERROR) @NotBlank(message = DetectionValidMessage.ID_FORMAT_ERROR)
private String scriptId; private String scriptId;
@ApiModelProperty("检测脚本类型") @ApiModelProperty("检测脚本类型")

View File

@@ -1,9 +0,0 @@
package com.njcn.gather.source.pojo.constant;
/**
* @author caozehui
* @data 2025-03-07
*/
public interface PqSourceValidMessage {
String ID_NOT_BLANK = "检测源id不能为空";
}

View File

@@ -1,7 +1,7 @@
package com.njcn.gather.source.pojo.param; package com.njcn.gather.source.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -28,24 +28,24 @@ public class PqSourceParam {
/** /**
* 检测模式,字典表 * 检测模式,字典表
*/ */
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
private String pattern; private String pattern;
/** /**
* 检测源类型,字典表 * 检测源类型,字典表
*/ */
@ApiModelProperty(value = "检测源类型", required = true) @ApiModelProperty(value = "检测源类型", required = true)
@NotBlank(message = DevValidMessage.PQ_SOURCE_TYPE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PQ_SOURCE_TYPE_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PQ_SOURCE_TYPE_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PQ_SOURCE_TYPE_FORMAT_ERROR)
private String type; private String type;
/** /**
* 设备类型,字典表 * 设备类型,字典表
*/ */
@ApiModelProperty(value = "设备类型", required = true) @ApiModelProperty(value = "设备类型", required = true)
@NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK) @NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_TYPE_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR)
private String devType; private String devType;
@ApiModelProperty("源参数") @ApiModelProperty("源参数")
@@ -58,16 +58,16 @@ public class PqSourceParam {
private String name; private String name;
@ApiModelProperty("模式") @ApiModelProperty("模式")
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
private String pattern; private String pattern;
@ApiModelProperty(value = "检测源类型") @ApiModelProperty(value = "检测源类型")
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PQ_SOURCE_TYPE_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PQ_SOURCE_TYPE_FORMAT_ERROR)
private String type; private String type;
@ApiModelProperty(value = "设备类型") @ApiModelProperty(value = "设备类型")
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_TYPE_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR)
private String devType; private String devType;
} }
@@ -75,8 +75,8 @@ public class PqSourceParam {
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public static class UpdateParam extends PqSourceParam { public static class UpdateParam extends PqSourceParam {
@ApiModelProperty(value = "检测源ID", required = true) @ApiModelProperty(value = "检测源ID", required = true)
@NotBlank(message = DevValidMessage.ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
private String id; private String id;
} }
} }

View File

@@ -1,17 +0,0 @@
package com.njcn.gather.type.pojo.constant;
/**
* @author caozehui
* @data 2025-02-10
*/
public interface DevTypeValidMessage {
String ID_NOT_BLANK = "id不能为空请检查id参数";
String ID_FORMAT_ERROR = "id格式错误请检查id参数";
String NAME_NOT_BLANK = "名称不能为空";
String ICD_NOT_BLANK = "ICD不能为空";
String POWER_NOT_BLANK = "工作电源不能为空";
String VOLT_NOT_BLANK = "额定电压不能为空";
String CURR_NOT_BLANK = "额定电流不能为空";
String CHNS_NOT_BLANK = "通道数不能为空";
String DEV_CHNS_RANGE_ERROR = "通道数格式错误";
}

View File

@@ -1,8 +1,7 @@
package com.njcn.gather.type.pojo.param; package com.njcn.gather.type.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex; import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.device.pojo.constant.DevValidMessage; import com.njcn.gather.pojo.constant.DetectionValidMessage;
import com.njcn.gather.type.pojo.constant.DevTypeValidMessage;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -20,28 +19,28 @@ import javax.validation.constraints.Pattern;
@Data @Data
public class DevTypeParam { public class DevTypeParam {
@ApiModelProperty(value = "名称", required = true) @ApiModelProperty(value = "名称", required = true)
@NotBlank(message = DevTypeValidMessage.NAME_NOT_BLANK) @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
private String name; private String name;
@ApiModelProperty(value = "设备关联的ICD", required = true) @ApiModelProperty(value = "设备关联的ICD", required = true)
@NotBlank(message = DevTypeValidMessage.ICD_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ICD_NOT_BLANK)
private String icd; private String icd;
@ApiModelProperty(value = "工作电源", required = true) @ApiModelProperty(value = "工作电源", required = true)
@NotBlank(message = DevTypeValidMessage.POWER_NOT_BLANK) @NotBlank(message = DetectionValidMessage.POWER_NOT_BLANK)
private String power; private String power;
@ApiModelProperty(value = "额定电压", required = true) @ApiModelProperty(value = "额定电压", required = true)
@NotNull(message = DevTypeValidMessage.VOLT_NOT_BLANK) @NotNull(message = DetectionValidMessage.VOLT_NOT_BLANK)
private Double devVolt; private Double devVolt;
@ApiModelProperty(value = "额定电流", required = true) @ApiModelProperty(value = "额定电流", required = true)
@NotNull(message = DevTypeValidMessage.CURR_NOT_BLANK) @NotNull(message = DetectionValidMessage.CURR_NOT_BLANK)
private Double devCurr; private Double devCurr;
@ApiModelProperty(value = "通道数", required = true) @ApiModelProperty(value = "通道数", required = true)
@NotNull(message = DevTypeValidMessage.CHNS_NOT_BLANK) @NotNull(message = DetectionValidMessage.CHNS_NOT_BLANK)
@Min(value = 1, message = DevTypeValidMessage.DEV_CHNS_RANGE_ERROR) @Min(value = 1, message = DetectionValidMessage.DEV_CHNS_RANGE_ERROR)
private Integer devChns; private Integer devChns;
@ApiModelProperty(value = "报告模板") @ApiModelProperty(value = "报告模板")
@@ -66,8 +65,8 @@ public class DevTypeParam {
public static class UpdateParam extends DevTypeParam { public static class UpdateParam extends DevTypeParam {
@ApiModelProperty(value = "id", required = true) @ApiModelProperty(value = "id", required = true)
@NotBlank(message = DevTypeValidMessage.ID_NOT_BLANK) @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevTypeValidMessage.ID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
private String id; private String id;
} }
} }

View File

@@ -21,7 +21,13 @@ public enum SystemResponseEnum {
CODE_REPEAT("A01005", "该层级下已存在相同的编码"), CODE_REPEAT("A01005", "该层级下已存在相同的编码"),
CAN_NOT_DELETE_USED_DICT("A01006", "该字典在使用中,不能删除"), CAN_NOT_DELETE_USED_DICT("A01006", "该字典在使用中,不能删除"),
CAN_NOT_UPDATE_USED_DICT("A01007", "该字典在使用中,不能修改"), CAN_NOT_UPDATE_USED_DICT("A01007", "该字典在使用中,不能修改"),
LOG_RECORD_FAILED("A01008", "日志记录失败"); LOG_RECORD_FAILED("A01008", "日志记录失败"),
GET_MAC_ADDRESS_FAILED("A01040", "获取本机MAC地址失败"),
REGISTRATION_CODE_FORMAT_ERROR("A01041", "注册码格式错误"),
MAC_ADDRESS_NOT_MATCH("A01042","注册码中的MAC地址与本机MAC地址不匹配"),
REGISTRATION_CODE_EXPIRED("A01043","注册码已过期"),;
private final String code; private final String code;

View File

@@ -1,24 +0,0 @@
package com.njcn.gather.system.reg.pojo.enums;
import lombok.Getter;
/**
* @author caozehui
* @data 2025-02-11
*/
@Getter
public enum RegResponseEnum {
GET_MAC_ADDRESS_FAILED("A005001", "获取本机MAC地址失败"),
REGISTRATION_CODE_FORMAT_ERROR("A005002", "注册码格式错误"),
MAC_ADDRESS_NOT_MATCH("A005003","注册码中的MAC地址与本机MAC地址不匹配"),
REGISTRATION_CODE_EXPIRED("A005004","注册码已过期"),;
private final String code;
private final String message;
RegResponseEnum(String code, String message) {
this.message = message;
this.code = code;
}
}

View File

@@ -12,9 +12,9 @@ import com.njcn.gather.system.cfg.service.ISysTestConfigService;
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum; import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
import com.njcn.gather.system.dictionary.pojo.po.DictData; import com.njcn.gather.system.dictionary.pojo.po.DictData;
import com.njcn.gather.system.dictionary.service.IDictDataService; import com.njcn.gather.system.dictionary.service.IDictDataService;
import com.njcn.gather.system.pojo.enums.SystemResponseEnum;
import com.njcn.gather.system.reg.mapper.SysRegResMapper; import com.njcn.gather.system.reg.mapper.SysRegResMapper;
import com.njcn.gather.system.reg.pojo.dto.RegInfoData; import com.njcn.gather.system.reg.pojo.dto.RegInfoData;
import com.njcn.gather.system.reg.pojo.enums.RegResponseEnum;
import com.njcn.gather.system.reg.pojo.enums.RegStatusEnum; import com.njcn.gather.system.reg.pojo.enums.RegStatusEnum;
import com.njcn.gather.system.reg.pojo.param.SysRegResParam; import com.njcn.gather.system.reg.pojo.param.SysRegResParam;
import com.njcn.gather.system.reg.pojo.po.SysRegRes; import com.njcn.gather.system.reg.pojo.po.SysRegRes;
@@ -102,7 +102,7 @@ public class SysRegResServiceImpl extends ServiceImpl<SysRegResMapper, SysRegRes
// 对比Mac地址 // 对比Mac地址
String mac = getMAC(); String mac = getMAC();
if (!mac.equals(regInfoData.getMacAddress())) { if (!mac.equals(regInfoData.getMacAddress())) {
throw new BusinessException(RegResponseEnum.MAC_ADDRESS_NOT_MATCH); throw new BusinessException(SystemResponseEnum.MAC_ADDRESS_NOT_MATCH);
} }
List<String> expireDateList = regInfoData.getExpireDateList(); List<String> expireDateList = regInfoData.getExpireDateList();
@@ -112,7 +112,7 @@ public class SysRegResServiceImpl extends ServiceImpl<SysRegResMapper, SysRegRes
// 比对到期日期 // 比对到期日期
String maxExpireDate = expireDateList.stream().max((a, b) -> a.compareTo(b)).get(); String maxExpireDate = expireDateList.stream().max((a, b) -> a.compareTo(b)).get();
if (LocalDate.parse(maxExpireDate).isBefore(LocalDate.now())) { if (LocalDate.parse(maxExpireDate).isBefore(LocalDate.now())) {
throw new BusinessException(RegResponseEnum.REGISTRATION_CODE_EXPIRED); throw new BusinessException(SystemResponseEnum.REGISTRATION_CODE_EXPIRED);
} }
sysTestConfigService.addTestConfig(regInfoData.getScene()); sysTestConfigService.addTestConfig(regInfoData.getScene());
@@ -254,7 +254,7 @@ public class SysRegResServiceImpl extends ServiceImpl<SysRegResMapper, SysRegRes
try { try {
inetAddress = InetAddress.getLocalHost(); inetAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
throw new BusinessException(RegResponseEnum.GET_MAC_ADDRESS_FAILED); throw new BusinessException(SystemResponseEnum.GET_MAC_ADDRESS_FAILED);
} }
return NetUtil.getMacAddress(inetAddress); return NetUtil.getMacAddress(inetAddress);
} }
@@ -311,11 +311,11 @@ public class SysRegResServiceImpl extends ServiceImpl<SysRegResMapper, SysRegRes
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
RegInfoData regInfoData = objectMapper.readValue(decodedString, RegInfoData.class); RegInfoData regInfoData = objectMapper.readValue(decodedString, RegInfoData.class);
if (ObjectUtil.isNull(regInfoData) || ObjectUtil.isNull(regInfoData.getScene()) || regInfoData.getTypeList().size() == 0 || regInfoData.getTypeList().size() != regInfoData.getExpireDateList().size()) { if (ObjectUtil.isNull(regInfoData) || ObjectUtil.isNull(regInfoData.getScene()) || regInfoData.getTypeList().size() == 0 || regInfoData.getTypeList().size() != regInfoData.getExpireDateList().size()) {
throw new BusinessException(RegResponseEnum.REGISTRATION_CODE_FORMAT_ERROR); throw new BusinessException(SystemResponseEnum.REGISTRATION_CODE_FORMAT_ERROR);
} }
return regInfoData; return regInfoData;
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(RegResponseEnum.REGISTRATION_CODE_FORMAT_ERROR); throw new BusinessException(SystemResponseEnum.REGISTRATION_CODE_FORMAT_ERROR);
} }
} }
} }