针对第三方测试功能调整

This commit is contained in:
xy
2024-12-02 19:50:08 +08:00
parent 396fe59b94
commit 6a3b848dc0
6 changed files with 31 additions and 7 deletions

View File

@@ -7,10 +7,8 @@ package com.njcn.web.constant;
*/
public interface ValidMessage {
String MISS_PREFIX="字段不能为空,请检查";
String ID_NOT_BLANK = "id不能为空请检查id参数";
String ID_FORMAT_ERROR = "id格式错误请检查id参数";
@@ -69,7 +67,7 @@ public interface ValidMessage {
String DEVICE_VERSION_NOT_BLANK = "装置版本json文件不能为空请检查deviceVersionFile参数";
String SEARCH_DATA_ERROR = "搜索值有特殊字符或者过长,请检查搜索参数";
String SEARCH_DATA_ERROR = "搜索值过长,请检查搜索参数";
String DATA_TOO_LONG = "参数过长,请检查参数";

View File

@@ -19,7 +19,7 @@ public class BaseParam implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("搜索值")
@Pattern(regexp = PatternRegex.ALL_CHAR_1_20, message = ValidMessage.SEARCH_DATA_ERROR)
@Pattern(regexp = PatternRegex.DES32_REGEX, message = ValidMessage.SEARCH_DATA_ERROR)
private String searchValue;
@ApiModelProperty("开始时间")

View File

@@ -4,11 +4,15 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.db.bo.BaseEntity;
import com.njcn.web.constant.ValidMessage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Pattern;
/**
*
* Description:
@@ -32,7 +36,7 @@ public class UserReportProjectPO extends BaseEntity {
* 用户协议容量
*/
@TableField(value = "agreement_capacity")
@Pattern(regexp = PatternRegex.COORDINATE, message = ValidMessage.PARAM_FORMAT_ERROR)
private Double agreementCapacity;
/**

View File

@@ -4,11 +4,15 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.db.bo.BaseEntity;
import com.njcn.web.constant.ValidMessage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Pattern;
/**
*
* Description:
@@ -32,6 +36,7 @@ public class UserReportSensitivePO extends BaseEntity {
* PCC点
*/
@TableField(value = "pcc_point")
@Pattern(regexp = PatternRegex.DES32_REGEX, message = ValidMessage.DATA_TOO_LONG)
private String pccPoint;
/**
@@ -44,6 +49,7 @@ public class UserReportSensitivePO extends BaseEntity {
* 敏感装置名称
*/
@TableField(value = "device_name")
@Pattern(regexp = PatternRegex.DES32_REGEX, message = ValidMessage.DATA_TOO_LONG)
private String deviceName;
/**
@@ -74,6 +80,7 @@ public class UserReportSensitivePO extends BaseEntity {
* 预测评估审核单位
*/
@TableField(value = "evaluation_chek_dept")
@Pattern(regexp = PatternRegex.DES32_REGEX, message = ValidMessage.DATA_TOO_LONG)
private String evaluationChekDept;
/**

View File

@@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.db.bo.BaseEntity;
import com.njcn.web.constant.ValidMessage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Pattern;
import java.math.BigDecimal;
/**
@@ -31,30 +34,35 @@ public class UserReportSubstationPO extends BaseEntity {
* PCC点
*/
@TableField(value = "pcc_point")
@Pattern(regexp = PatternRegex.DES32_REGEX, message = ValidMessage.DATA_TOO_LONG)
private String pccPoint;
/**
* 基准短路容量MVA
*/
@TableField(value = "base_short_circuit_capacity")
@Pattern(regexp = PatternRegex.COORDINATE, message = ValidMessage.PARAM_FORMAT_ERROR)
private BigDecimal baseShortCircuitCapacity;
/**
* 系统最小短路容量MVA
*/
@TableField(value = "min_short_circuit_capacity")
@Pattern(regexp = PatternRegex.COORDINATE, message = ValidMessage.PARAM_FORMAT_ERROR)
private BigDecimal minShortCircuitCapacity;
/**
* PCC供电设备容量MVA
*/
@TableField(value = "pcc_equipment_capacity")
@Pattern(regexp = PatternRegex.COORDINATE, message = ValidMessage.PARAM_FORMAT_ERROR)
private BigDecimal pccEquipmentCapacity;
/**
* 用户用电协议容量MVA
*/
@TableField(value = "user_agreement_capacity")
@Pattern(regexp = PatternRegex.COORDINATE, message = ValidMessage.PARAM_FORMAT_ERROR)
private BigDecimal userAgreementCapacity;
/**
@@ -73,6 +81,7 @@ public class UserReportSubstationPO extends BaseEntity {
* 预测评估审核单位
*/
@TableField(value = "evaluation_chek_dept")
@Pattern(regexp = PatternRegex.DES32_REGEX, message = ValidMessage.DATA_TOO_LONG)
private String evaluationChekDept;
/**

View File

@@ -298,9 +298,9 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
@Override
public Page<UserReportVO> getUserReport(UserReportParam.UserReportQueryParam userReportQueryParam) {
//正则校验
Pattern pattern = Pattern.compile(PatternRegex.ALL_CHAR_1_20);
Pattern pattern = Pattern.compile(PatternRegex.DES32_REGEX);
Matcher matcher = pattern.matcher(userReportQueryParam.getProjectName());
if (!Objects.equals(userReportQueryParam.getProjectName(),"") && !matcher.matches()) {
if (StringUtils.isNotBlank(userReportQueryParam.getProjectName()) && !matcher.matches()) {
throw new BusinessException(ValidMessage.SEARCH_DATA_ERROR);
}
QueryWrapper<UserReportVO> userReportVOQueryWrapper = new QueryWrapper<>();
@@ -471,6 +471,12 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
@Override
public Page<UserReportVO> getInterferenceUserPage(UserReportParam.UserReportQueryParam userReportQueryParam, Boolean allDataFlag) {
//正则校验
Pattern pattern = Pattern.compile(PatternRegex.ALL_CHAR_1_20);
Matcher matcher = pattern.matcher(userReportQueryParam.getProjectName());
if (StringUtils.isNotBlank(userReportQueryParam.getProjectName()) && !matcher.matches()) {
throw new BusinessException(ValidMessage.SEARCH_DATA_ERROR);
}
QueryWrapper<UserReportVO> userReportVOQueryWrapper = new QueryWrapper<>();
List<String> colleaguesIds = userFeignClient.getColleaguesIdByUserId(RequestUtil.getUserIndex()).getData();
List<String> data = deptFeignClient.getDepSonIdtByDeptId(userReportQueryParam.getOrgId()).getData();