合并代码

This commit is contained in:
2022-11-21 17:58:18 +08:00
parent a4c225d067
commit a81a815636
65 changed files with 3828 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
package com.njcn.harmonic.controller.distribution;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.BizParamConstant;
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.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.vo.PwRMpBenchmarkLevelVO;
import com.njcn.harmonic.service.distribution.PwRMpBenchmarkLevelMService;
import com.njcn.harmonic.service.distribution.PwRMpBenchmarkLevelQService;
import com.njcn.harmonic.service.distribution.PwRMpBenchmarkLevelYService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Title RMpBenchmarkLevelController
* @Package com.njcn.device.pms.controller
* @Author jianghaifei
* @Date 2022-10-11 10:34
* @Version V1.0
*/
@RestController
@Api(tags = "配网-基准水平评估")
@RequiredArgsConstructor
@RequestMapping("/pwRMpBenchmarkLevel")
public class PwRMpBenchmarkLevelController extends BaseController {
private final PwRMpBenchmarkLevelMService rMpBenchmarkLevelMService; //基准水平-月
private final PwRMpBenchmarkLevelQService rMpBenchmarkLevelQService; //基准水平-季
private final PwRMpBenchmarkLevelYService rMpBenchmarkLevelYService; //基准水平-年
@PostMapping("getPwRMpBenchmarkLevelList")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("配网-全网基准水平")
public HttpResult<Page<PwRMpBenchmarkLevelVO>> getPwRMpBenchmarkLevelList(@RequestBody RMpBenchmarkLevelParam rMpBenchmarkLevelParam) {
String methodDescribe = getMethodDescribe("getPwRMpBenchmarkLevelList");
if (rMpBenchmarkLevelParam.getType() == null) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION, null, methodDescribe);
}
//获取查询条件-时间类型
String type = rMpBenchmarkLevelParam.getType().toString();
Page<PwRMpBenchmarkLevelVO> rMpBenchmarkLevelList;
switch (type) {
case BizParamConstant.STAT_BIZ_YEAR:
//查询基准水平-年数据
rMpBenchmarkLevelList = rMpBenchmarkLevelYService.getPwRMpBenchmarkLevelList(rMpBenchmarkLevelParam);
break;
case BizParamConstant.STAT_BIZ_QUARTER:
//查询基准水平-季数据
rMpBenchmarkLevelList = rMpBenchmarkLevelQService.getPwRMpBenchmarkLevelList(rMpBenchmarkLevelParam);
break;
case BizParamConstant.STAT_BIZ_MONTH:
//查询基准水平-月数据
rMpBenchmarkLevelList = rMpBenchmarkLevelMService.getPwRMpBenchmarkLevelList(rMpBenchmarkLevelParam);
break;
default:
//如果前端没有传type默认查询月数据
rMpBenchmarkLevelList = rMpBenchmarkLevelMService.getPwRMpBenchmarkLevelList(rMpBenchmarkLevelParam);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rMpBenchmarkLevelList, methodDescribe);
}
}

View File

