系统配置指标功能
This commit is contained in:
@@ -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<String> ids;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 统计类型和指标关系表
|
||||
* </p>
|
||||
*
|
||||
* @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;
|
||||
|
||||
|
||||
}
|
||||
@@ -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<CsTargetVO> noBinds;
|
||||
|
||||
@ApiModelProperty("已绑指标")
|
||||
List<CsTargetVO> binds;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -14,16 +14,16 @@
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>org.slf4j</groupId>-->
|
||||
<!-- <artifactId>slf4j-log4j12</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>ch.qos.logback</groupId>-->
|
||||
<!-- <artifactId>logback-classic</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 统计类型和指标关系表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @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<List<CsStatisticalSetVO>> getCsStatisticalDetail() {
|
||||
String methodDescribe = getMethodDescribe("getCsStatisticalDetail");
|
||||
List<CsStatisticalSetVO> 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<CsBindConditionVO> 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<Boolean> add(@RequestBody @Validated StatisticalAddParam statisticalAddParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
Boolean result = iCsStatisticalSetService.add(statisticalAddParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.algorithm.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.algorithm.pojo.po.CsBmdPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
public interface CsBmdMapper extends BaseMapper<CsBmdPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.algorithm.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.algorithm.pojo.po.CsEpdPqdPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
public interface CsEpdPqdMapper extends BaseMapper<CsEpdPqdPO> {
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 统计类型和指标关系表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
@Mapper
|
||||
public interface CsStatisticalSetMapper extends BaseMapper<CsStatisticalSetPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.algorithm.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.algorithm.pojo.po.CsBmdPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
public interface ICsBmdService extends IService<CsBmdPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.algorithm.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.algorithm.pojo.po.CsEpdPqdPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
public interface ICsEpdPqdService extends IService<CsEpdPqdPO> {
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 统计类型和指标关系表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
public interface ICsStatisticalSetService {
|
||||
|
||||
List<CsStatisticalSetVO> getCsStatisticalDetail();
|
||||
|
||||
CsBindConditionVO bindCondition(String id);
|
||||
|
||||
Boolean add(StatisticalAddParam statisticalAddParam);
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
@Service
|
||||
public class CsBmdServiceImpl extends ServiceImpl<CsBmdMapper, CsBmdPO> implements ICsBmdService {
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
@Service
|
||||
public class CsEpdPqdServiceImpl extends ServiceImpl<CsEpdPqdMapper, CsEpdPqdPO> implements ICsEpdPqdService {
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 统计类型和指标关系表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CsStatisticalSetServiceImpl extends ServiceImpl<CsStatisticalSetMapper, CsStatisticalSetPO> implements ICsStatisticalSetService {
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
public List<CsStatisticalSetVO> getCsStatisticalDetail() {
|
||||
List<CsStatisticalSetVO> list = new ArrayList<>();
|
||||
List<DictData> 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<CsStatisticalSetPO> list = new ArrayList<>();
|
||||
LambdaQueryWrapper<CsStatisticalSetPO> 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;
|
||||
}
|
||||
}
|
||||
@@ -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"),
|
||||
;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user