diff --git a/pqs-common/common-poi/src/main/java/com/njcn/poi/excel/ExcelUtil.java b/pqs-common/common-poi/src/main/java/com/njcn/poi/excel/ExcelUtil.java index 27a0e188a..066a9df47 100644 --- a/pqs-common/common-poi/src/main/java/com/njcn/poi/excel/ExcelUtil.java +++ b/pqs-common/common-poi/src/main/java/com/njcn/poi/excel/ExcelUtil.java @@ -7,9 +7,12 @@ import com.njcn.web.utils.HttpServletUtil; import lombok.extern.slf4j.Slf4j; import org.apache.poi.hssf.usermodel.DVConstraint; import org.apache.poi.hssf.usermodel.HSSFDataValidation; +import org.apache.poi.ss.usermodel.DataValidationHelper; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.util.CellRangeAddressList; +import org.apache.poi.xssf.usermodel.XSSFDataValidation; +import org.apache.poi.xssf.usermodel.XSSFDataValidationConstraint; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; @@ -96,13 +99,15 @@ public class ExcelUtil { Sheet sheet = workbook.getSheetAt(0); // 生成下拉列表 // 只对(x,x)单元格有效 - CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(3, 65535, firstCol, lastCol); + CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(2, 65535, firstCol, lastCol); // 生成下拉框内容 - DVConstraint dvConstraint = DVConstraint.createExplicitListConstraint(strings); - HSSFDataValidation dataValidation = new HSSFDataValidation(cellRangeAddressList, dvConstraint); + DataValidationHelper dvHelper = sheet.getDataValidationHelper(); + XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint) + dvHelper.createExplicitListConstraint(strings); + XSSFDataValidation validation =(XSSFDataValidation)dvHelper.createValidation( + dvConstraint, cellRangeAddressList); // 对sheet页生效 - sheet.addValidationData(dataValidation); - + sheet.addValidationData(validation); } diff --git a/pqs-common/common-swagger/src/main/java/com/njcn/swagger/config/Knife4jSwaggerConfig.java b/pqs-common/common-swagger/src/main/java/com/njcn/swagger/config/Knife4jSwaggerConfig.java index b8bbda1a4..df88e8bc5 100644 --- a/pqs-common/common-swagger/src/main/java/com/njcn/swagger/config/Knife4jSwaggerConfig.java +++ b/pqs-common/common-swagger/src/main/java/com/njcn/swagger/config/Knife4jSwaggerConfig.java @@ -54,6 +54,7 @@ public class Knife4jSwaggerConfig { List controllerPath = Stream.of( "com.njcn.user.controller", "com.njcn.device.controller", + "com.njcn.pvdevice.controller", "com.njcn.auth.controller", "com.njcn.system.controller", "com.njcn.harmonic.controller", diff --git a/pqs-common/common-web/src/main/java/com/njcn/web/pojo/annotation/DateTimeStrValid.java b/pqs-common/common-web/src/main/java/com/njcn/web/pojo/annotation/DateTimeStrValid.java index c1239f7d8..4bf63d4d0 100644 --- a/pqs-common/common-web/src/main/java/com/njcn/web/pojo/annotation/DateTimeStrValid.java +++ b/pqs-common/common-web/src/main/java/com/njcn/web/pojo/annotation/DateTimeStrValid.java @@ -2,7 +2,7 @@ package com.njcn.web.pojo.annotation; /** * pqs - * + * 校验前台传的时间格式是否正确 * @author cdf * @date 2022/1/11 */ diff --git a/pqs-common/pom.xml b/pqs-common/pom.xml index 628be90c3..18d1a1a61 100644 --- a/pqs-common/pom.xml +++ b/pqs-common/pom.xml @@ -20,7 +20,7 @@ common-web common-autocode common-influxdb - + common-poi diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/enums/DeviceResponseEnum.java b/pqs-device/device-api/src/main/java/com/njcn/device/enums/DeviceResponseEnum.java index ed4801c5f..2e8bd9824 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/enums/DeviceResponseEnum.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/enums/DeviceResponseEnum.java @@ -41,7 +41,7 @@ public enum DeviceResponseEnum { NODE_INFO_FAIL("A0261","前置机服务器为空"), - SUBV_NAME_REPETITION("A0262","母线名称重复"), + SUBV_NAME_REPETITION("A0262","同一变电站下母线名称重复"), SUBV_NAME_SAME("A0263","母线名称已存在"), SUBV_NO("A0264","母线不存在"), @@ -52,9 +52,12 @@ public enum DeviceResponseEnum { DEVICE_LINE_BIG("A0268","每台装置下监测点数量最多6个"), + DEVICE_UNKNOWN_ERROR("A0269","终端服务未知异常"), PARENT_INDEX_LACK("A0270","索引和实体同时存在"), + DEVICE_VOLTAGE_BIG("A0271","每台装置下母线数量最多6个"), + VOLTAGE_NUM_USE("A0272","母线序号已存在"), REQUEST_DATA_ERROR("A2071","请求体格式有误"), DEPT_LINE_EMPTY("A2072","当前用户部门未有监测点绑定"), DIC_GET_EMPTY("A2073","字典获取为空"), @@ -63,12 +66,13 @@ public enum DeviceResponseEnum { INVALID_LEVEL("A2074","非法拓扑等级"), LINE_EMPTY("A2075","监测点为空"), + /*excel相关*/ Excel_ERROR("A2080","excel解析异常"), FLOW_SAME_NAME("A0350","当前名称已存在"), FLOW_FLAG("A0351","默认类型已存在"), - FLOW_ERROR("A0352","占比参数异常"); + FLOW_ERROR("A0352","占比参数异常") @@ -76,6 +80,10 @@ public enum DeviceResponseEnum { + ; + + + private final String code; diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/enums/PvDeviceResponseEnum.java b/pqs-device/device-api/src/main/java/com/njcn/device/enums/PvDeviceResponseEnum.java new file mode 100644 index 000000000..ff2885809 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/enums/PvDeviceResponseEnum.java @@ -0,0 +1,48 @@ +package com.njcn.device.enums; + +import lombok.Getter; + +/** + * pqs + * 终端枚举 + * @author cdf + * @date 2021/6/21 + */ +@Getter +public enum PvDeviceResponseEnum { + + /** + * A0350 ~ A0450 用于pv终端模块的枚举 + */ + UNIT_REPEAT("A0350","单位名称重复"), + SUBSTATION_REPEAT("A0351","变电站名称重复"), + TEN_VOLTAGE_REPEAT("A0352","10kV线路名称重复"), + VOLTAGE_REPEAT("A0352","母线名称重复"), + SUB_AREA_REPEAT("A0353","台区名称重复"), + SUB_NUM_REPEAT("A0354","母线号重复"), + + + + TEN_VOLTAGE_NULL("A0360","未查询到指定10kV线路"), + UNIT_NULL("A0361","未查询到指定单位"), + SUB_AREA_NULL("A0362","未查询到指定台区"), + DEV_NULL("A0363","未查询到指定终端") + + + + + ; + + + + + + private final String code; + + private final String message; + + PvDeviceResponseEnum(String code, String message) { + this.code = code; + this.message = message; + } +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/bo/excel/OracleTerminalExcel.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/bo/excel/OracleTerminalExcel.java index 52f749674..e263d49dd 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/bo/excel/OracleTerminalExcel.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/bo/excel/OracleTerminalExcel.java @@ -81,7 +81,7 @@ public class OracleTerminalExcel implements Serializable { @NotNull(message = "定检状态不能为空") private Integer checkFlag; - @Excel(name = "终端类型", width = 15) + @Excel(name = "终端型号", width = 15) @NotBlank(message = "设备型号不能为空") private String devType; diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/bo/excel/TerminalBaseExcel.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/bo/excel/TerminalBaseExcel.java index c84e82a5b..6de05bde6 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/bo/excel/TerminalBaseExcel.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/bo/excel/TerminalBaseExcel.java @@ -74,12 +74,12 @@ public class TerminalBaseExcel implements Serializable { @NotBlank(message = "终端厂家不能为空") private String manufacturer; - @Excel(name = "终端类型", width = 15) + @Excel(name = "设备型号", width = 15) @NotBlank(message = "设备型号不能为空") private String devType; @Excel(name = "网络参数", width = 15) - @NotBlank(message = "设备ip不能为空") + @NotBlank(message = "设备网络参数不能为空") private String ip; @Excel(name = "端口", width = 15) @@ -112,7 +112,7 @@ public class TerminalBaseExcel implements Serializable { private String sim; @Excel(name = "母线", width = 15) - @NotBlank(message = "母线不能为空") + @NotBlank(message = "母线名称不能为空") private String subvName; @Excel(name = "母线号", width = 15) @@ -127,9 +127,6 @@ public class TerminalBaseExcel implements Serializable { @NotNull(message = "母线模型不为空") private Integer subvModel; - @Excel(name = "监测点索引", width = 15) - @NotNull(message = "监测点索引不能为空") - private Integer id; @Excel(name = "监测点名称", width = 15) @NotBlank(message = "监测点名称不能为空") diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/VersionParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/VersionParam.java index 3482abe9d..f520b01ca 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/VersionParam.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/VersionParam.java @@ -39,7 +39,7 @@ public class VersionParam { private LocalDate date; /** - * 装置系列(终端类型),字典表 + * 装置系列(终端型号),字典表 */ @ApiModelProperty("装置系列(终端类型)") private String devType; diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/DeviceQueryParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/DeviceQueryParam.java new file mode 100644 index 000000000..57c0822d0 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/DeviceQueryParam.java @@ -0,0 +1,26 @@ +package com.njcn.device.pojo.param.pv; + +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2022/7/6 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeviceQueryParam extends BaseParam { + + + @ApiModelProperty(value = "manufacturer",name = "制造厂商") + private List manufacturer; + + @ApiModelProperty(value = "devType",name = "设备类型") + private List devType; +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/DistributedQueryParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/DistributedQueryParam.java new file mode 100644 index 000000000..3e1c014b6 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/DistributedQueryParam.java @@ -0,0 +1,25 @@ +package com.njcn.device.pojo.param.pv; + +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2022/7/6 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DistributedQueryParam extends BaseParam { + + @ApiModelProperty(value = "name",name = "分布式光伏台账名称") + private String name; + + @ApiModelProperty(value = "scale",name = "电压等级") + private List scale; +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/LineDetailQueryParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/LineDetailQueryParam.java new file mode 100644 index 000000000..28952a008 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/LineDetailQueryParam.java @@ -0,0 +1,23 @@ +package com.njcn.device.pojo.param.pv; + +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * pqs + * + * @author cdf + * @date 2022/7/6 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class LineDetailQueryParam extends BaseParam { + + @ApiModelProperty(value = "scale",name = "分布式光伏台账名称",required = true) + private String name; + + @ApiModelProperty(value = "scale",name = "电压等级") + private String scale; +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/LvUserQueryParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/LvUserQueryParam.java new file mode 100644 index 000000000..48c4549d0 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/LvUserQueryParam.java @@ -0,0 +1,28 @@ +package com.njcn.device.pojo.param.pv; + +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2022/7/6 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class LvUserQueryParam extends BaseParam { + + @ApiModelProperty(value = "scale",name = "低压侧台账名称") + private String name; + + @ApiModelProperty(value = "userCode",name = "用户编号") + private String userCode; + + @ApiModelProperty(value = "scale",name = "电压等级") + private List scale; +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvDeviceParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvDeviceParam.java new file mode 100644 index 000000000..0d22728c3 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvDeviceParam.java @@ -0,0 +1,116 @@ +package com.njcn.device.pojo.param.pv; + +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 com.njcn.web.pojo.annotation.DateTimeStrValid; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +@TableName("pv_device") +public class PvDeviceParam implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 终端类型(电能质量监测终端、智能电表、智能融合终端),字典表 + */ + @ApiModelProperty(name = "type",value = "终端类型(电能质量监测终端、智能电表、智能融合终端),字典表",required = true) + @NotBlank(message = "终端类型不可为空") + private String type; + + /** + * 用于保存PMS中电能质量监测终端Id、智能融合终端Id,智能电表Id + */ + @ApiModelProperty(name = "devCode",value = "用于保存PMS中电能质量监测终端Id、智能融合终端Id,智能电表Id",required = true) + @NotBlank(message = "终端Id不能为空") + private String devCode; + + /** + * 终端Ip + */ + @ApiModelProperty(name = "ip",value = "终端Ip",required = true) + @NotBlank(message = "终端Ip不能为空") + private String ip; + + /** + * 端口 + */ + @ApiModelProperty(name = "port",value = "端口",required = true) + @NotNull(message = "端口不能为空") + private Integer port; + + /** + * 终端型号(570、580……)字典表 + */ + @ApiModelProperty(name = "devType",value = "终端型号(570、580……)字典表") + private String devType; + + /** + * 设备制造商,字典表 + */ + @ApiModelProperty(name = "manufacturer",value = "设备制造商,字典表",required = true) + @NotBlank(message = "设备制造商不能为空") + private String manufacturer; + + /** + * 装置识别码(3ds加密) + */ + @ApiModelProperty(name = "series",value = "装置识别码(3ds加密)") + private String series; + + /** + * 装置秘钥(3ds加密) + */ + @ApiModelProperty(name = "devKey",value = "装置秘钥(3ds加密)") + private String devKey; + + /** + * 本次定检时间,默认等于投运时间 + */ + @ApiModelProperty(name = "thisTimeCheck",value = "本次定检时间,默认等于投运时间",required = true) + @NotBlank(message = "本次定检时间不能为空") + @DateTimeStrValid(message = "本次定检时间格式错误") + private String thisTimeCheck; + + /** + * 下次定检时间,默认为投运时间后推3年,假如时间小于3个月则为待检 + */ + @ApiModelProperty(name = "nextTimeCheck",value = "下次定检时间,默认为投运时间后推3年,假如时间小于3个月则为待检",required = true) + @NotBlank(message = "下次定检时间不能为空") + @DateTimeStrValid(message = "下次定检时间格式错误") + private String nextTimeCheck; + + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class UpdatePvDeviceParam extends PvDeviceParam{ + /** + * id + */ + @ApiModelProperty("id") + @NotBlank(message = ValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR) + private String id; + } + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvDispatchParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvDispatchParam.java new file mode 100644 index 000000000..cdeed755c --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvDispatchParam.java @@ -0,0 +1,36 @@ +package com.njcn.device.pojo.param.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Getter +@Setter +@TableName("pv_dispatch") +public class PvDispatchParam implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 调度表Id + */ + private String id; + + /** + * 调度名称 + */ + private String name; + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvDistributedParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvDistributedParam.java new file mode 100644 index 000000000..e4eb74361 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvDistributedParam.java @@ -0,0 +1,97 @@ +package com.njcn.device.pojo.param.pv; + +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 io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-06 + */ +@Data +public class PvDistributedParam implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 分布式光伏名称 + */ + @ApiModelProperty(name = "name",value = "分布式光伏名称",required = true) + @NotBlank(message = "分布式光伏名称不可为空") + private String name; + + /** + * 用户编号(与低压用户台账表低压用户编号字段一致) + */ + @ApiModelProperty(name = "userCode",value = "用户编号",required = true) + @NotBlank(message = "用户编号不可为空") + private String userCode; + + /** + * 终端编号 + */ + @ApiModelProperty(name = "devCode",value = "终端编号") + private String devCode; + + /** + * 并网电压等级Id,字典表 + */ + @ApiModelProperty(name = "scale",value = "并网电压等级Id,字典表") + private String scale; + + /** + * 装机容量(KVA) + */ + @ApiModelProperty(name = "machineCapacity",value = "装机容量(KVA)") + private Float machineCapacity; + + /** + * 上网方式 + */ + @ApiModelProperty(name = "inteType",value = "上网方式") + private String inteType; + + /** + * 接入相别 + */ + @ApiModelProperty(name = "phase",value = "接入相别") + private String phase; + + /** + * 储能配置容量(KVA) + */ + @ApiModelProperty(name = "energyCapacity",value = "储能配置容量(KVA)") + private Float energyCapacity; + + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class UpdatePvDistributedParam extends PvDistributedParam{ + /** + * id + */ + @ApiModelProperty("id") + @NotBlank(message = ValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR) + private String id; + } + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvLineDetailParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvLineDetailParam.java new file mode 100644 index 000000000..c744b8ea1 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvLineDetailParam.java @@ -0,0 +1,239 @@ +package com.njcn.device.pojo.param.pv; + +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 io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +public class PvLineDetailParam implements Serializable { + + private static final long serialVersionUID = 1L; + + + + /** + * 所属终端 + */ + @ApiModelProperty(name = "",value = "",required = true) + private String devId; + + /** + * 监测点类型(I类监测点、II类监测点、III类监测点),字典表 + */ + @ApiModelProperty(name = "",value = "",required = true) + private String type; + + /** + * 所属变电站(I类监测点) + */ + @ApiModelProperty(name = "",value = "",required = true) + private String substationId; + + /** + * 所属母线名称(I类监测点) + */ + @ApiModelProperty(name = "",value = "") + private String voltageId; + + /** + * 所属台区ID(II类监测点) + */ + @ApiModelProperty(name = "",value = "") + private String subAreaId; + + /** + * 所属分布式光伏台账(III类监测点) + */ + @ApiModelProperty(name = "",value = "") + private String distributedId; + + /** + * 所属低压用户台账(III类监测点) + */ + @ApiModelProperty(name = "",value = "") + private String lvUserId; + + /** + * 线路号(在同一台设备中的监测点号) + */ + @ApiModelProperty(name = "",value = "") + private Integer num; + + /** + * PT一次变比 + */ + @ApiModelProperty(name = "",value = "") + private Float pt1; + + /** + * PT二次变比 + */ + @ApiModelProperty(name = "",value = "") + private Float pt2; + + /** + * CT一次变比 + */ + @ApiModelProperty(name = "",value = "") + private Float ct1; + + /** + * CT二次变比 + */ + @ApiModelProperty(name = "",value = "") + private Float ct2; + + /** + * 设备容量 + */ + @ApiModelProperty(name = "",value = "") + private Float devCapacity; + + /** + * 短路容量 + */ + @ApiModelProperty(name = "",value = "") + private Float shortCapacity; + + /** + * 基准容量 + */ + @ApiModelProperty(name = "",value = "") + private Float standardCapacity; + + /** + * 协议容量 + */ + @ApiModelProperty(name = "",value = "") + private Float dealCapacity; + + /** + * 接线类型(0:星型接法;1:三角型接法;2:开口三角型接法) + */ + @ApiModelProperty(name = "",value = "") + private Integer ptType; + + /** + * 测量间隔(1-10分钟) + */ + @ApiModelProperty(name = "",value = "") + private Integer timeInterval; + + /** + * 干扰源类型,字典表 + */ + @ApiModelProperty(name = "",value = "") + private String loadType; + + /** + * 行业类型,字典表 + */ + @ApiModelProperty(name = "",value = "") + private String businessType; + + /** + * 网公司谐波监测平台标志(0-否;1-是),默认否 + */ + @ApiModelProperty(name = "",value = "") + private Integer monitorFlag; + + /** + * 电网标志(0-电网侧;1-非电网侧) + */ + @ApiModelProperty(name = "",value = "") + private Integer powerFlag; + + /** + * 国网谐波监测平台监测点号 + */ + @ApiModelProperty(name = "",value = "") + private String monitorId; + + /** + * 监测点对象名称 + */ + @ApiModelProperty(name = "",value = "") + private String objName; + + /** + * 人为干预是否参与统计(0:不参与,1:参与)默认参与统计 + */ + @ApiModelProperty(name = "",value = "") + private Integer statFlag; + + /** + * 备注 + */ + @ApiModelProperty(name = "",value = "") + private String remark; + + /** + * 电压互感器类型,字典表 + */ + @ApiModelProperty(name = "",value = "") + private String tfType; + + /** + * 所属变压器编号 + */ + @ApiModelProperty(name = "",value = "") + private String tfCode; + + /** + * 中性点接地方式,字典表 + */ + @ApiModelProperty(name = "",value = "") + private String groundType; + + /** + * 投运日期 + */ + @ApiModelProperty(name = "",value = "") + private String putIn; + + /** + * 接入日期 + */ + @ApiModelProperty(name = "",value = "") + private String access; + + /** + * 是否专项供电(0:否,1:是)默认参与统计 + */ + @ApiModelProperty(name = "",value = "") + private Integer powerSupply; + + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class UpdatePvLineDetailParam extends PvLineDetailParam{ + /** + * id + */ + @ApiModelProperty("id") + @NotBlank(message = ValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR) + private String id; + } + + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvLvUserParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvLvUserParam.java new file mode 100644 index 000000000..5dce35de3 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvLvUserParam.java @@ -0,0 +1,107 @@ +package com.njcn.device.pojo.param.pv; + +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 io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +public class PvLvUserParam implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 低压用户编号(营销系统中查出) + */ + @ApiModelProperty(name = "userCode",value = "低压用户编号") + @NotBlank(message = "低压用户编号不为空") + private String userCode; + + /** + * 低压用户名称 + */ + @ApiModelProperty(name = "name",value = "低压用户名称") + @NotBlank(message = "低压用户名称不为空") + private String name; + + /** + * 用户协议容量(kVA) + */ + @ApiModelProperty(name = "userCapacity",value = "用户协议容量") + private Float userCapacity; + + /** + * 是否发生过投诉 + */ + @ApiModelProperty(name = "complain",value = "是否发生过投诉") + private Integer complain; + + /** + * 投诉内容 + */ + @ApiModelProperty(name = "complainPart",value = "投诉内容") + private String complainPart; + + /** + * 整改措施 + */ + @ApiModelProperty(name = "corrective",value = "整改措施") + private String corrective; + + /** + * 是否有治理装置 + */ + @ApiModelProperty(name = "devGovern",value = "是否有治理装置") + private Integer devGovern; + + /** + * 治理装置类型 + */ + @ApiModelProperty(name = "governType",value = "治理装置类型") + private String governType; + + /** + * 治理装置电压等级 + */ + @ApiModelProperty(name = "scale",value = "治理装置电压等级") + private String scale; + + /** + * 治理装置容量 + */ + @ApiModelProperty(name = "governCapacity",value = "治理装置容量") + private Float governCapacity; + + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class UpdatePvLvUserParam extends PvLvUserParam{ + /** + * id + */ + @ApiModelProperty("id") + @NotBlank(message = ValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR) + private String id; + } + + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvSubAreaParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvSubAreaParam.java new file mode 100644 index 000000000..1d5b207ba --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvSubAreaParam.java @@ -0,0 +1,148 @@ +package com.njcn.device.pojo.param.pv; + +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 io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +public class PvSubAreaParam implements Serializable { + + private static final long serialVersionUID = 1L; + + + + /** + * 所属10kV线路表Id(外键) + */ + @ApiModelProperty(name = "tenVoltageId",value = "所属10kV线路表Id",required = true) + @NotBlank(message = "所属10kV线路表Id不可为空") + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = "所属10kV线路表Id格式有误") + private String tenVoltageId; + + /** + * 所属单位Id(台区所属的单位和变电站所属单位可能不是一个单位) + */ + @ApiModelProperty(name = "unitId",value = "所属单位Id",required = true) + @NotBlank(message = "所属单位Id不可为空") + private String unitId; + + /** + * 台区名称 + */ + @ApiModelProperty(name = "name",value = "台区名称",required = true) + @NotBlank(message = "台区名称不可为空") + private String name; + + /** + * 台区编号 + */ + @ApiModelProperty(name = "code",value = "台区编号",required = true) + @NotBlank(message = "台区编号不可为空") + private String code; + + /** + * 电缆长度字段 + */ + @ApiModelProperty(name = "cableLength",value = "电缆长度字段") + private Double cableLength; + + /** + * 电阻 + */ + @ApiModelProperty(name = "resistance",value = "电阻") + private Double resistance; + + /** + * 电抗 + */ + @ApiModelProperty(name = "reactance",value = "电抗") + private Double reactance; + + /** + * 变压器型号 + */ + @ApiModelProperty(name = "type",value = "变压器型号") + private String type; + + /** + * 变压器容量 + */ + @ApiModelProperty(name = "capacity",value = "变压器容量") + private Float capacity; + + /** + * 变压器调压方式 + */ + @ApiModelProperty(name = "regulationMode",value = "变压器调压方式") + private Integer regulationMode; + + /** + * 台区无功补偿容量(KVA) + */ + @ApiModelProperty(name = "reactCapacity",value = "台区无功补偿容量(KVA)") + private Float reactCapacity; + + /** + * 是否安装智能融合终端 + */ + @ApiModelProperty(name = "devFusion",value = "是否安装智能融合终端") + private Boolean devFusion; + + /** + * 是否有分布式光伏接入 + */ + @ApiModelProperty(name = "pv",value = "是否有分布式光伏接入") + private Boolean pv; + + /** + * 分布式光伏总装机容量(KVA) + */ + @ApiModelProperty(name = "totalC",value = "分布式光伏总装机容量(KVA)") + private Float totalC; + + /** + * 分布式光伏用户数量 + */ + @ApiModelProperty(name = "pvUsers",value = "分布式光伏用户数量") + private Integer pvUsers; + + /** + * 其他分布式电源装置容量 + */ + @ApiModelProperty(name = "powerPower",value = "其他分布式电源装置容量") + private Float powerPower; + + + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class UpdatePvSubAreaParam extends PvSubAreaParam{ + /** + * id + */ + @ApiModelProperty("id") + @NotBlank(message = ValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR) + private String id; + } + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvSubstationParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvSubstationParam.java new file mode 100644 index 000000000..45e0bf6a5 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvSubstationParam.java @@ -0,0 +1,79 @@ +package com.njcn.device.pojo.param.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +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 javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +public class PvSubstationParam implements Serializable { + + private static final long serialVersionUID = 1L; + + + + /** + * 所属单位Id + */ + @ApiModelProperty(name = "unitId",value = "所属单位Id",required = true) + @NotBlank(message = "所属单位Id不能为空") + private String unitId; + + /** + * 变电站名称 + */ + @ApiModelProperty(name = "name",value = "变电站名称",required = true) + @NotBlank(message = "变电站名称不能为空") + private String name; + + /** + * 电压等级Id,字典表 + */ + @ApiModelProperty(name = "scale",value = "电压等级Id",required = true) + @NotBlank(message = "电压等级不能为空") + private String scale; + + /** + * 变电站总容量(MVA)(手动填写) + */ + @ApiModelProperty(name = "totalCapacity",value = "变电站总容量",required = true) + @NotNull(message = "变电站总容量不能为空") + private Double totalCapacity; + + /** + * 运维班组Code + */ + @ApiModelProperty(name = "teamCode",value = "运维班组Code",required = true) + @NotBlank(message = "运维班组Code不能为空") + private String teamCode; + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class UpdatePvSubstationParam extends PvSubstationParam{ + /** + * id + */ + @ApiModelProperty("id") + @NotBlank(message = ValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR) + private String id; + } + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvTenVoltageParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvTenVoltageParam.java new file mode 100644 index 000000000..2a4bdebc4 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvTenVoltageParam.java @@ -0,0 +1,154 @@ +package com.njcn.device.pojo.param.pv; + +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 com.njcn.web.pojo.annotation.DateTimeStrValid; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +public class PvTenVoltageParam implements Serializable { + + private static final long serialVersionUID = 1L; + + + + /** + * 调度表Id(外键) + */ + @ApiModelProperty(name = "dispatchId",value = "调度表Id",required = true) + @NotBlank(message = "调度表Id不能为空") + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = "id格式违规") + private String dispatchId; + + + /** + * 线路名称 + */ + @ApiModelProperty(name = "name",value = "线路名称",required = true) + @NotBlank(message = "线路名称不能为空") + private String name; + + /** + * 跨区域类型 + */ + @ApiModelProperty(name = "crType",value = "跨区域类型") + private String crType; + + /** + * 电压等级Id,字典表 + */ + @ApiModelProperty(name = "scale",value = "电压等级Id,字典表") + private String scale; + + /** + * 设计电压等级Id,字典表 + */ + @ApiModelProperty(name = "designScale",value = "设计电压等级Id,字典表") + private String designScale; + + /** + * 设备状态 + */ + @ApiModelProperty(name = "devStatus",value = "设备状态") + private Integer devStatus; + + /** + * 是否接地极(0:false;1:true) + */ + @ApiModelProperty(name = "earthing",value = "是否接地极(0:false;1:true)") + private Boolean earthing; + + /** + * 线路性质 + */ + @ApiModelProperty(name = "quality",value = "线路性质") + private String quality; + + /** + * 所属主线 + */ + @ApiModelProperty(name = "masterStroke",value = "所属主线") + private String masterStroke; + + /** + * 专业分类 + */ + @ApiModelProperty(name = "major",value = "专业分类") + private String major; + + /** + * 设备主人 + */ + @ApiModelProperty(name = "master",value = "设备主人") + private String master; + + /** + * 起点电站 + */ + @ApiModelProperty(name = "startStation",value = "起点电站") + private String startStation; + + /** + * 终点电站 + */ + @ApiModelProperty(name = "endStation",value = "终点电站") + private String endStation; + + /** + * 运行负载限额 + */ + @ApiModelProperty(name = "runLoad",value = "运行负载限额") + private Float runLoad; + + /** + * 额定输出功率 + */ + @ApiModelProperty(name = "outputPower",value = "额定输出功率") + private Float outputPower; + + /** + * 最大允许电流 + */ + @ApiModelProperty(name = "maxCurrent",value = "最大允许电流") + private Float maxCurrent; + + /** + * 投运日期 + */ + @ApiModelProperty(name = "putIntoDate",value = "投运日期") + @DateTimeStrValid(message = "投运时间格式错误",format = "yyyy-MM-dd HH:mm:ss") + private String putIntoDate; + + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class UpdatePvTenVoltageParam extends PvTenVoltageParam{ + /** + * id + */ + @ApiModelProperty("id") + @NotBlank(message = ValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR) + private String id; + } + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvUnitParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvUnitParam.java new file mode 100644 index 000000000..4c73872b0 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvUnitParam.java @@ -0,0 +1,66 @@ +package com.njcn.device.pojo.param.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +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 lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +public class PvUnitParam implements Serializable { + + private static final long serialVersionUID = 1L; + + + + /** + * 父节点(0为根节点) + */ + @ApiModelProperty(name = "pid",value = "父节点(0为根节点)") + @NotBlank(message = "父节点id不能为空") + private String pid; + + /** + * 单位名称 + */ + @ApiModelProperty(name = "name",value = "单位名称") + @NotBlank(message = "单位名称不能为空") + private String name; + + /** + * 单位编码 + */ + @ApiModelProperty(name = "code",value = "单位编码") + @NotBlank(message = "单位编码不能为空") + private String code; + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class UpdatePvUnitParam extends PvUnitParam{ + /** + * id + */ + @ApiModelProperty("id") + @NotBlank(message = ValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR) + private String id; + } + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvVoltageParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvVoltageParam.java new file mode 100644 index 000000000..490179862 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/PvVoltageParam.java @@ -0,0 +1,76 @@ +package com.njcn.device.pojo.param.pv; + +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 io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.Range; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +public class PvVoltageParam implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 母线名称 + */ + @ApiModelProperty(value = "母线名称",required = true) + @NotBlank(message = "母线名称不可为空") + private String name; + + /** + * 母线号(在同一台设备中的电压通道号) + */ + @ApiModelProperty(value = "母线号(在同一台设备中的电压通道号)",required = true) + @NotNull(message = "母线号不可为空") + @Range(min = 1,max = 6,message = "选择1-6路母线号线路") + private Integer num; + + /** + * 电压等级Id,字典表 + */ + @ApiModelProperty(value = "电压等级Id,字典表",required = true) + @NotBlank(message = "电压等级不可为空") + private String scale; + + /** + * 母线模型(0:虚拟母线;1:实际母线)默认是实际母线 + */ + @ApiModelProperty(value = "母线模型(0:虚拟母线;1:实际母线)默认是实际母线",required = true) + @NotNull(message = "母线模型不可为空") + private Integer model; + + @Data + @EqualsAndHashCode(callSuper = true) + public static class UpdatePvVoltageParam extends PvVoltageParam{ + /** + * id + */ + @ApiModelProperty("id") + @NotBlank(message = ValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR) + private String id; + } + + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/SubAreaQueryParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/SubAreaQueryParam.java new file mode 100644 index 000000000..f6cb3aa62 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/SubAreaQueryParam.java @@ -0,0 +1,33 @@ +package com.njcn.device.pojo.param.pv; + +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2022/7/6 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class SubAreaQueryParam extends BaseParam { + + @ApiModelProperty("所属10kV线路id") + private List tenVoltageId; + + @ApiModelProperty("所属单位id") + private List unitId; + + @ApiModelProperty("台区名称") + private String name; + + @ApiModelProperty("是否接入") + private Boolean isJoin; + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/SubstationQueryParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/SubstationQueryParam.java new file mode 100644 index 000000000..16df963bb --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/SubstationQueryParam.java @@ -0,0 +1,26 @@ +package com.njcn.device.pojo.param.pv; + +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2022/7/5 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class SubstationQueryParam extends BaseParam { + + @ApiModelProperty(value = "单位id",name = "unitId") + private List unitId; + + @ApiModelProperty(value = "电压等级",name = "scale") + private List scale; +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/TenVoltageQueryParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/TenVoltageQueryParam.java new file mode 100644 index 000000000..ba54187e9 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/TenVoltageQueryParam.java @@ -0,0 +1,26 @@ +package com.njcn.device.pojo.param.pv; + +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2022/7/5 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class TenVoltageQueryParam extends BaseParam { + + @ApiModelProperty(name = "scale",value = "电压等级") + private List scale; + + @ApiModelProperty(name = "designScale",value = "电压等级") + private List designScale; +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/VoltageQueryParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/VoltageQueryParam.java new file mode 100644 index 000000000..844ccc9b7 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/pv/VoltageQueryParam.java @@ -0,0 +1,23 @@ +package com.njcn.device.pojo.param.pv; + +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * pqs + * + * @author cdf + * @date 2022/7/6 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class VoltageQueryParam extends BaseParam { + + @ApiModelProperty(value = "scale",name = "母线名称",required = true) + private String name; + + @ApiModelProperty(value = "scale",name = "电压等级") + private String scale; +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvDevice.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvDevice.java new file mode 100644 index 000000000..b6531766f --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvDevice.java @@ -0,0 +1,91 @@ +package com.njcn.device.pojo.po.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +@TableName("pv_device") +@EqualsAndHashCode(callSuper = true) +public class PvDevice extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 终端台账表Id + */ + private String id; + + /** + * 终端类型(电能质量监测终端、智能电表、智能融合终端),字典表 + */ + private String type; + + /** + * 用于保存PMS中电能质量监测终端Id、智能融合终端Id,智能电表Id + */ + private String devCode; + + /** + * 终端Ip + */ + private String ip; + + /** + * 端口 + */ + private Integer port; + + /** + * 终端型号(570、580……)字典表 + */ + private String devType; + + /** + * 设备制造商,字典表 + */ + private String manufacturer; + + /** + * 装置识别码(3ds加密) + */ + private String series; + + /** + * 装置秘钥(3ds加密) + */ + private String devKey; + + /** + * 本次定检时间,默认等于投运时间 + */ + private LocalDate thisTimeCheck; + + /** + * 下次定检时间,默认为投运时间后推3年,假如时间小于3个月则为待检 + */ + private LocalDate nextTimeCheck; + + /** + * 状态 + */ + private Integer state; + + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvDispatch.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvDispatch.java new file mode 100644 index 000000000..799a0a13b --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvDispatch.java @@ -0,0 +1,35 @@ +package com.njcn.device.pojo.po.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Getter +@Setter +@TableName("pv_dispatch") +public class PvDispatch extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 调度表Id + */ + private String id; + + /** + * 调度名称 + */ + private String name; + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvDistributed.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvDistributed.java new file mode 100644 index 000000000..f623e9813 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvDistributed.java @@ -0,0 +1,86 @@ +package com.njcn.device.pojo.po.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-06 + */ +@Data +@TableName("pv_distributed") +@EqualsAndHashCode(callSuper = true) +public class PvDistributed extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 分布式光伏台账表Id + */ + private String id; + + /** + * 所属台区表Id(外键) + */ + private String subAreaId; + + /** + * 分布式光伏名称 + */ + private String name; + + /** + * 用户编号(与低压用户台账表低压用户编号字段一致) + */ + private String userCode; + + /** + * 终端编号 + */ + private String devCode; + + /** + * 并网电压等级Id,字典表 + */ + private String scale; + + /** + * 装机容量(KVA) + */ + private Float machineCapacity; + + /** + * 上网方式 + */ + private String inteType; + + /** + * 接入相别 + */ + private String phase; + + /** + * 储能配置容量(KVA) + */ + private Float energyCapacity; + + /** + * 状态 + */ + private Integer state; + + + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvLineDetail.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvLineDetail.java new file mode 100644 index 000000000..baa378fcc --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvLineDetail.java @@ -0,0 +1,201 @@ +package com.njcn.device.pojo.po.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +@TableName("pv_line_detail") +@EqualsAndHashCode(callSuper = true) +public class PvLineDetail extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 监测点序号 + */ + private String id; + + /** + * 所属终端 + */ + private String devId; + + /** + * 监测点类型(I类监测点、II类监测点、III类监测点),字典表 + */ + private String type; + + /** + * 所属变电站(I类监测点) + */ + private String substationId; + + /** + * 所属母线名称(I类监测点) + */ + private String voltageId; + + /** + * 所属台区ID(II类监测点) + */ + private String subAreaId; + + /** + * 所属分布式光伏台账(III类监测点) + */ + private String distributedId; + + /** + * 所属低压用户台账(III类监测点) + */ + private String lvUserId; + + /** + * 线路号(在同一台设备中的监测点号) + */ + private Integer num; + + /** + * PT一次变比 + */ + private Float pt1; + + /** + * PT二次变比 + */ + private Float pt2; + + /** + * CT一次变比 + */ + private Float ct1; + + /** + * CT二次变比 + */ + private Float ct2; + + /** + * 设备容量 + */ + private Float devCapacity; + + /** + * 短路容量 + */ + private Float shortCapacity; + + /** + * 基准容量 + */ + private Float standardCapacity; + + /** + * 协议容量 + */ + private Float dealCapacity; + + /** + * 接线类型(0:星型接法;1:三角型接法;2:开口三角型接法) + */ + private Integer ptType; + + /** + * 测量间隔(1-10分钟) + */ + private Integer timeInterval; + + /** + * 干扰源类型,字典表 + */ + private String loadType; + + /** + * 行业类型,字典表 + */ + private String businessType; + + /** + * 网公司谐波监测平台标志(0-否;1-是),默认否 + */ + private Integer monitorFlag; + + /** + * 电网标志(0-电网侧;1-非电网侧) + */ + private Integer powerFlag; + + /** + * 国网谐波监测平台监测点号 + */ + private String monitorId; + + /** + * 监测点对象名称 + */ + private String objName; + + /** + * 人为干预是否参与统计(0:不参与,1:参与)默认参与统计 + */ + private Integer statFlag; + + /** + * 备注 + */ + private String remark; + + /** + * 电压互感器类型,字典表 + */ + private String tfType; + + /** + * 所属变压器编号 + */ + private String tfCode; + + /** + * 中性点接地方式,字典表 + */ + private String groundType; + + /** + * 投运日期 + */ + private LocalDateTime putIn; + + /** + * 接入日期 + */ + private LocalDateTime access; + + /** + * 是否专项供电(0:否,1:是)默认参与统计 + */ + private Integer powerSupply; + + /** + * 状态 + */ + private Integer state; + + + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvLvUser.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvLvUser.java new file mode 100644 index 000000000..1adbf7673 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvLvUser.java @@ -0,0 +1,91 @@ +package com.njcn.device.pojo.po.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +@TableName("pv_lv_user") +@EqualsAndHashCode(callSuper = true) +public class PvLvUser extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 低压用户台账表Id + */ + private String id; + + + /** + * 低压用户编号(营销系统中查出) + */ + private String userCode; + + /** + * 低压用户名称 + */ + private String name; + + /** + * 用户协议容量(kVA) + */ + private Float userCapacity; + + /** + * 是否发生过投诉 + */ + private Integer complain; + + /** + * 投诉内容 + */ + private String complainPart; + + /** + * 整改措施 + */ + private String corrective; + + /** + * 是否有治理装置 + */ + private Integer devGovern; + + /** + * 治理装置类型 + */ + private String governType; + + /** + * 治理装置电压等级 + */ + private String scale; + + /** + * 治理装置容量 + */ + private Float governCapacity; + + /** + * 状态 + */ + private Integer state; + + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvSubArea.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvSubArea.java new file mode 100644 index 000000000..0018d51db --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvSubArea.java @@ -0,0 +1,119 @@ +package com.njcn.device.pojo.po.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +@TableName("pv_sub_area") +@EqualsAndHashCode(callSuper = true) +public class PvSubArea extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 台区表Id + */ + private String id; + + /** + * 所属10kV线路表Id(外键) + */ + private String tenVoltageId; + + /** + * 所属单位Id(台区所属的单位和变电站所属单位可能不是一个单位) + */ + private String unitId; + + /** + * 台区名称 + */ + private String name; + + /** + * 台区编号 + */ + private String code; + + /** + * 电缆长度字段 + */ + private Double cableLength; + + /** + * 电阻 + */ + private Double resistance; + + /** + * 电抗 + */ + private Double reactance; + + /** + * 变压器型号 + */ + private String type; + + /** + * 变压器容量 + */ + private Float capacity; + + /** + * 变压器调压方式 + */ + private Integer regulationMode; + + /** + * 台区无功补偿容量(KVA) + */ + private Float reactCapacity; + + /** + * 是否安装智能融合终端 + */ + private Boolean devFusion; + + /** + * 是否有分布式光伏接入 + */ + private Boolean pv; + + /** + * 分布式光伏总装机容量(KVA) + */ + private Float totalC; + + /** + * 分布式光伏用户数量 + */ + private Integer pvUsers; + + /** + * 其他分布式电源装置容量 + */ + private Float powerPower; + + /** + * 状态 + */ + private Integer state; + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvSubstation.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvSubstation.java new file mode 100644 index 000000000..5b7e7ae28 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvSubstation.java @@ -0,0 +1,56 @@ +package com.njcn.device.pojo.po.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +@TableName("pv_substation") +public class PvSubstation { + + private static final long serialVersionUID = 1L; + + /** + * 变电站表Id + */ + private String id; + + /** + * 所属单位Id + */ + private String unitId; + + /** + * 变电站名称 + */ + private String name; + + /** + * 电压等级Id,字典表 + */ + private String scale; + + /** + * 变电站总容量(MVA)(手动填写) + */ + private Double totalCapacity; + + /** + * 运维班组Code + */ + private String teamCode; + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvTenVoltage.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvTenVoltage.java new file mode 100644 index 000000000..fdd7f0b42 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvTenVoltage.java @@ -0,0 +1,124 @@ +package com.njcn.device.pojo.po.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +@TableName("pv_ten_voltage") +public class PvTenVoltage extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 线路表Id + */ + private String id; + + /** + * 调度表Id(外键) + */ + private String dispatchId; + + + /** + * 线路名称 + */ + private String name; + + /** + * 跨区域类型 + */ + private String crType; + + /** + * 电压等级Id,字典表 + */ + private String scale; + + /** + * 设计电压等级Id,字典表 + */ + private String designScale; + + /** + * 设备状态 + */ + private Integer devStatus; + + /** + * 是否接地极(0:false;1:true) + */ + private Boolean earthing; + + /** + * 线路性质 + */ + private String quality; + + /** + * 所属主线 + */ + private String masterStroke; + + /** + * 专业分类 + */ + private String major; + + /** + * 设备主人 + */ + private String master; + + /** + * 起点电站 + */ + private String startStation; + + /** + * 终点电站 + */ + private String endStation; + + /** + * 运行负载限额 + */ + private Float runLoad; + + /** + * 额定输出功率 + */ + private Float outputPower; + + /** + * 最大允许电流 + */ + private Float maxCurrent; + + /** + * 投运日期 + */ + private LocalDateTime putIntoDate; + + /** + * 状态 + */ + private Integer state; + + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvUnit.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvUnit.java new file mode 100644 index 000000000..cdec58986 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvUnit.java @@ -0,0 +1,45 @@ +package com.njcn.device.pojo.po.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Getter +@Setter +@TableName("pv_unit") +public class PvUnit implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 单位表Id + */ + private String id; + + /** + * 父节点(0为根节点) + */ + private String pid; + + /** + * 单位名称 + */ + private String name; + + /** + * 单位编码 + */ + private String code; + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvVoltage.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvVoltage.java new file mode 100644 index 000000000..9e8fdf33a --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/po/pv/PvVoltage.java @@ -0,0 +1,52 @@ +package com.njcn.device.pojo.po.pv; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Data +@TableName("pv_voltage") +public class PvVoltage { + + private static final long serialVersionUID = 1L; + + /** + * 母线序号 + */ + private String id; + + + /** + * 母线名称 + */ + private String name; + + /** + * 母线号(在同一台设备中的电压通道号) + */ + private Integer num; + + /** + * 电压等级Id,字典表 + */ + private String scale; + + /** + * 母线模型(0:虚拟母线;1:实际母线)默认是实际母线 + */ + private Integer model; + + +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/VersionVO.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/VersionVO.java index 4fa2f7717..758460828 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/VersionVO.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/VersionVO.java @@ -26,7 +26,7 @@ public class VersionVO implements Serializable { /** * 装置系列(终端类型),字典表 */ - @ApiModelProperty("装置系列(终端类型)") + @ApiModelProperty("装置系列(终端型号)") private String devType; /** diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/pv/UnitTreeVO.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/pv/UnitTreeVO.java new file mode 100644 index 000000000..07b14a5db --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/pv/UnitTreeVO.java @@ -0,0 +1,25 @@ +package com.njcn.device.pojo.vo.pv; + +import lombok.Data; + +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2022/7/7 + */ +@Data +public class UnitTreeVO { + + private String id; + + private String pid; + + private String name; + + private String code; + + private List children; +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/controller/TerminalBaseController.java b/pqs-device/device-boot/src/main/java/com/njcn/device/controller/TerminalBaseController.java index faae249ea..55688e3d7 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/controller/TerminalBaseController.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/controller/TerminalBaseController.java @@ -2,6 +2,7 @@ package com.njcn.device.controller; import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.hutool.core.collection.CollectionUtil; import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.constant.OperateType; @@ -67,6 +68,7 @@ public class TerminalBaseController extends BaseController { public HttpResult addTerminal(@Valid @RequestBody AddTerminalParam addTerminalParam) { String methodDescribe = getMethodDescribe("addTerminal"); //装置母线监测点相关检验 + List voltageName = new ArrayList<>(); if (CollectionUtil.isNotEmpty(addTerminalParam.getDeviceParam())) { //校验装置是否存在重名 List listDev = addTerminalParam.getDeviceParam(); @@ -87,10 +89,7 @@ public class TerminalBaseController extends BaseController { if (CollectionUtil.isNotEmpty(deviceParam.getSubVoltageParam())) { List subvList = deviceParam.getSubVoltageParam(); List subVName = subvList.stream().map(SubVoltageParam::getName).collect(Collectors.toList()); - long countSubV = subVName.stream().distinct().count(); - if (countSubV != subVName.size()) { - throw new BusinessException(DeviceResponseEnum.SUBV_NAME_REPETITION); - } + voltageName.addAll(subVName); //校验监测点名称 for (SubVoltageParam subVoltageParam : subvList) { if (CollectionUtil.isNotEmpty(subVoltageParam.getLineParam())) { @@ -109,6 +108,11 @@ public class TerminalBaseController extends BaseController { } } } + + long countSubV = voltageName.stream().distinct().count(); + if (countSubV != voltageName.size()) { + throw new BusinessException(DeviceResponseEnum.SUBV_NAME_REPETITION); + } } terminalBaseService.addTerminal(addTerminalParam); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); @@ -124,7 +128,7 @@ public class TerminalBaseController extends BaseController { @ApiOperation("终端修改操作") @OperateInfo(operateType = OperateType.UPDATE, info = LogEnum.BUSINESS_MEDIUM) @PutMapping("updateTerminal") - public HttpResult updateTerminal(@Valid @RequestBody UpdateTerminalParam updateTerminalParam) { + public HttpResult updateTerminal(@Valid @RequestBody UpdateTerminalParam updateTerminalParam) { String methodDescribe = getMethodDescribe("updateTerminal"); terminalBaseService.updateTerminal(updateTerminalParam); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); @@ -155,7 +159,7 @@ public class TerminalBaseController extends BaseController { @ApiOperation("终端删除操作") @OperateInfo(operateType = OperateType.DELETE, info = LogEnum.BUSINESS_SERIOUS) @DeleteMapping("delTerminal") - public HttpResult delTerminal(@RequestParam("id") String id) { + public HttpResult delTerminal(@RequestParam("id") String id) { String methodDescribe = getMethodDescribe("delTerminal"); terminalBaseService.delTerminal(id); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); @@ -246,12 +250,7 @@ public class TerminalBaseController extends BaseController { @ApiOperation("导出台账模板") @GetMapping(value = "downTerminalTemplate") public void downTerminalTemplate(HttpServletResponse response) { - ExportParams exportExcel = new ExportParams("批量导入模板(请严格按照模板标准填入数据)","台账信息"); - Workbook workbook = ExcelExportUtil.exportExcel(exportExcel,TerminalBaseExcel.class,new ArrayList()); - //这里是自己加的 带下拉框的代码 - ExcelUtil.selectList(workbook, 4, 4, new String[]{"斤","两","个","袋","份"}); - ExcelUtil.selectList(workbook, 0, 0, new String[]{"蔬菜","水果","主食","熟食","调料"}); - PoiUtil.exportFileByWorkbook(workbook, "菜品管理", response); + terminalBaseService.downTerminalTemplate(response); } /** diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/LineMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/LineMapper.java index cf00b97ee..6729d960d 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/LineMapper.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/LineMapper.java @@ -54,6 +54,13 @@ public interface LineMapper extends BaseMapper { */ List getLineDetailByDeviceId(@Param("devId") String devId); + /** + * 查询装置下的母线信息 + * @param devId 设备id + * @date 2022/7/1 + */ + List getVoltageByDevId(@Param("devId") String devId); + /** * 通过监测点id获取母线详情 @@ -297,4 +304,15 @@ public interface LineMapper extends BaseMapper { */ String getDevIndex(@Param("lineId")String lineId); + /** + * 获取变电站下母线 + * @param subId 变电站id + * @author cdf + * @date 2022/7/4 + * @return 结果 + */ + List getVoltageListBySubId(@Param("subId")String subId,@Param("voltageName")List voltageName); + + + } diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/mapping/LineMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/mapping/LineMapper.xml index 779a7ad9a..215beabc7 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/mapping/LineMapper.xml +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/mapping/LineMapper.xml @@ -48,6 +48,14 @@ and a.state = 1 + + - - + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/service/TerminalBaseService.java b/pqs-device/device-boot/src/main/java/com/njcn/device/service/TerminalBaseService.java index 6fb0f63cf..0716dd756 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/service/TerminalBaseService.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/service/TerminalBaseService.java @@ -173,6 +173,13 @@ public interface TerminalBaseService { */ List exportTerminalBase(); + /** + * 导出台账模板 + * @author cdf + * @date 2022/5/17 + */ + void downTerminalTemplate(HttpServletResponse response); + /** * 将台账数据导入终端相关表 * @param file 原始数据信息 diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/TerminalBaseServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/TerminalBaseServiceImpl.java index 930fdba07..f17915ea6 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/TerminalBaseServiceImpl.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/TerminalBaseServiceImpl.java @@ -1,6 +1,8 @@ package com.njcn.device.service.impl; +import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; import cn.hutool.core.collection.CollectionUtil; @@ -32,6 +34,7 @@ import com.njcn.device.service.INodeService; import com.njcn.device.service.LineBakService; import com.njcn.device.service.TerminalBaseService; import com.njcn.device.utils.DeviceUtil; +import com.njcn.device.utils.ExcelStyleUtil; import com.njcn.poi.excel.ExcelUtil; import com.njcn.poi.util.PoiUtil; import com.njcn.system.api.AreaFeignClient; @@ -42,6 +45,8 @@ import com.njcn.system.pojo.po.DictData; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.Workbook; +import org.checkerframework.checker.units.qual.C; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -188,7 +193,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple LambdaQueryWrapper lineLambdaQueryWrapper = new LambdaQueryWrapper<>(); if (CollectionUtil.isNotEmpty(addTerminalParam.getDeviceParam()) && StrUtil.isNotBlank(subIndex)) { //校验变电站下的装置名称ip是否重复 - checkDev(addTerminalParam, subIndex,lineLambdaQueryWrapper); + checkDevNameAndIp(addTerminalParam, subIndex, lineLambdaQueryWrapper); for (DeviceParam deviceParam : addTerminalParam.getDeviceParam()) { @@ -200,21 +205,28 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple List listVoltageNum = Stream.of(1, 2, 3, 4, 5, 6).collect(Collectors.toList()); //标识当前装置下的监测点数量 int lineNum = 0, voltageNum = 0; + //校验监测点总数不超过6 if (CollectionUtil.isNotEmpty(deviceParam.getSubVoltageParam())) { for (SubVoltageParam subVoltage : deviceParam.getSubVoltageParam()) { if (CollectionUtil.isNotEmpty(subVoltage.getLineParam())) { for (LineParam lineValid : subVoltage.getLineParam()) { - if (StrUtil.isNotBlank(lineValid.getName())) { + if (StrUtil.isBlank(lineValid.getLineIndex())) { lineNum++; } } } + + //一台装置母线最多6路 + if (StrUtil.isBlank(subVoltage.getSubvIndex())) { + voltageNum++; + } + } } - if (StrUtil.isBlank(deviceParam.getDevIndex())) { + Line device = assembleLine(deviceParam.getName(), LineBaseEnum.DEVICE_LEVEL.getCode(), subIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex, deviceParam.getSort()); this.baseMapper.insert(device); devIdIndex = device.getId(); @@ -241,7 +253,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple List insertFunList = new ArrayList<>(); for (DictData dicData : funList) { DevFuction devFunction = new DevFuction(); - devFunction.setLineId(device.getId()); devFunction.setFucName(dicData.getId()); devFunction.setId(IdUtil.simpleUUID()); @@ -260,43 +271,84 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple listLineNum.removeIf(integer -> sline.getNum().equals(integer)); } } + //母线 + List voltageList = lineMapper.getVoltageByDevId(devIdIndex); + if (CollectionUtil.isNotEmpty(voltageList)) { + voltageNum = voltageNum + voltageList.size(); + for (Voltage v : voltageList) { + listVoltageNum.removeIf(integer -> v.getNum().equals(integer)); + } + } } if (lineNum > 6) { throw new BusinessException(DeviceResponseEnum.DEVICE_LINE_BIG); } + if (voltageNum > 6) { + throw new BusinessException(DeviceResponseEnum.DEVICE_VOLTAGE_BIG); + } //判断设备下是否存在母线 if (CollectionUtil.isNotEmpty(deviceParam.getSubVoltageParam())) { //当通过设备节点新增时候需要校验是否存在同名母线名称 - if (StrUtil.isBlank(deviceParam.getDevIndex())) { - List subvNameList = deviceParam.getSubVoltageParam().stream() - .filter((subv) -> subv.getSubvIndex() == null) - .map(SubVoltageParam::getName).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(subvNameList)) { - lineLambdaQueryWrapper.clear(); - lineLambdaQueryWrapper.eq(Line::getPid, devIdIndex) - .eq(Line::getState, DataStateEnum.ENABLE.getCode()) - .in(Line::getName, subvNameList); - List subvRes = this.list(lineLambdaQueryWrapper); - if (subvRes.size() > 0) { - List subvList = subvRes.stream().map(Line::getName).collect(Collectors.toList()); - throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, String.join(";", subvList)); - } + List subvNameList = deviceParam.getSubVoltageParam().stream() + .filter((subv) -> subv.getSubvIndex() == null) + .map(SubVoltageParam::getName).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(subvNameList)) { + lineLambdaQueryWrapper.clear(); + lineLambdaQueryWrapper.eq(Line::getPid, devIdIndex) + .eq(Line::getState, DataStateEnum.ENABLE.getCode()) + .in(Line::getName, subvNameList); + List subvRes = this.list(lineLambdaQueryWrapper); + if (subvRes.size() > 0) { + List subvList = subvRes.stream().map(Line::getName).collect(Collectors.toList()); + throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, String.join(";", subvList)); } - } + //母线 + List voltageName = deviceParam.getSubVoltageParam().stream().filter(item -> StrUtil.isBlank(item.getSubvIndex())).map(SubVoltageParam::getName).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(voltageName)) { + List voltageList = this.baseMapper.getVoltageListBySubId(subIndex, voltageName); + if(CollectionUtil.isNotEmpty(voltageList)){ + throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, String.join(";", voltageList.stream().map(Line::getName).collect(Collectors.toList()))); + } + } + + + //校验同一变电站下只能有唯一母线名称 + List addVoltage = deviceParam.getSubVoltageParam().stream().filter(item->item.getSubvIndex() == null).map(SubVoltageParam::getName).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(addVoltage)) { + List voltageListBySubId = this.baseMapper.getVoltageListBySubId(subIndex, addVoltage); + if(CollectionUtil.isNotEmpty(voltageListBySubId)){ + throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, String.join(";",voltageListBySubId.stream().map(Line::getName).collect(Collectors.toList()))); + } + } + for (SubVoltageParam subVoltageParam : deviceParam.getSubVoltageParam()) { //母线id String subvIndex; if (StrUtil.isBlank(subVoltageParam.getSubvIndex()) && StrUtil.isNotBlank(devIdIndex)) { + + + DictData scaleRes = dicDataFeignClient.getDicDataById(subVoltageParam.getScale()).getData(); if (Objects.isNull(scaleRes)) { throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY); } + + //校验母线 + if (CollectionUtil.isNotEmpty(listVoltageNum)) { + if (!listVoltageNum.contains(subVoltageParam.getNum())) { + throw new BusinessException(DeviceResponseEnum.VOLTAGE_NUM_USE, "母线序号:" + subVoltageParam.getNum()); + } + } else { + throw new BusinessException(DeviceResponseEnum.DEVICE_VOLTAGE_BIG); + } + + Line subVoltage = assembleLine(subVoltageParam.getName(), LineBaseEnum.SUB_V_LEVEL.getCode(), devIdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex, subVoltageParam.getSort()); this.baseMapper.insert(subVoltage); subvIndex = subVoltage.getId(); @@ -378,7 +430,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple /** * 校验装置 */ - private void checkDev(AddTerminalParam addTerminalParam, String subIndex,LambdaQueryWrapper lineLambdaQueryWrapper) { + private void checkDevNameAndIp(AddTerminalParam addTerminalParam, String subIndex, LambdaQueryWrapper lineLambdaQueryWrapper) { List devNameList = addTerminalParam.getDeviceParam().stream().filter((dev -> dev.getDevIndex() == null)).map(DeviceParam::getName).collect(Collectors.toList()); @@ -648,6 +700,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple /** * 终端查询操作 * + * @param id pq_line表 id * @author cdf * @date 2021/7/19 */ @@ -890,6 +943,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple SubVoltageVO subVoltageVO = new SubVoltageVO(); BeanUtils.copyProperties(subVoltage, subVoltageVO); Voltage voltage = voltageMapper.selectById(subVoltage.getId()); + subVoltageVO.setSubvIndex(subVoltage.getId()); BeanUtils.copyProperties(voltage, subVoltageVO); subVoltageVO.setLineVO(lineVOS); subVoltageVOS.add(subVoltageVO); @@ -1341,6 +1395,45 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple return this.baseMapper.getTerminalBaseExcel(); } + @Override + public void downTerminalTemplate(HttpServletResponse response) { + ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "台账信息"); + exportParams.setStyle(ExcelStyleUtil.class); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TerminalBaseExcel.class, new ArrayList()); + List businessList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.BUSINESS_TYPE.getName()).getData(); + List loadTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName()).getData(); + List manufacturerList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName()).getData(); + List devTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_TYPE.getName()).getData(); + List frontList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.FRONT_TYPE.getName()).getData(); + List scaleList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_VOLTAGE.getName()).getData(); + List nodeList = nodeService.nodeAllList(); + + + //这里是自己加的 带下拉框的代码 + ExcelUtil.selectList(workbook, 8, 8, new String[]{"虚拟设备", "实际设备", "离线设备"}); + ExcelUtil.selectList(workbook, 9, 9, new String[]{"暂态系统", "稳态系统", "双系统"}); + ExcelUtil.selectList(workbook, 10, 10, new String[]{"投运", "热备用", "停运"}); + ExcelUtil.selectList(workbook, 11, 11, manufacturerList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{})); + ExcelUtil.selectList(workbook, 12, 12, devTypeList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{})); + ExcelUtil.selectList(workbook, 17, 17, new String[]{"周期触发", "变为触发"}); + ExcelUtil.selectList(workbook, 18, 18, nodeList.stream().map(Node::getName).collect(Collectors.toList()).toArray(new String[]{})); + ExcelUtil.selectList(workbook, 19, 19, frontList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{})); + + /*母线序号*/ + ExcelUtil.selectList(workbook, 23, 23, new String[]{"1", "2", "3", "3", "4", "5", "6"}); + ExcelUtil.selectList(workbook, 24, 24, scaleList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{})); + ExcelUtil.selectList(workbook, 25, 25, new String[]{"虚拟母线", "实际母线"}); + ExcelUtil.selectList(workbook, 27, 27, new String[]{"1", "2", "3", "3", "4", "5", "6"}); + ExcelUtil.selectList(workbook, 28, 28, new String[]{"极重要", "重要", "普通", "不重要"}); + ExcelUtil.selectList(workbook, 35, 35, new String[]{"星型接法", "三角型接法", "开口三角型接法"}); + ExcelUtil.selectList(workbook, 36, 36, new String[]{"3", "5", "10"}); + ExcelUtil.selectList(workbook, 37, 37, loadTypeList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{})); + ExcelUtil.selectList(workbook, 38, 38, businessList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{})); + ExcelUtil.selectList(workbook, 41, 41, new String[]{"电网侧", "非电网侧"}); + ExcelUtil.selectList(workbook, 42, 42, new String[]{"不参与统计", "参与统计"}); + PoiUtil.exportFileByWorkbook(workbook, "台账导入模板.xlsx", response); + } + @Override @Transactional(rollbackFor = Exception.class) public void importTerminalBase(MultipartFile file, HttpServletResponse response) { diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/utils/ExcelStyleUtil.java b/pqs-device/device-boot/src/main/java/com/njcn/device/utils/ExcelStyleUtil.java new file mode 100644 index 000000000..3d5e27731 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/utils/ExcelStyleUtil.java @@ -0,0 +1,159 @@ +package com.njcn.device.utils; + +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; +import cn.afterturn.easypoi.excel.entity.params.ExcelForEachParams; +import cn.afterturn.easypoi.excel.export.styler.IExcelExportStyler; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.*; + +/** + * pqs + * + * @author cdf + * @date 2022/7/4 + */ +public class ExcelStyleUtil implements IExcelExportStyler { + // 数据行类型 + private static final String DATA_STYLES = "dataStyles"; + // 标题类型 + private static final String TITLE_STYLES = "titleStyles"; + //头样式 + private static final String HEADER_STYLES = "headerStyles"; + + //数据行样式 + private CellStyle styles; + // 标题样式 + private CellStyle titleStyle; + + // 标题样式 + private CellStyle headerStyle; + + public ExcelStyleUtil(Workbook workbook) { + this.init(workbook); + } + + private void init(Workbook workbook) { + this.styles = initStyles(workbook); + this.titleStyle = initTitleStyle(workbook); + this.headerStyle = initTitleStyle(workbook); + } + + + @Override + public CellStyle getHeaderStyle(short headerColor) { + return headerStyle; + } + + /** + * 标题样式 + */ + @Override + public CellStyle getTitleStyle(short i) { + return titleStyle; + } + + @Override + public CellStyle getStyles(boolean parity, ExcelExportEntity entity) { + return styles; + } + + /** + * 获取样式方法 + * + * @param dataRow 数据行 + * @param obj 对象 + * @param data 数据 + */ + @Override + public CellStyle getStyles(Cell cell, int dataRow, ExcelExportEntity entity, Object obj, Object data) { + return getStyles(true, entity); + } + + @Override + public CellStyle getTemplateStyles(boolean isSingle, ExcelForEachParams excelForEachParams) { + return null; + } + + + /** + * 初始化--标题行样式 + * @param workbook + * @return + */ + private CellStyle initTitleStyle(Workbook workbook) { + return buildCellStyle(workbook,TITLE_STYLES); + } + + /** + * 头样式 + * @author cdf + * @date 2022/7/4 + */ + private CellStyle initHeaderStyle(Workbook workbook) { + return buildCellStyle(workbook,HEADER_STYLES); + } + + /** + * 初始化--数据行样式 + * @param workbook + * @return + */ + private CellStyle initStyles(Workbook workbook) { + return buildCellStyle(workbook,DATA_STYLES); + } + + /** + * 设置单元格样式 + * @param workbook + * @param type 类型 用来区分是数据行样式还是标题样式 + * @return + */ + private CellStyle buildCellStyle(Workbook workbook,String type) { + CellStyle style = workbook.createCellStyle(); + // 字体样式 + Font font = workbook.createFont(); + if(TITLE_STYLES.equals(type)){ + font.setFontHeightInPoints((short)12); + font.setBold(true); + // 设置水平对齐的样式为居中对齐; + style.setAlignment(HorizontalAlignment.CENTER); + } + if(HEADER_STYLES.equals(type)){ + font.setFontHeightInPoints((short)12); + font.setBold(true); + // 设置水平对齐的样式为居中对齐; + style.setAlignment(HorizontalAlignment.LEFT); + } + if(DATA_STYLES.equals(type)){ + font.setFontHeightInPoints((short)10); + // 设置水平对齐的样式为居中对齐; + style.setAlignment(HorizontalAlignment.CENTER); + } + font.setFontName("Courier New"); + style.setFont(font); + // 设置底边框 + style.setBorderBottom(BorderStyle.THIN); + // 设置左边框 + style.setBorderLeft(BorderStyle.THIN); + // 设置右边框; + style.setBorderRight(BorderStyle.THIN); + // 设置顶边框; + style.setBorderTop(BorderStyle.THIN); + // 设置底边颜色 + style.setBottomBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); + // 设置左边框颜色; + style.setLeftBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); + // 设置右边框颜色; + style.setRightBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); + // 设置顶边框颜色; + style.setTopBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); + // 设置自动换行; + style.setWrapText(false); + + + // 设置垂直对齐的样式为居中对齐; + style.setVerticalAlignment(VerticalAlignment.CENTER); + return style; + } +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvDeviceController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvDeviceController.java new file mode 100644 index 000000000..9394bc57f --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvDeviceController.java @@ -0,0 +1,160 @@ +package com.njcn.pvdevice.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.constant.OperateType; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pojo.param.pv.DeviceQueryParam; +import com.njcn.device.pojo.param.pv.PvDeviceParam; +import com.njcn.device.pojo.po.pv.PvDevice; +import com.njcn.pvdevice.service.IPvDeviceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.njcn.web.controller.BaseController; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 终端控制器 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@RestController +@RequestMapping("/pvDevice") +@Api(tags = "pv终端控制器") +@RequiredArgsConstructor +public class PvDeviceController extends BaseController { + + private final IPvDeviceService iPvDeviceService; + + + /** + * 新增终端 + * @param pvDeviceParam 终端实体 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("addDevice") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD) + @ApiOperation("新增终端") + @ApiImplicitParam(name = "pvDeviceParam",value = "终端实体",required = true) + public HttpResult addDevice(@RequestBody @Validated PvDeviceParam pvDeviceParam){ + String methodDescribe = getMethodDescribe("addDevice"); + boolean res = iPvDeviceService.addDevice(pvDeviceParam); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 修改终端 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("updateDevice") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) + @ApiOperation("修改终端") + @ApiImplicitParam(name = "updatePvDeviceParam",value = "终端实体",required = true) + public HttpResult updateDevice(@RequestBody @Validated PvDeviceParam.UpdatePvDeviceParam updatePvDeviceParam){ + String methodDescribe = getMethodDescribe("updateDevice"); + boolean res = iPvDeviceService.updateDevice(updatePvDeviceParam); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 分页查询终端 + * @param deviceQueryParam 查询实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getPvDeviceList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("分页查询终端") + @ApiImplicitParam(name = "deviceQueryParam",value = "终端实体",required = true) + public HttpResult> getPvDeviceList(@RequestBody DeviceQueryParam deviceQueryParam){ + String methodDescribe = getMethodDescribe("getPvDeviceList"); + Page page = iPvDeviceService.getPvDeviceList(deviceQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); + } + + /** + * 查询所有终端 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getAllPvDeviceList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("查询所有终端") + public HttpResult> getAllPvDeviceList(){ + String methodDescribe = getMethodDescribe("getAllPvDeviceList"); + List list = iPvDeviceService.getAllPvDeviceList(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + + /** + * 根据终端id查询终端 + * @param id 终端id + * @author cdf + * @date 2022/7/5 + * @return PvDevice + */ + @GetMapping("getPvDeviceById") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("根据终端id查询终端") + @ApiImplicitParam(name = "id",value = "终端id",required = true) + public HttpResult getPvDeviceById(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("getPvDeviceById"); + PvDevice pvDevice = iPvDeviceService.getPvDeviceById(id); + if(Objects.nonNull(pvDevice)){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvDevice, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + + } + + + /** + * 删除终端 + * @param id 终端id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + @DeleteMapping("delPvDevice") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("删除终端") + @ApiImplicitParam(name = "id",value = "终端id",required = true) + public HttpResult delPvDevice(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("delPvDevice"); + boolean res = iPvDeviceService.delPvDevice(id); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + +} + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvDispatchController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvDispatchController.java new file mode 100644 index 000000000..3939641d1 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvDispatchController.java @@ -0,0 +1,26 @@ +package com.njcn.pvdevice.controller; + + +import io.swagger.annotations.Api; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import com.njcn.web.controller.BaseController; + +/** + *

+ * 前端控制器 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@RestController +@RequestMapping("/pvDispatch") +@Api(tags = "设备控制器") +@RequiredArgsConstructor +public class PvDispatchController extends BaseController { + +} + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvDistributedController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvDistributedController.java new file mode 100644 index 000000000..6bc0a2e74 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvDistributedController.java @@ -0,0 +1,159 @@ +package com.njcn.pvdevice.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.constant.OperateType; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pojo.param.pv.PvDistributedParam; +import com.njcn.device.pojo.param.pv.DistributedQueryParam; +import com.njcn.device.pojo.po.pv.PvDistributed; +import com.njcn.pvdevice.service.IPvDistributedService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.njcn.web.controller.BaseController; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 分布式光伏控制器 + *

+ * + * @author cdf + * @since 2022-07-06 + */ +@RestController +@RequestMapping("/pvDistributed") +@Api(tags = "pv分布式光伏控制器") +@RequiredArgsConstructor +public class PvDistributedController extends BaseController { + + private final IPvDistributedService iPvDistributedService; + + + /** + * 新增分布式光伏台账 + * @param pvDistributedParam 分布式光伏台账实体 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("addDistributed") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD) + @ApiOperation("新增分布式光伏台账") + @ApiImplicitParam(name = "pvDistributedParam",value = "分布式光伏台账实体",required = true) + public HttpResult addDistributed(@RequestBody @Validated PvDistributedParam pvDistributedParam){ + String methodDescribe = getMethodDescribe("addDistributed"); + boolean res = iPvDistributedService.addDistributed(pvDistributedParam); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 修改分布式光伏台账 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("updateDistributed") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) + @ApiOperation("修改分布式光伏台账") + @ApiImplicitParam(name = "updatePvDistributedParam",value = "分布式光伏台账实体",required = true) + public HttpResult updateDistributed(@RequestBody @Validated PvDistributedParam.UpdatePvDistributedParam updatePvDistributedParam){ + String methodDescribe = getMethodDescribe("updateDistributed"); + boolean res = iPvDistributedService.updateDistributed(updatePvDistributedParam); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 分页查询分布式光伏台账 + * @param distributedQueryParam 查询实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getPvDistributedList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("分页查询分布式光伏台账") + @ApiImplicitParam(name = "distributedQueryParam",value = "分布式光伏台账实体",required = true) + public HttpResult> getPvDistributedList(@RequestBody DistributedQueryParam distributedQueryParam){ + String methodDescribe = getMethodDescribe("getPvDistributedList"); + Page page = iPvDistributedService.getPvDistributedList(distributedQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); + } + + /** + * 查询所有分布式光伏台账 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getAllPvDistributedList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("查询所有分布式光伏台账") + public HttpResult> getAllPvDistributedList(){ + String methodDescribe = getMethodDescribe("getAllPvDistributedList"); + List list = iPvDistributedService.getAllPvDistributedList(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + + /** + * 根据分布式光伏台账id查询分布式光伏台账 + * @param id 分布式光伏台账id + * @author cdf + * @date 2022/7/5 + * @return PvDistributed + */ + @GetMapping("getPvDistributedById") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("根据分布式光伏台账id查询分布式光伏台账") + @ApiImplicitParam(name = "id",value = "分布式光伏台账id",required = true) + public HttpResult getPvDistributedById(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("getPvDistributedById"); + PvDistributed pvDistributed = iPvDistributedService.getPvDistributedById(id); + if(Objects.nonNull(pvDistributed)){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvDistributed, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + + } + + + /** + * 删除分布式光伏台账 + * @param id 分布式光伏台账id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + @DeleteMapping("delPvDistributed") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("删除分布式光伏台账") + @ApiImplicitParam(name = "id",value = "分布式光伏台账id",required = true) + public HttpResult delPvDistributed(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("delPvDistributed"); + boolean res = iPvDistributedService.delPvDistributed(id); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + +} + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvLineDetailController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvLineDetailController.java new file mode 100644 index 000000000..dc55bcbc8 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvLineDetailController.java @@ -0,0 +1,161 @@ +package com.njcn.pvdevice.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.constant.OperateType; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pojo.param.pv.LineDetailQueryParam; +import com.njcn.device.pojo.param.pv.PvLineDetailParam; +import com.njcn.device.pojo.po.pv.PvLineDetail; +import com.njcn.pvdevice.service.IPvLineDetailService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.njcn.web.controller.BaseController; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 监测点控制器 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@RestController +@RequestMapping("/pvLineDetail") +@Api(tags = "pv监测点控制器") +@RequiredArgsConstructor +public class PvLineDetailController extends BaseController { + + private final IPvLineDetailService iPvLineDetailService; + + + + /** + * 新增监测点 + * @param pvLineDetailParam 监测点实体 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("addLineDetail") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD) + @ApiOperation("新增监测点") + @ApiImplicitParam(name = "pvLineDetailParam",value = "监测点实体",required = true) + public HttpResult addLineDetail(@RequestBody @Validated PvLineDetailParam pvLineDetailParam){ + String methodDescribe = getMethodDescribe("addLineDetail"); + boolean res = iPvLineDetailService.addLineDetail(pvLineDetailParam); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 修改监测点 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("updateLineDetail") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) + @ApiOperation("修改监测点") + @ApiImplicitParam(name = "updatePvLineDetailParam",value = "监测点实体",required = true) + public HttpResult updateLineDetail(@RequestBody @Validated PvLineDetailParam.UpdatePvLineDetailParam updatePvLineDetailParam){ + String methodDescribe = getMethodDescribe("updateLineDetail"); + boolean res = iPvLineDetailService.updateLineDetail(updatePvLineDetailParam); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 分页查询监测点 + * @param lineDetailQueryParam 查询实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getPvLineDetailList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("分页查询监测点") + @ApiImplicitParam(name = "lineDetailQueryParam",value = "监测点实体",required = true) + public HttpResult> getPvLineDetailList(@RequestBody LineDetailQueryParam lineDetailQueryParam){ + String methodDescribe = getMethodDescribe("getPvLineDetailList"); + Page page = iPvLineDetailService.getPvLineDetailList(lineDetailQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); + } + + /** + * 查询所有监测点 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getAllPvLineDetailList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("查询所有监测点") + public HttpResult> getAllPvLineDetailList(){ + String methodDescribe = getMethodDescribe("getAllPvLineDetailList"); + List list = iPvLineDetailService.getAllPvLineDetailList(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + + /** + * 根据监测点id查询监测点 + * @param id 监测点id + * @author cdf + * @date 2022/7/5 + * @return PvLineDetail + */ + @GetMapping("getPvLineDetailById") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("根据监测点id查询监测点") + @ApiImplicitParam(name = "id",value = "监测点id",required = true) + public HttpResult getPvLineDetailById(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("getPvLineDetailById"); + PvLineDetail pvLineDetail = iPvLineDetailService.getPvLineDetailById(id); + if(Objects.nonNull(pvLineDetail)){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvLineDetail, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + + } + + + /** + * 删除监测点 + * @param id 监测点id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + @DeleteMapping("delPvLineDetail") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("删除监测点") + @ApiImplicitParam(name = "id",value = "监测点id",required = true) + public HttpResult delPvLineDetail(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("delPvLineDetail"); + boolean res = iPvLineDetailService.delPvLineDetail(id); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + +} + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvLvUserController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvLvUserController.java new file mode 100644 index 000000000..30fcdcb50 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvLvUserController.java @@ -0,0 +1,160 @@ +package com.njcn.pvdevice.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.constant.OperateType; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pojo.param.pv.LvUserQueryParam; +import com.njcn.device.pojo.param.pv.PvLvUserParam; +import com.njcn.device.pojo.po.pv.PvLvUser; +import com.njcn.pvdevice.service.IPvLvUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.njcn.web.controller.BaseController; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 低压用户台账控制器 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@RestController +@RequestMapping("/pvLvUser") +@Api(tags = "pv低压用户台账控制器") +@RequiredArgsConstructor +public class PvLvUserController extends BaseController { + + private final IPvLvUserService iPvLvUserService; + + + /** + * 新增低压用户台账 + * @param pvLvUserParam 低压用户台账实体 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("addLvUser") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD) + @ApiOperation("新增低压用户台账") + @ApiImplicitParam(name = "pvLvUserParam",value = "低压用户台账实体",required = true) + public HttpResult addLvUser(@RequestBody @Validated PvLvUserParam pvLvUserParam){ + String methodDescribe = getMethodDescribe("addLvUser"); + boolean res = iPvLvUserService.addLvUser(pvLvUserParam); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 修改低压用户台账 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("updateLvUser") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) + @ApiOperation("修改低压用户台账") + @ApiImplicitParam(name = "updatePvLvUserParam",value = "低压用户台账实体",required = true) + public HttpResult updateLvUser(@RequestBody @Validated PvLvUserParam.UpdatePvLvUserParam updatePvLvUserParam){ + String methodDescribe = getMethodDescribe("updateLvUser"); + boolean res = iPvLvUserService.updateLvUser(updatePvLvUserParam); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 分页查询低压用户台账 + * @param lvUserQueryParam 查询实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getPvLvUserList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("分页查询低压用户台账") + @ApiImplicitParam(name = "lvUserQueryParam",value = "低压用户台账实体",required = true) + public HttpResult> getPvLvUserList(@RequestBody LvUserQueryParam lvUserQueryParam){ + String methodDescribe = getMethodDescribe("getPvLvUserList"); + Page page = iPvLvUserService.getPvLvUserList(lvUserQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); + } + + /** + * 查询所有低压用户台账 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getAllPvLvUserList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("查询所有低压用户台账") + public HttpResult> getAllPvLvUserList(){ + String methodDescribe = getMethodDescribe("getAllPvLvUserList"); + List list = iPvLvUserService.getAllPvLvUserList(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + + /** + * 根据低压用户台账id查询低压用户台账 + * @param id 低压用户台账id + * @author cdf + * @date 2022/7/5 + * @return PvLvUser + */ + @GetMapping("getPvLvUserById") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("根据低压用户台账id查询低压用户台账") + @ApiImplicitParam(name = "id",value = "低压用户台账id",required = true) + public HttpResult getPvLvUserById(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("getPvLvUserById"); + PvLvUser pvLvUser = iPvLvUserService.getPvLvUserById(id); + if(Objects.nonNull(pvLvUser)){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvLvUser, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + + } + + + /** + * 删除低压用户台账 + * @param id 低压用户台账id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + @DeleteMapping("delPvLvUser") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("删除低压用户台账") + @ApiImplicitParam(name = "id",value = "低压用户台账id",required = true) + public HttpResult delPvLvUser(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("delPvLvUser"); + boolean res = iPvLvUserService.delPvLvUser(id); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + +} + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvSubAreaController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvSubAreaController.java new file mode 100644 index 000000000..d84da962a --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvSubAreaController.java @@ -0,0 +1,161 @@ +package com.njcn.pvdevice.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.constant.OperateType; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pojo.param.pv.PvSubAreaParam; +import com.njcn.device.pojo.param.pv.SubAreaQueryParam; +import com.njcn.device.pojo.po.pv.PvSubArea; +import com.njcn.pvdevice.service.IPvSubAreaService; +import com.sun.el.parser.BooleanNode; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.njcn.web.controller.BaseController; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 台区控制器 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@RestController +@RequestMapping("/pvSubArea") +@Api(tags = "pv台区控制器") +@RequiredArgsConstructor +public class PvSubAreaController extends BaseController { + + private final IPvSubAreaService iPvSubAreaService; + + + + /** + * 新增台区 + * @param pvSubAreaParam 台区实体 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("addSubArea") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD) + @ApiOperation("新增台区") + @ApiImplicitParam(name = "pvSubAreaParam",value = "台区实体",required = true) + public HttpResult addSubArea(@RequestBody @Validated PvSubAreaParam pvSubAreaParam){ + String methodDescribe = getMethodDescribe("addSubArea"); + boolean res = iPvSubAreaService.addSubArea(pvSubAreaParam); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 修改台区 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("updateSubArea") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) + @ApiOperation("修改台区") + @ApiImplicitParam(name = "updatePvSubAreaParam",value = "台区实体",required = true) + public HttpResult updateSubArea(@RequestBody @Validated PvSubAreaParam.UpdatePvSubAreaParam updatePvSubAreaParam){ + String methodDescribe = getMethodDescribe("updateSubArea"); + boolean res = iPvSubAreaService.updateSubArea(updatePvSubAreaParam); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 分页查询台区 + * @param subAreaQueryParam 查询实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getPvSubAreaList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("分页查询台区") + @ApiImplicitParam(name = "subAreaQueryParam",value = "台区实体",required = true) + public HttpResult> getPvSubAreaList(@RequestBody SubAreaQueryParam subAreaQueryParam){ + String methodDescribe = getMethodDescribe("getPvSubAreaList"); + Page page = iPvSubAreaService.getPvSubAreaList(subAreaQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); + } + + /** + * 查询所有台区 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getAllPvSubAreaList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("查询所有台区") + public HttpResult> getAllPvSubAreaList(){ + String methodDescribe = getMethodDescribe("getAllPvSubAreaList"); + List list = iPvSubAreaService.getAllPvSubAreaList(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + + /** + * 根据台区id查询台区 + * @param id 台区id + * @author cdf + * @date 2022/7/5 + * @return PvSubArea + */ + @GetMapping("getPvSubAreaById") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("根据台区id查询台区") + @ApiImplicitParam(name = "id",value = "台区id",required = true) + public HttpResult getPvSubAreaById(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("getPvSubAreaById"); + PvSubArea pvSubArea = iPvSubAreaService.getPvSubAreaById(id); + if(Objects.nonNull(pvSubArea)){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvSubArea, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + + } + + + /** + * 删除台区 + * @param id 台区id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + @DeleteMapping("delPvSubArea") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("删除台区") + @ApiImplicitParam(name = "id",value = "台区id",required = true) + public HttpResult delPvSubArea(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("delPvSubArea"); + boolean res = iPvSubAreaService.delPvSubArea(id); + if(res){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + +} + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvSubstationController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvSubstationController.java new file mode 100644 index 000000000..7e65709a4 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvSubstationController.java @@ -0,0 +1,151 @@ +package com.njcn.pvdevice.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.constant.OperateType; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pojo.param.pv.PvSubstationParam; +import com.njcn.device.pojo.param.pv.SubstationQueryParam; +import com.njcn.device.pojo.po.pv.PvSubstation; +import com.njcn.pvdevice.service.IPvSubstationService; +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.njcn.web.controller.BaseController; + +import java.util.List; + +/** + *

+ * 变电站控制器 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@RestController +@RequestMapping("/pvSubstation") +@Api(tags = "pv变电站控制器") +@RequiredArgsConstructor +public class PvSubstationController extends BaseController { + + private final IPvSubstationService iPvSubstationService; + + /** + * 新增变电站 + * @param pvSubstationParam 变电站实体 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("addSubstation") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD) + @ApiOperation("新增变电站") + @ApiImplicitParam(name = "pvSubstationParam",value = "变电站实体",required = true) + public HttpResult addSubstation(@RequestBody @Validated PvSubstationParam pvSubstationParam){ + String methodDescribe = getMethodDescribe("addSubstation"); + iPvSubstationService.addSubstation(pvSubstationParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + + + } + + + /** + * 修改变电站 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("updateSubstation") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) + @ApiOperation("修改变电站") + @ApiImplicitParam(name = "updatePvSubstationParam",value = "变电站实体",required = true) + public HttpResult updateSubstation(@RequestBody @Validated PvSubstationParam.UpdatePvSubstationParam updatePvSubstationParam){ + String methodDescribe = getMethodDescribe("updateSubstation"); + iPvSubstationService.updateSubstation(updatePvSubstationParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + + + } + + + /** + * 分页查询变电站 + * @param substationQueryParam 查询实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getPvSubstationList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("分页查询变电站") + @ApiImplicitParam(name = "substationQueryParam",value = "变电站实体",required = true) + public HttpResult> getPvSubstationList(@RequestBody SubstationQueryParam substationQueryParam){ + String methodDescribe = getMethodDescribe("getPvSubstationList"); + Page page = iPvSubstationService.getPvSubstationList(substationQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); + + } + + /** + * 查询所有变电站 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getAllPvSubstationList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("查询所有变电站") + public HttpResult> getAllPvSubstationList(){ + String methodDescribe = getMethodDescribe("getAllPvSubstationList"); + List list = iPvSubstationService.getAllPvSubstationList(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + + /** + * 根据变电站id查询变电站 + * @param id 变电站id + * @author cdf + * @date 2022/7/5 + * @return PvSubstation + */ + @GetMapping("getPvSubstationById") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("根据变电站id查询变电站") + @ApiImplicitParam(name = "id",value = "变电站id",required = true) + public HttpResult getPvSubstationById(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("getPvSubstationById"); + PvSubstation pvSubstation = iPvSubstationService.getPvSubstationById(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvSubstation, methodDescribe); + } + + + /** + * 删除变电站 + * @param id 变电站id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + @DeleteMapping("delPvSubstation") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("删除变电站") + @ApiImplicitParam(name = "id",value = "变电站id",required = true) + public HttpResult delPvSubstation(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("delPvSubstation"); + iPvSubstationService.delPvSubstation(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + + +} + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvTenVoltageController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvTenVoltageController.java new file mode 100644 index 000000000..eec46eece --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvTenVoltageController.java @@ -0,0 +1,141 @@ +package com.njcn.pvdevice.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.constant.OperateType; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pojo.param.pv.PvTenVoltageParam; +import com.njcn.device.pojo.param.pv.TenVoltageQueryParam; +import com.njcn.device.pojo.po.pv.PvTenVoltage; +import com.njcn.pvdevice.service.IPvTenVoltageService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.njcn.web.controller.BaseController; + +/** + *

+ * 前端控制器 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@RestController +@RequestMapping("/pvTenVoltage") +@Api(tags = "pv十千伏线路控制器") +@RequiredArgsConstructor +public class PvTenVoltageController extends BaseController { + + private final IPvTenVoltageService iPvTenVoltageService; + + /** + * 新增10kV线路 + * + * @param pvTenVoltageParam 10kV线路实体 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("addTenVoltage") + @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD) + @ApiOperation("新增10kV线路") + @ApiImplicitParam(name = "pvTenVoltageParam", value = "10kV线路实体", required = true) + public HttpResult addTenVoltage(@RequestBody @Validated PvTenVoltageParam pvTenVoltageParam) { + String methodDescribe = getMethodDescribe("addTenVoltage"); + boolean flag = iPvTenVoltageService.addTenVoltage(pvTenVoltageParam); + if (flag) { + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 修改10kV线路 + * + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("updateTenVoltage") + @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE) + @ApiOperation("修改10kV线路") + @ApiImplicitParam(name = "updatePvTenVoltageParam", value = "10kV线路实体", required = true) + public HttpResult updateTenVoltage(@RequestBody @Validated PvTenVoltageParam.UpdatePvTenVoltageParam updatePvTenVoltageParam) { + String methodDescribe = getMethodDescribe("updateTenVoltage"); + boolean flag = iPvTenVoltageService.updateTenVoltage(updatePvTenVoltageParam); + if (flag) { + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + + + /** + * 分页查询10kV线路 + * + * @param tenVoltageQueryParam 查询实体 + * @return Page + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("getPvTenVoltageList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("分页查询10kV线路") + @ApiImplicitParam(name = "tenVoltageQueryParam", value = "10kV线路实体", required = true) + public HttpResult> getPvTenVoltageList(@RequestBody @Validated TenVoltageQueryParam tenVoltageQueryParam) { + String methodDescribe = getMethodDescribe("getPvTenVoltageList"); + Page page = iPvTenVoltageService.getPvTenVoltageList(tenVoltageQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); + + } + + + /** + * 根据10kV线路id查询10kV线路 + * + * @param id 10kV线路id + * @return PvTenVoltage + * @author cdf + * @date 2022/7/5 + */ + @GetMapping("getPvTenVoltageById") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("根据10kV线路id查询10kV线路") + @ApiImplicitParam(name = "id", value = "10kV线路id", required = true) + public HttpResult getPvTenVoltageById(@RequestParam("id") String id) { + String methodDescribe = getMethodDescribe("getPvTenVoltageById"); + PvTenVoltage pvTenVoltage = iPvTenVoltageService.getPvTenVoltageById(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvTenVoltage, methodDescribe); + } + + + /** + * 删除10kV线路 + * + * @param id 10kV线路id + * @return boolean + * @author cdf + * @date 2022/7/5 + */ + @DeleteMapping("delPvTenVoltage") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("删除10kV线路") + @ApiImplicitParam(name = "id", value = "10kV线路id", required = true) + public HttpResult delPvTenVoltage(@RequestParam("id") String id) { + String methodDescribe = getMethodDescribe("delPvTenVoltage"); + boolean flag = iPvTenVoltageService.delPvTenVoltage(id); + if (flag) { + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } +} + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvUnitController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvUnitController.java new file mode 100644 index 000000000..9f09def6b --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvUnitController.java @@ -0,0 +1,134 @@ +package com.njcn.pvdevice.controller; + + +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.constant.OperateType; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pojo.param.pv.PvUnitParam; +import com.njcn.device.pojo.po.pv.PvUnit; +import com.njcn.device.pojo.vo.pv.UnitTreeVO; +import com.njcn.pvdevice.service.IPvUnitService; +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.njcn.web.controller.BaseController; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@RestController +@RequestMapping("/pvUnit") +@Api(tags = "pv单位控制器") +@RequiredArgsConstructor +public class PvUnitController extends BaseController { + + private final IPvUnitService iPvUnitService; + + /** + * 新增单位 + * @param pvUnitParam 单位实体 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("addUnit") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD) + @ApiOperation("新增单位") + @ApiImplicitParam(name = "pvUnitParam",value = "单位实体",required = true) + public HttpResult addUnit(@RequestBody @Validated PvUnitParam pvUnitParam){ + String methodDescribe = getMethodDescribe("addUnit"); + iPvUnitService.addUnit(pvUnitParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + + + } + + + /** + * 修改单位 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("updateUnit") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) + @ApiOperation("修改单位") + @ApiImplicitParam(name = "updatePvUnitParam",value = "单位实体",required = true) + public HttpResult updateUnit(@RequestBody @Validated PvUnitParam.UpdatePvUnitParam updatePvUnitParam){ + String methodDescribe = getMethodDescribe("updateUnit"); + iPvUnitService.updateUnit(updatePvUnitParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + + + } + + + /** + * 查询所有单位 + * @param baseParam 查询实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getPvUnitList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("查询所有单位") + @ApiImplicitParam(name = "baseParam",value = "单位实体",required = true) + public HttpResult> getPvUnitList(@RequestBody BaseParam baseParam){ + String methodDescribe = getMethodDescribe("getPvUnitList"); + List res = iPvUnitService.getPvUnitList(baseParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe); + + } + + + /** + * 根据单位id查询单位 + * @param id 单位id + * @author cdf + * @date 2022/7/5 + * @return PvUnit + */ + @GetMapping("getPvUnitById") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("根据单位id查询单位") + @ApiImplicitParam(name = "id",value = "单位id",required = true) + public HttpResult getPvUnitById(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("getPvUnitById"); + PvUnit pvUnit = iPvUnitService.getPvUnitById(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvUnit, methodDescribe); + } + + + /** + * 删除单位 + * @param id 单位id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + @DeleteMapping("delPvUnit") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("删除单位") + @ApiImplicitParam(name = "id",value = "单位id",required = true) + public HttpResult delPvUnit(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("delPvUnit"); + iPvUnitService.delPvUnit(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + +} + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvVoltageController.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvVoltageController.java new file mode 100644 index 000000000..3535ed189 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/controller/PvVoltageController.java @@ -0,0 +1,147 @@ +package com.njcn.pvdevice.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.constant.OperateType; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pojo.param.pv.PvVoltageParam; +import com.njcn.device.pojo.param.pv.VoltageQueryParam; +import com.njcn.device.pojo.po.pv.PvVoltage; +import com.njcn.pvdevice.service.IPvTenVoltageService; +import com.njcn.pvdevice.service.IPvVoltageService; +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.njcn.web.controller.BaseController; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@RestController +@RequestMapping("/pvVoltage") +@Api(tags = "pv母线控制器") +@RequiredArgsConstructor +public class PvVoltageController extends BaseController { + + private final IPvVoltageService iPvVoltageService; + + + /** + * 新增母线 + * @param pvVoltageParam 母线实体 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("addVoltage") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.ADD) + @ApiOperation("新增母线") + @ApiImplicitParam(name = "pvVoltageParam",value = "母线实体",required = true) + public HttpResult addVoltage(@RequestBody @Validated PvVoltageParam pvVoltageParam){ + String methodDescribe = getMethodDescribe("addVoltage"); + iPvVoltageService.addVoltage(pvVoltageParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + + + /** + * 修改母线 + * @author cdf + * @date 2022/7/5 + */ + @PostMapping("updateVoltage") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) + @ApiOperation("修改母线") + @ApiImplicitParam(name = "updatePvVoltageParam",value = "母线实体",required = true) + public HttpResult updateVoltage(@RequestBody @Validated PvVoltageParam.UpdatePvVoltageParam updatePvVoltageParam){ + String methodDescribe = getMethodDescribe("updateVoltage"); + iPvVoltageService.updateVoltage(updatePvVoltageParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + + + /** + * 分页查询母线 + * @param voltageQueryParam 查询实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getPvVoltageList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("分页查询母线") + @ApiImplicitParam(name = "voltageQueryParam",value = "母线实体",required = true) + public HttpResult> getPvVoltageList(@RequestBody VoltageQueryParam voltageQueryParam){ + String methodDescribe = getMethodDescribe("getPvVoltageList"); + Page page = iPvVoltageService.getPvVoltageList(voltageQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); + } + + /** + * 查询所有母线 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + @PostMapping("getAllPvVoltageList") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("查询所有母线") + public HttpResult> getAllPvVoltageList(){ + String methodDescribe = getMethodDescribe("getAllPvVoltageList"); + List list = iPvVoltageService.getAllPvVoltageList(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + + /** + * 根据母线id查询母线 + * @param id 母线id + * @author cdf + * @date 2022/7/5 + * @return PvVoltage + */ + @GetMapping("getPvVoltageById") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("根据母线id查询母线") + @ApiImplicitParam(name = "id",value = "母线id",required = true) + public HttpResult getPvVoltageById(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("getPvVoltageById"); + PvVoltage pvVoltage = iPvVoltageService.getPvVoltageById(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvVoltage, methodDescribe); + } + + + /** + * 删除母线 + * @param id 母线id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + @DeleteMapping("delPvVoltage") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("删除母线") + @ApiImplicitParam(name = "id",value = "母线id",required = true) + public HttpResult delPvVoltage(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("delPvVoltage"); + iPvVoltageService.delPvVoltage(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + +} + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvDeviceMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvDeviceMapper.java new file mode 100644 index 000000000..e0db5690f --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvDeviceMapper.java @@ -0,0 +1,30 @@ +package com.njcn.pvdevice.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.DeviceQueryParam; +import com.njcn.device.pojo.po.pv.PvDevice; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface PvDeviceMapper extends BaseMapper { + + + + + /** + * 获取所有终端台账 + * @author cdf + * @date 2022/7/8 + */ + Page getPvDeviceList(Page page,@Param("deviceQueryParam") DeviceQueryParam deviceQueryParam); + + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvDispatchMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvDispatchMapper.java new file mode 100644 index 000000000..7db32cfdf --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvDispatchMapper.java @@ -0,0 +1,16 @@ +package com.njcn.pvdevice.mapper; + +import com.njcn.device.pojo.po.pv.PvDispatch; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface PvDispatchMapper extends BaseMapper { + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvDistributedMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvDistributedMapper.java new file mode 100644 index 000000000..4bed6e715 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvDistributedMapper.java @@ -0,0 +1,27 @@ +package com.njcn.pvdevice.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.DistributedQueryParam; +import com.njcn.device.pojo.po.pv.PvDistributed; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2022-07-06 + */ +public interface PvDistributedMapper extends BaseMapper { + + /** + * 查询索引分布式光伏 + * @author cdf + * @date 2022/7/7 + */ + Page getPvDistributedList(Page page,@Param("distributedQueryParam") DistributedQueryParam distributedQueryParam); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvLineDetailMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvLineDetailMapper.java new file mode 100644 index 000000000..d82aad350 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvLineDetailMapper.java @@ -0,0 +1,16 @@ +package com.njcn.pvdevice.mapper; + +import com.njcn.device.pojo.po.pv.PvLineDetail; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface PvLineDetailMapper extends BaseMapper { + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvLvUserMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvLvUserMapper.java new file mode 100644 index 000000000..74dc5c90a --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvLvUserMapper.java @@ -0,0 +1,26 @@ +package com.njcn.pvdevice.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.LvUserQueryParam; +import com.njcn.device.pojo.po.pv.PvLvUser; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface PvLvUserMapper extends BaseMapper { + + /** + * 分页获取低压用户台账 + * @author cdf + * @date 2022/7/8 + */ + Page getPvLvUserList(Page page,@Param("lvUserQueryParam") LvUserQueryParam lvUserQueryParam); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvSubAreaMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvSubAreaMapper.java new file mode 100644 index 000000000..62141d615 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvSubAreaMapper.java @@ -0,0 +1,27 @@ +package com.njcn.pvdevice.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.SubAreaQueryParam; +import com.njcn.device.pojo.po.pv.PvSubArea; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface PvSubAreaMapper extends BaseMapper { + + + /** + * 查询所有台区 + * @author cdf + * @date 2022/7/7 + */ + Page getPvSubAreaList(Page page,@Param("subsAreaQueryParam") SubAreaQueryParam subsAreaQueryParam); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvSubstationMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvSubstationMapper.java new file mode 100644 index 000000000..b58b65aa6 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvSubstationMapper.java @@ -0,0 +1,21 @@ +package com.njcn.pvdevice.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.SubstationQueryParam; +import com.njcn.device.pojo.po.pv.PvSubstation; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface PvSubstationMapper extends BaseMapper { + + Page getPvSubstationList(Page page,@Param("substationQueryParam") SubstationQueryParam substationQueryParam); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvTenVoltageMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvTenVoltageMapper.java new file mode 100644 index 000000000..f731c3b95 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvTenVoltageMapper.java @@ -0,0 +1,26 @@ +package com.njcn.pvdevice.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.TenVoltageQueryParam; +import com.njcn.device.pojo.po.pv.PvTenVoltage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface PvTenVoltageMapper extends BaseMapper { + + /** + * 获取所有10kV线路 + * @author cdf + * @date 2022/7/7 + */ + Page getPvTenVoltageList(Page page,@Param("tenVoltageQueryParam") TenVoltageQueryParam tenVoltageQueryParam); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvUnitMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvUnitMapper.java new file mode 100644 index 000000000..ea0372bb0 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvUnitMapper.java @@ -0,0 +1,28 @@ +package com.njcn.pvdevice.mapper; + +import com.njcn.device.pojo.po.pv.PvUnit; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.device.pojo.vo.pv.UnitTreeVO; +import com.njcn.web.pojo.param.BaseParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface PvUnitMapper extends BaseMapper { + + /** + * 获取主列表单位树 + * @author cdf + * @date 2022/7/7 + */ + List getPvUnitList(@Param("orderBy")String orderBy,@Param("sortBy")String sortBy); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvVoltageMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvVoltageMapper.java new file mode 100644 index 000000000..8dd1c0ba2 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/PvVoltageMapper.java @@ -0,0 +1,16 @@ +package com.njcn.pvdevice.mapper; + +import com.njcn.device.pojo.po.pv.PvVoltage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface PvVoltageMapper extends BaseMapper { + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvDeviceMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvDeviceMapper.xml new file mode 100644 index 000000000..0deb78937 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvDeviceMapper.xml @@ -0,0 +1,44 @@ + + + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvDispatchMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvDispatchMapper.xml new file mode 100644 index 000000000..eb221771a --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvDispatchMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvDistributedMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvDistributedMapper.xml new file mode 100644 index 000000000..10336029e --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvDistributedMapper.xml @@ -0,0 +1,34 @@ + + + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvLineDetailMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvLineDetailMapper.xml new file mode 100644 index 000000000..a3efeab81 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvLineDetailMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvLvUserMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvLvUserMapper.xml new file mode 100644 index 000000000..682e26b6a --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvLvUserMapper.xml @@ -0,0 +1,36 @@ + + + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvSubAreaMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvSubAreaMapper.xml new file mode 100644 index 000000000..3e8eb5c8a --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvSubAreaMapper.xml @@ -0,0 +1,49 @@ + + + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvSubstationMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvSubstationMapper.xml new file mode 100644 index 000000000..cb4d48d4d --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvSubstationMapper.xml @@ -0,0 +1,39 @@ + + + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvTenVoltageMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvTenVoltageMapper.xml new file mode 100644 index 000000000..8980c7e8f --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvTenVoltageMapper.xml @@ -0,0 +1,49 @@ + + + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvUnitMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvUnitMapper.xml new file mode 100644 index 000000000..ddf5fe332 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvUnitMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvVoltageMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvVoltageMapper.xml new file mode 100644 index 000000000..21b198390 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/mapper/mapping/PvVoltageMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvDeviceService.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvDeviceService.java new file mode 100644 index 000000000..63c587633 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvDeviceService.java @@ -0,0 +1,72 @@ +package com.njcn.pvdevice.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.DeviceQueryParam; +import com.njcn.device.pojo.param.pv.PvDeviceParam; +import com.njcn.device.pojo.po.pv.PvDevice; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.device.pojo.po.pv.PvDevice; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface IPvDeviceService extends IService { + + + /** + * 新增分布式台账 + * @param pvDeviceParam 分布式台账实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean addDevice(PvDeviceParam pvDeviceParam); + + /** + * 修改分布式台账 + * @param updatePvDeviceParam 分布式台账实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean updateDevice(PvDeviceParam.UpdatePvDeviceParam updatePvDeviceParam); + + + /** + * 分页查询分布式台账 + * @param DeviceQueryParam 分布式台账实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + Page getPvDeviceList(DeviceQueryParam deviceQueryParam); + + List getAllPvDeviceList(); + + + /** + * 根据分布式台账id查询分布式台账 + * @param id 分布式台账id + * @author cdf + * @date 2022/7/5 + * @return PvDevice + */ + PvDevice getPvDeviceById(String id); + + /** + * 删除分布式台账 + * @param id 分布式台账id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean delPvDevice(String id); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvDispatchService.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvDispatchService.java new file mode 100644 index 000000000..08a39ea92 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvDispatchService.java @@ -0,0 +1,16 @@ +package com.njcn.pvdevice.service; + +import com.njcn.device.pojo.po.pv.PvDispatch; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface IPvDispatchService extends IService { + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvDistributedService.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvDistributedService.java new file mode 100644 index 000000000..ec9f3339f --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvDistributedService.java @@ -0,0 +1,74 @@ +package com.njcn.pvdevice.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.device.pojo.param.pv.PvDistributedParam; +import com.njcn.device.pojo.param.pv.DistributedQueryParam; +import com.njcn.device.pojo.po.pv.PvDistributed; +import com.njcn.device.pojo.po.pv.PvDistributed; + +import java.util.List; + +/** + *

+ * 分布式服务类 + *

+ * + * @author cdf + * @since 2022-07-06 + */ +public interface IPvDistributedService extends IService { + + + /** + * 新增分布式台账 + * @param pvDistributedParam 分布式台账实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean addDistributed(PvDistributedParam pvDistributedParam); + + /** + * 修改分布式台账 + * @param updatePvDistributedParam 分布式台账实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean updateDistributed(PvDistributedParam.UpdatePvDistributedParam updatePvDistributedParam); + + + /** + * 分页查询分布式台账 + * @param distributedQueryParam 分布式台账实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + Page getPvDistributedList(DistributedQueryParam distributedQueryParam); + + List getAllPvDistributedList(); + + + /** + * 根据分布式台账id查询分布式台账 + * @param id 分布式台账id + * @author cdf + * @date 2022/7/5 + * @return PvDistributed + */ + PvDistributed getPvDistributedById(String id); + + /** + * 删除分布式台账 + * @param id 分布式台账id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean delPvDistributed(String id); + + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvLineDetailService.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvLineDetailService.java new file mode 100644 index 000000000..9fef54fe5 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvLineDetailService.java @@ -0,0 +1,72 @@ +package com.njcn.pvdevice.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.LineDetailQueryParam; +import com.njcn.device.pojo.param.pv.PvLineDetailParam; +import com.njcn.device.pojo.po.pv.PvLineDetail; +import com.njcn.device.pojo.po.pv.PvLineDetail; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface IPvLineDetailService extends IService { + + + /** + * 新增监测点 + * @param pvLineDetailParam 监测点实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean addLineDetail(PvLineDetailParam pvLineDetailParam); + + /** + * 修改监测点 + * @param updatePvLineDetailParam 监测点实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean updateLineDetail(PvLineDetailParam.UpdatePvLineDetailParam updatePvLineDetailParam); + + + /** + * 分页查询监测点 + * @param lineDetailQueryParam 监测点实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + Page getPvLineDetailList(LineDetailQueryParam lineDetailQueryParam); + + List getAllPvLineDetailList(); + + + /** + * 根据监测点id查询监测点 + * @param id 监测点id + * @author cdf + * @date 2022/7/5 + * @return PvLineDetail + */ + PvLineDetail getPvLineDetailById(String id); + + /** + * 删除监测点 + * @param id 监测点id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean delPvLineDetail(String id); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvLvUserService.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvLvUserService.java new file mode 100644 index 000000000..b56bda57b --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvLvUserService.java @@ -0,0 +1,71 @@ +package com.njcn.pvdevice.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.LvUserQueryParam; +import com.njcn.device.pojo.param.pv.PvLvUserParam; +import com.njcn.device.pojo.po.pv.PvLvUser; +import com.njcn.device.pojo.po.pv.PvLvUser; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface IPvLvUserService extends IService { + + + /** + * 新增分低压用户台账 + * @param pvLvUserParam 分低压用户台账实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean addLvUser(PvLvUserParam pvLvUserParam); + + /** + * 修改分低压用户台账 + * @param updatePvLvUserParam 分低压用户台账实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean updateLvUser(PvLvUserParam.UpdatePvLvUserParam updatePvLvUserParam); + + + /** + * 分页查询分低压用户台账 + * @param lvUserQueryParam 分低压用户台账实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + Page getPvLvUserList(LvUserQueryParam lvUserQueryParam); + + List getAllPvLvUserList(); + + + /** + * 根据分低压用户台账id查询分低压用户台账 + * @param id 分低压用户台账id + * @author cdf + * @date 2022/7/5 + * @return PvLvUser + */ + PvLvUser getPvLvUserById(String id); + + /** + * 删除分低压用户台账 + * @param id 分低压用户台账id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean delPvLvUser(String id); +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvSubAreaService.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvSubAreaService.java new file mode 100644 index 000000000..1a9375489 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvSubAreaService.java @@ -0,0 +1,71 @@ +package com.njcn.pvdevice.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.PvSubAreaParam; +import com.njcn.device.pojo.param.pv.SubAreaQueryParam; +import com.njcn.device.pojo.po.pv.PvSubArea; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.device.pojo.po.pv.PvSubArea; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface IPvSubAreaService extends IService { + + /** + * 新增台区 + * @param pvSubAreaParam 台区实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean addSubArea(PvSubAreaParam pvSubAreaParam); + + /** + * 修改台区 + * @param updatePvSubAreaParam 台区实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean updateSubArea(PvSubAreaParam.UpdatePvSubAreaParam updatePvSubAreaParam); + + + /** + * 分页查询台区 + * @param subAreaQueryParam 台区实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + Page getPvSubAreaList(SubAreaQueryParam subAreaQueryParam); + + List getAllPvSubAreaList(); + + + /** + * 根据台区id查询台区 + * @param id 台区id + * @author cdf + * @date 2022/7/5 + * @return PvSubArea + */ + PvSubArea getPvSubAreaById(String id); + + /** + * 删除台区 + * @param id 台区id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean delPvSubArea(String id); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvSubstationService.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvSubstationService.java new file mode 100644 index 000000000..b31c8fc51 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvSubstationService.java @@ -0,0 +1,72 @@ +package com.njcn.pvdevice.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.PvSubstationParam; +import com.njcn.device.pojo.param.pv.SubstationQueryParam; +import com.njcn.device.pojo.po.pv.PvSubstation; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.device.pojo.po.pv.PvSubstation; +import com.njcn.web.pojo.param.BaseParam; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface IPvSubstationService extends IService { + + /** + * 新增变电站 + * @param pvSubstationParam 变电站实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean addSubstation(PvSubstationParam pvSubstationParam); + + /** + * 修改变电站 + * @param updatePvSubstationParam 变电站实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean updateSubstation(PvSubstationParam.UpdatePvSubstationParam updatePvSubstationParam); + + + /** + * 分页查询变电站 + * @param substationQueryParam 变电站实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + Page getPvSubstationList(SubstationQueryParam substationQueryParam); + + List getAllPvSubstationList(); + + + /** + * 根据变电站id查询变电站 + * @param id 变电站id + * @author cdf + * @date 2022/7/5 + * @return PvSubstation + */ + PvSubstation getPvSubstationById(String id); + + /** + * 删除变电站 + * @param id 变电站id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean delPvSubstation(String id); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvTenVoltageService.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvTenVoltageService.java new file mode 100644 index 000000000..f913508a7 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvTenVoltageService.java @@ -0,0 +1,68 @@ +package com.njcn.pvdevice.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.PvTenVoltageParam; +import com.njcn.device.pojo.param.pv.TenVoltageQueryParam; +import com.njcn.device.pojo.po.pv.PvTenVoltage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.device.pojo.po.pv.PvTenVoltage; + +/** + *

+ * 十千伏线路服务类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface IPvTenVoltageService extends IService { + + + /** + * 新增单位 + * @param pvTenVoltageParam 单位实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean addTenVoltage(PvTenVoltageParam pvTenVoltageParam); + + /** + * 修改单位 + * @param updatePvTenVoltageParam 单位实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean updateTenVoltage(PvTenVoltageParam.UpdatePvTenVoltageParam updatePvTenVoltageParam); + + + /** + * 分页查询单位 + * @param tenVoltageQueryParam 单位实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + Page getPvTenVoltageList(TenVoltageQueryParam tenVoltageQueryParam); + + + /** + * 根据单位id查询单位 + * @param id 单位id + * @author cdf + * @date 2022/7/5 + * @return PvTenVoltage + */ + PvTenVoltage getPvTenVoltageById(String id); + + /** + * 删除单位 + * @param id 单位id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean delPvTenVoltage(String id); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvUnitService.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvUnitService.java new file mode 100644 index 000000000..8be03eb74 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvUnitService.java @@ -0,0 +1,68 @@ +package com.njcn.pvdevice.service; + +import com.njcn.device.pojo.param.pv.PvUnitParam; +import com.njcn.device.pojo.po.pv.PvUnit; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.device.pojo.vo.pv.UnitTreeVO; +import com.njcn.web.pojo.param.BaseParam; + +import java.util.List; + +/** + *

+ * 单位服务类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface IPvUnitService extends IService { + + /** + * 新增单位 + * @param pvUnitParam 单位实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean addUnit(PvUnitParam pvUnitParam); + + /** + * 修改单位 + * @param updatePvUnitParam 单位实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean updateUnit(PvUnitParam.UpdatePvUnitParam updatePvUnitParam); + + + /** + * 分页查询单位 + * @param baseParam 单位实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + List getPvUnitList(BaseParam baseParam); + + + /** + * 根据单位id查询单位 + * @param id 单位id + * @author cdf + * @date 2022/7/5 + * @return PvUnit + */ + PvUnit getPvUnitById(String id); + + /** + * 删除单位 + * @param id 单位id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean delPvUnit(String id); + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvVoltageService.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvVoltageService.java new file mode 100644 index 000000000..750f56c11 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/IPvVoltageService.java @@ -0,0 +1,72 @@ +package com.njcn.pvdevice.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.device.pojo.param.pv.PvVoltageParam; +import com.njcn.device.pojo.param.pv.VoltageQueryParam; +import com.njcn.device.pojo.po.pv.PvVoltage; +import com.njcn.device.pojo.po.pv.PvVoltage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.web.pojo.param.BaseParam; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +public interface IPvVoltageService extends IService { + + + /** + * 新增母线 + * @param pvVoltageParam 母线实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean addVoltage(PvVoltageParam pvVoltageParam); + + /** + * 修改母线 + * @param updatePvVoltageParam 母线实体 + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean updateVoltage(PvVoltageParam.UpdatePvVoltageParam updatePvVoltageParam); + + + /** + * 分页查询母线 + * @param voltageQueryParam 母线实体 + * @author cdf + * @date 2022/7/5 + * @return Page + */ + Page getPvVoltageList(VoltageQueryParam voltageQueryParam); + + List getAllPvVoltageList(); + + + /** + * 根据母线id查询母线 + * @param id 母线id + * @author cdf + * @date 2022/7/5 + * @return PvVoltage + */ + PvVoltage getPvVoltageById(String id); + + /** + * 删除母线 + * @param id 母线id + * @author cdf + * @date 2022/7/5 + * @return boolean + */ + boolean delPvVoltage(String id); +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvDeviceServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvDeviceServiceImpl.java new file mode 100644 index 000000000..3a3fa7ea8 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvDeviceServiceImpl.java @@ -0,0 +1,127 @@ +package com.njcn.pvdevice.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.enums.common.DataStateEnum; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.common.utils.PubUtils; +import com.njcn.device.enums.PvDeviceResponseEnum; +import com.njcn.device.pojo.param.pv.DeviceQueryParam; +import com.njcn.device.pojo.param.pv.PvDeviceParam; +import com.njcn.device.pojo.po.pv.PvDevice; +import com.njcn.device.pojo.po.pv.PvDevice; +import com.njcn.pvdevice.mapper.PvDeviceMapper; +import com.njcn.pvdevice.service.IPvDeviceService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.SystemResponseEnum; +import com.njcn.web.factory.PageFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 终端台账实现类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Service +@RequiredArgsConstructor +public class PvDeviceServiceImpl extends ServiceImpl implements IPvDeviceService { + + private final DicDataFeignClient dicDataFeignClient; + + + @Override + public boolean addDevice(PvDeviceParam pvDeviceParam) { + checkNameAndParam(pvDeviceParam, false); + + PvDevice pvDevice = new PvDevice(); + BeanUtils.copyProperties(pvDeviceParam, pvDevice); + pvDevice.setState(DataStateEnum.ENABLE.getCode()); + pvDevice.setThisTimeCheck(PubUtils.localDateFormat(pvDeviceParam.getThisTimeCheck())); + pvDevice.setNextTimeCheck(PubUtils.localDateFormat(pvDeviceParam.getNextTimeCheck())); + return this.save(pvDevice); + } + + @Override + public boolean updateDevice(PvDeviceParam.UpdatePvDeviceParam updatePvDeviceParam) { + checkNameAndParam(updatePvDeviceParam, true); + + PvDevice pvDevice = new PvDevice(); + BeanUtils.copyProperties(updatePvDeviceParam, pvDevice); + pvDevice.setState(DataStateEnum.ENABLE.getCode()); + pvDevice.setThisTimeCheck(PubUtils.localDateFormat(updatePvDeviceParam.getThisTimeCheck())); + pvDevice.setNextTimeCheck(PubUtils.localDateFormat(updatePvDeviceParam.getNextTimeCheck())); + return this.updateById(pvDevice); + } + + @Override + public Page getPvDeviceList(DeviceQueryParam subsAreaQueryParam) { + Page page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam), PageFactory.getPageSize(subsAreaQueryParam)); + return this.baseMapper.getPvDeviceList(page,subsAreaQueryParam); + } + + @Override + public List getAllPvDeviceList() { + return this.list(); + } + + @Override + public PvDevice getPvDeviceById(String id) { + return this.getById(id); + } + + @Override + public boolean delPvDevice(String id) { + return this.removeById(id); + } + + + /** + * 校验单位名称是否重复 + */ + private void checkNameAndParam(PvDeviceParam pvDeviceParam, boolean isUpdate) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PvDevice::getDevCode, pvDeviceParam.getDevCode()); + if (isUpdate) { + //更新操作 + if (pvDeviceParam instanceof PvDeviceParam.UpdatePvDeviceParam) { + lambdaQueryWrapper.eq(PvDevice::getId, ((PvDeviceParam.UpdatePvDeviceParam) pvDeviceParam).getId()); + } + } + int count = this.count(lambdaQueryWrapper); + if (count > 0) { + throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT); + } + + + /*校验设备型号*/ + if (StrUtil.isNotBlank(pvDeviceParam.getDevType())) { + if (Objects.isNull(dicDataFeignClient.getDicDataById(pvDeviceParam.getDevType()))) { + throw new BusinessException(SystemResponseEnum.DEV_TYPE_EMPTY); + } + } + + /*校验生产厂家*/ + + if (Objects.isNull(dicDataFeignClient.getDicDataById(pvDeviceParam.getManufacturer()))) { + throw new BusinessException(SystemResponseEnum.MANUFACTURER); + } + + } + + /** + * 校验参数是否违规 + */ + private void checkParam(PvDeviceParam pvDeviceParam) { + + } +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvDispatchServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvDispatchServiceImpl.java new file mode 100644 index 000000000..40c785461 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvDispatchServiceImpl.java @@ -0,0 +1,20 @@ +package com.njcn.pvdevice.service.impl; + +import com.njcn.device.pojo.po.pv.PvDispatch; +import com.njcn.pvdevice.mapper.PvDispatchMapper; +import com.njcn.pvdevice.service.IPvDispatchService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Service +public class PvDispatchServiceImpl extends ServiceImpl implements IPvDispatchService { + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvDistributedServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvDistributedServiceImpl.java new file mode 100644 index 000000000..36263e4ee --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvDistributedServiceImpl.java @@ -0,0 +1,110 @@ +package com.njcn.pvdevice.service.impl; + + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.common.pojo.enums.common.DataStateEnum; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.device.enums.PvDeviceResponseEnum; +import com.njcn.device.pojo.param.pv.PvDistributedParam; +import com.njcn.device.pojo.param.pv.DistributedQueryParam; +import com.njcn.device.pojo.po.pv.PvDistributed; +import com.njcn.device.pojo.po.pv.PvDistributed; +import com.njcn.pvdevice.mapper.PvDistributedMapper; +import com.njcn.pvdevice.service.IPvDistributedService; +import com.njcn.pvdevice.service.IPvSubAreaService; +import com.njcn.pvdevice.service.IPvUnitService; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.SystemResponseEnum; +import com.njcn.web.factory.PageFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 服务实现类 + *

+ * + * @author cdf + * @since 2022-07-06 + */ +@Service +@RequiredArgsConstructor +public class PvDistributedServiceImpl extends ServiceImpl implements IPvDistributedService { + + private final DicDataFeignClient dicDataFeignClient; + + + @Override + public boolean addDistributed(PvDistributedParam pvDistributedParam) { + checkNameAndParam(pvDistributedParam,false); + PvDistributed pvDistributed = new PvDistributed(); + BeanUtils.copyProperties(pvDistributedParam,pvDistributed); + pvDistributed.setState(DataStateEnum.ENABLE.getCode()); + return this.save(pvDistributed); + } + + @Override + public boolean updateDistributed(PvDistributedParam.UpdatePvDistributedParam updatePvDistributedParam) { + checkNameAndParam(updatePvDistributedParam,true); + PvDistributed pvDistributed = new PvDistributed(); + BeanUtils.copyProperties(updatePvDistributedParam,pvDistributed); + pvDistributed.setState(DataStateEnum.ENABLE.getCode()); + return this.updateById(pvDistributed); + } + + @Override + public Page getPvDistributedList(DistributedQueryParam distributedQueryParam) { + Page page = new Page<>(PageFactory.getPageNum(distributedQueryParam),PageFactory.getPageSize(distributedQueryParam)); + return this.baseMapper.getPvDistributedList(page,distributedQueryParam); + } + + @Override + public List getAllPvDistributedList() { + return this.list(); + } + + @Override + public PvDistributed getPvDistributedById(String id) { + return this.getById(id); + } + + @Override + public boolean delPvDistributed(String id) { + return this.removeById(id); + } + + + /** + * 校验单位名称是否重复 + */ + private void checkNameAndParam(PvDistributedParam pvDistributedParam, boolean isUpdate) { + + if(StrUtil.isNotBlank(pvDistributedParam.getScale())) { + if (Objects.isNull(dicDataFeignClient.getDicDataById(pvDistributedParam.getScale()))) { + throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY); + } + } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PvDistributed::getName, pvDistributedParam.getName()); + if (isUpdate) { + //更新操作 + if (pvDistributedParam instanceof PvDistributedParam.UpdatePvDistributedParam) { + lambdaQueryWrapper.eq(PvDistributed::getId, ((PvDistributedParam.UpdatePvDistributedParam) pvDistributedParam).getId()); + } + } + int count = this.count(lambdaQueryWrapper); + if (count > 0) { + throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT); + } + } + + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvLineDetailServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvLineDetailServiceImpl.java new file mode 100644 index 000000000..3e5b00433 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvLineDetailServiceImpl.java @@ -0,0 +1,113 @@ +package com.njcn.pvdevice.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.device.enums.PvDeviceResponseEnum; +import com.njcn.device.pojo.param.pv.LineDetailQueryParam; +import com.njcn.device.pojo.param.pv.PvLineDetailParam; +import com.njcn.device.pojo.po.pv.PvLineDetail; +import com.njcn.device.pojo.po.pv.PvLineDetail; +import com.njcn.pvdevice.mapper.PvLineDetailMapper; +import com.njcn.pvdevice.service.IPvDeviceService; +import com.njcn.pvdevice.service.IPvLineDetailService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.SystemResponseEnum; +import com.njcn.web.factory.PageFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 监测点实现类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Service +@RequiredArgsConstructor +public class PvLineDetailServiceImpl extends ServiceImpl implements IPvLineDetailService { + + private final DicDataFeignClient dicDataFeignClient; + + private final IPvDeviceService iPvDeviceService; + + + @Override + public boolean addLineDetail(PvLineDetailParam pvLineDetailParam) { + checkName(pvLineDetailParam,false); + checkParam(pvLineDetailParam); + PvLineDetail pvLineDetail = new PvLineDetail(); + BeanUtils.copyProperties(pvLineDetailParam,pvLineDetail); + return this.save(pvLineDetail); + } + + @Override + public boolean updateLineDetail(PvLineDetailParam.UpdatePvLineDetailParam updatePvLineDetailParam) { + checkName(updatePvLineDetailParam,true); + checkParam(updatePvLineDetailParam); + PvLineDetail pvLineDetail = new PvLineDetail(); + BeanUtils.copyProperties(updatePvLineDetailParam,pvLineDetail); + return this.updateById(pvLineDetail); + } + + @Override + public Page getPvLineDetailList(LineDetailQueryParam subsAreaQueryParam) { + Page page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam),PageFactory.getPageSize(subsAreaQueryParam)); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + return this.page(page,lambdaQueryWrapper); + } + + @Override + public List getAllPvLineDetailList() { + return this.list(); + } + + @Override + public PvLineDetail getPvLineDetailById(String id) { + return this.getById(id); + } + + @Override + public boolean delPvLineDetail(String id) { + return this.removeById(id); + } + + + /** + * 校验单位名称是否重复 + */ + private void checkName(PvLineDetailParam pvLineDetailParam, boolean isUpdate) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PvLineDetail::getNum, pvLineDetailParam.getNum()); + if (isUpdate) { + //更新操作 + if (pvLineDetailParam instanceof PvLineDetailParam.UpdatePvLineDetailParam) { + lambdaQueryWrapper.eq(PvLineDetail::getId, ((PvLineDetailParam.UpdatePvLineDetailParam) pvLineDetailParam).getId()); + } + } + int count = this.count(lambdaQueryWrapper); + if (count > 0) { + throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT); + } + } + + /** + * 校验参数是否违规 + */ + private void checkParam(PvLineDetailParam pvLineDetailParam){ + if(Objects.isNull(dicDataFeignClient.getDicDataById(pvLineDetailParam.getLoadType()))){ + throw new BusinessException(SystemResponseEnum.INTERFERENCE_EMPTY); + } + if(Objects.isNull(iPvDeviceService.getPvDeviceById(pvLineDetailParam.getDevId()))){ + throw new BusinessException(PvDeviceResponseEnum.DEV_NULL); + } + } +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvLvUserServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvLvUserServiceImpl.java new file mode 100644 index 000000000..a003e1450 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvLvUserServiceImpl.java @@ -0,0 +1,109 @@ +package com.njcn.pvdevice.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.enums.common.DataStateEnum; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.device.enums.PvDeviceResponseEnum; +import com.njcn.device.pojo.param.pv.LvUserQueryParam; +import com.njcn.device.pojo.param.pv.PvLvUserParam; +import com.njcn.device.pojo.po.pv.PvLvUser; +import com.njcn.device.pojo.po.pv.PvLvUser; +import com.njcn.pvdevice.mapper.PvLvUserMapper; +import com.njcn.pvdevice.service.IPvLvUserService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.pvdevice.service.IPvSubAreaService; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.SystemResponseEnum; +import com.njcn.web.factory.PageFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 分布式用户实现类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Service +@RequiredArgsConstructor +public class PvLvUserServiceImpl extends ServiceImpl implements IPvLvUserService { + + private final DicDataFeignClient dicDataFeignClient; + + + @Override + public boolean addLvUser(PvLvUserParam pvLvUserParam) { + checkNameAndParam(pvLvUserParam,false); + PvLvUser pvLvUser = new PvLvUser(); + BeanUtils.copyProperties(pvLvUserParam,pvLvUser); + pvLvUser.setState(DataStateEnum.ENABLE.getCode()); + return this.save(pvLvUser); + } + + @Override + public boolean updateLvUser(PvLvUserParam.UpdatePvLvUserParam updatePvLvUserParam) { + checkNameAndParam(updatePvLvUserParam,true); + PvLvUser pvLvUser = new PvLvUser(); + BeanUtils.copyProperties(updatePvLvUserParam,pvLvUser); + pvLvUser.setState(DataStateEnum.ENABLE.getCode()); + return this.updateById(pvLvUser); + } + + @Override + public Page getPvLvUserList(LvUserQueryParam lvUserQueryParam) { + Page page = new Page<>(PageFactory.getPageNum(lvUserQueryParam),PageFactory.getPageSize(lvUserQueryParam)); + return this.baseMapper.getPvLvUserList(page,lvUserQueryParam); + } + + @Override + public List getAllPvLvUserList() { + return this.list(); + } + + @Override + public PvLvUser getPvLvUserById(String id) { + return this.getById(id); + } + + @Override + public boolean delPvLvUser(String id) { + return this.removeById(id); + } + + + /** + * 校验单位名称是否重复 + */ + private void checkNameAndParam(PvLvUserParam pvLvUserParam, boolean isUpdate) { + + if(StrUtil.isNotBlank(pvLvUserParam.getScale())) { + if (Objects.isNull(dicDataFeignClient.getDicDataById(pvLvUserParam.getScale()))) { + throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY); + } + } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PvLvUser::getName, pvLvUserParam.getName()); + if (isUpdate) { + //更新操作 + if (pvLvUserParam instanceof PvLvUserParam.UpdatePvLvUserParam) { + lambdaQueryWrapper.eq(PvLvUser::getId, ((PvLvUserParam.UpdatePvLvUserParam) pvLvUserParam).getId()); + } + } + int count = this.count(lambdaQueryWrapper); + if (count > 0) { + throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT); + } + } + + + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvSubAreaServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvSubAreaServiceImpl.java new file mode 100644 index 000000000..d608b74c5 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvSubAreaServiceImpl.java @@ -0,0 +1,114 @@ +package com.njcn.pvdevice.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.enums.common.DataStateEnum; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.device.enums.PvDeviceResponseEnum; +import com.njcn.device.pojo.param.pv.PvSubAreaParam; +import com.njcn.device.pojo.param.pv.SubAreaQueryParam; +import com.njcn.device.pojo.po.pv.PvSubArea; +import com.njcn.device.pojo.po.pv.PvSubArea; +import com.njcn.pvdevice.mapper.PvSubAreaMapper; +import com.njcn.pvdevice.service.IPvSubAreaService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.pvdevice.service.IPvTenVoltageService; +import com.njcn.pvdevice.service.IPvUnitService; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.SystemResponseEnum; +import com.njcn.system.pojo.po.DictData; +import com.njcn.web.factory.PageFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 服务实现类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Service +@RequiredArgsConstructor +public class PvSubAreaServiceImpl extends ServiceImpl implements IPvSubAreaService { + + + private final DicDataFeignClient dicDataFeignClient; + + private final IPvTenVoltageService iPvTenVoltageService; + + private final IPvUnitService iPvUnitService; + + @Override + public boolean addSubArea(PvSubAreaParam pvSubAreaParam) { + checkNameAndParam(pvSubAreaParam,false); + PvSubArea pvSubArea = new PvSubArea(); + BeanUtils.copyProperties(pvSubAreaParam,pvSubArea); + pvSubArea.setState(DataStateEnum.ENABLE.getCode()); + return this.save(pvSubArea); + } + + @Override + public boolean updateSubArea(PvSubAreaParam.UpdatePvSubAreaParam updatePvSubAreaParam) { + checkNameAndParam(updatePvSubAreaParam,true); + PvSubArea pvSubArea = new PvSubArea(); + BeanUtils.copyProperties(updatePvSubAreaParam,pvSubArea); + pvSubArea.setState(DataStateEnum.ENABLE.getCode()); + return this.updateById(pvSubArea); + } + + @Override + public Page getPvSubAreaList(SubAreaQueryParam subsAreaQueryParam) { + Page page = new Page<>(PageFactory.getPageNum(subsAreaQueryParam),PageFactory.getPageSize(subsAreaQueryParam)); + return this.baseMapper.getPvSubAreaList(page,subsAreaQueryParam); + } + + @Override + public List getAllPvSubAreaList() { + return this.list(); + } + + @Override + public PvSubArea getPvSubAreaById(String id) { + return this.getById(id); + } + + @Override + public boolean delPvSubArea(String id) { + return this.removeById(id); + } + + + /** + * 校验单位名称是否重复 + */ + private void checkNameAndParam(PvSubAreaParam pvSubAreaParam, boolean isUpdate) { + + if(Objects.isNull(iPvTenVoltageService.getPvTenVoltageById(pvSubAreaParam.getTenVoltageId()))){ + throw new BusinessException(PvDeviceResponseEnum.TEN_VOLTAGE_NULL); + } + if(Objects.isNull(iPvUnitService.getPvUnitById(pvSubAreaParam.getUnitId()))){ + throw new BusinessException(PvDeviceResponseEnum.UNIT_NULL); + } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PvSubArea::getName, pvSubAreaParam.getName()); + if (isUpdate) { + //更新操作 + if (pvSubAreaParam instanceof PvSubAreaParam.UpdatePvSubAreaParam) { + lambdaQueryWrapper.eq(PvSubArea::getId, ((PvSubAreaParam.UpdatePvSubAreaParam) pvSubAreaParam).getId()); + } + } + int count = this.count(lambdaQueryWrapper); + if (count > 0) { + throw new BusinessException(PvDeviceResponseEnum.SUB_AREA_REPEAT); + } + } + + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvSubstationServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvSubstationServiceImpl.java new file mode 100644 index 000000000..f14c13946 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvSubstationServiceImpl.java @@ -0,0 +1,121 @@ +package com.njcn.pvdevice.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.db.constant.DbConstant; +import com.njcn.device.enums.DeviceResponseEnum; +import com.njcn.device.enums.PvDeviceResponseEnum; +import com.njcn.device.pojo.param.pv.PvSubstationParam; +import com.njcn.device.pojo.param.pv.SubstationQueryParam; +import com.njcn.device.pojo.po.Node; +import com.njcn.device.pojo.po.pv.PvSubstation; +import com.njcn.device.pojo.po.pv.PvSubstation; +import com.njcn.pvdevice.mapper.PvSubstationMapper; +import com.njcn.pvdevice.service.IPvSubstationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.pvdevice.service.IPvUnitService; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.DicDataTypeEnum; +import com.njcn.system.enums.SystemResponseEnum; +import com.njcn.system.pojo.po.DictData; +import com.njcn.web.factory.PageFactory; +import com.njcn.web.pojo.param.BaseParam; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 变电站管理实现类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Service +@RequiredArgsConstructor +public class PvSubstationServiceImpl extends ServiceImpl implements IPvSubstationService { + + private final DicDataFeignClient dicDataFeignClient; + + private final IPvUnitService iPvUnitService; + + + @Override + public boolean addSubstation(PvSubstationParam pvSubstationParam) { + checkNameAndParam(pvSubstationParam,false); + PvSubstation pvSubstation = new PvSubstation(); + BeanUtils.copyProperties(pvSubstationParam,pvSubstation); + return this.save(pvSubstation); + } + + @Override + public boolean updateSubstation(PvSubstationParam.UpdatePvSubstationParam updatePvSubstationParam) { + checkNameAndParam(updatePvSubstationParam,true); + PvSubstation pvSubstation = new PvSubstation(); + BeanUtils.copyProperties(updatePvSubstationParam,pvSubstation); + return this.updateById(pvSubstation); + } + + @Override + public Page getPvSubstationList(SubstationQueryParam substationQueryParam) { + Page page = new Page<>(PageFactory.getPageNum(substationQueryParam),PageFactory.getPageSize(substationQueryParam)); + return this.baseMapper.getPvSubstationList(page,substationQueryParam); + } + + @Override + public List getAllPvSubstationList() { + return this.list(); + } + + @Override + public PvSubstation getPvSubstationById(String id) { + return this.getById(id); + } + + @Override + public boolean delPvSubstation(String id) { + return this.removeById(id); + } + + + /** + * 校验单位名称是否重复 + * + * @author cdf + * @date 2022/7/5 + */ + private void checkNameAndParam(PvSubstationParam pvSubstationParam, boolean isUpdate) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PvSubstation::getName, pvSubstationParam.getName()); + + if (isUpdate) { + //更新操作 + if (pvSubstationParam instanceof PvSubstationParam.UpdatePvSubstationParam) { + lambdaQueryWrapper.eq(PvSubstation::getId, ((PvSubstationParam.UpdatePvSubstationParam) pvSubstationParam).getId()); + } + } + int count = this.count(lambdaQueryWrapper); + if (count > 0) { + throw new BusinessException(PvDeviceResponseEnum.SUBSTATION_REPEAT); + } + + DictData dictData = dicDataFeignClient.getDicDataById(pvSubstationParam.getScale()).getData(); + if(Objects.isNull(dictData)){ + throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY); + } + if(Objects.isNull(iPvUnitService.getPvUnitById(pvSubstationParam.getUnitId()))){ + throw new BusinessException(PvDeviceResponseEnum.UNIT_NULL); + } + + } + + +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvTenVoltageServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvTenVoltageServiceImpl.java new file mode 100644 index 000000000..c5e2a92c4 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvTenVoltageServiceImpl.java @@ -0,0 +1,114 @@ +package com.njcn.pvdevice.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.enums.common.DataStateEnum; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.device.enums.PvDeviceResponseEnum; +import com.njcn.device.pojo.param.pv.PvTenVoltageParam; +import com.njcn.device.pojo.param.pv.TenVoltageQueryParam; +import com.njcn.device.pojo.po.pv.PvTenVoltage; +import com.njcn.device.pojo.po.pv.PvTenVoltage; +import com.njcn.pvdevice.mapper.PvTenVoltageMapper; +import com.njcn.pvdevice.service.IPvTenVoltageService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.SystemResponseEnum; +import com.njcn.system.pojo.po.DictData; +import com.njcn.web.factory.PageFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +/** + *

+ * 服务实现类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Service +@RequiredArgsConstructor +public class PvTenVoltageServiceImpl extends ServiceImpl implements IPvTenVoltageService { + + private final DicDataFeignClient dicDataFeignClient; + + @Override + public boolean addTenVoltage(PvTenVoltageParam pvTenVoltageParam) { + checkNameAndParam(pvTenVoltageParam,false); + PvTenVoltage pvTenVoltage = new PvTenVoltage(); + BeanUtils.copyProperties(pvTenVoltageParam,pvTenVoltage); + pvTenVoltage.setState(DataStateEnum.ENABLE.getCode()); + return this.save(pvTenVoltage); + } + + @Override + public boolean updateTenVoltage(PvTenVoltageParam.UpdatePvTenVoltageParam updatePvTenVoltageParam) { + checkNameAndParam(updatePvTenVoltageParam,true); + PvTenVoltage pvTenVoltage = new PvTenVoltage(); + BeanUtils.copyProperties(updatePvTenVoltageParam,pvTenVoltage); + pvTenVoltage.setState(DataStateEnum.ENABLE.getCode()); + return this.updateById(pvTenVoltage); + } + + @Override + public Page getPvTenVoltageList(TenVoltageQueryParam tenVoltageQueryParam) { + Page page = new Page<>(PageFactory.getPageNum(tenVoltageQueryParam),PageFactory.getPageSize(tenVoltageQueryParam)); + return this.baseMapper.getPvTenVoltageList(page,tenVoltageQueryParam); + } + + @Override + public PvTenVoltage getPvTenVoltageById(String id) { + return this.getById(id); + } + + @Override + public boolean delPvTenVoltage(String id) { + return this.removeById(id); + } + + + /** + * 校验单位名称是否重复 + * + * @author cdf + * @date 2022/7/5 + */ + private void checkNameAndParam(PvTenVoltageParam pvTenVoltageParam, boolean isUpdate) { + + if(StrUtil.isNotBlank(pvTenVoltageParam.getScale())) { + DictData dictData = dicDataFeignClient.getDicDataById(pvTenVoltageParam.getScale()).getData(); + if (Objects.isNull(dictData)) { + throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY); + } + } + if(StrUtil.isNotBlank(pvTenVoltageParam.getDesignScale())) { + DictData dictDesignScale = dicDataFeignClient.getDicDataById(pvTenVoltageParam.getDesignScale()).getData(); + if (Objects.isNull(dictDesignScale)) { + throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY); + } + } + + + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PvTenVoltage::getName, pvTenVoltageParam.getName()); + + if (isUpdate) { + //更新操作 + if (pvTenVoltageParam instanceof PvTenVoltageParam.UpdatePvTenVoltageParam) { + lambdaQueryWrapper.eq(PvTenVoltage::getId, ((PvTenVoltageParam.UpdatePvTenVoltageParam) pvTenVoltageParam).getId()); + } + } + int count = this.count(lambdaQueryWrapper); + if (count > 0) { + throw new BusinessException(PvDeviceResponseEnum.TEN_VOLTAGE_REPEAT); + } + + + } +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvUnitServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvUnitServiceImpl.java new file mode 100644 index 000000000..e3bbbc805 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvUnitServiceImpl.java @@ -0,0 +1,100 @@ +package com.njcn.pvdevice.service.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.device.enums.PvDeviceResponseEnum; +import com.njcn.device.pojo.param.pv.PvUnitParam; +import com.njcn.device.pojo.po.pv.PvUnit; +import com.njcn.device.pojo.vo.pv.UnitTreeVO; +import com.njcn.pvdevice.mapper.PvUnitMapper; +import com.njcn.pvdevice.service.IPvUnitService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.web.pojo.param.BaseParam; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Service +public class PvUnitServiceImpl extends ServiceImpl implements IPvUnitService { + + + @Override + public boolean addUnit(PvUnitParam pvUnitParam) { + checkName(pvUnitParam, false); + PvUnit pvUnit = new PvUnit(); + BeanUtils.copyProperties(pvUnitParam, pvUnit); + return this.save(pvUnit); + } + + @Override + public boolean updateUnit(PvUnitParam.UpdatePvUnitParam updatePvUnitParam) { + checkName(updatePvUnitParam, true); + PvUnit pvUnit = new PvUnit(); + BeanUtils.copyProperties(updatePvUnitParam, pvUnit); + return this.updateById(pvUnit); + } + + @Override + public List getPvUnitList(BaseParam baseParam) { + List list = this.baseMapper.getPvUnitList(baseParam.getOrderBy(), baseParam.getSortBy()); + List parentList = list.stream().filter(item -> item.getPid().equals("0")).collect(Collectors.toList()); + parentList.forEach(item -> item.setChildren(getChildren(item,list))); + return parentList; + } + + /** + * 递归查询子节点 + * @param root 根节点 + * @param all 所有节点 + * @return 根节点信息 + */ + private List getChildren(UnitTreeVO root, List all) { + return all.stream().filter(m -> Objects.equals(m.getPid(), root.getId())) + .peek(m -> m.setChildren(getChildren(m, all))).collect(Collectors.toList()); + } + + @Override + public PvUnit getPvUnitById(String id) { + return this.getById(id); + } + + @Override + public boolean delPvUnit(String id) { + return this.removeById(id); + } + + + /** + * 校验单位名称是否重复 + * + * @author cdf + * @date 2022/7/5 + */ + private void checkName(PvUnitParam pvUnitParam, boolean isUpdate) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PvUnit::getName, pvUnitParam.getName()); + + if (isUpdate) { + //更新操作 + if (pvUnitParam instanceof PvUnitParam.UpdatePvUnitParam) { + lambdaQueryWrapper.eq(PvUnit::getId, ((PvUnitParam.UpdatePvUnitParam) pvUnitParam).getId()); + } + } + int count = this.count(lambdaQueryWrapper); + if (count > 0) { + throw new BusinessException(PvDeviceResponseEnum.UNIT_REPEAT); + } + } +} diff --git a/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvVoltageServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvVoltageServiceImpl.java new file mode 100644 index 000000000..fb58c5832 --- /dev/null +++ b/pqs-device/device-boot/src/main/java/com/njcn/pvdevice/service/impl/PvVoltageServiceImpl.java @@ -0,0 +1,124 @@ +package com.njcn.pvdevice.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.device.enums.PvDeviceResponseEnum; +import com.njcn.device.pojo.param.pv.PvVoltageParam; +import com.njcn.device.pojo.param.pv.VoltageQueryParam; +import com.njcn.device.pojo.po.pv.PvTenVoltage; +import com.njcn.device.pojo.po.pv.PvVoltage; +import com.njcn.device.pojo.po.pv.PvVoltage; +import com.njcn.pvdevice.mapper.PvVoltageMapper; +import com.njcn.pvdevice.service.IPvVoltageService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.SystemResponseEnum; +import com.njcn.system.pojo.po.DictData; +import com.njcn.web.factory.PageFactory; +import com.njcn.web.pojo.param.BaseParam; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 母线实现类 + *

+ * + * @author cdf + * @since 2022-07-05 + */ +@Service +@RequiredArgsConstructor +public class PvVoltageServiceImpl extends ServiceImpl implements IPvVoltageService { + + private final DicDataFeignClient dicDataFeignClient; + + @Override + public boolean addVoltage(PvVoltageParam pvVoltageParam) { + DictData dictData = dicDataFeignClient.getDicDataById(pvVoltageParam.getScale()).getData(); + if(Objects.isNull(dictData)){ + throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY); + } + checkName(pvVoltageParam,false); + PvVoltage pvVoltage = new PvVoltage(); + BeanUtils.copyProperties(pvVoltageParam,pvVoltage); + return this.save(pvVoltage); + } + + @Override + public boolean updateVoltage(PvVoltageParam.UpdatePvVoltageParam updatePvVoltageParam) { + DictData dictData = dicDataFeignClient.getDicDataById(updatePvVoltageParam.getScale()).getData(); + if(Objects.isNull(dictData)){ + throw new BusinessException(SystemResponseEnum.VOLTAGE_EMPTY); + } + checkName(updatePvVoltageParam,true); + PvVoltage pvVoltage = new PvVoltage(); + BeanUtils.copyProperties(updatePvVoltageParam,pvVoltage); + return this.updateById(pvVoltage); + } + + @Override + public Page getPvVoltageList(VoltageQueryParam voltageQueryParam) { + Page page = new Page<>(PageFactory.getPageNum(voltageQueryParam),PageFactory.getPageSize(voltageQueryParam)); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PvVoltage::getName,voltageQueryParam.getSearchValue()) + .eq(PvVoltage::getScale,voltageQueryParam.getScale()); + return this.page(page,lambdaQueryWrapper); + } + + @Override + public List getAllPvVoltageList() { + return this.list(); + } + + @Override + public PvVoltage getPvVoltageById(String id) { + return this.getById(id); + } + + @Override + public boolean delPvVoltage(String id) { + return this.removeById(id); + } + + + /** + * 校验单位名称是否重复 + * + * @author cdf + * @date 2022/7/5 + */ + private void checkName(PvVoltageParam pvVoltageParam, boolean isUpdate) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(PvVoltage::getName, pvVoltageParam.getName()); + if (isUpdate) { + //更新操作 + if (pvVoltageParam instanceof PvVoltageParam.UpdatePvVoltageParam) { + lambdaQueryWrapper.eq(PvVoltage::getId, ((PvVoltageParam.UpdatePvVoltageParam) pvVoltageParam).getId()); + } + } + int count = this.count(lambdaQueryWrapper); + if (count > 0) { + throw new BusinessException(PvDeviceResponseEnum.VOLTAGE_REPEAT); + } + + //校验序号 + lambdaQueryWrapper.clear(); + lambdaQueryWrapper.eq(PvVoltage::getNum, pvVoltageParam.getNum()); + if (isUpdate) { + //更新操作 + if (pvVoltageParam instanceof PvVoltageParam.UpdatePvVoltageParam) { + lambdaQueryWrapper.eq(PvVoltage::getId, ((PvVoltageParam.UpdatePvVoltageParam) pvVoltageParam).getId()); + } + } + int countNum = this.count(lambdaQueryWrapper); + if (countNum > 0) { + throw new BusinessException(PvDeviceResponseEnum.SUB_NUM_REPEAT); + } + } +} diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataTypeEnum.java b/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataTypeEnum.java index e475e02e4..1f814eb82 100644 --- a/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataTypeEnum.java +++ b/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataTypeEnum.java @@ -15,7 +15,7 @@ public enum DicDataTypeEnum { * 字典类型名称 */ FRONT_TYPE("前置类型"), - DEV_TYPE("终端类型"), + DEV_TYPE("终端型号"), DEV_FUN("终端功能"), DEV_STATUS("终端状态"), DEV_LEVEL("终端等级"), diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/enums/SystemResponseEnum.java b/pqs-system/system-api/src/main/java/com/njcn/system/enums/SystemResponseEnum.java index 8cf271917..ddd4096a3 100644 --- a/pqs-system/system-api/src/main/java/com/njcn/system/enums/SystemResponseEnum.java +++ b/pqs-system/system-api/src/main/java/com/njcn/system/enums/SystemResponseEnum.java @@ -19,7 +19,15 @@ public enum SystemResponseEnum { DICT_DATA_NAME_REPEAT("A00352", "字典数据名称重复"), AREA_CODE_REPEAT("A00353","行政区域编码重复"), LOAD_TYPE_EMPTY("A00354","用能负荷数据为空"), - LINE_MARK_EMPTY("A00355","字典监测点评分等级数据为空") + LINE_MARK_EMPTY("A00355","字典监测点评分等级数据为空"), + VOLTAGE_EMPTY("A00356","查询字典电压等级数据为空"), + + INTERFERENCE_EMPTY("A00356","查询字典干扰源类型数据为空"), + BUSINESS_EMPTY("A00356","查询字典行业类型数据为空"), + DEV_TYPE_EMPTY("A00357","查询字典设备类型数据为空"), + MANUFACTURER("A00358","查询字典终端厂家数据为空"), + + ; private final String code;