diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/PqDataVerifyCount.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/PqDataVerifyCount.java new file mode 100644 index 000000000..0f3ed73d3 --- /dev/null +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/PqDataVerifyCount.java @@ -0,0 +1,68 @@ +package com.njcn.device.pq.pojo.po; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.github.jeffreyning.mybatisplus.anno.MppMultiId; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.time.LocalDate; + +/** + *

+ * + *

+ * + * @author xy + * @since 2025-02-17 + */ +@Getter +@Setter +@TableName("pq_data_verify_count") +public class PqDataVerifyCount implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 监测点id + */ + @MppMultiId + @TableField(value = "line_id") + private String lineId; + + /** + * 数据时间 + */ + @MppMultiId + @TableField(value = "time_id") + @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8") + private LocalDate time; + + /** + * 异常指标数量 + */ + @TableField(value = "total") + private Integer total ; + + /** + * 总指标数量 + */ + @TableField(value = "total_all") + private Integer totalAll ; + + /** + * 异常短时闪变数量 + */ + @TableField(value = "flicker") + private Integer flicker ; + + /** + * 短时闪变总数量 + */ + @TableField(value = "flicker_all") + private Integer flickerAll; + + +} diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/jb/DistributionArea.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/jb/DistributionArea.java new file mode 100644 index 000000000..e7efd2327 --- /dev/null +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/jb/DistributionArea.java @@ -0,0 +1,165 @@ +package com.njcn.device.pq.pojo.po.jb; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author hongawen + * @since 2022-10-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("distribution_area") +public class DistributionArea extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 台区编号 + */ + private String id; + + /** + * 台区名称 + */ + private String name; + + /** + * 组织机构名称 + */ + private String orgName; + + /** + * 组织机构ID(外键) + */ + private String orgId; + + /** + * 运维单位名称 + */ + private String operationName; + + /** + * 运维单位ID(外键) + */ + private String operationId; + + /** + * 变电站名称 + */ + private String powerrName; + + /** + * 电站ID(外键) + */ + private String powerStationId; + + /** + * 监测线路名称 + */ + private String lineName; + + /** + * 所属线路ID(外键) + */ + private String lineId; + + /** + * 电压等级 + */ + private String voltageLevel; + + + /** + * 配变容量 + */ + private Float pCapacity; + + /** + * 地区特征(字典) + */ + private String regionalism; + + + /** + * 设备地区特征(字典) + */ + private String devRegionalism; + + /** + * 是否农网:0-否;1:是; + */ + private Integer ifRuralPowerGrid; + + /** + * 使用性质 + */ + private String natureOfUse; + + /** + * 供电半径 + */ + private Float powerSupplyRadius; + + /** + * 供电线路总长度 + */ + private Float lineLength; + + /** + * 运行状态(字典) + */ + private String state; + + /** + * 分布式光伏用户数 + */ + private Integer distributedPhotovoltaicNum; + + /** + * 分布式光伏总装机容量 + */ + private Float photovoltaicCapacity; + + /** + * 是否有电动汽车接入:0-否;1:是; + */ + private Integer ifBevAp; + + /** + * 接入负荷类型(字典) + */ + private String apLoadType; + + /** + * 是否是上送国网监测点,0-否 1-是 + */ + private Integer isUpToGrid; + + /** + * 经度 + */ + private Double longitude; + + /** + * 维度 + */ + private Double latitude; + + /** + * 数据状态:0-删除;1-正常; + */ + private Integer status; + + /** + * 数据状态:0-手动录入;1-gw台账录入 + */ + private Integer inputStatus; + +} diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/jb/GenerationUser.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/jb/GenerationUser.java new file mode 100644 index 000000000..65b6ba1fb --- /dev/null +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/jb/GenerationUser.java @@ -0,0 +1,128 @@ +package com.njcn.device.pq.pojo.po.jb; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDate; + +/** + *

+ * 发电用户 + *