@@ -0,0 +1,106 @@
package com.njcn.harmonic.controller.distribution;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.pojo.param.RStatHarmonicMParam;
import com.njcn.harmonic.pojo.vo.RArrayVO;
import com.njcn.harmonic.pojo.vo.RIconVO;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicOrgMService;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicOrgQService;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicOrgYService;
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 org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author rui.wu
* @since 2022-10-14
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "配网指标分类概览-各单位分类总览")
@RequestMapping("/harmonic/pwRStatHarmonicOrg")
public class PwRStatHarmonicOrgController extends BaseController {
private final RStatHarmonicOrgYService rStatHarmonicOrgYService;
private final RStatHarmonicOrgQService rStatHarmonicOrgQService;
private final RStatHarmonicOrgMService rStatHarmonicOrgMService;
/**
* 查询查询监测点稳态指标 日/月点数
*/
@PostMapping("/getPwRStatHarmonicOrg")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询稳态累计超标监测点数")
@ApiImplicitParam(name = "param", value = "累计超标监测点数参数", required = true)
public HttpResult<List<RArrayVO>> getPwRStatHarmonicOrg(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getPwRStatHarmonicOrg");
List<RArrayVO> org = null;
String string = param.getType().toString();
switch (string) {
//查询各单位累计超标监测点数-年数据
case BizParamConstant.STAT_BIZ_YEAR:
org = rStatHarmonicOrgYService.getPwRStatHarmonicYAll(param);
break;
//查询各单位累计超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
org = rStatHarmonicOrgQService.getPwRStatHarmonicQAll(param);
break;
//查询各单位累计超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
org = rStatHarmonicOrgMService.getPwRStatHarmonicMAll(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, org, methodDescribe);
}
/**
* 查询查询监测点稳态指标 日/月点数
*/
@PostMapping("/getPwRStatHarmonicOrgIcon")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询稳态各单位超标监测统计图")
@ApiImplicitParam(name = "param", value = "各单位超标监测统计参数", required = true)
public HttpResult<List<RIconVO>> getPwRStatHarmonicOrgIcon(@RequestBody RStatHarmonicMParam param) {
String methodDescribe = getMethodDescribe("getPwRStatHarmonicOrgIcon");
List<RIconVO> icon= null;
String string = param.getType().toString();
switch (string) {
//查询各单位累计超标监测点数统计图-年数据
case BizParamConstant.STAT_BIZ_YEAR:
icon = rStatHarmonicOrgYService.getPwRStatHarmonicOrgYIcon(param);
break;
//查询各单位累计超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
icon = rStatHarmonicOrgQService.getPwRStatHarmonicOrgQIcon(param);
break;
//查询各单位累计超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
icon = rStatHarmonicOrgMService.getPwRStatHarmonicOrgMIcon(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, icon, methodDescribe);
}
}

View File

@@ -0,0 +1,46 @@
package com.njcn.harmonic.controller.distribution;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
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.harmonic.pojo.param.RStatPwPermeabilityMParam;
import com.njcn.harmonic.pojo.vo.RStatPwPermeabilityMVO;
import com.njcn.harmonic.service.distribution.RStatPwPermeabilityMService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Title RStatPwPermeabilityMController
* @Package com.njcn.harmonic.controller
* @Author jianghaifei
* @Date 2022-11-07 13:55
* @Version V1.0
*/
@RestController
@RequestMapping("/rStatPwPermeability")
@RequiredArgsConstructor
@Api(tags = "配网-各渗透率光伏台区基准水平")
public class RStatPwPermeabilityMController extends BaseController {
private final RStatPwPermeabilityMService rStatPwPermeabilityMService;
@PostMapping("getPwPermeabilityList")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询各渗透率光伏台区基准水平")
public HttpResult<Page<RStatPwPermeabilityMVO>> getPwPermeabilityList(@RequestBody RStatPwPermeabilityMParam rStatPwPermeabilityMParam) {
String methodDescribe = getMethodDescribe("getPwPermeabilityList");
Page<RStatPwPermeabilityMVO> list = rStatPwPermeabilityMService.getPwPermeabilityList(rStatPwPermeabilityMParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -0,0 +1,73 @@
package com.njcn.harmonic.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.BizParamConstant;
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.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO;
import com.njcn.harmonic.service.majornetwork.RMpBenchmarkLevelMService;
import com.njcn.harmonic.service.majornetwork.RMpBenchmarkLevelQService;
import com.njcn.harmonic.service.majornetwork.RMpBenchmarkLevelYService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Title RMpBenchmarkLevelController
* @Package com.njcn.device.pms.controller
* @Author jianghaifei
* @Date 2022-10-11 10:34
* @Version V1.0
*/
@RestController
@Api(tags = "主网-基准水平评估")
@RequiredArgsConstructor
@RequestMapping("/rMpBenchmarkLevel")
public class RMpBenchmarkLevelController extends BaseController {
private final RMpBenchmarkLevelMService rMpBenchmarkLevelMService; //基准水平-月
private final RMpBenchmarkLevelQService rMpBenchmarkLevelQService; //基准水平-季
private final RMpBenchmarkLevelYService rMpBenchmarkLevelYService; //基准水平-年
@PostMapping("getAllRMpBenchmarkLevelList")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("主网-区域稳态电能质量水平评估")
public HttpResult<List<RMpBenchmarkLevelVO>> getAllRMpBenchmarkLevelList(@RequestBody RMpBenchmarkLevelParam rMpBenchmarkLevelParam) {
String methodDescribe = getMethodDescribe("getAllRMpBenchmarkLevelList");
//获取查询条件-时间类型
String type = rMpBenchmarkLevelParam.getType().toString();
List<RMpBenchmarkLevelVO> rMpBenchmarkLevelList;
switch (type) {
case BizParamConstant.STAT_BIZ_YEAR:
//查询基准水平-年数据
rMpBenchmarkLevelList = rMpBenchmarkLevelYService.getRMpBenchmarkLevelList(rMpBenchmarkLevelParam);
break;
case BizParamConstant.STAT_BIZ_QUARTER:
//查询基准水平-季数据
rMpBenchmarkLevelList = rMpBenchmarkLevelQService.getRMpBenchmarkLevelList(rMpBenchmarkLevelParam);
break;
case BizParamConstant.STAT_BIZ_MONTH:
//查询基准水平-月数据
rMpBenchmarkLevelList = rMpBenchmarkLevelMService.getRMpBenchmarkLevelList(rMpBenchmarkLevelParam);
break;
default:
//如果前端没有传type默认查询月数据
rMpBenchmarkLevelList = rMpBenchmarkLevelMService.getRMpBenchmarkLevelList(rMpBenchmarkLevelParam);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rMpBenchmarkLevelList, methodDescribe);
}
}

View File

@@ -0,0 +1,99 @@
package com.njcn.harmonic.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.pojo.param.RStatHarmonicMParam;
import com.njcn.harmonic.pojo.vo.*;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicMService;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicQService;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicYService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author rui.wu
* @since 2022-10-09
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-监测点分类总览")
@RequestMapping("/harmonic/rStatHarmonic")
public class RStatHarmonicController extends BaseController {
private final RStatHarmonicMService rStatHarmonicMService;
private final RStatHarmonicQService rStatHarmonicQService;
private final RStatHarmonicYService rStatHarmonicYService;
/**
* 查询查询监测点稳态指标 日/月点数
*/
@GetMapping("/getAllRStatHarmonic")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询稳态累计超标监测点数")
public HttpResult<List<RArrayVO>> getAllRStatHarmonic(StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getAllRStatHarmonic");
List<RArrayVO> rStatHarmonicMAll = null;
String string = param.getType().toString();
switch (string) {
//查询超标监测点数-年数据
case BizParamConstant.STAT_BIZ_YEAR:
rStatHarmonicMAll = rStatHarmonicYService.getRStatHarmonicYAll(param);
break;
//查询超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
rStatHarmonicMAll = rStatHarmonicQService.getRStatHarmonicQAll(param);
break;
//查询超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
rStatHarmonicMAll = rStatHarmonicMService.getRStatHarmonicMAll(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicMAll, methodDescribe);
}
/**
* 电铁-频率偏差-电压统计图
*/
@GetMapping("/getRStatHarmonicIconVoltage")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("稳态电铁-频率偏差-电压统计图")
public HttpResult<List<RIconVO>> getRStatHarmonicIconVoltage(RStatHarmonicMParam param) {
String methodDescribe = getMethodDescribe("getRStatHarmonicIconVoltage");
List<RIconVO> rStatHarmonicIcon = rStatHarmonicMService.getRStatHarmonicIconVoltage(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicIcon, methodDescribe);
}
/**
* 电铁-频率偏差-电压统计图
*/
@GetMapping("/getRStatHarmonicIconDate")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("稳态电铁-频率偏差-越线日期统计图")
public HttpResult<List<RHarmonicPolylineVO>> getRStatHarmonicIconDate(RStatHarmonicMParam param) {
String methodDescribe = getMethodDescribe("getRStatHarmonicIconDate");
List<RHarmonicPolylineVO> rStatHarmonicIcon = rStatHarmonicMService.getRStatHarmonicIconDate(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicIcon, methodDescribe);
}
}

View File

@@ -0,0 +1,106 @@
package com.njcn.harmonic.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.pojo.param.RStatHarmonicMParam;
import com.njcn.harmonic.pojo.vo.RArrayVO;
import com.njcn.harmonic.pojo.vo.RIconVO;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicOrgMService;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicOrgQService;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicOrgYService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author rui.wu
* @since 2022-10-14
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-各单位分类总览")
@RequestMapping("/harmonic/rStatHarmonicOrg")
public class RStatHarmonicOrgController extends BaseController {
private final RStatHarmonicOrgYService rStatHarmonicOrgYService;
private final RStatHarmonicOrgQService rStatHarmonicOrgQService;
private final RStatHarmonicOrgMService rStatHarmonicOrgMService;
/**
* 查询查询监测点稳态指标 日/月点数
*/
@GetMapping("/getAllRStatHarmonicOrg")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询稳态累计超标监测点数")
public HttpResult<List<RArrayVO>> getAllRStatHarmonicOrg(StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getAllRStatHarmonicOrg");
List<RArrayVO> rStatHarmonicOrgMAll = null;
String string = param.getType().toString();
switch (string) {
//查询各单位累计超标监测点数-年数据
case BizParamConstant.STAT_BIZ_YEAR:
rStatHarmonicOrgMAll = rStatHarmonicOrgYService.getRStatHarmonicYAll(param);
break;
//查询各单位累计超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
rStatHarmonicOrgMAll = rStatHarmonicOrgQService.getRStatHarmonicQAll(param);
break;
//查询各单位累计超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
rStatHarmonicOrgMAll = rStatHarmonicOrgMService.getRStatHarmonicMAll(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicOrgMAll, methodDescribe);
}
/**
* 查询查询监测点稳态指标 日/月点数
*/
@GetMapping("/getAllRStatHarmonicOrgIcon")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询稳态各单位超标监测统计图")
public HttpResult<List<RIconVO>> getAllRStatHarmonicOrgIcon(RStatHarmonicMParam param) {
String methodDescribe = getMethodDescribe("getAllRStatHarmonicOrgIcon");
List<RIconVO> getAllRStatHarmonicOrgIcon = null;
String string = param.getType().toString();
switch (string) {
//查询各单位累计超标监测点数统计图-年数据
case BizParamConstant.STAT_BIZ_YEAR:
getAllRStatHarmonicOrgIcon = rStatHarmonicOrgYService.getRStatHarmonicOrgYIcon(param);
break;
//查询各单位累计超标监测点数-季数据
case BizParamConstant.STAT_BIZ_QUARTER:
getAllRStatHarmonicOrgIcon = rStatHarmonicOrgQService.getRStatHarmonicOrgQIcon(param);
break;
//查询各单位累计超标监测点数-月数据
case BizParamConstant.STAT_BIZ_MONTH:
getAllRStatHarmonicOrgIcon = rStatHarmonicOrgMService.getRStatHarmonicOrgMIcon(param);
break;
default:
break;
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, getAllRStatHarmonicOrgIcon, methodDescribe);
}
}

View File

@@ -0,0 +1,81 @@
package com.njcn.harmonic.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.pojo.vo.RSubstationIcon2VO;
import com.njcn.harmonic.pojo.vo.RSubstationIconVO;
import com.njcn.harmonic.pojo.vo.RVoltageIconVO;
import com.njcn.harmonic.service.majornetwork.RStatSubstationMService;
import com.njcn.harmonic.service.majornetwork.RStatSubstationVoltageMService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author rui.wu
* @since 2022-10-18
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-变电站分类总览")
@RequestMapping("/harmonic/rStatSubstation")
public class RStatSubstationController extends BaseController {
private final RStatSubstationMService rStatSubstationMService;
private final RStatSubstationVoltageMService rStatSubstationVoltageMService;
/**
* 变电站稳态指标超标分布(按超标天数)
*/
@GetMapping("/getAllRStatSubstationIconDays")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("变电站稳态指标超标分布(按超标天数)")
public HttpResult<RSubstationIconVO> getAllRStatSubstationIconDays(StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getAllRStatSubstationIconDays");
RSubstationIconVO statSubstationIcon = rStatSubstationMService.getStatSubstationIcon(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
}
/**
* 变电站稳态指标超标分布(按电压等级)
*/
@GetMapping("/getAllRStatSubstationIconVoltage")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("变电站稳态指标超标分布(按电压等级)")
public HttpResult<List<RVoltageIconVO>> getAllRStatSubstationIconVoltage(StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getAllRStatSubstationIconVoltage");
List<RVoltageIconVO> statSubstationIcon = rStatSubstationVoltageMService.getStatSubstationIcon(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
}
/**
* 变电站稳态指标平均超标天数
*/
@GetMapping("/getAllRStatSubstationIconAvgDays")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("变电站稳态指标平均超标天数")
public HttpResult<List<RSubstationIcon2VO>> getAllRStatSubstationIconAvgDays(StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getAllRStatSubstationIconAvgDays");
List<RSubstationIcon2VO> statSubstationIcon = rStatSubstationMService.getStatSubstationIcon2(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
}
}

View File

@@ -0,0 +1,15 @@
package com.njcn.harmonic.mapper.distribution;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelM;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_m】的数据库操作Mapper
* @createDate 2022-10-11 10:32:18
* @Entity com.njcn.device.pms.pojo.po.RMpBenchmarkLevelM
*/
public interface PwRMpBenchmarkLevelMMapper extends BaseMapper<RMpBenchmarkLevelM> {
}

View File

@@ -0,0 +1,15 @@
package com.njcn.harmonic.mapper.distribution;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelQ;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_q】的数据库操作Mapper
* @createDate 2022-10-11 10:32:18
* @Entity com.njcn.device.pms.pojo.po.RMpBenchmarkLevelQ
*/
public interface PwRMpBenchmarkLevelQMapper extends BaseMapper<RMpBenchmarkLevelQ> {
}

View File

@@ -0,0 +1,15 @@
package com.njcn.harmonic.mapper.distribution;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelY;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_y】的数据库操作Mapper
* @createDate 2022-10-11 10:32:18
* @Entity com.njcn.device.pms.pojo.po.RMpBenchmarkLevelY
*/
public interface PwRMpBenchmarkLevelYMapper extends BaseMapper<RMpBenchmarkLevelY> {
}

View File

@@ -0,0 +1,27 @@
package com.njcn.harmonic.mapper.distribution;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.harmonic.pojo.param.RStatPwPermeabilityMParam;
import com.njcn.harmonic.pojo.po.RStatPwPermeabilityM;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.vo.RStatPwPermeabilityMVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author jianghf
* @description 针对表【r_stat_pw_permeability_m】的数据库操作Mapper
* @createDate 2022-11-07 10:35:21
* @Entity com.njcn.harmonic.pojo.po.RStatPwPermeabilityM
*/
public interface RStatPwPermeabilityMMapper extends BaseMapper<RStatPwPermeabilityM> {
Page<RStatPwPermeabilityMVO> getPwPermeabilityList(IPage<RStatPwPermeabilityMVO> page, @Param("condMap") Map<String, Object> condMap);
}

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.harmonic.mapper.distribution.PwRMpBenchmarkLevelMMapper">
<resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.RMpBenchmarkLevelM">
<id property="measurementPointId" column="measurement_point_id" jdbcType="VARCHAR"/>
<id property="dataDate" column="data_date" jdbcType="DATE"/>
<result property="voltageAvg" column="voltage_avg" jdbcType="FLOAT"/>
<result property="voltageSd" column="voltage_sd" jdbcType="FLOAT"/>
<result property="unbalanceAvg" column="unbalance_avg" jdbcType="FLOAT"/>
<result property="unbalanceSd" column="unbalance_sd" jdbcType="FLOAT"/>
<result property="vthdAvg" column="vthd_avg" jdbcType="FLOAT"/>
<result property="vthdSd" column="vthd_sd" jdbcType="FLOAT"/>
<result property="flickerAvg" column="flicker_avg" jdbcType="FLOAT"/>
<result property="flickerSd" column="flicker_sd" jdbcType="FLOAT"/>
</resultMap>
<sql id="Base_Column_List">
measurement_point_id,data_date,voltage_avg,
voltage_sd,unbalance_avg,unbalance_sd,
vthd_avg,vthd_sd,flicker_avg,
flicker_sd
</sql>
</mapper>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.harmonic.mapper.distribution.PwRMpBenchmarkLevelQMapper">
<resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.RMpBenchmarkLevelQ">
<id property="measurementPointId" column="measurement_point_id" jdbcType="VARCHAR"/>
<id property="dataDate" column="data_date" jdbcType="DATE"/>
<result property="voltageAvg" column="voltage_avg" jdbcType="FLOAT"/>
<result property="voltageSd" column="voltage_sd" jdbcType="FLOAT"/>
<result property="unbalanceAvg" column="unbalance_avg" jdbcType="FLOAT"/>
<result property="unbalanceSd" column="unbalance_sd" jdbcType="FLOAT"/>
<result property="vthdAvg" column="vthd_avg" jdbcType="FLOAT"/>
<result property="vthdSd" column="vthd_sd" jdbcType="FLOAT"/>
<result property="flickerAvg" column="flicker_avg" jdbcType="FLOAT"/>
<result property="flickerSd" column="flicker_sd" jdbcType="FLOAT"/>
</resultMap>
<sql id="Base_Column_List">
measurement_point_id,data_date,voltage_avg,
voltage_sd,unbalance_avg,unbalance_sd,
vthd_avg,vthd_sd,flicker_avg,
flicker_sd
</sql>
</mapper>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.harmonic.mapper.distribution.PwRMpBenchmarkLevelYMapper">
<resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.RMpBenchmarkLevelY">
<id property="measurementPointId" column="measurement_point_id" jdbcType="VARCHAR"/>
<id property="dataDate" column="data_date" jdbcType="DATE"/>
<result property="voltageAvg" column="voltage_avg" jdbcType="FLOAT"/>
<result property="voltageSd" column="voltage_sd" jdbcType="FLOAT"/>
<result property="unbalanceAvg" column="unbalance_avg" jdbcType="FLOAT"/>
<result property="unbalanceSd" column="unbalance_sd" jdbcType="FLOAT"/>
<result property="vthdAvg" column="vthd_avg" jdbcType="FLOAT"/>
<result property="vthdSd" column="vthd_sd" jdbcType="FLOAT"/>
<result property="flickerAvg" column="flicker_avg" jdbcType="FLOAT"/>
<result property="flickerSd" column="flicker_sd" jdbcType="FLOAT"/>
</resultMap>
<sql id="Base_Column_List">
measurement_point_id,data_date,voltage_avg,
voltage_sd,unbalance_avg,unbalance_sd,
vthd_avg,vthd_sd,flicker_avg,
flicker_sd
</sql>
</mapper>

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.harmonic.mapper.distribution.RStatPwPermeabilityMMapper">
<resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.RStatPwPermeabilityM">
<id property="orgNo" column="org_no" jdbcType="VARCHAR"/>
<id property="dataDate" column="data_date" jdbcType="DATE"/>
<id property="psrId" column="psr_id" jdbcType="VARCHAR"/>
<result property="voltageAvg" column="voltage_avg" jdbcType="FLOAT"/>
<result property="voltageSd" column="voltage_sd" jdbcType="FLOAT"/>
<result property="unbalanceAvg" column="unbalance_avg" jdbcType="FLOAT"/>
<result property="unbalanceSd" column="unbalance_sd" jdbcType="FLOAT"/>
<result property="vthdAvg" column="vthd_avg" jdbcType="FLOAT"/>
<result property="vthdSd" column="vthd_sd" jdbcType="FLOAT"/>
<result property="flickerAvg" column="flicker_avg" jdbcType="FLOAT"/>
<result property="flickerSd" column="flicker_sd" jdbcType="FLOAT"/>
<result property="permeabilityType" column="permeability_type" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
org_no,data_date,psr_id,
voltage_avg,voltage_sd,unbalance_avg,
unbalance_sd,vthd_avg,vthd_sd,
flicker_avg,flicker_sd,permeability_type
</sql>
<select id="getPwPermeabilityList" resultType="com.njcn.harmonic.pojo.vo.RStatPwPermeabilityMVO">
select
rspp25.org_no as orgNO, rspp25.psr_id as psrId,
rspp25.voltage_avg as voltageAvg25,rspp25.voltage_sd as voltageSd25,rspp25.unbalance_avg as unbalanceAvg25,
rspp25.unbalance_sd as unbalanceSd25, rspp25.vthd_avg as vthdAvg25,rspp25.vthd_sd as vthdSd25,
rspp25.flicker_avg as flickerAvg25, rspp25.flicker_sd as flickerSd25,
rspp50.voltage_avg as voltageAvg50,rspp50.voltage_sd as voltageSd50,rspp50.unbalance_avg as unbalanceAvg50,
rspp50.unbalance_sd as unbalanceSd50, rspp50.vthd_avg as vthdAvg50,rspp50.vthd_sd as vthdSd50,
rspp50.flicker_avg as flickerAvg50, rspp50.flicker_sd as flickerSd50,
rspp75.voltage_avg as voltageAvg75,rspp75.voltage_sd as voltageSd75,rspp75.unbalance_avg as unbalanceAvg75,
rspp75.unbalance_sd as unbalanceSd75, rspp75.vthd_avg as vthdAvg75,rspp75.vthd_sd as vthdSd75,
rspp75.flicker_avg as flickerAvg75, rspp75.flicker_sd as flickerSd75,
rspp99.voltage_avg as voltageAvg99,rspp99.voltage_sd as voltageSd99,rspp99.unbalance_avg as unbalanceAvg99,
rspp99.unbalance_sd as unbalanceSd99, rspp99.vthd_avg as vthdAvg99,rspp99.vthd_sd as vthdSd99,
rspp99.flicker_avg as flickerAvg99, rspp99.flicker_sd as flickerSd99,
rspp100.voltage_avg as voltageAvg100,rspp100.voltage_sd as voltageSd100,rspp100.unbalance_avg as unbalanceAvg100,
rspp100.unbalance_sd as unbalanceSd100, rspp100.vthd_avg as vthdAvg100,rspp100.vthd_sd as vthdSd100,
rspp100.flicker_avg as flickerAvg100, rspp100.flicker_sd as flickerSd100
from
r_stat_pw_permeability_m rspp25
left join r_stat_pw_permeability_m rspp50 on rspp25.psr_id = rspp50.psr_id
left join r_stat_pw_permeability_m rspp75 on rspp25.psr_id = rspp75.psr_id
left join r_stat_pw_permeability_m rspp99 on rspp25.psr_id = rspp99.psr_id
left join r_stat_pw_permeability_m rspp100 on rspp25.psr_id = rspp100.psr_id
where 1 = 1
<if test="condMap.startTime != null and condMap.startTime != ''">
and DATE_FORMAT(rspp25.data_date, '%Y-%m') &gt;= DATE_FORMAT(#{condMap.startTime}, '%Y-%m')
</if>
<if test="condMap.endTime != null and condMap.endTime != ''">
and DATE_FORMAT(rspp25.data_date, '%Y-%m') &lt;= DATE_FORMAT(#{condMap.endTime}, '%Y-%m')
</if>
and rspp25.data_date = rspp50.data_date
and rspp25.data_date = rspp75.data_date
and rspp25.data_date = rspp99.data_date
and rspp25.data_date = rspp100.data_date
and rspp25.permeability_type = #{condMap.Rate_0_25}
and rspp50.permeability_type = #{condMap.Rate_25_50}
and rspp75.permeability_type = #{condMap.Rate_50_75}
and rspp99.permeability_type = #{condMap.Rate_75_100}
and rspp100.permeability_type = #{condMap.Rate_100}
and rspp25.psr_id in
<foreach collection="condMap.idList" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,15 @@
package com.njcn.harmonic.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelM;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_m】的数据库操作Mapper
* @createDate 2022-10-11 10:32:18
* @Entity com.njcn.device.pms.pojo.po.RMpBenchmarkLevelM
*/
public interface RMpBenchmarkLevelMMapper extends BaseMapper<RMpBenchmarkLevelM> {
}

View File

@@ -0,0 +1,15 @@
package com.njcn.harmonic.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelQ;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_q】的数据库操作Mapper
* @createDate 2022-10-11 10:32:18
* @Entity com.njcn.device.pms.pojo.po.RMpBenchmarkLevelQ
*/
public interface RMpBenchmarkLevelQMapper extends BaseMapper<RMpBenchmarkLevelQ> {
}

View File

@@ -0,0 +1,15 @@
package com.njcn.harmonic.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelY;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_y】的数据库操作Mapper
* @createDate 2022-10-11 10:32:18
* @Entity com.njcn.device.pms.pojo.po.RMpBenchmarkLevelY
*/
public interface RMpBenchmarkLevelYMapper extends BaseMapper<RMpBenchmarkLevelY> {
}

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.harmonic.mapper.majornetwork.RMpBenchmarkLevelMMapper">
<resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.RMpBenchmarkLevelM">
<id property="measurementPointId" column="measurement_point_id" jdbcType="VARCHAR"/>
<id property="dataDate" column="data_date" jdbcType="DATE"/>
<result property="voltageAvg" column="voltage_avg" jdbcType="FLOAT"/>
<result property="voltageSd" column="voltage_sd" jdbcType="FLOAT"/>
<result property="unbalanceAvg" column="unbalance_avg" jdbcType="FLOAT"/>
<result property="unbalanceSd" column="unbalance_sd" jdbcType="FLOAT"/>
<result property="vthdAvg" column="vthd_avg" jdbcType="FLOAT"/>
<result property="vthdSd" column="vthd_sd" jdbcType="FLOAT"/>
<result property="flickerAvg" column="flicker_avg" jdbcType="FLOAT"/>
<result property="flickerSd" column="flicker_sd" jdbcType="FLOAT"/>
</resultMap>
<sql id="Base_Column_List">
measurement_point_id,data_date,voltage_avg,
voltage_sd,unbalance_avg,unbalance_sd,
vthd_avg,vthd_sd,flicker_avg,
flicker_sd
</sql>
</mapper>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.harmonic.mapper.majornetwork.RMpBenchmarkLevelQMapper">
<resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.RMpBenchmarkLevelQ">
<id property="measurementPointId" column="measurement_point_id" jdbcType="VARCHAR"/>
<id property="dataDate" column="data_date" jdbcType="DATE"/>
<result property="voltageAvg" column="voltage_avg" jdbcType="FLOAT"/>
<result property="voltageSd" column="voltage_sd" jdbcType="FLOAT"/>
<result property="unbalanceAvg" column="unbalance_avg" jdbcType="FLOAT"/>
<result property="unbalanceSd" column="unbalance_sd" jdbcType="FLOAT"/>
<result property="vthdAvg" column="vthd_avg" jdbcType="FLOAT"/>
<result property="vthdSd" column="vthd_sd" jdbcType="FLOAT"/>
<result property="flickerAvg" column="flicker_avg" jdbcType="FLOAT"/>
<result property="flickerSd" column="flicker_sd" jdbcType="FLOAT"/>
</resultMap>
<sql id="Base_Column_List">
measurement_point_id,data_date,voltage_avg,
voltage_sd,unbalance_avg,unbalance_sd,
vthd_avg,vthd_sd,flicker_avg,
flicker_sd
</sql>
</mapper>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.harmonic.mapper.majornetwork.RMpBenchmarkLevelYMapper">
<resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.RMpBenchmarkLevelY">
<id property="measurementPointId" column="measurement_point_id" jdbcType="VARCHAR"/>
<id property="dataDate" column="data_date" jdbcType="DATE"/>
<result property="voltageAvg" column="voltage_avg" jdbcType="FLOAT"/>
<result property="voltageSd" column="voltage_sd" jdbcType="FLOAT"/>
<result property="unbalanceAvg" column="unbalance_avg" jdbcType="FLOAT"/>
<result property="unbalanceSd" column="unbalance_sd" jdbcType="FLOAT"/>
<result property="vthdAvg" column="vthd_avg" jdbcType="FLOAT"/>
<result property="vthdSd" column="vthd_sd" jdbcType="FLOAT"/>
<result property="flickerAvg" column="flicker_avg" jdbcType="FLOAT"/>
<result property="flickerSd" column="flicker_sd" jdbcType="FLOAT"/>
</resultMap>
<sql id="Base_Column_List">
measurement_point_id,data_date,voltage_avg,
voltage_sd,unbalance_avg,unbalance_sd,
vthd_avg,vthd_sd,flicker_avg,
flicker_sd
</sql>
</mapper>

View File

@@ -0,0 +1,25 @@
package com.njcn.harmonic.service.distribution;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelM;
import com.njcn.harmonic.pojo.vo.PwRMpBenchmarkLevelVO;
import java.util.List;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_m】的数据库操作Service
* @createDate 2022-10-11 10:32:18
*/
public interface PwRMpBenchmarkLevelMService extends IService<RMpBenchmarkLevelM> {
/***
* 配网-全网基准水平
* @author jianghaifei
* @date 2022-11-04 10:30
* @param rMpBenchmarkLevelParam
* @return java.util.List<com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO>
*/
Page<PwRMpBenchmarkLevelVO> getPwRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam);
}

View File

@@ -0,0 +1,25 @@
package com.njcn.harmonic.service.distribution;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelQ;
import com.njcn.harmonic.pojo.vo.PwRMpBenchmarkLevelVO;
import java.util.List;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_q】的数据库操作Service
* @createDate 2022-10-11 10:32:18
*/
public interface PwRMpBenchmarkLevelQService extends IService<RMpBenchmarkLevelQ> {
/***
* 配网-全网基准水平
* @author jianghaifei
* @date 2022-11-04 10:31
* @param rMpBenchmarkLevelParam
* @return java.util.List<com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO>
*/
Page<PwRMpBenchmarkLevelVO> getPwRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.harmonic.service.distribution;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelY;
import com.njcn.harmonic.pojo.vo.PwRMpBenchmarkLevelVO;
import java.util.List;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_y】的数据库操作Service
* @createDate 2022-10-11 10:32:18
*/
public interface PwRMpBenchmarkLevelYService extends IService<RMpBenchmarkLevelY> {
/***
* 配网-全网基准水平
* @author jianghaifei
* @date 2022-11-04 10:30
* @param rMpBenchmarkLevelParam
* @return java.util.List<com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO>
*/
Page<PwRMpBenchmarkLevelVO> getPwRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam);
}

View File

@@ -0,0 +1,27 @@
package com.njcn.harmonic.service.distribution;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.harmonic.pojo.param.RStatPwPermeabilityMParam;
import com.njcn.harmonic.pojo.po.RStatPwPermeabilityM;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.harmonic.pojo.vo.RStatPwPermeabilityMVO;
import java.util.List;
/**
* 各渗透率光伏台区基准水平
* @author jianghf
* @description 针对表【r_stat_pw_permeability_m】的数据库操作Service
* @createDate 2022-11-07 10:35:21
*/
public interface RStatPwPermeabilityMService extends IService<RStatPwPermeabilityM> {
/***
* 获取各渗透率光伏台区基准水平
* @author jianghaifei
* @date 2022-11-07 14:38
* @param rStatPwPermeabilityMParam
* @return java.util.List<com.njcn.harmonic.pojo.vo.RStatPwPermeabilityMVO>
*/
Page<RStatPwPermeabilityMVO> getPwPermeabilityList(RStatPwPermeabilityMParam rStatPwPermeabilityMParam);
}

View File

@@ -0,0 +1,103 @@
package com.njcn.harmonic.service.distribution.impl;
import cn.hutool.core.collection.CollUtil;
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.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.harmonic.mapper.distribution.PwRMpBenchmarkLevelMMapper;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelM;
import com.njcn.harmonic.pojo.vo.PwRMpBenchmarkLevelVO;
import com.njcn.harmonic.service.distribution.PwRMpBenchmarkLevelMService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_m】的数据库操作Service实现
* @createDate 2022-10-11 10:32:18
*/
@Service
@RequiredArgsConstructor
public class PwRMpBenchmarkLevelMServiceImpl extends ServiceImpl<PwRMpBenchmarkLevelMMapper, RMpBenchmarkLevelM>
implements PwRMpBenchmarkLevelMService {
private final PwMonitorClient pwMonitorClient;
/***
* 配网-全网基准水平
* @author jianghaifei
* @date 2022-11-04 10:30
* @param rMpBenchmarkLevelParam
* @return java.util.List<com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO>
*/
@Override
public Page<PwRMpBenchmarkLevelVO> getPwRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam) {
//提取查询条件
String id = rMpBenchmarkLevelParam.getId(); //单位id
if (StringUtils.isBlank(id)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "单位id不可为空");
}
String startTime = rMpBenchmarkLevelParam.getStartTime(); //开始时间
String endTime = rMpBenchmarkLevelParam.getEndTime(); //截止时间
List <String> voltageLevelParamList = StringUtils.isNotBlank(rMpBenchmarkLevelParam.getVoltageLevel()) ? Arrays.asList(rMpBenchmarkLevelParam.getVoltageLevel().split(",")) : null; //电压等级
Integer pageNum = rMpBenchmarkLevelParam.getPageNum() != null && rMpBenchmarkLevelParam.getPageNum() != 0 ? rMpBenchmarkLevelParam.getPageNum() : 1; //页码
Integer pageSize = rMpBenchmarkLevelParam.getPageSize() != null && rMpBenchmarkLevelParam.getPageSize() != 0 ? rMpBenchmarkLevelParam.getPageSize() : 10; //页面尺寸
//根据条件查询单位下面的所有配网监测点
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
pwPmsMonitorParam.setOrgId(id); //单位id
pwPmsMonitorParam.setVoltageLevels(voltageLevelParamList); //电压等级
List<PwPmsMonitorDTO> pwMonitorList = pwMonitorClient.getPwMonitorList(pwPmsMonitorParam).getData();
if (CollUtil.isEmpty(pwMonitorList)) {
return new Page<>();
}
//监测点id集合
List<String> monitorIdList = pwMonitorList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
//监测点map key:监测点id value:监测点实体
Map<String, PwPmsMonitorDTO> monitorMap = pwMonitorList.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId, monitor -> monitor));
//查询【基准水平-月】数据
/*组装条件where measurement_point_id in (monitorIdList) and data_date >= startTime
and data_date <= endTime and voltage_level
*/
LambdaQueryWrapper<RMpBenchmarkLevelM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(CollUtil.isNotEmpty(monitorIdList), RMpBenchmarkLevelM::getMeasurementPointId, monitorIdList)
.ge(StringUtils.isNotBlank(startTime), RMpBenchmarkLevelM::getDataDate, startTime)
.le(StringUtils.isNotBlank(endTime), RMpBenchmarkLevelM::getDataDate, endTime);
Page<RMpBenchmarkLevelM> listPage = this.page(new Page<>(pageNum, pageSize), lambdaQueryWrapper);
List<PwRMpBenchmarkLevelVO> resultList = listPage.getRecords().stream().map(item -> {
//封装前端需要的对象
PwRMpBenchmarkLevelVO rMpBenchmarkLevelVO = new PwRMpBenchmarkLevelVO();
BeanUtils.copyProperties(item, rMpBenchmarkLevelVO);
//单位信息
rMpBenchmarkLevelVO.setOrgNo(monitorMap.get(item.getMeasurementPointId()).getOrgId()); //单位id
rMpBenchmarkLevelVO.setOrgName(monitorMap.get(item.getMeasurementPointId()).getOrgName()); //单位名称
//监测点信息
rMpBenchmarkLevelVO.setMeasurementPointName(monitorMap.get(item.getMeasurementPointId()).getMonitorName()); //监测点名称
//电压等级
rMpBenchmarkLevelVO.setVoltageLevel(monitorMap.get(item.getMeasurementPointId()).getVoltageLevel());
return rMpBenchmarkLevelVO;
}).collect(Collectors.toList());
Page<PwRMpBenchmarkLevelVO> resultPage = new Page<>();
BeanUtils.copyProperties(listPage, resultPage);
resultPage.setRecords(resultList);
return resultPage;
}
}

View File

@@ -0,0 +1,103 @@
package com.njcn.harmonic.service.distribution.impl;
import cn.hutool.core.collection.CollUtil;
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.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.harmonic.mapper.distribution.PwRMpBenchmarkLevelQMapper;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelM;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelQ;
import com.njcn.harmonic.pojo.vo.PwRMpBenchmarkLevelVO;
import com.njcn.harmonic.service.distribution.PwRMpBenchmarkLevelQService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_q】的数据库操作Service实现
* @createDate 2022-10-11 10:32:18
*/
@Service
@RequiredArgsConstructor
public class PwRMpBenchmarkLevelQServiceImpl extends ServiceImpl<PwRMpBenchmarkLevelQMapper, RMpBenchmarkLevelQ>
implements PwRMpBenchmarkLevelQService {
private final PwMonitorClient pwMonitorClient;
/***
* 配网-全网基准水平
* @author jianghaifei
* @date 2022-11-04 10:31
* @param rMpBenchmarkLevelParam
* @return java.util.List<com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO>
*/
@Override
public Page<PwRMpBenchmarkLevelVO> getPwRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam) {
//提取查询条件
String id = rMpBenchmarkLevelParam.getId(); //单位id
if (StringUtils.isBlank(id)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "单位id不可为空");
}
String startTime = rMpBenchmarkLevelParam.getStartTime(); //开始时间
String endTime = rMpBenchmarkLevelParam.getEndTime(); //截止时间
List <String> voltageLevelParamList = StringUtils.isNotBlank(rMpBenchmarkLevelParam.getVoltageLevel()) ? Arrays.asList(rMpBenchmarkLevelParam.getVoltageLevel().split(",")) : null; //电压等级
Integer pageNum = rMpBenchmarkLevelParam.getPageNum() != null && rMpBenchmarkLevelParam.getPageNum() != 0 ? rMpBenchmarkLevelParam.getPageNum() : 1; //页码
Integer pageSize = rMpBenchmarkLevelParam.getPageSize() != null && rMpBenchmarkLevelParam.getPageSize() != 0 ? rMpBenchmarkLevelParam.getPageSize() : 10; //页面尺寸
//根据条件查询单位下面的所有配网监测点
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
pwPmsMonitorParam.setOrgId(id); //单位id
pwPmsMonitorParam.setVoltageLevels(voltageLevelParamList); //电压等级
List<PwPmsMonitorDTO> pwMonitorList = pwMonitorClient.getPwMonitorList(pwPmsMonitorParam).getData();
if (CollUtil.isEmpty(pwMonitorList)) {
return new Page<>();
}
//监测点id集合
List<String> monitorIdList = pwMonitorList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
//监测点map key:监测点id value:监测点实体
Map<String, PwPmsMonitorDTO> monitorMap = pwMonitorList.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId, monitor -> monitor));
//查询【基准水平-季】数据
/*组装条件where measurement_point_id in (monitorIdList) and data_date >= startTime
and data_date <= endTime and voltage_level
*/
LambdaQueryWrapper<RMpBenchmarkLevelQ> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(CollUtil.isNotEmpty(monitorIdList), RMpBenchmarkLevelQ::getMeasurementPointId, monitorIdList)
.ge(StringUtils.isNotBlank(startTime), RMpBenchmarkLevelQ::getDataDate, startTime)
.le(StringUtils.isNotBlank(endTime), RMpBenchmarkLevelQ::getDataDate, endTime);
Page<RMpBenchmarkLevelQ> listPage = this.page(new Page<>(pageNum, pageSize), lambdaQueryWrapper);
List<PwRMpBenchmarkLevelVO> resultList = listPage.getRecords().stream().map(item -> {
//封装前端需要的对象
PwRMpBenchmarkLevelVO rMpBenchmarkLevelVO = new PwRMpBenchmarkLevelVO();
BeanUtils.copyProperties(item, rMpBenchmarkLevelVO);
//单位信息
rMpBenchmarkLevelVO.setOrgNo(monitorMap.get(item.getMeasurementPointId()).getOrgId()); //单位id
rMpBenchmarkLevelVO.setOrgName(monitorMap.get(item.getMeasurementPointId()).getOrgName()); //单位名称
//监测点信息
rMpBenchmarkLevelVO.setMeasurementPointName(monitorMap.get(item.getMeasurementPointId()).getMonitorName()); //监测点名称
//电压等级
rMpBenchmarkLevelVO.setVoltageLevel(monitorMap.get(item.getMeasurementPointId()).getVoltageLevel());
return rMpBenchmarkLevelVO;
}).collect(Collectors.toList());
Page<PwRMpBenchmarkLevelVO> resultPage = new Page<>();
BeanUtils.copyProperties(listPage, resultPage);
resultPage.setRecords(resultList);
return resultPage;
}
}

View File

@@ -0,0 +1,105 @@
package com.njcn.harmonic.service.distribution.impl;
import cn.hutool.core.collection.CollUtil;
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.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.harmonic.mapper.distribution.PwRMpBenchmarkLevelYMapper;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelQ;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelY;
import com.njcn.harmonic.pojo.vo.PwRMpBenchmarkLevelVO;
import com.njcn.harmonic.service.distribution.PwRMpBenchmarkLevelYService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_y】的数据库操作Service实现
* @createDate 2022-10-11 10:32:18
*/
@Service
@RequiredArgsConstructor
public class PwRMpBenchmarkLevelYServiceImpl extends ServiceImpl<PwRMpBenchmarkLevelYMapper, RMpBenchmarkLevelY>
implements PwRMpBenchmarkLevelYService {
private final PwMonitorClient pwMonitorClient;
/***
* 配网-全网基准水平
* @author jianghaifei
* @date 2022-11-04 10:32
* @param rMpBenchmarkLevelParam
* @return java.util.List<com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO>
*/
@Override
public Page<PwRMpBenchmarkLevelVO> getPwRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam) {
//提取查询条件
String id = rMpBenchmarkLevelParam.getId(); //单位id
if (StringUtils.isBlank(id)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "单位id不可为空");
}
String startTime = rMpBenchmarkLevelParam.getStartTime(); //开始时间
String endTime = rMpBenchmarkLevelParam.getEndTime(); //截止时间
List <String> voltageLevelParamList = StringUtils.isNotBlank(rMpBenchmarkLevelParam.getVoltageLevel()) ? Arrays.asList(rMpBenchmarkLevelParam.getVoltageLevel().split(",")) : null; //电压等级
Integer pageNum = rMpBenchmarkLevelParam.getPageNum() != null && rMpBenchmarkLevelParam.getPageNum() != 0 ? rMpBenchmarkLevelParam.getPageNum() : 1; //页码
Integer pageSize = rMpBenchmarkLevelParam.getPageSize() != null && rMpBenchmarkLevelParam.getPageSize() != 0 ? rMpBenchmarkLevelParam.getPageSize() : 10; //页面尺寸
//根据条件查询单位下面的所有配网监测点
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
pwPmsMonitorParam.setOrgId(id); //单位id
pwPmsMonitorParam.setVoltageLevels(voltageLevelParamList); //电压等级
List<PwPmsMonitorDTO> pwMonitorList = pwMonitorClient.getPwMonitorList(pwPmsMonitorParam).getData();
if (CollUtil.isEmpty(pwMonitorList)) {
return new Page<>();
}
//监测点id集合
List<String> monitorIdList = pwMonitorList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
//监测点map key:监测点id value:监测点实体
Map<String, PwPmsMonitorDTO> monitorMap = pwMonitorList.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId, monitor -> monitor));
//查询【基准水平-年】数据
/*组装条件where measurement_point_id in (monitorIdList) and data_date >= startTime
and data_date <= endTime and voltage_level
*/
LambdaQueryWrapper<RMpBenchmarkLevelY> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(CollUtil.isNotEmpty(monitorIdList), RMpBenchmarkLevelY::getMeasurementPointId, monitorIdList)
.ge(StringUtils.isNotBlank(startTime), RMpBenchmarkLevelY::getDataDate, startTime)
.le(StringUtils.isNotBlank(endTime), RMpBenchmarkLevelY::getDataDate, endTime);
Page<RMpBenchmarkLevelY> listPage = this.page(new Page<>(pageNum, pageSize), lambdaQueryWrapper);
List<PwRMpBenchmarkLevelVO> resultList = listPage.getRecords().stream().map(item -> {
//封装前端需要的对象
PwRMpBenchmarkLevelVO rMpBenchmarkLevelVO = new PwRMpBenchmarkLevelVO();
BeanUtils.copyProperties(item, rMpBenchmarkLevelVO);
//单位信息
rMpBenchmarkLevelVO.setOrgNo(monitorMap.get(item.getMeasurementPointId()).getOrgId()); //单位id
rMpBenchmarkLevelVO.setOrgName(monitorMap.get(item.getMeasurementPointId()).getOrgName()); //单位名称
//监测点信息
rMpBenchmarkLevelVO.setMeasurementPointName(monitorMap.get(item.getMeasurementPointId()).getMonitorName()); //监测点名称
//电压等级
rMpBenchmarkLevelVO.setVoltageLevel(monitorMap.get(item.getMeasurementPointId()).getVoltageLevel());
return rMpBenchmarkLevelVO;
}).collect(Collectors.toList());
Page<PwRMpBenchmarkLevelVO> resultPage = new Page<>();
BeanUtils.copyProperties(listPage, resultPage);
resultPage.setRecords(resultList);
return resultPage;
}
}

