系统配置指标功能
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user