+ * + * @author hongawen + * @since 2022-10-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("power_generation_user") +public class GenerationUser extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 用户编号 + */ + private String id; + + /** + * 用户名称 + */ + private String name; + + /** + * 组织机构名称 + */ + private String orgName; + + /** + * 组织机构ID(外键) + */ + private String orgId; + + /** + * 运维单位名称 + */ + private String operationName; + + /** + * 运维单位ID(外键) + */ + private String operationId; + + /** + * 电源类别(字典) + */ + private String powerCategory; + + /** + * 电站类型(字典) + */ + private String powerStationType; + + /** + * 发电方式(字典) + */ + private String powerGenerationMode; + + /** + * 并网电压等级(字典) + */ + private String voltageLevel; + + /** + * 总装机容量 + */ + private Float sourceCapacity; + + /** + * 并网日期 + */ + private LocalDate connectionDate; + + /** + * 能源消纳方式(字典) + */ + private String connectionMode; + + /** + * 客户状态(字典) + */ + private String gcStat; + + /** + * 供电变电站(外键) + */ + private String powerStationId; + + /** + * 供电线路(外键) + */ + private String lineId; + + /** + * 供电台区(外键) + */ + private String platformId; + + /** + * 用户标签 + */ + private String userTag; + + /** + * 是否是上送国网监测点,0-否 1-是 + */ + private Integer isUpToGrid; + + /** + * 数据状态:0-删除;1-正常; + */ + private Integer status; + + + + +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/jb/PmsPowerDistributionAreaController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/jb/PmsPowerDistributionAreaController.java new file mode 100644 index 000000000..53e7a8360 --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/jb/PmsPowerDistributionAreaController.java @@ -0,0 +1,121 @@ +package com.njcn.device.pq.controller.jb; + + +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.common.utils.LogUtil; +import com.njcn.device.pms.annotation.TerminalOperationLogDesc; +import com.njcn.device.pms.pojo.param.PowerDistributionareaParam; +import com.njcn.device.pms.pojo.param.TaiZhangParam; +import com.njcn.device.pq.pojo.po.jb.DistributionArea; +import com.njcn.device.pq.service.IPowerDistributionAreaService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + *

+ * 台区信息增删改查 + *