View File

@@ -0,0 +1,91 @@
package com.njcn.harmonic.service.distribution.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.harmonic.mapper.distribution.RStatPwPermeabilityMMapper;
import com.njcn.harmonic.pojo.param.RStatPwPermeabilityMParam;
import com.njcn.harmonic.pojo.po.RStatPwPermeabilityM;
import com.njcn.harmonic.pojo.vo.RStatPwPermeabilityMVO;
import com.njcn.harmonic.service.distribution.RStatPwPermeabilityMService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 各渗透率光伏台区基准水平
* @author jianghf
* @description 针对表【r_stat_pw_permeability_m】的数据库操作Service实现
* @createDate 2022-11-07 10:35:21
*/
@Service
@RequiredArgsConstructor
public class RStatPwPermeabilityMServiceImpl extends ServiceImpl<RStatPwPermeabilityMMapper, RStatPwPermeabilityM>
implements RStatPwPermeabilityMService{
private final PwMonitorClient pwMonitorClient;
private final DicDataFeignClient dicDataFeignClient;
/***
* 获取各渗透率光伏台区基准水平
* @author jianghaifei
* @date 2022-11-07 14:38
* @param rStatPwPermeabilityMParam
* @return java.util.List<com.njcn.harmonic.pojo.vo.RStatPwPermeabilityMVO>
*/
@Override
public Page<RStatPwPermeabilityMVO> getPwPermeabilityList(RStatPwPermeabilityMParam rStatPwPermeabilityMParam) {
//提起参数
String id = rStatPwPermeabilityMParam.getId(); //单位id
String psrName = rStatPwPermeabilityMParam.getPsrName(); //台区名称
String startTime = rStatPwPermeabilityMParam.getStartTime(); //开始时间
String endTime = rStatPwPermeabilityMParam.getEndTime(); //结束时间
Integer pageNum = rStatPwPermeabilityMParam.getPageNum() != null && rStatPwPermeabilityMParam.getPageNum() != 0 ? rStatPwPermeabilityMParam.getPageNum() : 1; //页码
Integer pageSize = rStatPwPermeabilityMParam.getPageSize() != null && rStatPwPermeabilityMParam.getPageSize() != 0 ? rStatPwPermeabilityMParam.getPageSize() : 10; //页面尺寸
//根据条件查询单位下面的所有配网监测点
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
pwPmsMonitorParam.setOrgId(id); //单位id
pwPmsMonitorParam.setMonitorName(psrName); //台区名称(监测点名称)
List<PwPmsMonitorDTO> pwMonitorList = pwMonitorClient.getPwMonitorList(pwPmsMonitorParam).getData();
if (CollUtil.isEmpty(pwMonitorList)) {
return new Page<>();
}
//监测点id集合
List<String> monitorIdList = pwMonitorList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
//监测点map key:监测点id value:监测点实体
Map<String, PwPmsMonitorDTO> monitorMap = pwMonitorList.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId, monitor -> monitor));
//获取各渗透率字典
List<DictData> rateList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.PERMEABILITY_TYPE.getCode()).getData();
Map<String, Object> condMap = rateList.stream().collect(Collectors.toMap(DictData::getCode, DictData::getId));
condMap.put("startTime", startTime);
condMap.put("endTime", endTime);
condMap.put("idList", monitorIdList);
Page<RStatPwPermeabilityMVO> listPage = this.baseMapper.getPwPermeabilityList(new Page<>(pageNum, pageSize), condMap);
List<RStatPwPermeabilityMVO> list = listPage.getRecords().stream().peek(item -> {
item.setOrgName(monitorMap.get(item.getPsrId()).getOrgName()); //单位名称
item.setPsrName(monitorMap.get(item.getPsrId()).getMonitorName()); //台区名称
}).collect(Collectors.toList());
listPage.setRecords(list);
return listPage;
}
}

