diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/param/SimulateDetectionParam.java b/detection/src/main/java/com/njcn/gather/detection/pojo/param/SimulateDetectionParam.java index 519e7aaa..b1b9c63d 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/param/SimulateDetectionParam.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/param/SimulateDetectionParam.java @@ -1,8 +1,6 @@ package com.njcn.gather.detection.pojo.param; -import com.njcn.gather.script.pojo.constant.PqScriptValidMessage; -import com.njcn.gather.source.pojo.constant.PqSourceValidMessage; -import io.swagger.annotations.ApiModelProperty; +import com.njcn.gather.pojo.constant.DetectionValidMessage; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -31,12 +29,12 @@ public class SimulateDetectionParam { */ private String scriptId; - @NotNull(message = PqScriptValidMessage.INDEX_NOT_NULL) + @NotNull(message = DetectionValidMessage.INDEX_NOT_NULL) private Integer scriptIndex; /** * 源id */ - @NotBlank(message = PqSourceValidMessage.ID_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.SOURCE_ID_NOT_BLANK) private String sourceId; } diff --git a/detection/src/main/java/com/njcn/gather/device/pojo/param/PqDevParam.java b/detection/src/main/java/com/njcn/gather/device/pojo/param/PqDevParam.java index 63a1c562..976719a3 100644 --- a/detection/src/main/java/com/njcn/gather/device/pojo/param/PqDevParam.java +++ b/detection/src/main/java/com/njcn/gather/device/pojo/param/PqDevParam.java @@ -2,7 +2,7 @@ package com.njcn.gather.device.pojo.param; import com.njcn.common.pojo.constant.PatternRegex; 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.param.BaseParam; import io.swagger.annotations.ApiModelProperty; @@ -25,13 +25,13 @@ public class PqDevParam { private String name; @ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true) - @NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR) private String pattern; @ApiModelProperty(value = "设备类型,字典表", required = true) - @NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_TYPE_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR) private String devType; @ApiModelProperty(value = "设备厂家,字典表", required = true) @@ -41,7 +41,7 @@ public class PqDevParam { private String createDate; @ApiModelProperty(value = "设备序列号", required = true) - @NotBlank(message = DevValidMessage.FACTORYNO_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK) private String createId; @ApiModelProperty(value = "固件版本", required = true) @@ -51,24 +51,24 @@ public class PqDevParam { private String softwareVersion; @ApiModelProperty(value = "通讯协议", required = true) - @NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PROTOCOL_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PROTOCOL_FORMAT_ERROR) private String protocol; @ApiModelProperty(value = "IP地址", required = true) - @NotBlank(message = DevValidMessage.IP_NOT_BLANK) - @Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.IP_NOT_BLANK) + @Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR) private String ip; @ApiModelProperty(value = "端口号", required = true) - @NotNull(message = DevValidMessage.PORT_NOT_NULL) - @Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR) + @NotNull(message = DetectionValidMessage.PORT_NOT_NULL) + @Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR) private Integer port; @ApiModelProperty(value = "装置是否为加密版本", required = true) - @NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL) - @Min(value = 0, message = DevValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR) - @Max(value = 1, message = DevValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR) + @NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL) + @Min(value = 0, message = DetectionValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR) + @Max(value = 1, message = DetectionValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR) private Integer encryptionFlag; @ApiModelProperty("装置识别码(3ds加密)") @@ -81,7 +81,7 @@ public class PqDevParam { private String sampleId; @ApiModelProperty(value = "送样日期") - @DateTimeStrValid(message = DevValidMessage.ARRIVE_DATE_FORMAT_ERROR) + @DateTimeStrValid(message = DetectionValidMessage.ARRIVE_DATE_FORMAT_ERROR) private String arrivedDate; @ApiModelProperty("所属地市名称") @@ -100,13 +100,13 @@ public class PqDevParam { private String qrCode; @ApiModelProperty(value = "检测次数,默认为0", required = true) - @NotNull(message = DevValidMessage.RECHECK_NUM_NOT_NULL) - @Min(value = 0, message = DevValidMessage.RECHECK_NUM_FORMAT_ERROR) + @NotNull(message = DetectionValidMessage.RECHECK_NUM_NOT_NULL) + @Min(value = 0, message = DetectionValidMessage.RECHECK_NUM_FORMAT_ERROR) private Integer reCheckNum; @ApiModelProperty("是否支持系数校准") - @Min(value = 0, message = DevValidMessage.FACTOR_FLAG_FORMAT_ERROR) - @Max(value = 1, message = DevValidMessage.FACTOR_FLAG_FORMAT_ERROR) + @Min(value = 0, message = DetectionValidMessage.FACTOR_FLAG_FORMAT_ERROR) + @Max(value = 1, message = DetectionValidMessage.FACTOR_FLAG_FORMAT_ERROR) private String factorFlag; @ApiModelProperty("监测点台账列表") @@ -127,8 +127,8 @@ public class PqDevParam { public static class UpdateParam extends PqDevParam { @ApiModelProperty(value = "id", required = true) - @NotBlank(message = DevValidMessage.ID_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR) private String id; } @@ -152,17 +152,17 @@ public class PqDevParam { @ApiModelProperty("检测状态列表") private List< - @Min(value = 0, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR) - @Max(value = 3, message = DevValidMessage.CHECK_STATE_FORMAT_ERROR) Integer> checkStateList; + @Min(value = 0, message = DetectionValidMessage.CHECK_STATE_FORMAT_ERROR) + @Max(value = 3, message = DetectionValidMessage.CHECK_STATE_FORMAT_ERROR) Integer> checkStateList; @ApiModelProperty("检测结果") - @Min(value = 0, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR) - @Max(value = 2, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR) + @Min(value = 0, message = DetectionValidMessage.CHECK_RESULT_FORMAT_ERROR) + @Max(value = 2, message = DetectionValidMessage.CHECK_RESULT_FORMAT_ERROR) private Integer checkResult; @ApiModelProperty("报告状态") - @Min(value = 0, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR) - @Max(value = 2, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR) + @Min(value = 0, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR) + @Max(value = 2, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR) private Integer reportState; } @@ -170,23 +170,23 @@ public class PqDevParam { @Data public static class DeleteParam { @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) - @NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.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) + @NotNull(message = DetectionValidMessage.PLAN_ID_NOT_NULL) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR) private String planId; @ApiModelProperty("被检设备ID列表") - @NotNull(message = DevValidMessage.PQ_DEV_IDS_NOT_NULL) + @NotNull(message = DetectionValidMessage.PQ_DEV_IDS_NOT_NULL) private List pqDevIds; } } diff --git a/detection/src/main/java/com/njcn/gather/device/pojo/vo/CNDevExcel.java b/detection/src/main/java/com/njcn/gather/device/pojo/vo/CNDevExcel.java index 84f681f6..64c61cfd 100644 --- a/detection/src/main/java/com/njcn/gather/device/pojo/vo/CNDevExcel.java +++ b/detection/src/main/java/com/njcn/gather/device/pojo/vo/CNDevExcel.java @@ -2,9 +2,8 @@ package com.njcn.gather.device.pojo.vo; import cn.afterturn.easypoi.excel.annotation.Excel; 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.EqualsAndHashCode; import org.hibernate.validator.constraints.Range; import javax.validation.constraints.NotBlank; @@ -19,24 +18,24 @@ import javax.validation.constraints.Pattern; public class CNDevExcel { @Excel(name = "预投计划*", width = 20, orderNum = "1") - @NotBlank(message = DevValidMessage.PREINVESTMENT_PLAN_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.PREINVESTMENT_PLAN_NOT_BLANK) private String preinvestmentPlan; @Excel(name = "设备编号(开始编号-结束编号,编号为数字)*", width = 50, orderNum = "2") - @NotBlank(message = DevValidMessage.NAME_NOT_BLANK) - @Pattern(regexp = PatternRegex.CN_DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK) + @Pattern(regexp = PatternRegex.CN_DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR) private String name; @Excel(name = "设备类型*", width = 20, orderNum = "3") - @NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK) private String devType; @Excel(name = "通讯协议*", width = 15, orderNum = "4") - @NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK) private String protocol; @Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "5") - @NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL) + @NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL) private Integer encryptionFlag; @Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "6") @@ -49,12 +48,12 @@ public class CNDevExcel { private Integer factorFlag; @Excel(name = "IP地址*", width = 20, orderNum = "9") - @NotBlank(message = DevValidMessage.IP_NOT_BLANK) - @Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.IP_NOT_BLANK) + @Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR) private String ip; @Excel(name = "端口号*", width = 15, orderNum = "10") - @NotNull(message = DevValidMessage.PORT_NOT_NULL) - @Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR) + @NotNull(message = DetectionValidMessage.PORT_NOT_NULL) + @Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR) private Integer port; } diff --git a/detection/src/main/java/com/njcn/gather/device/pojo/vo/ProvinceDevExcel.java b/detection/src/main/java/com/njcn/gather/device/pojo/vo/ProvinceDevExcel.java index 664f72ca..2d0062fc 100644 --- a/detection/src/main/java/com/njcn/gather/device/pojo/vo/ProvinceDevExcel.java +++ b/detection/src/main/java/com/njcn/gather/device/pojo/vo/ProvinceDevExcel.java @@ -2,8 +2,7 @@ package com.njcn.gather.device.pojo.vo; import cn.afterturn.easypoi.excel.annotation.Excel; import com.njcn.common.pojo.constant.PatternRegex; -import com.njcn.gather.device.pojo.constant.DevValidMessage; -import com.njcn.web.pojo.annotation.DateTimeStrValid; +import com.njcn.gather.pojo.constant.DetectionValidMessage; import lombok.Data; import org.hibernate.validator.constraints.Range; @@ -24,24 +23,24 @@ public class ProvinceDevExcel implements Serializable { private static final long serialVersionUID = 1L; @Excel(name = "装置编号*", width = 20) - @NotBlank(message = DevValidMessage.FACTORYNO_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK) private String createId; @Excel(name = "设备名称*", width = 20, orderNum = "2") - @NotBlank(message = DevValidMessage.NAME_NOT_BLANK) - @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK) + @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR) private String name; @Excel(name = "设备类型*", width = 20, orderNum = "3") - @NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK) private String devType; @Excel(name = "设备厂家*", width = 20, orderNum = "7") - @NotBlank(message = DevValidMessage.MANUFACTURER_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK) private String manufacturer; @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; @Excel(name = "固件版本", width = 15, orderNum = "9") @@ -51,11 +50,11 @@ public class ProvinceDevExcel implements Serializable { private String softwareVersion; @Excel(name = "通讯协议*", width = 15, orderNum = "11") - @NotBlank(message = DevValidMessage.PROTOCOL_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK) private String protocol; @Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "12") - @NotNull(message = DevValidMessage.ENCRYPTION_NOT_NULL) + @NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL) private Integer encryptionFlag; @Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "13") @@ -68,12 +67,12 @@ public class ProvinceDevExcel implements Serializable { private Integer factorFlag; @Excel(name = "IP地址*", width = 20, orderNum = "16") - @NotBlank(message = DevValidMessage.IP_NOT_BLANK) - @Pattern(regexp = PatternRegex.IP_REGEX, message = DevValidMessage.IP_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.IP_NOT_BLANK) + @Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR) private String ip; @Excel(name = "端口号*", width = 15, orderNum = "17") - @NotNull(message = DevValidMessage.PORT_NOT_NULL) - @Range(min = 1, max = 65535, message = DevValidMessage.PORT_RANGE_ERROR) + @NotNull(message = DetectionValidMessage.PORT_NOT_NULL) + @Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR) private Integer port; } diff --git a/detection/src/main/java/com/njcn/gather/err/pojo/param/PqErrSysDtlsParam.java b/detection/src/main/java/com/njcn/gather/err/pojo/param/PqErrSysDtlsParam.java index 6df06024..4738d1c2 100644 --- a/detection/src/main/java/com/njcn/gather/err/pojo/param/PqErrSysDtlsParam.java +++ b/detection/src/main/java/com/njcn/gather/err/pojo/param/PqErrSysDtlsParam.java @@ -1,7 +1,7 @@ package com.njcn.gather.err.pojo.param; 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 lombok.Data; @@ -17,13 +17,13 @@ import javax.validation.constraints.Pattern; public class PqErrSysDtlsParam { @ApiModelProperty(value = "误差项类型", required = true) - @NotBlank(message = DevValidMessage.ERR_SYS_DTLS_ERROR_TYPE_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERR_SYS_DTLS_ERROR_TYPE_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.ERR_SYS_DTLS_ERROR_TYPE_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ERR_SYS_DTLS_ERROR_TYPE_FORMAT_ERROR) private String errorType; @ApiModelProperty(value = "脚本项类型", required = true) - @NotBlank(message = DevValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_FORMAT_ERROR) private String scriptType; @ApiModelProperty(value = "误差判断起始值", required = true) @@ -47,15 +47,15 @@ public class PqErrSysDtlsParam { private Integer conditionType; @ApiModelProperty(value = "最大值误差", required = true) - @NotNull(message = DevValidMessage.MAX_ERROR_VALUE_NOT_NULL) + @NotNull(message = DetectionValidMessage.MAX_ERROR_VALUE_NOT_NULL) private Double maxErrorValue; @ApiModelProperty(value = "误差值类型", required = true) - @NotNull(message = DevValidMessage.ERROR_VALUE_TYPE_NOT_BLANK) + @NotNull(message = DetectionValidMessage.ERROR_VALUE_TYPE_NOT_BLANK) private Integer errorValueType; @ApiModelProperty("排序") - @NotNull(message = DevValidMessage.SORT_NOT_NULL) + @NotNull(message = DetectionValidMessage.SORT_NOT_NULL) private Integer sort; } diff --git a/detection/src/main/java/com/njcn/gather/err/pojo/param/PqErrSysParam.java b/detection/src/main/java/com/njcn/gather/err/pojo/param/PqErrSysParam.java index 72563919..4c6e6f6d 100644 --- a/detection/src/main/java/com/njcn/gather/err/pojo/param/PqErrSysParam.java +++ b/detection/src/main/java/com/njcn/gather/err/pojo/param/PqErrSysParam.java @@ -1,7 +1,7 @@ package com.njcn.gather.err.pojo.param; 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.param.BaseParam; import io.swagger.annotations.ApiModelProperty; @@ -20,24 +20,24 @@ import java.util.List; public class PqErrSysParam { @ApiModelProperty(value = "参照标准名称", required = true) - @NotBlank(message = DevValidMessage.STANDARD_NAME_NOT_BLANK) - @Pattern(regexp = PatternRegex.ERR_SYS_NAME, message = DevValidMessage.STANDARD_NAME_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.STANDARD_NAME_NOT_BLANK) + @Pattern(regexp = PatternRegex.ERR_SYS_NAME, message = DetectionValidMessage.STANDARD_NAME_FORMAT_ERROR) private String standardName; @ApiModelProperty(value = "标准实施年份", required = true) - @NotBlank(message = DevValidMessage.STANDARD_TIME_NOT_BLANK) - @DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.STANDARD_TIME_NOT_BLANK) + @DateTimeStrValid(format = "yyyy", message = DetectionValidMessage.STANDARD_TIME_FORMAT_ERROR) private String standardTime; @ApiModelProperty(value = "设备等级", required = true) - @NotBlank(message = DevValidMessage.DEV_LEVEL_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_LEVEL_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.DEV_LEVEL_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_LEVEL_FORMAT_ERROR) private String devLevel; @ApiModelProperty("状态") - @NotNull(message = DevValidMessage.ENABLE_NOT_NULL) - @Min(value = 0, message = DevValidMessage.ENABLE_FORMAT_ERROR) - @Max(value = 1, message = DevValidMessage.ENABLE_FORMAT_ERROR) + @NotNull(message = DetectionValidMessage.ENABLE_NOT_NULL) + @Min(value = 0, message = DetectionValidMessage.ENABLE_FORMAT_ERROR) + @Max(value = 1, message = DetectionValidMessage.ENABLE_FORMAT_ERROR) private Integer enable; @ApiModelProperty(value = "误差详情列表", required = true) @@ -48,11 +48,11 @@ public class PqErrSysParam { @EqualsAndHashCode(callSuper = false) public static class QueryParam extends BaseParam { @ApiModelProperty("标准实施年份") - @DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR) + @DateTimeStrValid(format = "yyyy", message = DetectionValidMessage.STANDARD_TIME_FORMAT_ERROR) private String standardTime; @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; } @@ -60,14 +60,14 @@ public class PqErrSysParam { @EqualsAndHashCode(callSuper = false) public static class UpdateParam extends PqErrSysParam { @ApiModelProperty("id") - @NotBlank(message = DevValidMessage.ID_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR) private String id; } @Data @EqualsAndHashCode(callSuper = false) - public static class DetectionParam{ + public static class DetectionParam { @ApiModelProperty("所属误差体系ID") private String errorSysId; diff --git a/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java b/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java index 311bdd03..d230e361 100644 --- a/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java @@ -68,6 +68,7 @@ public class PqErrSysServiceImpl extends ServiceImpl i @Override @Transactional public boolean addPqErrSys(PqErrSysParam param) { + this.checkRepeat(param, false); PqErrSys pqErrSys = new PqErrSys(); BeanUtils.copyProperties(param, pqErrSys); String id = UUID.randomUUID().toString().replaceAll("-", ""); @@ -80,9 +81,11 @@ public class PqErrSysServiceImpl extends ServiceImpl i return result1 && result2; } + @Override @Transactional public boolean updatePqErrSys(PqErrSysParam.UpdateParam param) { + this.checkRepeat(param, true); PqErrSys pqErrSys = new PqErrSys(); BeanUtils.copyProperties(param, pqErrSys); pqErrSys.setName(generateErrSysName(param)); @@ -123,7 +126,9 @@ public class PqErrSysServiceImpl extends ServiceImpl i @Override public List> listAllPqErrSys() { - List pqErrSysList = this.lambdaQuery().eq(PqErrSys::getState, DataStateEnum.ENABLE.getCode()).list(); + List pqErrSysList = this.lambdaQuery() + .eq(PqErrSys::getEnable,DataStateEnum.ENABLE.getCode()) + .eq(PqErrSys::getState, DataStateEnum.ENABLE.getCode()).list(); List> result = pqErrSysList.stream().map(pqErrSys -> { Map map = new HashMap<>(); map.put("id", pqErrSys.getId()); @@ -203,15 +208,25 @@ public class PqErrSysServiceImpl extends ServiceImpl i } /** - * 生成误差体系名称(标准号+年份+设备等级) + * 检查重复 * - * @return 检测源名称 + * @param param 检测参数 + * @param isExcludeSelf 是否排除自己 */ - private String generatePqSourceName(PqErrSysParam param) { - DictData devLevel = dictDataService.getDictDataById(param.getDevLevel()); - if (ObjectUtils.allNotNull(param.getStandardName(), param.getStandardTime(), devLevel)) { - return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevel.getName(); + private void checkRepeat(PqErrSysParam param, boolean isExcludeSelf) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("Standard_Name", param.getStandardName()) + .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); } } diff --git a/detection/src/main/java/com/njcn/gather/icd/pojo/constant/PqIcdPathValidMessage.java b/detection/src/main/java/com/njcn/gather/icd/pojo/constant/PqIcdPathValidMessage.java deleted file mode 100644 index 3aba9ad3..00000000 --- a/detection/src/main/java/com/njcn/gather/icd/pojo/constant/PqIcdPathValidMessage.java +++ /dev/null @@ -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路径格式错误"; -} diff --git a/detection/src/main/java/com/njcn/gather/icd/pojo/param/PqIcdPathParam.java b/detection/src/main/java/com/njcn/gather/icd/pojo/param/PqIcdPathParam.java index b7f3b521..8e054ba7 100644 --- a/detection/src/main/java/com/njcn/gather/icd/pojo/param/PqIcdPathParam.java +++ b/detection/src/main/java/com/njcn/gather/icd/pojo/param/PqIcdPathParam.java @@ -1,8 +1,7 @@ package com.njcn.gather.icd.pojo.param; import com.njcn.common.pojo.constant.PatternRegex; -import com.njcn.gather.icd.pojo.constant.PqIcdPathValidMessage; -import com.njcn.gather.type.pojo.constant.DevTypeValidMessage; +import com.njcn.gather.pojo.constant.DetectionValidMessage; import com.njcn.web.pojo.param.BaseParam; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -18,13 +17,13 @@ import javax.validation.constraints.Pattern; @Data public class PqIcdPathParam { @ApiModelProperty(value = "名称", required = true) - @NotBlank(message = PqIcdPathValidMessage.NAME_NOT_BLANK) - @Pattern(regexp = PatternRegex.ICD_NAME_REGEX, message = PqIcdPathValidMessage.NAME_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK) + @Pattern(regexp = PatternRegex.ICD_NAME_REGEX, message = DetectionValidMessage.ICD_NAME_FORMAT_ERROR) private String name; @ApiModelProperty(value = "存储路径", required = true) - @NotBlank(message = PqIcdPathValidMessage.PATH_NOT_BLANK) - @Pattern(regexp = PatternRegex.ICD_PATH_REGEX, message = PqIcdPathValidMessage.PATH_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.ICD_PATH_NOT_BLANK) + @Pattern(regexp = PatternRegex.ICD_PATH_REGEX, message = DetectionValidMessage.ICD_PATH_FORMAT_ERROR) private String path; /** @@ -45,8 +44,8 @@ public class PqIcdPathParam { @EqualsAndHashCode(callSuper = true) public static class UpdateParam extends PqIcdPathParam { @ApiModelProperty(value = "id", required = true) - @NotBlank(message = PqIcdPathValidMessage.ID_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = PqIcdPathValidMessage.ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR) private String id; } } diff --git a/detection/src/main/java/com/njcn/gather/monitor/pojo/param/PqMonitorParam.java b/detection/src/main/java/com/njcn/gather/monitor/pojo/param/PqMonitorParam.java index f04c1214..aa220478 100644 --- a/detection/src/main/java/com/njcn/gather/monitor/pojo/param/PqMonitorParam.java +++ b/detection/src/main/java/com/njcn/gather/monitor/pojo/param/PqMonitorParam.java @@ -1,10 +1,9 @@ package com.njcn.gather.monitor.pojo.param; 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 lombok.Data; -import lombok.EqualsAndHashCode; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @@ -21,24 +20,24 @@ public class PqMonitorParam { private String code; @ApiModelProperty(value = "所属母线") - @NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK) private String name; @ApiModelProperty(value = "监测点序号") - @NotNull(message = DevValidMessage.MONITOR_NUM_NOT_NULL) + @NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL) private Integer num; @ApiModelProperty(value = "PT变比") - @NotNull(message = DevValidMessage.PT_NOT_NULL) + @NotNull(message = DetectionValidMessage.PT_NOT_NULL) private Float pt; @ApiModelProperty(value = "CT变比") - @NotNull(message = DevValidMessage.CT_NOT_NULL) + @NotNull(message = DetectionValidMessage.CT_NOT_NULL) private Float ct; @ApiModelProperty(value = "接线方式") - @NotBlank(message = DevValidMessage.WIRING_TYPE_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.WIRING_TYPE_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.WIRING_TYPE_FORMAT_ERROR) private String ptType; } diff --git a/detection/src/main/java/com/njcn/gather/monitor/pojo/vo/PqMonitorExcel.java b/detection/src/main/java/com/njcn/gather/monitor/pojo/vo/PqMonitorExcel.java index 62d0c792..ffc4ac75 100644 --- a/detection/src/main/java/com/njcn/gather/monitor/pojo/vo/PqMonitorExcel.java +++ b/detection/src/main/java/com/njcn/gather/monitor/pojo/vo/PqMonitorExcel.java @@ -2,7 +2,7 @@ package com.njcn.gather.monitor.pojo.vo; import cn.afterturn.easypoi.excel.annotation.Excel; 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.EqualsAndHashCode; @@ -18,24 +18,24 @@ import javax.validation.constraints.Pattern; public class PqMonitorExcel { @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; @Excel(name = "所属母线", width = 20, orderNum = "2") - @NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK) private String name; @Excel(name = "PT变比", width = 20, orderNum = "3") - @NotNull(message = DevValidMessage.PT_NOT_NULL) + @NotNull(message = DetectionValidMessage.PT_NOT_NULL) private Float pt; @Excel(name = "CT变比", width = 20, orderNum = "4") - @NotNull(message = DevValidMessage.CT_NOT_NULL) + @NotNull(message = DetectionValidMessage.CT_NOT_NULL) private Float ct; @Excel(name = "接线方式", width = 20, orderNum = "5") - @NotBlank(message = DevValidMessage.WIRING_TYPE_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.WIRING_TYPE_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.WIRING_TYPE_FORMAT_ERROR) private String ptType; @Data diff --git a/detection/src/main/java/com/njcn/gather/plan/pojo/param/AdPlanParam.java b/detection/src/main/java/com/njcn/gather/plan/pojo/param/AdPlanParam.java index 4fb55e84..e919068a 100644 --- a/detection/src/main/java/com/njcn/gather/plan/pojo/param/AdPlanParam.java +++ b/detection/src/main/java/com/njcn/gather/plan/pojo/param/AdPlanParam.java @@ -1,13 +1,11 @@ package com.njcn.gather.plan.pojo.param; 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 io.swagger.annotations.ApiModelProperty; -import io.swagger.models.auth.In; import lombok.Data; import lombok.EqualsAndHashCode; -import org.springframework.web.bind.annotation.RequestParam; import javax.validation.constraints.*; import java.util.List; @@ -20,45 +18,45 @@ import java.util.List; public class AdPlanParam { @ApiModelProperty(value = "名称", required = true) - @NotBlank(message = DevValidMessage.NAME_NOT_BLANK) - @Pattern(regexp = PatternRegex.PLAN_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK) + @Pattern(regexp = PatternRegex.PLAN_NAME_REGEX, message = DetectionValidMessage.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) + @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.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 = DetectionValidMessage.SOURCE_IDS_NOT_EMPTY) + private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SOURCE_ID_FORMAT_ERROR) String> sourceIds; @ApiModelProperty(value = "数据源ID列表", required = true) - @NotEmpty(message = DevValidMessage.DATASOURCE_ID_NOT_EMPTY) + @NotEmpty(message = DetectionValidMessage.DATASOURCE_ID_NOT_EMPTY) private List datasourceIds; @ApiModelProperty(value = "检测脚本ID", required = true) - @NotBlank(message = DevValidMessage.SCRIPT_ID_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.SCRIPT_ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.SCRIPT_ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.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) + @NotBlank(message = DetectionValidMessage.ERROR_SYS_ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.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) + @NotNull(message = DetectionValidMessage.TIME_CHECK_NOT_NULL) + @Min(value = 0, message = DetectionValidMessage.TIME_CHECK_FORMAT_ERROR) + @Max(value = 1, message = DetectionValidMessage.TIME_CHECK_FORMAT_ERROR) private Integer timeCheck; @ApiModelProperty("被检设备ID列表") - @NotNull(message = DevValidMessage.PQ_DEV_IDS_NOT_NULL) + @NotNull(message = DetectionValidMessage.PQ_DEV_IDS_NOT_NULL) private List devIds; @ApiModelProperty(value = "是否关联报告") @@ -74,27 +72,27 @@ public class AdPlanParam { @EqualsAndHashCode(callSuper = true) public static class QueryParam extends BaseParam { @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; @ApiModelProperty(value = "模式,字典表(数字、模拟、比对)") - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) - @NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.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) + @Min(value = 0, message = DetectionValidMessage.TEST_STATE_FORMAT_ERROR) + @Max(value = 2, message = DetectionValidMessage.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) + @Min(value = 0, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR) + @Max(value = 2, message = DetectionValidMessage.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) + @Min(value = 0, message = DetectionValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR) + @Max(value = 2, message = DetectionValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR) private Integer result; } @@ -102,13 +100,13 @@ public class AdPlanParam { @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) + @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR) private String id; } @Data - public static class CheckParam{ + public static class CheckParam { // 0:不合格项复检 1:全部复检 private Integer reCheckType; private String planId; diff --git a/detection/src/main/java/com/njcn/gather/plan/pojo/vo/AdPlanExcel.java b/detection/src/main/java/com/njcn/gather/plan/pojo/vo/AdPlanExcel.java index b50dd3c0..c156674d 100644 --- a/detection/src/main/java/com/njcn/gather/plan/pojo/vo/AdPlanExcel.java +++ b/detection/src/main/java/com/njcn/gather/plan/pojo/vo/AdPlanExcel.java @@ -1,20 +1,11 @@ package com.njcn.gather.plan.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.pojo.constant.DevValidMessage; -import com.njcn.gather.device.pojo.vo.CNDevExcel; -import com.njcn.web.pojo.annotation.DateTimeStrValid; +import com.njcn.gather.pojo.constant.DetectionValidMessage; import lombok.Data; -import lombok.EqualsAndHashCode; -import org.hibernate.validator.constraints.Range; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import java.time.LocalDate; -import java.util.List; /** * @author caozehui @@ -23,38 +14,38 @@ import java.util.List; @Data public class AdPlanExcel { @Excel(name = "名称*", width = 40, needMerge = true, orderNum = "0") - @NotBlank(message = DevValidMessage.NAME_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK) private String name; @Excel(name = "检测源*", width = 40, needMerge = true, orderNum = "1") - @NotBlank(message = DevValidMessage.SOURC_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.SOURC_NOT_BLANK) private String source; @Excel(name = "数据源*", width = 20, needMerge = true, orderNum = "2") - @NotBlank(message = DevValidMessage.DATASOURCE_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.DATASOURCE_NOT_BLANK) private String datasourceId; @Excel(name = "脚本*", width = 100, needMerge = true, orderNum = "3") - @NotBlank(message = DevValidMessage.SCRIPT_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.SCRIPT_NOT_BLANK) private String scriptId; @Excel(name = "误差体系*", width = 30, needMerge = true, orderNum = "4") - @NotBlank(message = DevValidMessage.ERRORSYS_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.ERRORSYS_NOT_BLANK) private String errorSysId; @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; @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; @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; @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; } diff --git a/detection/src/main/java/com/njcn/gather/device/pojo/constant/DevValidMessage.java b/detection/src/main/java/com/njcn/gather/pojo/constant/DetectionValidMessage.java similarity index 72% rename from detection/src/main/java/com/njcn/gather/device/pojo/constant/DevValidMessage.java rename to detection/src/main/java/com/njcn/gather/pojo/constant/DetectionValidMessage.java index 5980494f..354b8619 100644 --- a/detection/src/main/java/com/njcn/gather/device/pojo/constant/DevValidMessage.java +++ b/detection/src/main/java/com/njcn/gather/pojo/constant/DetectionValidMessage.java @@ -1,43 +1,45 @@ -package com.njcn.gather.device.pojo.constant; +package com.njcn.gather.pojo.constant; /** * @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_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 NAME_NOT_BLANK = "名称不能为空,请检查name参数"; - String NAME_FORMAT_ERROR = "名称格式错误,请检查name参数"; String PATTERN_NOT_BLANK = "模式不能为空,请检查pattern参数"; 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 CREATEDATETIME_NOT_NULL = "出厂日期不能为空,请检查producedDate参数"; - String CREATEDATETIME_FORMAT_ERROR = "出厂日期格式错误,请检查createDate参数"; String FACTORYNO_NOT_BLANK = "出厂编号不能为空,请检查factoryNo参数"; - String FIRMWARE_NOT_BLANK = "固件版本不能为空,请检查firmware参数"; - - String SOFTWARE_NOT_BLANK = "软件版本不能为空,请检查software参数"; - String PROTOCOL_NOT_BLANK = "通讯协议不能为空,请检查protocol参数"; String IP_NOT_BLANK = "IP地址不能为空,请检查ip参数"; @@ -102,18 +104,6 @@ public interface DevValidMessage { 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 ERROR_VALUE_TYPE_NOT_BLANK = "误差值类型不能为空,请检查errorValueType参数"; @@ -124,18 +114,6 @@ public interface DevValidMessage { 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_FORMAT_ERROR = "设备ID格式错误"; @@ -180,10 +158,6 @@ public interface DevValidMessage { String CHECK_RESULT_FORMAT_ERROR = "检测结果格式错误"; - String DOCUMENT_STATE_FORMAT_ERROR = "归档状态格式错误"; - - String MONITOR_CODE_FORMAT_ERROR = "监测点编码格式错误"; - String MONITOR_NUM_NOT_NULL = "监测点序号不能为空"; String FACTOR_FLAG_FORMAT_ERROR = "是否支持系数校准格式错误"; @@ -195,18 +169,9 @@ public interface DevValidMessage { String DATASOURCE_NOT_BLANK = "数据源不能为空"; String SCRIPT_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 PREINVESTMENT_PLAN_NOT_BLANK = "预投资计划不能为空"; String TIMECHECK_NOT_NULL = "是否做守时检测不能为空"; - String CREATEID_NOT_BLANK = "设备序列号不能为空"; - String ASSOCIATE_REPORT_NOT_NULL = "是否关联报告不能为空"; } diff --git a/detection/src/main/java/com/njcn/gather/pojo/enums/DetectionResponseEnum.java b/detection/src/main/java/com/njcn/gather/pojo/enums/DetectionResponseEnum.java index 23a87e64..53e3354d 100644 --- a/detection/src/main/java/com/njcn/gather/pojo/enums/DetectionResponseEnum.java +++ b/detection/src/main/java/com/njcn/gather/pojo/enums/DetectionResponseEnum.java @@ -25,25 +25,26 @@ public enum DetectionResponseEnum { CANNOT_CHANGE_REPORT_WHEN_CHECKING("A02011", "只有检测状态为未检时,才能修改绑定报告模板"), ICD_PATH_NAME_REPEAT("A02012", "icd名称重复"), ERR_SYS_BOUND_NOT_DELETE("A02013", "误差体系已被计划所绑定,无法删除!"), + ERR_SYS_REPEAT("A02014", "已存在相同标准号、标准推行年份、适用设备等级的误差体系!"), - IMPORT_DATA_FAIL("A02014", "导入数据失败"), - SERIES_AND_DEVKEY_NOT_BLANK("A02015", "当为加密设备时,加密设备的序列号和设备密钥不能为空"), - PQ_SOURCE_GEN_NAME_ERROR("A02016", "检测源生成名称出错"), - ERR_SOURCE_GEN_NAME_ERROR("A02017", "误差体系生成名称出错"), - PQ_ERRSYS_GEN_NAME_ERROR("A02018", "误差体系生成名称出错"), - PLAN_HAS_DEVICE_BIND("A02019", "检测计划下已绑定设备,请先解绑设备"), - PQ_DEV_REPEAT("A02020", "重复的被检设备"), - PQ_DEV_HAS_MONITOR("A02021", "该设备下关联有监测点,请先移除监测点"), - HAS_NOT_UNCHECKED_DEVICE("A02022", "设备在检测中或已被检测过,请勿解除绑定"), - IMPORT_PLAN_DATA_FAIL("A02023", "导入的检测计划为空"), - IMPORT_DATA_FORMAT_FAIL("A02024", "导入数据格式错误"), - IMPORT_SOURCE_ERROR("A02025", "当前模式下一个检测计划只能有一个检测源"), - IMPORT_DATASOURCE_ERROR("A02026", "当前模式下一个检测计划只能有一个数据源"), - DEV_UN_CHECKED("A02027", "装置还未检测完成!"), - DEV_UN_REPORT("A02028", "装置报告未生成!"), - DEVICE_DIS_ERROR("A02029", "装置配置异常"), - DEVICE_DELETE("A02030", "设备无法删除,已绑定计划!"); + IMPORT_DATA_FAIL("A02040", "导入数据失败"), + SERIES_AND_DEVKEY_NOT_BLANK("A02041", "当为加密设备时,加密设备的序列号和设备密钥不能为空"), + PQ_SOURCE_GEN_NAME_ERROR("A02042", "检测源生成名称出错"), + ERR_SOURCE_GEN_NAME_ERROR("A02043", "误差体系生成名称出错"), + PQ_ERRSYS_GEN_NAME_ERROR("A02044", "误差体系生成名称出错"), + PLAN_HAS_DEVICE_BIND("A02045", "检测计划下已绑定设备,请先解绑设备"), + PQ_DEV_REPEAT("A02046", "重复的被检设备"), + PQ_DEV_HAS_MONITOR("A02047", "该设备下关联有监测点,请先移除监测点"), + HAS_NOT_UNCHECKED_DEVICE("A02048", "设备在检测中或已被检测过,请勿解除绑定"), + IMPORT_PLAN_DATA_FAIL("A02049", "导入的检测计划为空"), + IMPORT_DATA_FORMAT_FAIL("A02050", "导入数据格式错误"), + IMPORT_SOURCE_ERROR("A02051", "当前模式下一个检测计划只能有一个检测源"), + IMPORT_DATASOURCE_ERROR("A02052", "当前模式下一个检测计划只能有一个数据源"), + DEV_UN_CHECKED("A02053", "装置还未检测完成!"), + DEV_UN_REPORT("A02054", "装置报告未生成!"), + DEVICE_DIS_ERROR("A02055", "装置配置异常"), + DEVICE_DELETE("A02056", "设备无法删除,已绑定计划!"); private final String code; diff --git a/detection/src/main/java/com/njcn/gather/report/controller/ReportController.java b/detection/src/main/java/com/njcn/gather/report/controller/ReportController.java index 83b64c83..5c46f48d 100644 --- a/detection/src/main/java/com/njcn/gather/report/controller/ReportController.java +++ b/detection/src/main/java/com/njcn/gather/report/controller/ReportController.java @@ -21,6 +21,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; import java.util.List; @@ -91,7 +92,7 @@ public class ReportController extends BaseController { @PostMapping("/add") @ApiOperation("新增报告模板") @ApiImplicitParam(name = "param", value = "报告模板参数", required = true) - public HttpResult add(@RequestBody @Validated ReportParam reportParam) { + public HttpResult add(ReportParam reportParam) { String methodDescribe = getMethodDescribe("add"); LogUtil.njcnDebug(log, "{},新增参数为:{}", methodDescribe, reportParam); boolean result = pqReportService.add(reportParam); @@ -106,7 +107,7 @@ public class ReportController extends BaseController { @PostMapping("/update") @ApiOperation("更新报告模板") @ApiImplicitParam(name = "param", value = "报告模板参数", required = true) - public HttpResult update(@RequestBody @Validated ReportParam.UpdateParam reportParam) { + public HttpResult update(ReportParam.UpdateParam reportParam) { String methodDescribe = getMethodDescribe("update"); LogUtil.njcnDebug(log, "{},修改参数为:{}", methodDescribe, reportParam); boolean result = pqReportService.update(reportParam); diff --git a/detection/src/main/java/com/njcn/gather/report/pojo/constant/ReportValidMessage.java b/detection/src/main/java/com/njcn/gather/report/pojo/constant/ReportValidMessage.java deleted file mode 100644 index 32aa42af..00000000 --- a/detection/src/main/java/com/njcn/gather/report/pojo/constant/ReportValidMessage.java +++ /dev/null @@ -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 = "报告模板版本号格式不正确"; -} diff --git a/detection/src/main/java/com/njcn/gather/report/pojo/enums/ReportResponseEnum.java b/detection/src/main/java/com/njcn/gather/report/pojo/enums/ReportResponseEnum.java index 56482024..7b23e08e 100644 --- a/detection/src/main/java/com/njcn/gather/report/pojo/enums/ReportResponseEnum.java +++ b/detection/src/main/java/com/njcn/gather/report/pojo/enums/ReportResponseEnum.java @@ -19,7 +19,9 @@ public enum ReportResponseEnum { DEVICE_TYPE_NOT_EXIST("A012008", "设备类型缺失,请联系管理员!"), REPORT_TEMPLATE_NOT_EXIST("A012009", "报告模板缺失,请联系管理员!"), 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 message; diff --git a/detection/src/main/java/com/njcn/gather/report/pojo/param/ReportParam.java b/detection/src/main/java/com/njcn/gather/report/pojo/param/ReportParam.java index 3f3d5adc..b574e788 100644 --- a/detection/src/main/java/com/njcn/gather/report/pojo/param/ReportParam.java +++ b/detection/src/main/java/com/njcn/gather/report/pojo/param/ReportParam.java @@ -1,17 +1,11 @@ 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 io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import org.springframework.web.multipart.MultipartFile; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - /** * @author caozehui * @data 2025-03-19 @@ -20,13 +14,9 @@ import javax.validation.constraints.Pattern; public class ReportParam { @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; @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; @ApiModelProperty(value = "描述信息", required = true) diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java index 637554e8..ac683bce 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java @@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.exception.BusinessException; 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.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; @@ -179,6 +181,7 @@ public class PqReportServiceImpl extends ServiceImpl i @Override @Transactional public boolean add(ReportParam reportParam) { + this.checkPattern(reportParam); this.checkRepeat(reportParam, false); PqReport pqReport = new PqReport(); BeanUtils.copyProperties(reportParam, pqReport); @@ -189,9 +192,21 @@ public class PqReportServiceImpl extends ServiceImpl i 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 @Transactional public boolean update(ReportParam.UpdateParam reportParam) { + this.checkPattern(reportParam); this.checkRepeat(reportParam, true); PqReport pqReport = new PqReport(); BeanUtils.copyProperties(reportParam, pqReport); diff --git a/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java b/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java index 12bbc82f..2f202424 100644 --- a/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java +++ b/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java @@ -1,7 +1,7 @@ package com.njcn.gather.result.pojo.param; 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 lombok.Data; @@ -49,16 +49,16 @@ public class ResultParam { public static class QueryParam { @ApiModelProperty(value = "检测计划Id", required = true) - @NotBlank(message = DevValidMessage.PLAN_ID_NOT_NULL) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PLAN_ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.PLAN_ID_NOT_NULL) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR) private String planId; // 脚本类型,当为null时,表示查询所有脚本类型,否则只查询指定脚本类型 private String scriptType; @ApiModelProperty(value = "设备Id", required = true) - @NotBlank(message = DevValidMessage.DEV_ID_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.DEV_ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_ID_FORMAT_ERROR) private String deviceId; // 通道号,当为-1时,表示查询所有通道号,否则只查询指定通道号 @@ -68,22 +68,22 @@ public class ResultParam { @Data public static class ChangeErrorSystemParam { @ApiModelProperty(value = "检测计划Id", required = true) - @NotBlank(message = DevValidMessage.PLAN_ID_NOT_NULL) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PLAN_ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.PLAN_ID_NOT_NULL) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR) private String planId; @ApiModelProperty(value = "脚本Id", required = true) - @NotBlank(message = DevValidMessage.SCRIPT_ID_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.SCRIPT_ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.SCRIPT_ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SCRIPT_ID_FORMAT_ERROR) private String scriptId; @ApiModelProperty(value = "误差体系Id", required = true) - @NotBlank(message = DevValidMessage.ERROR_SYS_ID_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.ERROR_SYS_ID_NOT_BLANK) private String errorSysId; @ApiModelProperty(value = "设备Id", required = true) - @NotBlank(message = DevValidMessage.DEV_ID_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.DEV_ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_ID_FORMAT_ERROR) private String deviceId; private String code; diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/constant/PqScriptValidMessage.java b/detection/src/main/java/com/njcn/gather/script/pojo/constant/PqScriptValidMessage.java deleted file mode 100644 index 8e692dbe..00000000 --- a/detection/src/main/java/com/njcn/gather/script/pojo/constant/PqScriptValidMessage.java +++ /dev/null @@ -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参数"; -} diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java index 7e3dd9a0..7c2213e4 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java @@ -1,8 +1,7 @@ package com.njcn.gather.script.pojo.param; import com.njcn.common.pojo.constant.PatternRegex; -import com.njcn.gather.device.pojo.constant.DevValidMessage; -import com.njcn.gather.script.pojo.constant.PqScriptValidMessage; +import com.njcn.gather.pojo.constant.DetectionValidMessage; import com.njcn.gather.system.pojo.constant.SystemValidMessage; import com.njcn.web.pojo.annotation.DateTimeStrValid; import com.njcn.web.pojo.param.BaseParam; @@ -20,22 +19,22 @@ import javax.validation.constraints.*; public class PqScriptParam { @ApiModelProperty("名称") - @NotBlank(message = DevValidMessage.NAME_NOT_BLANK) - @Pattern(regexp = PatternRegex.SCRIPT_NAME_REGEX, message = PqScriptValidMessage.NAME_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK) + @Pattern(regexp = PatternRegex.SCRIPT_NAME_REGEX, message = DetectionValidMessage.SCRIPT_NAME_FORMAT_ERROR) private String name; @ApiModelProperty("类型") - @NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) - @Min(value = 0, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) - @Max(value = 1, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) + @NotNull(message = DetectionValidMessage.SCRIPT_TYPE_NOT_BLANK) + @Min(value = 0, message = DetectionValidMessage.SCRIPT_TYPE_FORMAT_ERROR) + @Max(value = 1, message = DetectionValidMessage.SCRIPT_TYPE_FORMAT_ERROR) private Integer type; /** * 检测脚本模式,字典表(数字、模拟、比对) */ @ApiModelProperty("模式") - @NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR) private String pattern; /** @@ -45,13 +44,13 @@ public class PqScriptParam { private String valueType; @ApiModelProperty("参照标准名称") - @NotBlank(message = DevValidMessage.STANDARD_NAME_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.STANDARD_NAME_NOT_BLANK) private String standardName; @ApiModelProperty("标准推行时间") - @NotBlank(message = DevValidMessage.STANDARD_TIME_NOT_BLANK) - @DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.STANDARD_TIME_NOT_BLANK) + @DateTimeStrValid(format = "yyyy", message = DetectionValidMessage.STANDARD_TIME_FORMAT_ERROR) private String standardTime; @@ -59,18 +58,18 @@ public class PqScriptParam { * 额定电压 */ @ApiModelProperty("额定电压") - @NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) - @Min(value = 0, message = PqScriptValidMessage.SCRIPT_VOLT_FORMAT_ERROR) - @Max(value = 380, message = PqScriptValidMessage.SCRIPT_VOLT_FORMAT_ERROR) + @NotNull(message = DetectionValidMessage.SCRIPT_TYPE_NOT_BLANK) + @Min(value = 0, message = DetectionValidMessage.SCRIPT_VOLT_FORMAT_ERROR) + @Max(value = 380, message = DetectionValidMessage.SCRIPT_VOLT_FORMAT_ERROR) private Double ratedVolt; /** * 额定电流 */ @ApiModelProperty("额定电流") - @NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) - @Min(value = 0, message = PqScriptValidMessage.SCRIPT_CURR_FORMAT_ERROR) - @Max(value = 20, message = PqScriptValidMessage.SCRIPT_CURR_FORMAT_ERROR) + @NotNull(message = DetectionValidMessage.SCRIPT_TYPE_NOT_BLANK) + @Min(value = 0, message = DetectionValidMessage.SCRIPT_CURR_FORMAT_ERROR) + @Max(value = 20, message = DetectionValidMessage.SCRIPT_CURR_FORMAT_ERROR) private Double ratedCurr; @@ -87,8 +86,8 @@ public class PqScriptParam { private String valueType; @ApiModelProperty("模式") - @NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR) private String pattern; } @@ -96,7 +95,7 @@ public class PqScriptParam { @EqualsAndHashCode(callSuper = true) public static class UpdateParam extends PqScriptParam { @ApiModelProperty("检测脚本ID") - @NotBlank(message = DevValidMessage.ID_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK) @Pattern(regexp = PatternRegex.SYSTEM_ID, message = SystemValidMessage.ID_FORMAT_ERROR) private String id; } diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/ScriptParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/ScriptParam.java index ef9f2109..e3ef3af2 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/ScriptParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/ScriptParam.java @@ -1,10 +1,10 @@ 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 lombok.Data; -import javax.validation.constraints.*; +import javax.validation.constraints.NotBlank; /** * @author caozehui @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class ScriptParam { @ApiModelProperty("检测脚本id") - @NotBlank(message = DevValidMessage.ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.ID_FORMAT_ERROR) private String scriptId; @ApiModelProperty("检测脚本类型") diff --git a/detection/src/main/java/com/njcn/gather/source/pojo/constant/PqSourceValidMessage.java b/detection/src/main/java/com/njcn/gather/source/pojo/constant/PqSourceValidMessage.java deleted file mode 100644 index d58b2463..00000000 --- a/detection/src/main/java/com/njcn/gather/source/pojo/constant/PqSourceValidMessage.java +++ /dev/null @@ -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不能为空"; -} diff --git a/detection/src/main/java/com/njcn/gather/source/pojo/param/PqSourceParam.java b/detection/src/main/java/com/njcn/gather/source/pojo/param/PqSourceParam.java index 73c1f3c2..54e3a1c7 100644 --- a/detection/src/main/java/com/njcn/gather/source/pojo/param/PqSourceParam.java +++ b/detection/src/main/java/com/njcn/gather/source/pojo/param/PqSourceParam.java @@ -1,7 +1,7 @@ package com.njcn.gather.source.pojo.param; 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 io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -28,24 +28,24 @@ public class PqSourceParam { /** * 检测模式,字典表 */ - @NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR) private String pattern; /** * 检测源类型,字典表 */ @ApiModelProperty(value = "检测源类型", required = true) - @NotBlank(message = DevValidMessage.PQ_SOURCE_TYPE_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PQ_SOURCE_TYPE_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.PQ_SOURCE_TYPE_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PQ_SOURCE_TYPE_FORMAT_ERROR) private String type; /** * 设备类型,字典表 */ @ApiModelProperty(value = "设备类型", required = true) - @NotBlank(message = DevValidMessage.DEV_TYPE_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_TYPE_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR) private String devType; @ApiModelProperty("源参数") @@ -58,16 +58,16 @@ public class PqSourceParam { private String name; @ApiModelProperty("模式") - @NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR) private String pattern; @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; @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; } @@ -75,8 +75,8 @@ public class PqSourceParam { @EqualsAndHashCode(callSuper = true) public static class UpdateParam extends PqSourceParam { @ApiModelProperty(value = "检测源ID", required = true) - @NotBlank(message = DevValidMessage.ID_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR) private String id; } } diff --git a/detection/src/main/java/com/njcn/gather/type/pojo/constant/DevTypeValidMessage.java b/detection/src/main/java/com/njcn/gather/type/pojo/constant/DevTypeValidMessage.java deleted file mode 100644 index 36384427..00000000 --- a/detection/src/main/java/com/njcn/gather/type/pojo/constant/DevTypeValidMessage.java +++ /dev/null @@ -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 = "通道数格式错误"; -} diff --git a/detection/src/main/java/com/njcn/gather/type/pojo/param/DevTypeParam.java b/detection/src/main/java/com/njcn/gather/type/pojo/param/DevTypeParam.java index 21785342..91b48dd7 100644 --- a/detection/src/main/java/com/njcn/gather/type/pojo/param/DevTypeParam.java +++ b/detection/src/main/java/com/njcn/gather/type/pojo/param/DevTypeParam.java @@ -1,8 +1,7 @@ package com.njcn.gather.type.pojo.param; import com.njcn.common.pojo.constant.PatternRegex; -import com.njcn.gather.device.pojo.constant.DevValidMessage; -import com.njcn.gather.type.pojo.constant.DevTypeValidMessage; +import com.njcn.gather.pojo.constant.DetectionValidMessage; import com.njcn.web.pojo.param.BaseParam; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -20,28 +19,28 @@ import javax.validation.constraints.Pattern; @Data public class DevTypeParam { @ApiModelProperty(value = "名称", required = true) - @NotBlank(message = DevTypeValidMessage.NAME_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK) private String name; @ApiModelProperty(value = "设备关联的ICD", required = true) - @NotBlank(message = DevTypeValidMessage.ICD_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.ICD_NOT_BLANK) private String icd; @ApiModelProperty(value = "工作电源", required = true) - @NotBlank(message = DevTypeValidMessage.POWER_NOT_BLANK) + @NotBlank(message = DetectionValidMessage.POWER_NOT_BLANK) private String power; @ApiModelProperty(value = "额定电压", required = true) - @NotNull(message = DevTypeValidMessage.VOLT_NOT_BLANK) + @NotNull(message = DetectionValidMessage.VOLT_NOT_BLANK) private Double devVolt; @ApiModelProperty(value = "额定电流", required = true) - @NotNull(message = DevTypeValidMessage.CURR_NOT_BLANK) + @NotNull(message = DetectionValidMessage.CURR_NOT_BLANK) private Double devCurr; @ApiModelProperty(value = "通道数", required = true) - @NotNull(message = DevTypeValidMessage.CHNS_NOT_BLANK) - @Min(value = 1, message = DevTypeValidMessage.DEV_CHNS_RANGE_ERROR) + @NotNull(message = DetectionValidMessage.CHNS_NOT_BLANK) + @Min(value = 1, message = DetectionValidMessage.DEV_CHNS_RANGE_ERROR) private Integer devChns; @ApiModelProperty(value = "报告模板") @@ -66,8 +65,8 @@ public class DevTypeParam { public static class UpdateParam extends DevTypeParam { @ApiModelProperty(value = "id", required = true) - @NotBlank(message = DevTypeValidMessage.ID_NOT_BLANK) - @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevTypeValidMessage.ID_FORMAT_ERROR) + @NotBlank(message = DetectionValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR) private String id; } } diff --git a/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java b/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java index 3a31b9d0..6d471b58 100644 --- a/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java +++ b/system/src/main/java/com/njcn/gather/system/pojo/enums/SystemResponseEnum.java @@ -21,7 +21,13 @@ public enum SystemResponseEnum { CODE_REPEAT("A01005", "该层级下已存在相同的编码"), CAN_NOT_DELETE_USED_DICT("A01006", "该字典在使用中,不能删除"), 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; diff --git a/system/src/main/java/com/njcn/gather/system/reg/pojo/enums/RegResponseEnum.java b/system/src/main/java/com/njcn/gather/system/reg/pojo/enums/RegResponseEnum.java deleted file mode 100644 index 2e7bc25e..00000000 --- a/system/src/main/java/com/njcn/gather/system/reg/pojo/enums/RegResponseEnum.java +++ /dev/null @@ -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; - } -} diff --git a/system/src/main/java/com/njcn/gather/system/reg/service/impl/SysRegResServiceImpl.java b/system/src/main/java/com/njcn/gather/system/reg/service/impl/SysRegResServiceImpl.java index 064e8ff9..113f6cec 100644 --- a/system/src/main/java/com/njcn/gather/system/reg/service/impl/SysRegResServiceImpl.java +++ b/system/src/main/java/com/njcn/gather/system/reg/service/impl/SysRegResServiceImpl.java @@ -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.po.DictData; 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.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.param.SysRegResParam; import com.njcn.gather.system.reg.pojo.po.SysRegRes; @@ -102,7 +102,7 @@ public class SysRegResServiceImpl extends ServiceImpl expireDateList = regInfoData.getExpireDateList(); @@ -112,7 +112,7 @@ public class SysRegResServiceImpl extends ServiceImpl a.compareTo(b)).get(); 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()); @@ -254,7 +254,7 @@ public class SysRegResServiceImpl extends ServiceImpl