+ * + * @author hongawen + * @since 2022-10-14 + */ +@Slf4j +@RestController +@RequestMapping("/distributionArea") +@Api(tags = "台账-台区信息") +@RequiredArgsConstructor +@Validated +public class PmsPowerDistributionAreaController extends BaseController { + + private final IPowerDistributionAreaService powerDistributionAreaService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("getPowerDistributionAreaList") + @ApiOperation("分页查询台区所有信息") + @ApiImplicitParam(name = "baseParam",value = "查询台区信息",required = true) + public HttpResult> getList(@RequestBody TaiZhangParam baseParam){ + String methodDescribe = getMethodDescribe("getList"); + LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, baseParam); + Page res = powerDistributionAreaService.getList(baseParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,res,methodDescribe); + } + + /** + * 新增台区信息 + * @author hany + * @date 2022/10/26 + */ + @PostMapping("/addPowerDistributionArea") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType=OperateType.ADD) + @ApiOperation("新增台区信息") + @ApiImplicitParam(name = "newParam", value = "模板实体", required = true) + @TerminalOperationLogDesc(value = "新增台区信息",module = 3) + public HttpResult add(@RequestBody @Validated PowerDistributionareaParam newParam){ + String methodDescribe = getMethodDescribe("add"); + boolean result = powerDistributionAreaService.add(newParam); + if (result) { + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } else { + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + } + + /** + * 修改台区信息 + * @author hany + * @date 2022/10/26 + */ + @PostMapping("/updatePowerDistributionArea") + @OperateInfo(info = LogEnum.SYSTEM_COMMON,operateType = OperateType.UPDATE) + @ApiOperation("修改台区信息") + @ApiImplicitParam(name = "UpdateParam", value = "更新实体", required = true) + @TerminalOperationLogDesc(value = "修改台区信息",module = 3) + public HttpResult update(@RequestBody @Validated PowerDistributionareaParam UpdateParam){ + String methodDescribe = getMethodDescribe("update"); + boolean result = powerDistributionAreaService.update(UpdateParam); + if (result) { + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } else { + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + } + + /** + * 删除台区信息 + * @param ids id + * @author hany + * @date 2022/10/26 + */ + @PostMapping("/deletePowerDistributionArea") + @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE) + @ApiOperation("删除台区信息") + @ApiImplicitParam(name = "ids", value = "ID索引", required = true) + @TerminalOperationLogDesc(value = "删除台区信息",module = 3) + public HttpResult delete(@RequestBody List ids){ + String methodDescribe = getMethodDescribe("delete"); + boolean result = powerDistributionAreaService.delete(ids); + if(result){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + }else { + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + } + } + + + +} + diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/jb/PmsPowerGenerationUserController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/jb/PmsPowerGenerationUserController.java new file mode 100644 index 000000000..a9dd906f2 --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/jb/PmsPowerGenerationUserController.java @@ -0,0 +1,100 @@ +package com.njcn.device.pq.controller.jb; + + +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.pms.annotation.TerminalOperationLogDesc; +import com.njcn.device.pms.pojo.param.PowerGenerationUserParam; +import com.njcn.device.pq.pojo.po.jb.GenerationUser; +import com.njcn.device.pq.service.IPowerGenerationUserService; +import com.njcn.web.controller.BaseController; +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 javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author hongawen + * @since 2022-10-14 + */ +@RestController +@RequestMapping("/generationUser") +@Api(tags = "台账-发电用户") +@RequiredArgsConstructor +public class PmsPowerGenerationUserController extends BaseController { + + private final IPowerGenerationUserService iPowerGenerationUserService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD) + @PostMapping("/addPowerGenerationUser") + @ApiOperation("新增发电用户") + @ApiImplicitParam(name = "powerGenerationUserParam", value = "发电用户实体", required = true) + @TerminalOperationLogDesc(value = "新增发电用户",module = 4) + public HttpResult addPowerGenerationUser(@RequestBody @Validated PowerGenerationUserParam powerGenerationUserParam) { + String methodDescribe = getMethodDescribe("addPowerGenerationUser"); + boolean result = iPowerGenerationUserService.addPowerGenerationUser(powerGenerationUserParam); + if(result){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE) + @PostMapping("/updatePowerGenerationUser") + @ApiOperation("修改发电用户") + @ApiImplicitParam(name = "powerGenerationUserParam", value = "发电用户实体", required = true) + @TerminalOperationLogDesc(value = "修改发电用户",module = 4) + public HttpResult updatePowerGenerationUser(@RequestBody @Validated PowerGenerationUserParam powerGenerationUserParam) { + String methodDescribe = getMethodDescribe("updatePowerGenerationUser"); + boolean result = iPowerGenerationUserService.updatePowerGenerationUser(powerGenerationUserParam); + if(result){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE) + @DeleteMapping("/delPowerGenerationUser") + @ApiOperation("删除发电用户") + @ApiImplicitParam(name = "powerGenerationUserIds", value = "发电用户ids", required = true) + @TerminalOperationLogDesc(value = "删除发电用户",module = 4) + public HttpResult delPowerGenerationUser(@RequestBody @NotEmpty(message = "发电用户id不可为空") List powerGenerationUserIds) { + String methodDescribe = getMethodDescribe("delPowerGenerationUser"); + boolean result = iPowerGenerationUserService.delPowerGenerationUser(powerGenerationUserIds); + if(result){ + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getPowerGenerationUserPageList") + @ApiOperation("分页获取发电用户列表") + @ApiImplicitParam(name = "baseParam", value = "基本查询体", required = true) + public HttpResult> getPowerGenerationUserPageList(@RequestBody BaseParam baseParam) { + String methodDescribe = getMethodDescribe("getPowerGenerationUserPageList"); + Page result = iPowerGenerationUserService.getPowerGenerationUserPageList(baseParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + + +} + diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PowerDistributionAreaMapper.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PowerDistributionAreaMapper.java new file mode 100644 index 000000000..15320000b --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PowerDistributionAreaMapper.java @@ -0,0 +1,19 @@ +package com.njcn.device.pq.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.device.pq.pojo.po.jb.DistributionArea; + + +/** + *

+ * Mapper 台区 + *

+ * + * @author hongawen + * @since 2022-10-14 + */ +public interface PowerDistributionAreaMapper extends BaseMapper { + + +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PowerGenerationUserMapper.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PowerGenerationUserMapper.java new file mode 100644 index 000000000..9ba1e980d --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PowerGenerationUserMapper.java @@ -0,0 +1,19 @@ +package com.njcn.device.pq.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.device.pq.pojo.po.jb.GenerationUser; + + +/** + *

+ * Mapper 台区 + *

+ * + * @author hongawen + * @since 2022-10-14 + */ +public interface PowerGenerationUserMapper extends BaseMapper { + + +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PqDataVerifyCountMapper.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PqDataVerifyCountMapper.java new file mode 100644 index 000000000..1752d55dd --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/PqDataVerifyCountMapper.java @@ -0,0 +1,22 @@ +package com.njcn.device.pq.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.device.pq.pojo.param.OnlineRateParam; +import com.njcn.device.pq.pojo.po.PqDataVerifyCount; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author cdf + * @since 2025-06-10 + */ +public interface PqDataVerifyCountMapper extends BaseMapper { + + + List selectSumVerify(@Param("param") OnlineRateParam param); +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/PqDataVerifyCountMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/PqDataVerifyCountMapper.xml new file mode 100644 index 000000000..bfac97569 --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/PqDataVerifyCountMapper.xml @@ -0,0 +1,32 @@ + + + + + + + \ No newline at end of file diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPowerDistributionAreaService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPowerDistributionAreaService.java new file mode 100644 index 000000000..6c9e7e765 --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPowerDistributionAreaService.java @@ -0,0 +1,46 @@ +package com.njcn.device.pq.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.device.pms.pojo.param.PowerDistributionareaParam; +import com.njcn.device.pms.pojo.param.TaiZhangParam; +import com.njcn.device.pq.pojo.po.jb.DistributionArea; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author hongawen + * @since 2022-10-14 + */ +public interface IPowerDistributionAreaService extends IService { + + /** + * 分页查询所有 + * @return + */ + Page getList(TaiZhangParam baseParam); + + + /** + * 新增 + */ + boolean add(PowerDistributionareaParam newParam); + + /** + * 修改 + * @param + */ + boolean update(PowerDistributionareaParam updateParam); + + /** + * 删除 + * @param ids ids + */ + boolean delete(List ids); + + +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPowerGenerationUserService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPowerGenerationUserService.java new file mode 100644 index 000000000..fee64529d --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPowerGenerationUserService.java @@ -0,0 +1,63 @@ +package com.njcn.device.pq.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.device.pms.pojo.param.PowerDistributionareaParam; +import com.njcn.device.pms.pojo.param.PowerGenerationUserParam; +import com.njcn.device.pms.pojo.param.TaiZhangParam; +import com.njcn.device.pms.pojo.po.PowerGenerationUser; +import com.njcn.device.pms.pojo.vo.PowerGenerationUserVO; +import com.njcn.device.pq.pojo.po.jb.DistributionArea; +import com.njcn.device.pq.pojo.po.jb.GenerationUser; +import com.njcn.web.pojo.param.BaseParam; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author hongawen + * @since 2022-10-14 + */ +public interface IPowerGenerationUserService extends IService { + + /** + * 新增发电用户 + * @author cdf + * @date 2022/10/25 + * @param powerGenerationUserParam 发电用户 + * @return boolean + */ + boolean addPowerGenerationUser(PowerGenerationUserParam powerGenerationUserParam); + + /** + * 修改发电用户 + * @author cdf + * @date 2022/10/25 + * @param powerGenerationUserParam 发电用户 + * @return boolean + */ + boolean updatePowerGenerationUser(PowerGenerationUserParam powerGenerationUserParam); + + /** + * 删除发电用户 + * @author cdf + * @date 2022/10/25 + * @param powerGenerationUserIds 发电用户 + * @return boolean + */ + boolean delPowerGenerationUser(List powerGenerationUserIds); + + /** + * 分页查询发电用户列表 + * @author cdf + * @date 2022/10/25 + * @param baseParam 基础参数 + * @return boolean + */ + Page getPowerGenerationUserPageList(BaseParam baseParam); + + +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqDataVerifyCountService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqDataVerifyCountService.java new file mode 100644 index 000000000..e3c4ea5a1 --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqDataVerifyCountService.java @@ -0,0 +1,24 @@ +package com.njcn.device.pq.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.device.pq.pojo.param.OnlineRateParam; +import com.njcn.device.pq.pojo.po.PqDataVerifyCount; + +import java.util.List; + + +/** + *

+ * 服务类 + *

+ * + * @author cdf + * @since 2025-06-10 + */ +public interface IPqDataVerifyCountService extends IService { + + + + List getSumVerify( OnlineRateParam param); + +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceRunEvaluateServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceRunEvaluateServiceImpl.java index 142a9a2b4..a1b4447d9 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceRunEvaluateServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceRunEvaluateServiceImpl.java @@ -19,9 +19,7 @@ import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; import com.njcn.device.pq.pojo.param.DevRunEvaluateParam; import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.device.pq.pojo.param.OnlineRateParam; -import com.njcn.device.pq.pojo.po.Line; -import com.njcn.device.pq.pojo.po.RStatIntegrityD; -import com.njcn.device.pq.pojo.po.RStatOnlinerateD; +import com.njcn.device.pq.pojo.po.*; import com.njcn.device.pq.pojo.vo.*; import cn.hutool.core.collection.CollectionUtil; import com.njcn.device.pq.enums.LineBaseEnum; @@ -29,6 +27,7 @@ import com.njcn.device.pq.enums.PowerFlagEnum; import com.njcn.device.pq.enums.RunFlagEnum; import com.njcn.device.pq.pojo.dto.MonitorInfoDTO; import com.njcn.device.pq.service.DeviceRunEvaluateService; +import com.njcn.device.pq.service.IPqDataVerifyCountService; import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper; import com.njcn.harmonic.api.RStatLimitRateDClient; import com.njcn.harmonic.pojo.param.RStatLimitQueryParam; @@ -72,6 +71,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService { private final OnLineRateMapper onLineRateMapper; private final DicDataFeignClient dicDataFeignClient; private final DeptFeignClient deptFeignClient; + private final IPqDataVerifyCountService pqDataVerifyCountService; /** * 数据完整性:50% */ @@ -377,10 +377,14 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService { DeviceRunEvaluateVO.Detail detail; //完整率 List integrityList = integrityDMapper.getLineIntegrityRateInfo(lineIds, param.getSearchBeginTime(), param.getSearchEndTime()); - //超标率 - List limitRatePOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(rStatLimitQueryParam).getData(); //获取所有终端在线率 List onlineRateByDev = onLineRateMapper.getOnlineRateByDevIds(onlineRateParam); + //异常信息 + onlineRateParam.setIds(lineIds); + List sumVerify = pqDataVerifyCountService.getSumVerify(onlineRateParam); + + //超标率 + // List limitRatePOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(rStatLimitQueryParam).getData(); for (GeneralDeviceDTO dto : deviceInfo) { detail = new DeviceRunEvaluateVO.Detail(); @@ -388,10 +392,10 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService { detail.setCount(dto.getDeviceIndexes().size()); detail.setOnline(onLineRate(onlineRateByDev, dto.getDeviceIndexes())); detail.setIntegrity(integrity(integrityList, dto.getLineIndexes())); - detail.setQualified(limitRate(limitRatePOList, dto.getLineIndexes())); + detail.setQualified(verify(sumVerify, dto.getLineIndexes())); detail.setScore(ONINTEGRITY.multiply(detail.getIntegrity()) .add(ONLINERATE.multiply(detail.getOnline()) - .add(LIMITRATE.multiply(detail.getQualified()))).stripTrailingZeros()); + .add(LIMITRATE.multiply(detail.getQualified()))).stripTrailingZeros().setScale(2, RoundingMode.HALF_UP)); Map> dev = lineDeviceByDevIds .stream() .filter(x -> dto.getDeviceIndexes().contains(x.getDevId())) @@ -417,10 +421,10 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService { } evaluateVO.setOnLineRate(onLineRate(onlineRateByDev, Arrays.asList(key))); evaluateVO.setIntegrityRate(integrity(integrityList, ids)); - evaluateVO.setPassRate(limitRate(limitRatePOList, ids)); + evaluateVO.setPassRate(verify(sumVerify, ids)); evaluateVO.setEvaluate(ONINTEGRITY.multiply(evaluateVO.getIntegrityRate()) .add(ONLINERATE.multiply(evaluateVO.getOnLineRate()) - .add(LIMITRATE.multiply(evaluateVO.getPassRate()))).stripTrailingZeros()); + .add(LIMITRATE.multiply(evaluateVO.getPassRate()))).stripTrailingZeros().setScale(2, RoundingMode.HALF_UP)); deviceDetail.add(evaluateVO); }); } @@ -431,6 +435,20 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService { return info; } + private BigDecimal verify(List sumVerify, List lineIds) { + //异常率 + List verifyList = sumVerify.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(verifyList)) { + double total = verifyList.stream().mapToDouble(PqDataVerifyCount::getTotal).sum(); + double totalAll = verifyList.stream().mapToDouble(PqDataVerifyCount::getTotalAll).sum(); + double flicker = verifyList.stream().mapToDouble(PqDataVerifyCount::getFlicker).sum(); + double flickerAll = verifyList.stream().mapToDouble(PqDataVerifyCount::getFlickerAll).sum(); + return NumberUtil.round(Math.min((total + flicker) * 100 / (totalAll + flickerAll), 100), 2); + } else { + return new BigDecimal(0); + } + } + private BigDecimal integrity(List integrityList, List lineIds) { //监测完整率 List integrityDS = integrityList.stream().filter(x -> lineIds.contains(x.getLineIndex())).collect(Collectors.toList()); diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PowerDistributionAreaServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PowerDistributionAreaServiceImpl.java new file mode 100644 index 000000000..3310556af --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PowerDistributionAreaServiceImpl.java @@ -0,0 +1,104 @@ +package com.njcn.device.pq.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.pms.enums.PmsDeviceResponseEnum; +import com.njcn.device.pms.pojo.param.PowerDistributionareaParam; +import com.njcn.device.pms.pojo.param.TaiZhangParam; +import com.njcn.device.pq.mapper.PowerDistributionAreaMapper; +import com.njcn.device.pq.pojo.po.jb.DistributionArea; +import com.njcn.device.pq.service.IPowerDistributionAreaService; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.user.api.DeptFeignClient; +import com.njcn.web.factory.PageFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + +/** + *

+ * 台区信息 + *

+ * + * @author hongawen + * @since 2022-10-14 + */ +@Service +@RequiredArgsConstructor +public class PowerDistributionAreaServiceImpl extends ServiceImpl implements IPowerDistributionAreaService { + + + + @Override + public Page getList(TaiZhangParam baseParam) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(DistributionArea::getStatus,DataStateEnum.ENABLE.getCode()) + .and(StrUtil.isNotBlank(baseParam.getSearchValue()), + i->i.like(DistributionArea::getName,baseParam.getSearchValue()) + .or() + .like(DistributionArea::getPowerrName,baseParam.getSearchValue()) + .or() + .like(DistributionArea::getLineName,baseParam.getSearchValue()) + .or() + .like(DistributionArea::getOrgName,baseParam.getSearchValue())).orderByDesc(DistributionArea::getCreateTime); + //初始化分页数据 + return this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper); + } + + + + + + /** + * 新增台区信息 + * @author hany + * @date 2022/10/26 + */ + @Override + public boolean add(PowerDistributionareaParam newParam) { + LambdaQueryWrapper che = new LambdaQueryWrapper<>(); + che.eq(DistributionArea::getId,newParam.getId()); + int count = this.count(che); + if(count>0){ + throw new BusinessException(PmsDeviceResponseEnum.POWER_CODE_SAME); + } + DistributionArea powerDistributionarea = new DistributionArea(); + BeanUtils.copyProperties(newParam,powerDistributionarea); + //设为正常状态 + powerDistributionarea.setStatus(DataStateEnum.ENABLE.getCode()); + return this.save(powerDistributionarea); + } + + /** + * 修改台区信息 + * @author hany + * @date 2022/10/26 + */ + @Override + public boolean update(PowerDistributionareaParam updateParam) { + DistributionArea powerDistributionarea = this.getById(updateParam.getId()); + if(Objects.isNull(powerDistributionarea)){ + throw new BusinessException(PmsDeviceResponseEnum.POWER_DIS_NOT_FIND); + } + BeanUtils.copyProperties(updateParam,powerDistributionarea); + return this.updateById(powerDistributionarea); + } + + /** + * 删除 + * @param ids + */ + @Override + @Transactional(rollbackFor=RuntimeException.class) + public boolean delete(List ids) { + return this.removeByIds(ids); + } + +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PowerGenerationUserServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PowerGenerationUserServiceImpl.java new file mode 100644 index 000000000..345fd03cb --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PowerGenerationUserServiceImpl.java @@ -0,0 +1,78 @@ +package com.njcn.device.pq.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.pms.enums.PmsDeviceResponseEnum; +import com.njcn.device.pms.pojo.param.PowerGenerationUserParam; +import com.njcn.device.pq.mapper.PowerGenerationUserMapper; +import com.njcn.device.pq.pojo.po.jb.GenerationUser; +import com.njcn.device.pq.service.IPowerGenerationUserService; +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 hongawen + * @since 2022-10-14 + */ +@Service +@RequiredArgsConstructor +public class PowerGenerationUserServiceImpl extends ServiceImpl implements IPowerGenerationUserService { + + + @Override + public boolean addPowerGenerationUser(PowerGenerationUserParam powerGenerationUserParam) { + LambdaQueryWrapper che = new LambdaQueryWrapper<>(); + che.eq(GenerationUser::getId,powerGenerationUserParam.getId()); + int count = this.count(che); + if(count>0){ + throw new BusinessException(PmsDeviceResponseEnum.POWER_CODE_SAME); + } + GenerationUser powerDistributionarea = new GenerationUser(); + BeanUtils.copyProperties(powerGenerationUserParam,powerDistributionarea); + //设为正常状态 + powerDistributionarea.setStatus(DataStateEnum.ENABLE.getCode()); + return this.save(powerDistributionarea); + } + + @Override + public boolean updatePowerGenerationUser(PowerGenerationUserParam powerGenerationUserParam) { + GenerationUser powerDistributionarea = this.getById(powerGenerationUserParam.getId()); + if(Objects.isNull(powerDistributionarea)){ + throw new BusinessException(PmsDeviceResponseEnum.POWER_DIS_NOT_FIND); + } + BeanUtils.copyProperties(powerGenerationUserParam,powerDistributionarea); + return this.updateById(powerDistributionarea); + } + + @Override + public boolean delPowerGenerationUser(List powerGenerationUserIds) { + return this.removeByIds(powerGenerationUserIds); + } + + @Override + public Page getPowerGenerationUserPageList(BaseParam baseParam) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(GenerationUser::getStatus, DataStateEnum.ENABLE.getCode()) + .and(StrUtil.isNotBlank(baseParam.getSearchValue()), + i->i.like(GenerationUser::getName,baseParam.getSearchValue()) + .or() + .like(GenerationUser::getOrgName,baseParam.getSearchValue())).orderByDesc(GenerationUser::getCreateTime); + //初始化分页数据 + return this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper); + } +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyCountServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyCountServiceImpl.java new file mode 100644 index 000000000..c3ec55e64 --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyCountServiceImpl.java @@ -0,0 +1,34 @@ +package com.njcn.device.pq.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.device.pq.mapper.PqDataVerifyCountMapper; +import com.njcn.device.pq.pojo.param.OnlineRateParam; +import com.njcn.device.pq.pojo.po.PqDataVerifyCount; +import com.njcn.device.pq.service.IPqDataVerifyCountService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + *

+ * 服务实现类 + *

+ * + * @author cdf + * @since 2025-06-10 + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class PqDataVerifyCountServiceImpl extends ServiceImpl implements IPqDataVerifyCountService { + + + @Override + public List getSumVerify(OnlineRateParam param) { + return this.baseMapper.selectSumVerify(param); + } +}