View File

@@ -0,0 +1,25 @@
package com.njcn.harmonic.service.majornetwork;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelM;
import com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO;
import java.util.List;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_m】的数据库操作Service
* @createDate 2022-10-11 10:32:18
*/
public interface RMpBenchmarkLevelMService extends IService<RMpBenchmarkLevelM> {
/***
* 查询区域稳态电能质量水平(月)
* @author jianghaifei
* @date 2022-10-11 11:26
* @param rMpBenchmarkLevelParam
* @return java.util.List<com.njcn.device.pms.pojo.po.RMpBenchmarkLevelM>
*/
List<RMpBenchmarkLevelVO> getRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.harmonic.service.majornetwork;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelQ;
import com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO;
import java.util.List;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_q】的数据库操作Service
* @createDate 2022-10-11 10:32:18
*/
public interface RMpBenchmarkLevelQService extends IService<RMpBenchmarkLevelQ> {
/***
* 主网-区域稳态电能质量水平评估
* @author jianghaifei
* @date 2022-11-04 10:30
* @param rMpBenchmarkLevelParam
* @return java.util.List<com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO>
*/
List<RMpBenchmarkLevelVO> getRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.harmonic.service.majornetwork;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelY;
import com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO;
import java.util.List;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_y】的数据库操作Service
* @createDate 2022-10-11 10:32:18
*/
public interface RMpBenchmarkLevelYService extends IService<RMpBenchmarkLevelY> {
/***
* 主网-区域稳态电能质量水平评估
* @author jianghaifei
* @date 2022-11-04 10:30
* @param rMpBenchmarkLevelParam
* @return java.util.List<com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO>
*/
List<RMpBenchmarkLevelVO> getRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam);
}

View File

@@ -0,0 +1,133 @@
package com.njcn.harmonic.service.majornetwork.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.harmonic.mapper.majornetwork.RMpBenchmarkLevelMMapper;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelM;
import com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO;
import com.njcn.harmonic.service.majornetwork.RMpBenchmarkLevelMService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_m】的数据库操作Service实现
* @createDate 2022-10-11 10:32:18
*/
@Service
@RequiredArgsConstructor
public class RMpBenchmarkLevelMServiceImpl extends ServiceImpl<RMpBenchmarkLevelMMapper, RMpBenchmarkLevelM>
implements RMpBenchmarkLevelMService {
private final DicDataFeignClient dicDataFeignClient;
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final MonitorClient monitorClient;
private final PwMonitorClient pwMonitorClient;
@Override
public List<RMpBenchmarkLevelVO> getRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam) {
//提取查询条件
String id = rMpBenchmarkLevelParam.getId(); //单位id
if (StringUtils.isBlank(id)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "单位id不可为空");
}
String startTime = rMpBenchmarkLevelParam.getStartTime(); //开始时间
String endTime = rMpBenchmarkLevelParam.getEndTime(); //截止时间
String benchmarkIndicator = rMpBenchmarkLevelParam.getBenchmarkIndicator(); //评价指标
List <String> voltageLevelParamList = StringUtils.isNotBlank(rMpBenchmarkLevelParam.getVoltageLevel()) ? Arrays.asList(rMpBenchmarkLevelParam.getVoltageLevel().split(",")) : null; //电压等级
//获取电压等级的字典
List<DictData> voltageLevelList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
//将电压信息转成mapkeyid valuename
Map<String, String> voltageLevelMap = voltageLevelList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
//获取基准水平评价指标字典
List<DictData> benchmarkIndicatorList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.BENCHMARK_INDICATORS.getCode()).getData();
//将基准水平评价指标信息转成mapkeyid valuename
Map<String, String> benchmarkIndicatorMap = benchmarkIndicatorList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
//查询所有子单位下的所有监测点
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam(id);
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
if (CollUtil.isNotEmpty(voltageLevelParamList)) {
//查询条件电压等级筛选电压等级为voltageLevel的监测点
List<SimpleDTO> simpleDTOList = voltageLevelParamList.stream().map(item -> {
SimpleDTO simpleDTO = new SimpleDTO();
simpleDTO.setId(item);
return simpleDTO;
}).collect(Collectors.toList());
pmsDeviceInfoParam.setVoltageLevel(simpleDTOList);
}
//获取到该部门的所有子部门的监测点idList
List<PmsGeneralDeviceDTO> pmsDeviceInfoWithInOrg = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
//过滤出业务需要的监测点id集合
List<String> firstMonitorIdList = new ArrayList<>(); //只用于合并多个部门的监测点id
pmsDeviceInfoWithInOrg.forEach(item -> firstMonitorIdList.addAll(item.getMonitorIdList()));
List<String> lastMonitorIdList = firstMonitorIdList.stream().distinct().collect(Collectors.toList()); //最终的监测点id集合
//如果没有监测点id信息直接返回空集合
if (CollUtil.isEmpty(lastMonitorIdList)) {
return new ArrayList<>();
}
//查询对应的监测点完整信息 并转为key监测点id value监测点实体的map集合
// LambdaQueryWrapper<Monitor> monitorWrapper = new LambdaQueryWrapper<>();
// monitorWrapper.in(Monitor::getId, lastMonitorIdList);
PmsMonitorInfoParam pmsMonitorInfoParam = new PmsMonitorInfoParam();
pmsMonitorInfoParam.setMonitorIds(lastMonitorIdList);
Map<String, PmsMonitorInfoDTO> monitorMap = monitorClient.getMonitorInfo(pmsMonitorInfoParam).getData().stream().collect(Collectors.toMap(PmsMonitorInfoDTO::getMonitorId, monitor -> monitor));
//查询【基准水平-月】数据
/*组装条件where measurement_point_id in (monitorIdList) and data_date >= startTime
and data_date <= endTime and voltage_level
*/
LambdaQueryWrapper<RMpBenchmarkLevelM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(CollUtil.isNotEmpty(lastMonitorIdList), RMpBenchmarkLevelM::getMeasurementPointId, lastMonitorIdList)
.ge(StringUtils.isNotBlank(startTime), RMpBenchmarkLevelM::getDataDate, startTime)
.le(StringUtils.isNotBlank(endTime), RMpBenchmarkLevelM::getDataDate, endTime);
List<RMpBenchmarkLevelM> list = this.list(lambdaQueryWrapper);
List<RMpBenchmarkLevelVO> resultList = list.stream().map(item -> {
//封装前端需要的对象
RMpBenchmarkLevelVO rMpBenchmarkLevelVO = new RMpBenchmarkLevelVO();
BeanUtils.copyProperties(item, rMpBenchmarkLevelVO);
PmsGeneralDeviceDTO pmsGeneralDeviceDTO = pmsDeviceInfoWithInOrg.stream().filter(dto -> dto.getMonitorIdList().contains(item.getMeasurementPointId()))
.collect(Collectors.toList()).get(0);
//单位信息
rMpBenchmarkLevelVO.setOrgNo(pmsGeneralDeviceDTO.getIndex()); //单位id
rMpBenchmarkLevelVO.setOrgName(pmsGeneralDeviceDTO.getName()); //单位名称
//基准水平评价指标
rMpBenchmarkLevelVO.setBenchmarkIndicator(benchmarkIndicator); //基准水平评价指标id
rMpBenchmarkLevelVO.setBenchmarkIndicatorName(benchmarkIndicatorMap.get(benchmarkIndicator)); //基准水平评价指标
//监测点信息
rMpBenchmarkLevelVO.setMeasurementPointName(monitorMap.get(item.getMeasurementPointId()).getMonitorName()); //监测点名称
//电压等级
rMpBenchmarkLevelVO.setVoltageLevel(monitorMap.get(item.getMeasurementPointId()).getMonitorVoltageLevel());
rMpBenchmarkLevelVO.setVoltageLevelName(voltageLevelMap.get(monitorMap.get(item.getMeasurementPointId()).getMonitorVoltageLevel()));
return rMpBenchmarkLevelVO;
}).collect(Collectors.toList());
return resultList;
}
}

