初始化

This commit is contained in:
2022-06-21 20:47:46 +08:00
parent b666a24a98
commit 59da3376c1
1246 changed files with 129600 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
package com.njcn.system.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.fallback.AreaFeignClientFallbackFactory;
import com.njcn.system.pojo.dto.AreaTreeDTO;
import com.njcn.system.pojo.po.Area;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author denghuajun
* @version 1.0.0
* @date 2022年01月05日 15:11
*/
@FeignClient(value = ServerInfo.SYSTEM,path = "/area",fallbackFactory = AreaFeignClientFallbackFactory.class)
public interface AreaFeignClient {
/**
* 根据行政区域id查询详情
*
* @param id 行政区域id
* @return 行政区域基本信息
*/
@GetMapping("/selectIdArea/{id}")
HttpResult<Area> selectIdArea(@PathVariable("id") String id);
/**
* 根据行政区域id查询详情
*
* @param list 行政区域id集合
* @return 行政区域基本信息
*/
@PostMapping("/areaNameByList")
HttpResult<List<Area>> areaNameByList(@RequestBody List<String> list);
/**
* 查询所有的行政区域树
*/
@PostMapping("/areaDeptTree")
HttpResult<List<AreaTreeDTO>> areaDeptTree(@RequestParam("id")String id , @RequestParam("type")Integer type);
/**
* 根据区域id获取省份信息
*/
@PostMapping("/areaPro")
HttpResult<Area> areaPro(@RequestParam("id")String id , @RequestParam("type")Integer type);
/**
* 根据行政区域名称查询详细
*
* @param name 行政区域名称
* @return 行政区域详情
*/
@GetMapping("/selectAreaByName/{name}")
HttpResult<Area> selectAreaByName(@PathVariable("name") String name);
}

View File

@@ -0,0 +1,27 @@
package com.njcn.system.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.fallback.ConfigFeignClientFallbackFactory;
import com.njcn.system.pojo.po.Config;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
/**
* @author denghuajun
* @version 1.0.0
* @date 2022年01月05日 15:11
*/
@FeignClient(value = ServerInfo.SYSTEM, path = "/config", fallbackFactory = ConfigFeignClientFallbackFactory.class)
public interface ConfigFeignClient {
/**
* 获取系统配置
*
* @return 配置信息
*/
@GetMapping("/getSysConfig")
HttpResult<Config> getSysConfig();
}

View File

@@ -0,0 +1,59 @@
package com.njcn.system.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.fallback.DicDataFeignClientFallbackFactory;
import com.njcn.system.pojo.po.DictData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.awt.image.RenderedImage;
import java.util.List;
/**
* pqs
*
* @author cdf
* @date 2021/6/24
*/
@FeignClient(value = ServerInfo.SYSTEM, path = "/dictData", fallbackFactory = DicDataFeignClientFallbackFactory.class)
public interface DicDataFeignClient {
@GetMapping("/getDicDataById")
HttpResult<DictData> getDicDataById(@RequestParam("dicIndex") String dicIndex);
@GetMapping("/getDicDataByTypeName")
HttpResult<List<DictData>> getDicDataByTypeName(@RequestParam("dictTypeName") String dictTypeName);
@GetMapping("/getDicDataByName")
HttpResult<DictData> getDicDataByName(@RequestParam("dicName") String dicName);
@GetMapping("/getLoadTypeBySys")
HttpResult<List<DictData>> getLoadTypeBySys();
/**
* 后台新增字典数据
*
* @param dicTypeName 类型名称
* @param dicDataName 数据名称
* @return 新增后的字典数据
*/
@GetMapping("/addDicData")
HttpResult<DictData> addDicData(@RequestParam("dicTypeName") String dicTypeName, @RequestParam("dicDataName") String dicDataName);
/**
* 根据字典类型名称&数据名称获取字典数据
*
* @param dicTypeName 字典类型名称
* @param dicDataName 字典数据名称
* @return 字典数据
*/
@GetMapping("/getDicDataByNameAndTypeName")
HttpResult<DictData> getDicDataByNameAndTypeName(@RequestParam("dicTypeName") String dicTypeName, @RequestParam("dicDataName") String dicDataName);
}

