diff --git a/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/param/StatisticalAddParam.java b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/param/StatisticalAddParam.java new file mode 100644 index 000000000..7ea3da9b6 --- /dev/null +++ b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/param/StatisticalAddParam.java @@ -0,0 +1,29 @@ +package com.njcn.algorithm.pojo.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * 类的介绍: + * + * @author xuyang + * @version 1.0.0 + * @createTime 2023/5/11 11:12 + */ +@Data +public class StatisticalAddParam implements Serializable { + + @ApiModelProperty("统计类型配置id") + @NotBlank(message = "id不可为空") + private String id; + + @ApiModelProperty("指标类型集合ids") + @NotEmpty(message = "id数组") + private List ids; + +} diff --git a/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/po/CsBmdPO.java b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/po/CsBmdPO.java new file mode 100644 index 000000000..6c3d4641b --- /dev/null +++ b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/po/CsBmdPO.java @@ -0,0 +1,45 @@ +package com.njcn.algorithm.pojo.po; + +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 xuyang + * @since 2023-05-11 + */ +@Data +@TableName("cs_bmd") +public class CsBmdPO { + + private static final long serialVersionUID = 1L; + + private String id; + + private String name; + + private String anotherName; + + private Integer idx; + + private String type; + + private String unit; + + private String phase; + + private String classId; + + private String statMethod; + + private String tranRule; + +} diff --git a/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/po/CsEpdPqdPO.java b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/po/CsEpdPqdPO.java new file mode 100644 index 000000000..238cf3b9f --- /dev/null +++ b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/po/CsEpdPqdPO.java @@ -0,0 +1,47 @@ +package com.njcn.algorithm.pojo.po; + +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 xuyang + * @since 2023-05-11 + */ +@Data +@TableName("cs_epd_pqd") +public class CsEpdPqdPO { + + private static final long serialVersionUID = 1L; + + private String id; + + private String name; + + private String anotherName; + + private Integer idx; + + private String type; + + private String phase; + + private String unit; + + private Integer harmStart; + + private Integer harmEnd; + + private String classId; + + private String statMethod; + +} diff --git a/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/po/CsStatisticalSetPO.java b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/po/CsStatisticalSetPO.java new file mode 100644 index 000000000..bab5df46f --- /dev/null +++ b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/po/CsStatisticalSetPO.java @@ -0,0 +1,37 @@ +package com.njcn.algorithm.pojo.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * 统计类型和指标关系表 + *