View File

@@ -0,0 +1,133 @@
package com.njcn.harmonic.service.majornetwork.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.harmonic.mapper.majornetwork.RMpBenchmarkLevelQMapper;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelQ;
import com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO;
import com.njcn.harmonic.service.majornetwork.RMpBenchmarkLevelQService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_q】的数据库操作Service实现
* @createDate 2022-10-11 10:32:18
*/
@Service
@RequiredArgsConstructor
public class RMpBenchmarkLevelQServiceImpl extends ServiceImpl<RMpBenchmarkLevelQMapper, RMpBenchmarkLevelQ>
implements RMpBenchmarkLevelQService {
private final DicDataFeignClient dicDataFeignClient;
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final MonitorClient monitorClient;
private final PwMonitorClient pwMonitorClient;
@Override
public List<RMpBenchmarkLevelVO> getRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam) {
//提取查询条件
String id = rMpBenchmarkLevelParam.getId(); //单位id
if (StringUtils.isBlank(id)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "单位id不可为空");
}
String startTime = rMpBenchmarkLevelParam.getStartTime(); //开始时间
String endTime = rMpBenchmarkLevelParam.getEndTime(); //截止时间
String benchmarkIndicator = rMpBenchmarkLevelParam.getBenchmarkIndicator(); //评价指标
List <String> voltageLevelParamList = StringUtils.isNotBlank(rMpBenchmarkLevelParam.getVoltageLevel()) ? Arrays.asList(rMpBenchmarkLevelParam.getVoltageLevel().split(",")) : null; //电压等级
//获取电压等级的字典
List<DictData> voltageLevelList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
//将电压信息转成mapkeyid valuename
Map<String, String> voltageLevelMap = voltageLevelList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
//获取基准水平评价指标字典
List<DictData> benchmarkIndicatorList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.BENCHMARK_INDICATORS.getCode()).getData();
//将基准水平评价指标信息转成mapkeyid valuename
Map<String, String> benchmarkIndicatorMap = benchmarkIndicatorList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
//查询所有子单位下的所有监测点
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam(id);
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
if (CollUtil.isNotEmpty(voltageLevelParamList)) {
//查询条件电压等级筛选电压等级为voltageLevel的监测点
List<SimpleDTO> simpleDTOList = voltageLevelParamList.stream().map(item -> {
SimpleDTO simpleDTO = new SimpleDTO();
simpleDTO.setId(item);
return simpleDTO;
}).collect(Collectors.toList());
pmsDeviceInfoParam.setVoltageLevel(simpleDTOList);
}
//获取到该部门的所有子部门的监测点idList
List<PmsGeneralDeviceDTO> pmsDeviceInfoWithInOrg = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
//过滤出业务需要的监测点id集合
List<String> firstMonitorIdList = new ArrayList<>(); //只用于合并多个部门的监测点id
pmsDeviceInfoWithInOrg.forEach(item -> firstMonitorIdList.addAll(item.getMonitorIdList()));
List<String> lastMonitorIdList = firstMonitorIdList.stream().distinct().collect(Collectors.toList()); //最终的监测点id集合
//如果没有监测点id信息直接返回空集合
if (CollUtil.isEmpty(lastMonitorIdList)) {
return new ArrayList<>();
}
//查询对应的监测点完整信息 并转为key监测点id value监测点实体的map集合
// LambdaQueryWrapper<Monitor> monitorWrapper = new LambdaQueryWrapper<>();
// monitorWrapper.in(Monitor::getId, lastMonitorIdList);
PmsMonitorInfoParam pmsMonitorInfoParam = new PmsMonitorInfoParam();
pmsMonitorInfoParam.setMonitorIds(lastMonitorIdList);
Map<String, PmsMonitorInfoDTO> monitorMap = monitorClient.getMonitorInfo(pmsMonitorInfoParam).getData().stream().collect(Collectors.toMap(PmsMonitorInfoDTO::getMonitorId, monitor -> monitor));
//查询【基准水平-月】数据
/*组装条件where measurement_point_id in (monitorIdList) and data_date >= startTime
and data_date <= endTime and voltage_level
*/
LambdaQueryWrapper<RMpBenchmarkLevelQ> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(CollUtil.isNotEmpty(lastMonitorIdList), RMpBenchmarkLevelQ::getMeasurementPointId, lastMonitorIdList)
.ge(StringUtils.isNotBlank(startTime), RMpBenchmarkLevelQ::getDataDate, startTime)
.le(StringUtils.isNotBlank(endTime), RMpBenchmarkLevelQ::getDataDate, endTime);
List<RMpBenchmarkLevelQ> list = this.list(lambdaQueryWrapper);
List<RMpBenchmarkLevelVO> resultList = list.stream().map(item -> {
//封装前端需要的对象
RMpBenchmarkLevelVO rMpBenchmarkLevelVO = new RMpBenchmarkLevelVO();
BeanUtils.copyProperties(item, rMpBenchmarkLevelVO);
PmsGeneralDeviceDTO pmsGeneralDeviceDTO = pmsDeviceInfoWithInOrg.stream().filter(dto -> dto.getMonitorIdList().contains(item.getMeasurementPointId()))
.collect(Collectors.toList()).get(0);
//单位信息
rMpBenchmarkLevelVO.setOrgNo(pmsGeneralDeviceDTO.getIndex()); //单位id
rMpBenchmarkLevelVO.setOrgName(pmsGeneralDeviceDTO.getName()); //单位名称
//基准水平评价指标
rMpBenchmarkLevelVO.setBenchmarkIndicator(benchmarkIndicator); //基准水平评价指标id
rMpBenchmarkLevelVO.setBenchmarkIndicatorName(benchmarkIndicatorMap.get(benchmarkIndicator)); //基准水平评价指标
//监测点信息
rMpBenchmarkLevelVO.setMeasurementPointName(monitorMap.get(item.getMeasurementPointId()).getMonitorName()); //监测点名称
//电压等级
rMpBenchmarkLevelVO.setVoltageLevel(monitorMap.get(item.getMeasurementPointId()).getMonitorVoltageLevel());
rMpBenchmarkLevelVO.setVoltageLevelName(voltageLevelMap.get(monitorMap.get(item.getMeasurementPointId()).getMonitorVoltageLevel()));
return rMpBenchmarkLevelVO;
}).collect(Collectors.toList());
return resultList;
}
}