View File

@@ -0,0 +1,25 @@
package com.njcn.system.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.fallback.AreaFeignClientFallbackFactory;
import com.njcn.system.pojo.po.Theme;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
/**
* @author 徐扬
*/
@FeignClient(value = ServerInfo.SYSTEM,path = "/theme",fallbackFactory = AreaFeignClientFallbackFactory.class)
public interface ThemeFeignClient {
/**
* 功能描述: 获取当前主题
* @return
* @author xy
* @date 2022/2/14 11:30
*/
@GetMapping("/getTheme")
HttpResult<Theme> getTheme();
}

View File

@@ -0,0 +1,72 @@
package com.njcn.system.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.pojo.dto.AreaTreeDTO;
import com.njcn.system.pojo.po.Area;
import com.njcn.system.utils.SystemEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author denghuajun
* @version 1.0.0
* @date 2022年01月05日 15:08
*/
@Slf4j
@Component
public class AreaFeignClientFallbackFactory implements FallbackFactory<AreaFeignClient> {
/**
* 输出远程请求接口异常日志
* @param cause RPC请求异常
*/
@Override
public AreaFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if(cause.getCause() instanceof BusinessException){
BusinessException businessException = (BusinessException) cause.getCause();
exceptionEnum = SystemEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new AreaFeignClient() {
@Override
public HttpResult<Area> selectIdArea(String id) {
log.error("{}异常,降级处理,异常为:{}","根据行政区域id查询详情",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<Area>> areaNameByList(List<String> list) {
log.error("{}异常,降级处理,异常为:{}","根据行政区域id集合查询名称",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<AreaTreeDTO>> areaDeptTree(String id, Integer type) {
log.error("{}异常,降级处理,异常为:{}","查询区域详情",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<Area> areaPro(String id, Integer type) {
log.error("{}异常,降级处理,异常为:{}","根据区域id查询省份信息",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<Area> selectAreaByName(String name) {
log.error("{}异常,降级处理,异常为:{}","根据行政区域名称查询详细",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,45 @@
package com.njcn.system.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.ConfigFeignClient;
import com.njcn.system.pojo.po.Config;
import com.njcn.system.utils.SystemEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author denghuajun
* @version 1.0.0
* @date 2022年01月05日 15:08
*/
@Slf4j
@Component
public class ConfigFeignClientFallbackFactory implements FallbackFactory<ConfigFeignClient> {
/**
* 输出远程请求接口异常日志
* @param cause RPC请求异常
*/
@Override
public ConfigFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if(cause.getCause() instanceof BusinessException){
BusinessException businessException = (BusinessException) cause.getCause();
exceptionEnum = SystemEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new ConfigFeignClient() {
@Override
public HttpResult<Config> getSysConfig() {
log.error("{}异常,降级处理,异常为:{}","获取系统配置",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,71 @@
package com.njcn.system.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.pojo.po.DictData;
import com.njcn.system.utils.SystemEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author hongawen
* @version 1.0.0
* @date 2021年09月09日 15:19
*/
@Slf4j
@Component
public class DicDataFeignClientFallbackFactory implements FallbackFactory<DicDataFeignClient> {
@Override
public DicDataFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if(cause.getCause() instanceof BusinessException){
BusinessException businessException = (BusinessException) cause.getCause();
exceptionEnum = SystemEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new DicDataFeignClient() {
@Override
public HttpResult<DictData> getDicDataById(String dicIndex) {
log.error("{}异常,降级处理,异常为:{}","根据字典索引获取字典数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<DictData>> getDicDataByTypeName(String dictTypeName) {
log.error("{}异常,降级处理,异常为:{}","根据字典类型名称获取字典数据集合",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<DictData> getDicDataByName(String dicName) {
log.error("{}异常,降级处理,异常为:{}","根据字典名称获取字典数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<DictData>> getLoadTypeBySys() {
log.error("{}异常,降级处理,异常为:{}","根据系统类型获取不同指标参数",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<DictData> addDicData(String dicTypeName, String dicDataName) {
log.error("{}异常,降级处理,异常为:{}","后台新增字典数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<DictData> getDicDataByNameAndTypeName(String typeName, String dicDataName) {
log.error("{}异常,降级处理,异常为:{}","根据字典类型名称&数据名称获取字典数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,45 @@
package com.njcn.system.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.ThemeFeignClient;
import com.njcn.system.pojo.po.Theme;
import com.njcn.system.utils.SystemEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author denghuajun
* @version 1.0.0
* @date 2022年01月05日 15:08
*/
@Slf4j
@Component
public class ThemeFeignClientFallbackFactory implements FallbackFactory<ThemeFeignClient> {
/**
* 输出远程请求接口异常日志
* @param cause RPC请求异常
* @return
*/
@Override
public ThemeFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if(cause.getCause() instanceof BusinessException){
BusinessException businessException = (BusinessException) cause.getCause();
exceptionEnum = SystemEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new ThemeFeignClient() {
@Override
public HttpResult<Theme> getTheme() {
log.error("{}异常,降级处理,异常为:{}","获取当前主题",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,13 @@
package com.njcn.system.enums;
import lombok.Getter;
/**
* @author denghuajun
* @date 2022/1/10
* A00500~A00520 行政区域枚举
*/
@Getter
public enum AreaEnum {
}

View File

@@ -0,0 +1,36 @@
package com.njcn.system.enums;
import lombok.Getter;
/**
* 类的介绍:
*
* @author xuyang
* @version 1.0.0
* @createTime 2021/8/5 21:56
*/
@Getter
public enum DicDataEnum {
/**
* 字典数据名称
*/
PLPC_ENUM("频率偏差", "PLPC"),
DYPC_ENUM("电压偏差", "DYPC"),
SXDYBPHD_ENUM("三相电压不平衡度", "SXDYBPHD"),
XBDY_ENUM("谐波电压", "XBDY"),
CSSB_ENUM("长时闪变", "CSSB"),
XBDL_ENUM("谐波电流", "XBDL"),
FXDL_ENUM("负序电流", "FXDL"),
JXBDY_ENUM("间谐波电压", "JXBDY");
private final String name;
private final String code;
DicDataEnum(String name, String code){
this.name=name;
this.code = code;
}
}

View File

@@ -0,0 +1,48 @@
package com.njcn.system.enums;
import lombok.Getter;
/**
* 类的介绍:
*
* @author xuyang
* @version 1.0.0
* @createTime 2021/8/5 21:56
*/
@Getter
public enum DicDataTypeEnum {
/**
* 字典类型名称
*/
FRONT_TYPE("前置类型"),
DEV_TYPE("终端类型"),
DEV_FUN("终端功能"),
DEV_STATUS("终端状态"),
DEV_LEVEL("终端等级"),
DEV_CONNECT("接线方式"),
DEV_MANUFACTURER("制造厂商"),
DEV_VOLTAGE("电压等级"),
EVENT_REASON("暂降原因"),
EVENT_TYPE("暂降类型"),
BUSINESS_TYPE("行业类型"),
INTERFERENCE_SOURCE_TYPE("干扰源类型"),
ALARM_TYPE("告警类型"),
DEV_OPS("运维日志"),
INDICATOR_TYPE("指标类型"),
COMMUNICATE_TYPE("通讯类型"),
RATE_TYPE("费率类型"),
ELE_LOAD_TYPE("用能负荷类型"),
ELE_STATISTICAL_TYPE("用能统计类型"),
LINE_MARK("监测点评分等级")
;
private final String name;
DicDataTypeEnum(String name){
this.name=name;
}
}

View File

@@ -0,0 +1,33 @@
package com.njcn.system.enums;
import lombok.Getter;
/**
* @author hongawen
* @version 1.0.0
* @date 2021年12月20日 09:56
*/
@Getter
public enum SystemResponseEnum {
/**
* 系统模块异常响应码的范围:
* A00350 ~ A00449
*/
SYSTEM_COMMON_ERROR("A00350","系统模块异常"),
DICT_TYPE_NAME_REPEAT("A00351", "字典类型名称重复"),
DICT_DATA_NAME_REPEAT("A00352", "字典数据名称重复"),
AREA_CODE_REPEAT("A00353","行政区域编码重复"),
LOAD_TYPE_EMPTY("A00354","用能负荷数据为空"),
LINE_MARK_EMPTY("A00355","字典监测点评分等级数据为空")
;
private final String code;
private final String message;
SystemResponseEnum(String code, String message) {
this.code = code;
this.message = message;
}
}

View File

@@ -0,0 +1,34 @@
package com.njcn.system.enums;
import lombok.Getter;
/**
* 类的介绍:
*
* @author xuyang
* @version 1.0.0
* @createTime 2022/1/12 14:17
*/
@Getter
public enum ThemeEnum {
/**
* 系统主题
*/
SAME_THEME_NAME("A0102", "主题名称重复"),
LOGO_FILE_BLANK("A0102", "logo图片为空"),
FAVICON_FILE_BLANK("A0102", "favicon图片为空")
;
private final String code;
private final String message;
ThemeEnum(String code, String message) {
this.code = code;
this.message = message;
}
}

View File

@@ -0,0 +1,15 @@
package com.njcn.system.pojo.constant;
/**
* @author 徐扬
*/
public interface SystemType {
/**
* 系统类型0-省级系统1-企业系统2-数据中心
*/
int PROVINCIAL_SYSTEM = 0;
int ENTERPRISE_SYSTEM = 1;
int DATA_CENTER = 2;
}

View File

@@ -0,0 +1,21 @@
package com.njcn.system.pojo.constant;
/**
* @author 徐扬
*/
public interface ThemeState {
/**
* 主题状态 0-删除1-正常;默认正常
*/
int DELETE = 0;
int NORMAL = 1;
/**
* 激活状态 0-未激活1-激活;默认未激活
*/
int INACTIVATED = 0;
int ACTIVATION = 1;
}

View File

@@ -0,0 +1,20 @@
package com.njcn.system.pojo.dto;
import com.njcn.web.pojo.dto.BaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author denghuajun
* @date 2022/1/10 10:33
*
*/
@Data
public class AreaTreeDTO extends BaseDTO {
@ApiModelProperty("是否被绑定")
private Integer isFalse = 0;
@ApiModelProperty("子节点")
private List<AreaTreeDTO> children;
}

View File

@@ -0,0 +1,48 @@
package com.njcn.system.pojo.enums;
import lombok.Getter;
import java.util.Arrays;
/**
* @author hongawen
* @version 1.0.0
* @date 2022年03月18日 13:27
*/
@Getter
public enum StatisticsEnum {
/**
* 统计类型字典枚举
*/
POWER_NETWORK("网络拓扑", "Power_Network"),
VOLTAGE_LEVEL("电压等级", "Voltage_Level"),
LOAD_TYPE("干扰源类型", "Load_Type"),
MANUFACTURER("终端厂家", "Manufacturer"),
REPORT_TYPE("上报类型", "Report_Type");
private final String name;
private final String code;
StatisticsEnum(String name, String code) {
this.name = name;
this.code = code;
}
/**
* 没有匹配到,则默认为网络拓扑
* @param code 统计类型code
* @return 统计枚举实例
*/
public static StatisticsEnum getStatisticsEnumByCode(String code) {
return Arrays.stream(StatisticsEnum.values())
.filter(statisticsEnum -> statisticsEnum.getCode().equalsIgnoreCase(code))
.findAny()
.orElse(POWER_NETWORK);
}
}

View File

@@ -0,0 +1,87 @@
package com.njcn.system.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.web.constant.ValidMessage;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
import java.math.BigDecimal;
/**
* @author denghuajun
* @version 1.0.0
* @date 2022年1月5日 8:59
*/
@Data
public class AreaParam {
@ApiModelProperty("父节点")
@NotBlank(message = ValidMessage.PID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEMS_ID, message = ValidMessage.PID_FORMAT_ERROR)
private String pid;
@ApiModelProperty("名称")
@NotBlank(message = ValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.ALL_CHAR_1_20, message = ValidMessage.NAME_FORMAT_ERROR)
private String name;
@ApiModelProperty("简称")
@NotBlank(message = ValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.ALL_CHAR_1_20, message = ValidMessage.NAME_FORMAT_ERROR)
private String shortName;
@ApiModelProperty("排序(编号)")
@NotBlank(message = ValidMessage.CODE_NOT_BLANK)
@Pattern(regexp = PatternRegex.ALL_CHAR_1_20, message = ValidMessage.CODE_FORMAT_ERROR)
private String areaCode;
@ApiModelProperty("区域类型 0-省级区域1-企业区域; ")
private Integer type;
@ApiModelProperty("中心点经度")
private BigDecimal lng;
@ApiModelProperty("中心点纬度")
private BigDecimal lat;
/**
* 更新操作实体
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class AreaUpdateParam extends AreaParam {
@ApiModelProperty("id")
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
private String id;
}
/**
* 分页查询实体
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class QueryParam extends BaseParam {
/**
* 区域类型 0-省级区域1-企业区域
*/
private Integer type;
}
}

View File

@@ -0,0 +1,93 @@
package com.njcn.system.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.web.constant.ValidMessage;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
/**
* @author hongawen
* @version 1.0.0
* @date 2021年12月17日 15:49
*/
@Data
public class DictDataParam {
@ApiModelProperty("字典类型id")
@NotBlank(message = ValidMessage.DICT_TYPE_ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.DICT_TYPE_ID_FORMAT_ERROR)
private String typeId;
@ApiModelProperty("名称")
@NotBlank(message = ValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.DIC_REGEX, message = ValidMessage.NAME_FORMAT_ERROR)
private String name;
@ApiModelProperty("编码")
@NotBlank(message = ValidMessage.CODE_NOT_BLANK)
@Pattern(regexp = PatternRegex.DIC_REGEX, message = ValidMessage.CODE_FORMAT_ERROR)
private String code;
@ApiModelProperty("排序")
@NotNull(message = ValidMessage.SORT_NOT_NULL)
@Min(value = 0, message = ValidMessage.SORT_FORMAT_ERROR)
@Max(value = 999, message = ValidMessage.SORT_FORMAT_ERROR)
private Integer sort;
@ApiModelProperty("事件等级0-普通1-中等2-严重(默认为0)")
private Integer level;
@ApiModelProperty("与高级算法内部Id描述对应")
private Integer algoDescribe;
/**
* 更新操作实体
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class DictDataUpdateParam extends DictDataParam {
/**
* 表Id
*/
@ApiModelProperty("id")
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
private String id;
}
/**
* 分页查询实体
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class DictDataQueryParam extends BaseParam {
}
/**
* 根据字典类型id分页查询字典数据
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class DicTypeIdQueryParam extends BaseParam {
@ApiModelProperty("字典类型id")
@NotBlank(message = ValidMessage.DICT_TYPE_ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.DICT_TYPE_ID_FORMAT_ERROR)
private String typeId;
}
}

View File

@@ -0,0 +1,83 @@
package com.njcn.system.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.web.constant.ValidMessage;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
/**
* @author hongawen
* @version 1.0.0
* @date 2021年12月17日 09:40
*/
@Data
public class DictTypeParam {
@ApiModelProperty("名称")
@NotBlank(message = ValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.DIC_REGEX, message = ValidMessage.NAME_FORMAT_ERROR)
private String name;
@ApiModelProperty("编码")
@NotBlank(message = ValidMessage.CODE_NOT_BLANK)
@Pattern(regexp = PatternRegex.ALL_CHAR_1_20, message = ValidMessage.CODE_FORMAT_ERROR)
private String code;
@ApiModelProperty("排序")
@NotNull(message = ValidMessage.SORT_NOT_NULL)
@Min(value = 0, message = ValidMessage.SORT_FORMAT_ERROR)
@Max(value = 999, message = ValidMessage.SORT_FORMAT_ERROR)
private Integer sort;
@ApiModelProperty("开启等级0-不开启1-开启,默认不开启")
@NotNull(message = ValidMessage.OPEN_LEVEL_NOT_NULL)
@Min(value = 0, message = ValidMessage.OPEN_LEVEL_FORMAT_ERROR)
@Max(value = 1, message = ValidMessage.OPEN_LEVEL_FORMAT_ERROR)
private Integer openLevel;
@ApiModelProperty("开启算法描述0-不开启1-开启,默认不开启")
@NotNull(message = ValidMessage.OPEN_DESCRIBE_NOT_NULL)
@Min(value = 0, message = ValidMessage.OPEN_DESCRIBE_FORMAT_ERROR)
@Max(value = 1, message = ValidMessage.OPEN_DESCRIBE_FORMAT_ERROR)
private Integer openDescribe;
@ApiModelProperty("描述")
private String remark;
/**
* 更新操作实体
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class DictTypeUpdateParam extends DictTypeParam {
@ApiModelProperty("id")
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
private String id;
}
/**
* 分页查询实体
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class DictTypeQueryParam extends BaseParam {
}
}

View File

@@ -0,0 +1,34 @@
package com.njcn.system.pojo.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* pqs
*
* @author cdf
* @date 2022/1/26
*/
@Data
@ApiModel
public class MxGraphParam {
@ApiModelProperty(name = "title",value = "组态标题",required = true)
@NotBlank(message = "组态标题不可为空")
private String title;
@ApiModelProperty(name = "mxContent",value = "组态内容",required = true)
@NotBlank(message = "内容不可为空")
private String mxContent;
@ApiModelProperty(name = "bgImage",value = "组态背景图")
private String bgImage;
@ApiModelProperty(name = "sort",value = "排序",required = true)
@NotNull(message = "排序不可为空")
private Integer sort;
}

View File

@@ -0,0 +1,63 @@
package com.njcn.system.pojo.param;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.web.constant.ValidMessage;
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.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/**
* 类的介绍:
*
* @author xuyang
* @version 1.0.0
* @createTime 2022/1/12 13:45
*/
@Data
public class ThemeParam {
@ApiModelProperty("主题名称")
@NotBlank(message = ValidMessage.NAME_NOT_BLANK)
@Pattern(regexp = PatternRegex.NORMAL, message = ValidMessage.NAME_FORMAT_ERROR)
private String name;
@ApiModelProperty("主题描述")
@NotBlank(message = ValidMessage.REMARK_NOT_BLANK)
@Pattern(regexp = PatternRegex.NORMAL, message = ValidMessage.REMARK_FORMAT_ERROR)
private String remark;
@ApiModelProperty("主题颜色")
@NotBlank(message = ValidMessage.COLOR_NOT_BLANK)
@Pattern(regexp = PatternRegex.COLOR_REGEX, message = ValidMessage.COLOR_FORMAT_ERROR)
private String color;
@ApiModelProperty("logo图片")
@NotNull(message = ValidMessage.LOGO_NOT_BLANK)
private MultipartFile logoFile;
@ApiModelProperty("favicon图标")
@NotNull(message = ValidMessage.FAVICON_NOT_BLANK)
private MultipartFile faviconFile;
/**
* 用户更新操作实体
*
* 需要填写的参数用户的id
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class ThemeUpdateParam extends ThemeParam {
@ApiModelProperty("主题表Id")
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
private String id;
}
}

View File

@@ -0,0 +1,72 @@
package com.njcn.system.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import java.math.BigDecimal;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* @author hongawen
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_area")
public class Area extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 区域Id
*/
private String id;
/**
* 父节点0为根节点
*/
private String pid;
/**
* 上层所有节点
*/
private String pids;
/**
* 区域名称
*/
private String name;
/**
* 简称
*/
private String shortName;
/**
* 排序(编号)
*/
private String areaCode;
/**
* 区域类型 0-省级区域1-企业区域;
*/
private Integer type;
/**
* 中心点经度
*/
private BigDecimal lng;
/**
* 中心点纬度
*/
private BigDecimal lat;
/**
* 区域状态 0-删除1-正常;默认正常
*/
private Integer state;
}

View File

@@ -0,0 +1,52 @@
package com.njcn.system.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import java.math.BigDecimal;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* @author hongawen
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_config")
public class Config extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 配置Id
*/
private String id;
/**
* 系统类型0-省级系统1-企业系统2-数据中心
*/
private Integer type;
/**
* 数据上报(以逗号分割,比如:冀北,网公司)默认为空
*/
private String dataReport;
/**
* 审计日志大小MB
*/
private BigDecimal logSize;
/**
* 审计日志存储时间1-6个月默认3个月
*/
private Boolean logTime;
/**
* 状态0-删除 1-正常
*/
private Integer state;
}

View File

@@ -0,0 +1,61 @@
package com.njcn.system.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* @author hongawen
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_dict_data")
public class DictData extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 字典数据表Id
*/
private String id;
/**
* 字典类型表Id
*/
private String typeId;
/**
* 名称
*/
private String name;
/**
* 编码
*/
private String code;
/**
* 排序
*/
private Integer sort;
/**
* 事件等级0-普通1-中等2-严重(默认为0)
*/
private Integer level;
/**
* 与高级算法内部Id描述对应
*/
private Integer algoDescribe;
/**
* 状态0-删除 1-正常
*/
private Integer state;
}

View File

@@ -0,0 +1,63 @@
package com.njcn.system.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* @author hongawen
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_dict_type")
public class DictType extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 字典类型表Id
*/
private String id;
/**
* 名称
*/
private String name;
/**
* 编码
*/
private String code;
/**
* 排序
*/
private Integer sort;
/**
* 开启等级0-不开启1-开启,默认不开启
*/
private Integer openLevel;
/**
* 开启描述0-不开启1-开启,默认不开启
*/
private Integer openDescribe;
/**
* 描述
*/
private String remark;
/**
* 状态0-删除 1-正常
*/
private Integer state;
}

View File

@@ -0,0 +1,29 @@
package com.njcn.system.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* pqs
* 组态表
* @author cdf
* @date 2022/1/26
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_mxgraph")
public class MxGraph extends BaseEntity {
private String id;
private String title;
private String mxContent;
private String bgImage;
private Integer sort;
private Integer state;
}

View File

@@ -0,0 +1,52 @@
package com.njcn.system.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* @author hongawen
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_resource")
public class Resource extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 资源Id
*/
private String id;
/**
* 名称
*/
private String name;
/**
* 资源类型(关联字典表)
*/
private String type;
/**
* 路径
*/
private String url;
/**
* 描述
*/
private String remark;
/**
* 状态0-删除 1-正常
*/
private Integer state;
}

View File

@@ -0,0 +1,51 @@
package com.njcn.system.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* @author hongawen
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_task")
public class Task extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 任务Id
*/
private String id;
/**
* 名称
*/
private String name;
/**
* 触发器策略(触发器执行时间)
*/
private String strategy;
/**
* 任务是否执行0-停止1-执行)
*/
private Boolean execute;
/**
* 描述
*/
private String remark;
/**
* 状态0-删除 1-正常
*/
private Integer state;
}

View File

@@ -0,0 +1,61 @@
package com.njcn.system.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* @author hongawen
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_theme")
public class Theme extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主题Id
*/
private String id;
/**
* 主题名称
*/
private String name;
/**
* logo名称
*/
private String logoUrl;
/**
* favicon名称
*/
private String faviconUrl;
/**
* 主题颜色
*/
private String color;
/**
* 0-未激活 1-激活,所有数据只有一条数据处于激活状态
*/
private Integer active;
/**
* 主题描述
*/
private String remark;
/**
* 状态0-删除 1-正常
*/
private Integer state;
}

View File

@@ -0,0 +1,43 @@
package com.njcn.system.pojo.vo;
import com.njcn.web.pojo.vo.AreaIdVO;
import com.njcn.web.pojo.vo.BaseVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
/**
* @author denghuajun
* @date 2022/1/6 10:03
*
*/
@Data
public class AreaTreeVO extends BaseVO {
@ApiModelProperty("上层所有节点")
private String pids;
@ApiModelProperty("区域名称")
private String name;
@ApiModelProperty("简称")
private String shortName;
@ApiModelProperty("排序(编号)")
private String areaCode;
@ApiModelProperty("中心点经度")
private BigDecimal lng;
@ApiModelProperty("中心点纬度")
private BigDecimal lat;
@ApiModelProperty("子节点详细信息")
private List<AreaTreeVO> children ;
}

View File

@@ -0,0 +1,30 @@
package com.njcn.system.pojo.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @author hongawen
* @version 1.0.0
* @date 2022年03月24日 16:06
*/
@Data
public class DictDataCache implements Serializable {
private String id;
private String name;
private String code;
private int sort;
private String typeId;
private String typeName;
private String typeCode;
}

View File

@@ -0,0 +1,58 @@
package com.njcn.system.pojo.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @author hongawen
* @version 1.0.0
* @date 2021年12月20日 15:52
*/
@Data
public class DictDataVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 字典数据表Id
*/
private String id;
/**
* 字典类型表名称
*/
private String typeName;
/**
* 名称
*/
private String name;
/**
* 编码
*/
private String code;
/**
* 排序
*/
private Integer sort;
/**
* 事件等级0-普通1-中等2-严重(默认为0)
*/
private Integer level;
/**
* 与高级算法内部Id描述对应
*/
private Integer algoDescribe;
/**
* 状态0-删除 1-正常
*/
private Integer state;
}

View File

@@ -0,0 +1,49 @@
package com.njcn.system.utils;
import cn.hutool.core.util.StrUtil;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.EnumUtils;
import com.njcn.system.enums.SystemResponseEnum;
import javax.validation.constraints.NotNull;
import java.util.Objects;
/**
* @author hongawen
* @version 1.0.0
* @date 2021年12月20日 10:03
*/
public class SystemEnumUtil {
/**
* 获取UserResponseEnum实例
*/
public static SystemResponseEnum getSystemEnumResponseEnumByMessage(@NotNull Object value) {
SystemResponseEnum systemResponseEnum;
try {
String message = value.toString();
if(message.indexOf(StrUtil.C_COMMA)>0){
value = message.substring(message.indexOf(StrUtil.C_COMMA)+1);
}
systemResponseEnum = EnumUtils.valueOf(SystemResponseEnum.class, value, SystemResponseEnum.class.getMethod(BusinessException.GET_MESSAGE_METHOD));
return Objects.isNull(systemResponseEnum) ? SystemResponseEnum.SYSTEM_COMMON_ERROR : systemResponseEnum;
} catch (NoSuchMethodException e) {
throw new BusinessException(CommonResponseEnum.INTERNAL_ERROR);
}
}
public static Enum<?> getExceptionEnum(HttpResult<Object> result){
//如果返回错误,且为内部错误,则直接抛出异常
CommonResponseEnum commonResponseEnum = EnumUtils.getCommonResponseEnumByCode(result.getCode());
if (commonResponseEnum == CommonResponseEnum.SYSTEM_RESPONSE_ENUM) {
return getSystemEnumResponseEnumByMessage(result.getMessage());
}
return commonResponseEnum;
}
}