1.pms公共连接点功能
This commit is contained in:
@@ -27,4 +27,7 @@ public interface UploadGwDataFeignClient {
|
||||
@PostMapping("/uploadEvaluationData")
|
||||
HttpResult<String> uploadEvaluationData(@RequestBody UploadParam param);
|
||||
|
||||
@PostMapping("/upGwCommPoint")
|
||||
HttpResult<String> upGwCommPoint(@RequestBody UploadParam param);
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,12 @@ public class UploadGwDataFallbackFactory implements FallbackFactory<UploadGwData
|
||||
log.error("{}异常,降级处理,异常为:{}", "国网上送-母线基准水平评估数据", throwable.toString());
|
||||
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> upGwCommPoint(UploadParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "国网上送-公共连接点数据", throwable.toString());
|
||||
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -16,8 +18,7 @@ import lombok.Setter;
|
||||
* @author xy
|
||||
* @since 2024-08-15
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
@TableName("r_upload_comm_point_bus")
|
||||
public class RUploadCommPointBus implements Serializable {
|
||||
|
||||
@@ -162,5 +163,246 @@ public class RUploadCommPointBus implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String cnMonitorId;
|
||||
|
||||
private Integer uploadStatus;
|
||||
|
||||
|
||||
public Integer getUploadStatus() {
|
||||
return uploadStatus;
|
||||
}
|
||||
|
||||
public void setUploadStatus(Integer uploadStatus) {
|
||||
this.uploadStatus = uploadStatus;
|
||||
}
|
||||
|
||||
public String getObjId() {
|
||||
return objId;
|
||||
}
|
||||
|
||||
public void setObjId(String objId) {
|
||||
this.objId = objId;
|
||||
}
|
||||
|
||||
public String getStatisticalType() {
|
||||
return statisticalType;
|
||||
}
|
||||
|
||||
public void setStatisticalType(String statisticalType) {
|
||||
this.statisticalType = statisticalType;
|
||||
}
|
||||
|
||||
public String getStatisticalDate() {
|
||||
return statisticalDate;
|
||||
}
|
||||
|
||||
public void setStatisticalDate(String statisticalDate) {
|
||||
this.statisticalDate = statisticalDate;
|
||||
}
|
||||
|
||||
public String getBusId() {
|
||||
return busId;
|
||||
}
|
||||
|
||||
public void setBusId(String busId) {
|
||||
this.busId = busId;
|
||||
}
|
||||
|
||||
public String getBusName() {
|
||||
return busName;
|
||||
}
|
||||
|
||||
public void setBusName(String busName) {
|
||||
this.busName = busName;
|
||||
}
|
||||
|
||||
public String getProvinceOrg() {
|
||||
return provinceOrg;
|
||||
}
|
||||
|
||||
public void setProvinceOrg(String provinceOrg) {
|
||||
this.provinceOrg = provinceOrg;
|
||||
}
|
||||
|
||||
public String getProvinceOrgName() {
|
||||
return provinceOrgName;
|
||||
}
|
||||
|
||||
public void setProvinceOrgName(String provinceOrgName) {
|
||||
this.provinceOrgName = provinceOrgName;
|
||||
}
|
||||
|
||||
public String getCityOrg() {
|
||||
return cityOrg;
|
||||
}
|
||||
|
||||
public void setCityOrg(String cityOrg) {
|
||||
this.cityOrg = cityOrg;
|
||||
}
|
||||
|
||||
public String getCityOrgName() {
|
||||
return cityOrgName;
|
||||
}
|
||||
|
||||
public void setCityOrgName(String cityOrgName) {
|
||||
this.cityOrgName = cityOrgName;
|
||||
}
|
||||
|
||||
public String getMaintOrg() {
|
||||
return maintOrg;
|
||||
}
|
||||
|
||||
public void setMaintOrg(String maintOrg) {
|
||||
this.maintOrg = maintOrg;
|
||||
}
|
||||
|
||||
public String getMaintOrgName() {
|
||||
return maintOrgName;
|
||||
}
|
||||
|
||||
public void setMaintOrgName(String maintOrgName) {
|
||||
this.maintOrgName = maintOrgName;
|
||||
}
|
||||
|
||||
public String getStationType() {
|
||||
return stationType;
|
||||
}
|
||||
|
||||
public void setStationType(String stationType) {
|
||||
this.stationType = stationType;
|
||||
}
|
||||
|
||||
public String getStationId() {
|
||||
return stationId;
|
||||
}
|
||||
|
||||
public void setStationId(String stationId) {
|
||||
this.stationId = stationId;
|
||||
}
|
||||
|
||||
public String getStationName() {
|
||||
return stationName;
|
||||
}
|
||||
|
||||
public void setStationName(String stationName) {
|
||||
this.stationName = stationName;
|
||||
}
|
||||
|
||||
public String getStationVoltageLevel() {
|
||||
return stationVoltageLevel;
|
||||
}
|
||||
|
||||
public void setStationVoltageLevel(String stationVoltageLevel) {
|
||||
this.stationVoltageLevel = stationVoltageLevel;
|
||||
}
|
||||
|
||||
public String getBusVoltageLevel() {
|
||||
return busVoltageLevel;
|
||||
}
|
||||
|
||||
public void setBusVoltageLevel(String busVoltageLevel) {
|
||||
this.busVoltageLevel = busVoltageLevel;
|
||||
}
|
||||
|
||||
public Integer getOvDays() {
|
||||
return ovDays;
|
||||
}
|
||||
|
||||
public void setOvDays(Integer ovDays) {
|
||||
this.ovDays = ovDays;
|
||||
}
|
||||
|
||||
public Double getAvgVrms() {
|
||||
return avgVrms;
|
||||
}
|
||||
|
||||
public void setAvgVrms(Double avgVrms) {
|
||||
this.avgVrms = avgVrms;
|
||||
}
|
||||
|
||||
public Double getgVrms() {
|
||||
return gVrms;
|
||||
}
|
||||
|
||||
public void setgVrms(Double gVrms) {
|
||||
this.gVrms = gVrms;
|
||||
}
|
||||
|
||||
public Integer getHarmVOvDays() {
|
||||
return harmVOvDays;
|
||||
}
|
||||
|
||||
public void setHarmVOvDays(Integer harmVOvDays) {
|
||||
this.harmVOvDays = harmVOvDays;
|
||||
}
|
||||
|
||||
public Integer getHarmVOvDuration() {
|
||||
return harmVOvDuration;
|
||||
}
|
||||
|
||||
public void setHarmVOvDuration(Integer harmVOvDuration) {
|
||||
this.harmVOvDuration = harmVOvDuration;
|
||||
}
|
||||
|
||||
public Integer getVunbanOvDays() {
|
||||
return vunbanOvDays;
|
||||
}
|
||||
|
||||
public void setVunbanOvDays(Integer vunbanOvDays) {
|
||||
this.vunbanOvDays = vunbanOvDays;
|
||||
}
|
||||
|
||||
public Integer getVunbanOvDuration() {
|
||||
return vunbanOvDuration;
|
||||
}
|
||||
|
||||
public void setVunbanOvDuration(Integer vunbanOvDuration) {
|
||||
this.vunbanOvDuration = vunbanOvDuration;
|
||||
}
|
||||
|
||||
public Integer getPltOvDays() {
|
||||
return pltOvDays;
|
||||
}
|
||||
|
||||
public void setPltOvDays(Integer pltOvDays) {
|
||||
this.pltOvDays = pltOvDays;
|
||||
}
|
||||
|
||||
public Integer getPltOvDuration() {
|
||||
return pltOvDuration;
|
||||
}
|
||||
|
||||
public void setPltOvDuration(Integer pltOvDuration) {
|
||||
this.pltOvDuration = pltOvDuration;
|
||||
}
|
||||
|
||||
public String getMonitorId() {
|
||||
return monitorId;
|
||||
}
|
||||
|
||||
public void setMonitorId(String monitorId) {
|
||||
this.monitorId = monitorId;
|
||||
}
|
||||
|
||||
public String getMonitorIds() {
|
||||
return monitorIds;
|
||||
}
|
||||
|
||||
public void setMonitorIds(String monitorIds) {
|
||||
this.monitorIds = monitorIds;
|
||||
}
|
||||
|
||||
public String getDataSource() {
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
public void setDataSource(String dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
public String getCnMonitorId() {
|
||||
return cnMonitorId;
|
||||
}
|
||||
|
||||
public void setCnMonitorId(String cnMonitorId) {
|
||||
this.cnMonitorId = cnMonitorId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
package com.njcn.harmonic.controller.upload;
|
||||
|
||||
|
||||
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.common.utils.LogUtil;
|
||||
import com.njcn.harmonic.pojo.param.UploadDataParam;
|
||||
import com.njcn.harmonic.pojo.po.upload.RUploadCommPointBus;
|
||||
import com.njcn.harmonic.pojo.vo.upload.UploadPointStatisticalDataVo;
|
||||
import com.njcn.harmonic.service.upload.IRUploadCommPointBusService;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -15,8 +32,33 @@ import com.njcn.web.controller.BaseController;
|
||||
* @since 2024-08-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/upload/rUploadCommPointBus")
|
||||
@RequestMapping("/upload")
|
||||
@RequiredArgsConstructor
|
||||
public class RUploadCommPointBusController extends BaseController {
|
||||
|
||||
private final IRUploadCommPointBusService irUploadCommPointBusService;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getCommPointBusPage")
|
||||
@ApiOperation("分页查询公共连接点")
|
||||
@ApiImplicitParam(name = "param", value = "实体参数", required = true)
|
||||
public HttpResult<Page<RUploadCommPointBus>> getCommPointBusPage(@RequestBody @Validated UploadDataParam param) {
|
||||
String methodDescribe = getMethodDescribe("getCommPointBusPage");
|
||||
Page<RUploadCommPointBus> page = irUploadCommPointBusService.getCommPointBusPage(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/upGwCommPoint")
|
||||
@ApiOperation("上送国网")
|
||||
@ApiImplicitParam(name = "param", value = "实体参数", required = true)
|
||||
public HttpResult<Boolean> upGwCommPoint(@RequestBody UploadDataParam param) {
|
||||
String methodDescribe = getMethodDescribe("upGwCommPoint");
|
||||
irUploadCommPointBusService.upGw(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
package com.njcn.harmonic.service.upload;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.harmonic.pojo.param.UploadDataParam;
|
||||
import com.njcn.harmonic.pojo.po.upload.RUploadCommPointBus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公共连接点母线电能质量统计 服务类
|
||||
* </p>
|
||||
*/
|
||||
@Service
|
||||
public interface IRUploadCommPointBusService extends IService<RUploadCommPointBus> {
|
||||
|
||||
Page<RUploadCommPointBus> getCommPointBusPage(UploadDataParam param);
|
||||
|
||||
Boolean upGw(UploadDataParam param);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,33 @@
|
||||
package com.njcn.harmonic.service.upload.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.harmonic.mapper.upload.RUploadCommPointBusMapper;
|
||||
import com.njcn.harmonic.pojo.param.UploadDataParam;
|
||||
import com.njcn.harmonic.pojo.po.upload.RUploadCommPointBus;
|
||||
import com.njcn.harmonic.service.upload.IRUploadCommPointBusService;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.web.enums.GWSendEnum;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.pojo.param.SendParam;
|
||||
import com.njcn.web.utils.GwSendUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公共连接点母线电能质量统计 服务实现类
|
||||
@@ -18,4 +39,80 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class RUploadCommPointBusServiceImpl extends ServiceImpl<RUploadCommPointBusMapper, RUploadCommPointBus> implements IRUploadCommPointBusService {
|
||||
|
||||
@Override
|
||||
public Page<RUploadCommPointBus> getCommPointBusPage(UploadDataParam param) {
|
||||
DateTime dateTime = DateUtil.parse(param.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
if(param.getDataType().equals("02")){
|
||||
param.setSearchBeginTime(DateUtil.format(dateTime,DatePattern.NORM_MONTH_PATTERN));
|
||||
}else if(param.getDataType().equals("01")){
|
||||
param.setSearchBeginTime(DateUtil.format(dateTime,DatePattern.NORM_YEAR_PATTERN));
|
||||
}
|
||||
LambdaQueryWrapper<RUploadCommPointBus> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(RUploadCommPointBus::getStatisticalType,param.getDataType())
|
||||
.eq(RUploadCommPointBus::getStatisticalDate,param.getSearchBeginTime());
|
||||
return this.page(new Page<>(PageFactory.getPageNum(param),PageFactory.getPageSize(param)),lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean upGw(UploadDataParam param) {
|
||||
if(StrUtil.isBlank(param.getSearchBeginTime())){
|
||||
throw new BusinessException("日期不可为空");
|
||||
}
|
||||
LambdaQueryWrapper<RUploadCommPointBus> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if(StrUtil.isBlank(param.getDataType())){
|
||||
//类型为空则上送日月年数据
|
||||
DateTime dateTime = DateUtil.parse(param.getSearchBeginTime(),DatePattern.NORM_DATE_PATTERN);
|
||||
String month = DateUtil.format(dateTime,DatePattern.NORM_MONTH_PATTERN);
|
||||
String year = DateUtil.format(dateTime,DatePattern.NORM_YEAR_PATTERN);
|
||||
lambdaQueryWrapper.in(RUploadCommPointBus::getStatisticalDate, Stream.of(param.getSearchBeginTime(),month,year).collect(Collectors.toList()));
|
||||
}else {
|
||||
lambdaQueryWrapper.eq(RUploadCommPointBus::getStatisticalType,param.getDataType())
|
||||
.eq(RUploadCommPointBus::getStatisticalDate,param.getSearchBeginTime());
|
||||
}
|
||||
List<RUploadCommPointBus> rUploadCommPointBusList = this.list(lambdaQueryWrapper);
|
||||
if(CollUtil.isEmpty(rUploadCommPointBusList)){
|
||||
throw new BusinessException("查询数据为空");
|
||||
}
|
||||
List<List<RUploadCommPointBus>> list = CollUtil.split(rUploadCommPointBusList,100);
|
||||
|
||||
for(int i=0;i<list.size();i++){
|
||||
SendParam sendParam = new SendParam();
|
||||
|
||||
if(i==0){
|
||||
sendParam.setIsAppend("0");
|
||||
}else if(i==list.size()-1){
|
||||
sendParam.setIsAppend("2");
|
||||
}else {
|
||||
sendParam.setIsAppend("1");
|
||||
}
|
||||
|
||||
if(StrUtil.isNotBlank(param.getDataType())){
|
||||
DateTime dateTime = DateUtil.parse(param.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
sendParam.setStatisticalType(param.getDataType());
|
||||
|
||||
if(param.getDataType().equals(DicDataEnum.STATISTICAL_TYPE_M.getCode())){
|
||||
param.setSearchBeginTime(DateUtil.format(dateTime,DatePattern.NORM_MONTH_PATTERN));
|
||||
}else if(param.getDataType().equals(DicDataEnum.STATISTICAL_TYPE_Y.getCode())){
|
||||
param.setSearchBeginTime(DateUtil.format(dateTime,DatePattern.NORM_YEAR_PATTERN));
|
||||
}
|
||||
sendParam.setStatisticalDate(param.getSearchBeginTime());
|
||||
}
|
||||
sendParam.setStats(list);
|
||||
Map<String, String> sendRes = GwSendUtil.send(sendParam, GWSendEnum.COMM_POINT);
|
||||
List<String> ids = list.get(i).stream().map(RUploadCommPointBus::getObjId).collect(Collectors.toList());
|
||||
int count = GwSendUtil.returnInfoMsg(ids,sendRes);
|
||||
System.out.println("上送成功,上送成功返回"+count+"条");
|
||||
if(count == list.get(i).size()){
|
||||
LambdaUpdateWrapper<RUploadCommPointBus> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(RUploadCommPointBus::getUploadStatus,1).in(RUploadCommPointBus::getObjId,ids);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user