+ * + * @author xuyang + * @since 2023-05-11 + */ +@Data +@TableName("cs_statistical_set") +public class CsStatisticalSetPO { + + private static final long serialVersionUID = 1L; + + /** + * 统计类型id + */ + private String id; + + /** + * 指标id + */ + private String targetId; + + +} diff --git a/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/vo/CsBindConditionVO.java b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/vo/CsBindConditionVO.java new file mode 100644 index 000000000..9c73c06f8 --- /dev/null +++ b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/vo/CsBindConditionVO.java @@ -0,0 +1,27 @@ +package com.njcn.algorithm.pojo.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 类的介绍: + * + * @author xuyang + * @version 1.0.0 + * @createTime 2023/5/11 10:59 + */ +@Data +@ApiModel(value="治理指标绑定情况") +public class CsBindConditionVO implements Serializable { + + @ApiModelProperty("未绑指标") + List noBinds; + + @ApiModelProperty("已绑指标") + List binds; + +} diff --git a/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/vo/CsStatisticalSetVO.java b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/vo/CsStatisticalSetVO.java new file mode 100644 index 000000000..14cf2d82d --- /dev/null +++ b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/vo/CsStatisticalSetVO.java @@ -0,0 +1,23 @@ +package com.njcn.algorithm.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 类的介绍: + * + * @author xuyang + * @version 1.0.0 + * @createTime 2023/5/11 11:38 + */ +@Data +public class CsStatisticalSetVO implements Serializable { + + @ApiModelProperty("治理统计类型id") + private String statisticalId; + + @ApiModelProperty("治理统计类型名称") + private String statisticalName; +} diff --git a/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/vo/CsTargetVO.java b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/vo/CsTargetVO.java new file mode 100644 index 000000000..5804ce9bc --- /dev/null +++ b/pqs-algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/vo/CsTargetVO.java @@ -0,0 +1,24 @@ +package com.njcn.algorithm.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 类的介绍: + * + * @author xuyang + * @version 1.0.0 + * @createTime 2023/5/11 11:04 + */ +@Data +public class CsTargetVO implements Serializable { + + @ApiModelProperty("Id") + private String id; + + @ApiModelProperty("name") + private String name; + +} diff --git a/pqs-algorithm/algorithm-boot/pom.xml b/pqs-algorithm/algorithm-boot/pom.xml index 2fe984f3b..38a9e7b2d 100644 --- a/pqs-algorithm/algorithm-boot/pom.xml +++ b/pqs-algorithm/algorithm-boot/pom.xml @@ -14,16 +14,16 @@ com.njcn common-web ${project.version} - - - org.slf4j - slf4j-log4j12 - - - ch.qos.logback - logback-classic - - + + + + + + + + + + com.njcn diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/controller/system/CsStatisticalSetController.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/controller/system/CsStatisticalSetController.java new file mode 100644 index 000000000..4b2bc0941 --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/controller/system/CsStatisticalSetController.java @@ -0,0 +1,74 @@ +package com.njcn.algorithm.controller.system; + + +import com.njcn.algorithm.pojo.param.StatisticalAddParam; +import com.njcn.algorithm.pojo.vo.CsBindConditionVO; +import com.njcn.algorithm.pojo.vo.CsStatisticalSetVO; +import com.njcn.algorithm.service.ICsStatisticalSetService; +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.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 xuyang + * @since 2023-05-11 + */ +@Slf4j +@RestController +@RequestMapping("/statistical") +@RequiredArgsConstructor +@Api(tags = "治理统计类型配置") +public class CsStatisticalSetController extends BaseController { + + private final ICsStatisticalSetService iCsStatisticalSetService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getCsStatisticalDetail") + @ApiOperation("治理统计配置详情") + public HttpResult> getCsStatisticalDetail() { + String methodDescribe = getMethodDescribe("getCsStatisticalDetail"); + List list = iCsStatisticalSetService.getCsStatisticalDetail(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/bindCondition") + @ApiOperation("治理指标绑定情况") + @ApiImplicitParam(name = "id", value = "统计类型id", required = true) + public HttpResult bindCondition(@RequestBody @Validated String id) { + String methodDescribe = getMethodDescribe("bindCondition"); + LogUtil.njcnDebug(log, "{},统计类型id为:{}", methodDescribe, id); + CsBindConditionVO csBindConditionVO = iCsStatisticalSetService.bindCondition(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csBindConditionVO, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) + @PostMapping("/add") + @ApiOperation("治理统计绑定指标") + @ApiImplicitParam(name = "statisticalAddParam", value = "统计类型配置参数", required = true) + public HttpResult add(@RequestBody @Validated StatisticalAddParam statisticalAddParam) { + String methodDescribe = getMethodDescribe("add"); + Boolean result = iCsStatisticalSetService.add(statisticalAddParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + +} + diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsBmdMapper.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsBmdMapper.java new file mode 100644 index 000000000..921d03808 --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsBmdMapper.java @@ -0,0 +1,16 @@ +package com.njcn.algorithm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.algorithm.pojo.po.CsBmdPO; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xuyang + * @since 2023-05-11 + */ +public interface CsBmdMapper extends BaseMapper { + +} diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsEpdPqdMapper.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsEpdPqdMapper.java new file mode 100644 index 000000000..d07fb7475 --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsEpdPqdMapper.java @@ -0,0 +1,16 @@ +package com.njcn.algorithm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.algorithm.pojo.po.CsEpdPqdPO; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xuyang + * @since 2023-05-11 + */ +public interface CsEpdPqdMapper extends BaseMapper { + +} diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsStatisticalSetMapper.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsStatisticalSetMapper.java new file mode 100644 index 000000000..60124e954 --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsStatisticalSetMapper.java @@ -0,0 +1,18 @@ +package com.njcn.algorithm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.algorithm.pojo.po.CsStatisticalSetPO; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 统计类型和指标关系表 Mapper 接口 + *

+ * + * @author xuyang + * @since 2023-05-11 + */ +@Mapper +public interface CsStatisticalSetMapper extends BaseMapper { + +} diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/ICsBmdService.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/ICsBmdService.java new file mode 100644 index 000000000..3f6dc557a --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/ICsBmdService.java @@ -0,0 +1,16 @@ +package com.njcn.algorithm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.algorithm.pojo.po.CsBmdPO; + +/** + *

+ * 服务类 + *

+ * + * @author xuyang + * @since 2023-05-11 + */ +public interface ICsBmdService extends IService { + +} diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/ICsEpdPqdService.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/ICsEpdPqdService.java new file mode 100644 index 000000000..501c3e1ff --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/ICsEpdPqdService.java @@ -0,0 +1,16 @@ +package com.njcn.algorithm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.algorithm.pojo.po.CsEpdPqdPO; + +/** + *

+ * 服务类 + *

+ * + * @author xuyang + * @since 2023-05-11 + */ +public interface ICsEpdPqdService extends IService { + +} diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/ICsStatisticalSetService.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/ICsStatisticalSetService.java new file mode 100644 index 000000000..3ffec8485 --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/ICsStatisticalSetService.java @@ -0,0 +1,25 @@ +package com.njcn.algorithm.service; + +import com.njcn.algorithm.pojo.param.StatisticalAddParam; +import com.njcn.algorithm.pojo.vo.CsBindConditionVO; +import com.njcn.algorithm.pojo.vo.CsStatisticalSetVO; + +import java.util.List; + +/** + *

+ * 统计类型和指标关系表 服务类 + *

+ * + * @author xuyang + * @since 2023-05-11 + */ +public interface ICsStatisticalSetService { + + List getCsStatisticalDetail(); + + CsBindConditionVO bindCondition(String id); + + Boolean add(StatisticalAddParam statisticalAddParam); + +} diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsBmdServiceImpl.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsBmdServiceImpl.java new file mode 100644 index 000000000..b54d8eaec --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsBmdServiceImpl.java @@ -0,0 +1,20 @@ +package com.njcn.algorithm.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.algorithm.mapper.CsBmdMapper; +import com.njcn.algorithm.pojo.po.CsBmdPO; +import com.njcn.algorithm.service.ICsBmdService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author xuyang + * @since 2023-05-11 + */ +@Service +public class CsBmdServiceImpl extends ServiceImpl implements ICsBmdService { + +} diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsEpdPqdServiceImpl.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsEpdPqdServiceImpl.java new file mode 100644 index 000000000..dd5d81395 --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsEpdPqdServiceImpl.java @@ -0,0 +1,20 @@ +package com.njcn.algorithm.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.algorithm.mapper.CsEpdPqdMapper; +import com.njcn.algorithm.pojo.po.CsEpdPqdPO; +import com.njcn.algorithm.service.ICsEpdPqdService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author xuyang + * @since 2023-05-11 + */ +@Service +public class CsEpdPqdServiceImpl extends ServiceImpl implements ICsEpdPqdService { + +} diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsStatisticalSetServiceImpl.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsStatisticalSetServiceImpl.java new file mode 100644 index 000000000..66cccbf15 --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsStatisticalSetServiceImpl.java @@ -0,0 +1,74 @@ +package com.njcn.algorithm.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.algorithm.mapper.CsStatisticalSetMapper; +import com.njcn.algorithm.pojo.param.StatisticalAddParam; +import com.njcn.algorithm.pojo.po.CsStatisticalSetPO; +import com.njcn.algorithm.pojo.vo.CsBindConditionVO; +import com.njcn.algorithm.pojo.vo.CsStatisticalSetVO; +import com.njcn.algorithm.service.ICsStatisticalSetService; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.DicDataTypeEnum; +import com.njcn.system.pojo.po.DictData; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 统计类型和指标关系表 服务实现类 + *

+ * + * @author xuyang + * @since 2023-05-11 + */ +@Service +@AllArgsConstructor +public class CsStatisticalSetServiceImpl extends ServiceImpl implements ICsStatisticalSetService { + + private final DicDataFeignClient dicDataFeignClient; + + @Override + public List getCsStatisticalDetail() { + List list = new ArrayList<>(); + List result = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.CS_STATISTICAL_TYPE.getCode()).getData(); + if (!CollectionUtils.isEmpty(result)){ + result.forEach(item->{ + CsStatisticalSetVO csStatisticalSetVO = new CsStatisticalSetVO(); + csStatisticalSetVO.setStatisticalId(item.getId()); + csStatisticalSetVO.setStatisticalName(item.getName()); + list.add(csStatisticalSetVO); + }); + } + return list; + } + + @Override + public CsBindConditionVO bindCondition(String id) { + return null; + } + + @Override + public Boolean add(StatisticalAddParam statisticalAddParam) { + boolean result = false; + List list = new ArrayList<>(); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(CsStatisticalSetPO::getId,statisticalAddParam.getId()); + this.remove(lambdaQueryWrapper); + if (!CollectionUtils.isEmpty(statisticalAddParam.getIds())){ + statisticalAddParam.getIds().forEach(item->{ + CsStatisticalSetPO csStatisticalSetPo = new CsStatisticalSetPO(); + csStatisticalSetPo.setId(statisticalAddParam.getId()); + csStatisticalSetPo.setTargetId(item); + list.add(csStatisticalSetPo); + }); + result = this.saveBatch(list,100); + } + return result; + } +} 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 6483f7faa..387262251 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 @@ -65,7 +65,8 @@ public enum DicDataTypeEnum { WORK_ORDER_TYPE("工单类型","Work_Order_Type"), DEV_VOLTAGE_STAND("标准电压等级","Dev_Voltage_Stand"), PRIMARY_TYPE("一级业务类型","Primary_Type"), - DEV_CLASS("终端类型(治理)","Dev_Class") + DEV_CLASS("终端类型(治理)","Dev_Class"), + CS_STATISTICAL_TYPE("治理统计类型","Cs_Statistical_Type"), ;