View File

@@ -0,0 +1,133 @@
package com.njcn.harmonic.service.majornetwork.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.harmonic.mapper.majornetwork.RMpBenchmarkLevelYMapper;
import com.njcn.harmonic.pojo.param.RMpBenchmarkLevelParam;
import com.njcn.harmonic.pojo.po.RMpBenchmarkLevelY;
import com.njcn.harmonic.pojo.vo.RMpBenchmarkLevelVO;
import com.njcn.harmonic.service.majornetwork.RMpBenchmarkLevelYService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author jianghf
* @description 针对表【r_mp_benchmark_level_y】的数据库操作Service实现
* @createDate 2022-10-11 10:32:18
*/
@Service
@RequiredArgsConstructor
public class RMpBenchmarkLevelYServiceImpl extends ServiceImpl<RMpBenchmarkLevelYMapper, RMpBenchmarkLevelY>
implements RMpBenchmarkLevelYService {
private final DicDataFeignClient dicDataFeignClient;
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final MonitorClient monitorClient;
private final PwMonitorClient pwMonitorClient;
@Override
public List<RMpBenchmarkLevelVO> getRMpBenchmarkLevelList(RMpBenchmarkLevelParam rMpBenchmarkLevelParam) {
//提取查询条件
String id = rMpBenchmarkLevelParam.getId(); //单位id
if (StringUtils.isBlank(id)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "单位id不可为空");
}
String startTime = rMpBenchmarkLevelParam.getStartTime(); //开始时间
String endTime = rMpBenchmarkLevelParam.getEndTime(); //截止时间
String benchmarkIndicator = rMpBenchmarkLevelParam.getBenchmarkIndicator(); //评价指标
List <String> voltageLevelParamList = StringUtils.isNotBlank(rMpBenchmarkLevelParam.getVoltageLevel()) ? Arrays.asList(rMpBenchmarkLevelParam.getVoltageLevel().split(",")) : null; //电压等级
//获取电压等级的字典
List<DictData> voltageLevelList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
//将电压信息转成mapkeyid valuename
Map<String, String> voltageLevelMap = voltageLevelList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
//获取基准水平评价指标字典
List<DictData> benchmarkIndicatorList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.BENCHMARK_INDICATORS.getCode()).getData();
//将基准水平评价指标信息转成mapkeyid valuename
Map<String, String> benchmarkIndicatorMap = benchmarkIndicatorList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
//查询所有子单位下的所有监测点
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam(id);
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
if (CollUtil.isNotEmpty(voltageLevelParamList)) {
//查询条件电压等级筛选电压等级为voltageLevel的监测点
List<SimpleDTO> simpleDTOList = voltageLevelParamList.stream().map(item -> {
SimpleDTO simpleDTO = new SimpleDTO();
simpleDTO.setId(item);
return simpleDTO;
}).collect(Collectors.toList());
pmsDeviceInfoParam.setVoltageLevel(simpleDTOList);
}
//获取到该部门的所有子部门的监测点idList
List<PmsGeneralDeviceDTO> pmsDeviceInfoWithInOrg = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
//过滤出业务需要的监测点id集合
List<String> firstMonitorIdList = new ArrayList<>(); //只用于合并多个部门的监测点id
pmsDeviceInfoWithInOrg.forEach(item -> firstMonitorIdList.addAll(item.getMonitorIdList()));
List<String> lastMonitorIdList = firstMonitorIdList.stream().distinct().collect(Collectors.toList()); //最终的监测点id集合
//如果没有监测点id信息直接返回空集合
if (CollUtil.isEmpty(lastMonitorIdList)) {
return new ArrayList<>();
}
//查询对应的监测点完整信息 并转为key监测点id value监测点实体的map集合
// LambdaQueryWrapper<Monitor> monitorWrapper = new LambdaQueryWrapper<>();
// monitorWrapper.in(Monitor::getId, lastMonitorIdList); e
PmsMonitorInfoParam pmsMonitorInfoParam = new PmsMonitorInfoParam();
pmsMonitorInfoParam.setMonitorIds(lastMonitorIdList);
Map<String, PmsMonitorInfoDTO> monitorMap = monitorClient.getMonitorInfo(pmsMonitorInfoParam).getData().stream().collect(Collectors.toMap(PmsMonitorInfoDTO::getMonitorId, monitor -> monitor));
//查询【基准水平-月】数据
/*组装条件where measurement_point_id in (monitorIdList) and data_date >= startTime
and data_date <= endTime and voltage_level
*/
LambdaQueryWrapper<RMpBenchmarkLevelY> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(CollUtil.isNotEmpty(lastMonitorIdList), RMpBenchmarkLevelY::getMeasurementPointId, lastMonitorIdList)
.ge(StringUtils.isNotBlank(startTime), RMpBenchmarkLevelY::getDataDate, startTime)
.le(StringUtils.isNotBlank(endTime), RMpBenchmarkLevelY::getDataDate, endTime);
List<RMpBenchmarkLevelY> list = this.list(lambdaQueryWrapper);
List<RMpBenchmarkLevelVO> resultList = list.stream().map(item -> {
//封装前端需要的对象
RMpBenchmarkLevelVO rMpBenchmarkLevelVO = new RMpBenchmarkLevelVO();
BeanUtils.copyProperties(item, rMpBenchmarkLevelVO);
PmsGeneralDeviceDTO pmsGeneralDeviceDTO = pmsDeviceInfoWithInOrg.stream().filter(dto -> dto.getMonitorIdList().contains(item.getMeasurementPointId()))
.collect(Collectors.toList()).get(0);
//单位信息
rMpBenchmarkLevelVO.setOrgNo(pmsGeneralDeviceDTO.getIndex()); //单位id
rMpBenchmarkLevelVO.setOrgName(pmsGeneralDeviceDTO.getName()); //单位名称
//基准水平评价指标
rMpBenchmarkLevelVO.setBenchmarkIndicator(benchmarkIndicator); //基准水平评价指标id
rMpBenchmarkLevelVO.setBenchmarkIndicatorName(benchmarkIndicatorMap.get(benchmarkIndicator)); //基准水平评价指标
//监测点信息
rMpBenchmarkLevelVO.setMeasurementPointName(monitorMap.get(item.getMeasurementPointId()).getMonitorName()); //监测点名称
//电压等级
rMpBenchmarkLevelVO.setVoltageLevel(monitorMap.get(item.getMeasurementPointId()).getMonitorVoltageLevel());
rMpBenchmarkLevelVO.setVoltageLevelName(voltageLevelMap.get(monitorMap.get(item.getMeasurementPointId()).getMonitorVoltageLevel()));
return rMpBenchmarkLevelVO;
}).collect(Collectors.toList());
return resultList;
}
}