Compare commits
19 Commits
4319f97a5c
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d3be4fbc5 | |||
| 08a2258b07 | |||
| bdae9986f2 | |||
| 911c5efec9 | |||
| a7f21789f7 | |||
| b6acb9bcf4 | |||
| 1cf6ac1670 | |||
| 3bad829b94 | |||
| 2d1371033c | |||
| 658b84faeb | |||
| 36bc9ef2f1 | |||
| a967f5aa44 | |||
| 88f964943a | |||
| 855967d083 | |||
| 066ed82476 | |||
| 530f4396f7 | |||
| 584ad2e6e4 | |||
| 8e3aac4cea | |||
| f98a57c510 |
@ -71,6 +71,8 @@ public interface DeviceTypeConstant {
|
|||||||
//英博DC/DCMPPT
|
//英博DC/DCMPPT
|
||||||
String DCDC = "dcdc";
|
String DCDC = "dcdc";
|
||||||
|
|
||||||
|
String MPPT ="mppt";
|
||||||
|
|
||||||
//柴油发电机_济宁微山湖
|
//柴油发电机_济宁微山湖
|
||||||
String CF = "cf";
|
String CF = "cf";
|
||||||
|
|
||||||
@ -371,6 +373,8 @@ public interface DeviceTypeConstant {
|
|||||||
String BMS_MIN_VOL = "bmsMinVol";
|
String BMS_MIN_VOL = "bmsMinVol";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mppt 日发起始
|
||||||
|
String PV_DAILY_CHARGE_START = "pvDailyReleaseStart";
|
||||||
//日充起始
|
//日充起始
|
||||||
String DAILY_CHARGE_START = "dailyChargeStart";
|
String DAILY_CHARGE_START = "dailyChargeStart";
|
||||||
//日放起始
|
//日放起始
|
||||||
|
|||||||
@ -0,0 +1,101 @@
|
|||||||
|
package com.ho.business.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EarningsCalculateMppt implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组id(与src_id)
|
||||||
|
*/
|
||||||
|
private Integer groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属id
|
||||||
|
*/
|
||||||
|
private Integer pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电站id
|
||||||
|
*/
|
||||||
|
private Integer stationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* device表中的id字段相连
|
||||||
|
*/
|
||||||
|
private Integer srcId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
private Integer deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
|
*/
|
||||||
|
private String day;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据类型: 0:充 1:放
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收益
|
||||||
|
*/
|
||||||
|
private BigDecimal digital;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电量
|
||||||
|
*/
|
||||||
|
private BigDecimal elec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费率类型:elec_template_sub表type
|
||||||
|
*/
|
||||||
|
private String rateType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总充,总放 根据type判断
|
||||||
|
*/
|
||||||
|
private BigDecimal total;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收益
|
||||||
|
*/
|
||||||
|
private BigDecimal discharge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电量
|
||||||
|
*/
|
||||||
|
private BigDecimal disElec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费率类型:elec_template_sub表type
|
||||||
|
*/
|
||||||
|
private String disRateType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 折扣
|
||||||
|
*/
|
||||||
|
private BigDecimal discount;
|
||||||
|
}
|
||||||
@ -52,6 +52,9 @@ public class Station implements Serializable {
|
|||||||
@ApiModelProperty(value = "额定功率")
|
@ApiModelProperty(value = "额定功率")
|
||||||
private BigDecimal ratePower;
|
private BigDecimal ratePower;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "额定功率(光伏mppt)")
|
||||||
|
private BigDecimal pvPower;
|
||||||
|
|
||||||
@ApiModelProperty(value = "sn编号列表")
|
@ApiModelProperty(value = "sn编号列表")
|
||||||
private List<String> snList;
|
private List<String> snList;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.ho.business.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ho.common.tools.constant.CommonConstant;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StationRemoteControl implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "电站id")
|
||||||
|
private Integer stationId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "电站名称")
|
||||||
|
private String stationName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "远程访问ip、也可以是域名")
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "端口")
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "账号")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内网ip")
|
||||||
|
private String intranetIp;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ems页面类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = CommonConstant.DATE)
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = CommonConstant.DATE)
|
||||||
|
@ApiModelProperty(value = "修改时间")
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
@ -124,6 +124,11 @@ public class StationPutReqVO {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "是否接入光伏:0代表不接,1代表接入")
|
@ApiModelProperty(value = "是否接入光伏:0代表不接,1代表接入")
|
||||||
private Integer inverterFlag;
|
private Integer inverterFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "额定功率(mppt)")
|
||||||
|
@Range(max = 999999999, message = "额定功率过大")
|
||||||
|
BigDecimal pvPower;
|
||||||
|
|
||||||
//图片地址
|
//图片地址
|
||||||
@ApiModelProperty(value = "图片地址")
|
@ApiModelProperty(value = "图片地址")
|
||||||
Integer logoPictureId;
|
Integer logoPictureId;
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.ho.business.vo.req;
|
||||||
|
|
||||||
|
import com.ho.business.entity.StationRemoteControl;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StationRemoteControlPageVo extends StationRemoteControl {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "第几页")
|
||||||
|
private Integer pageNum=1;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分页数量")
|
||||||
|
private Integer pageSize=10;
|
||||||
|
|
||||||
|
}
|
||||||
@ -102,6 +102,10 @@ public class StationReqVO {
|
|||||||
@ApiModelProperty(value = "是否接入光伏(0默认不接入 1接入)")
|
@ApiModelProperty(value = "是否接入光伏(0默认不接入 1接入)")
|
||||||
private Integer inverterFlag;
|
private Integer inverterFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "额定功率(mppt)")
|
||||||
|
@Range(max = 999999999, message = "额定功率过大")
|
||||||
|
BigDecimal pvPower;
|
||||||
|
|
||||||
@ApiModelProperty(value = "卡号")
|
@ApiModelProperty(value = "卡号")
|
||||||
private String iccId;
|
private String iccId;
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,7 @@ public class EarningsCalculateReq {
|
|||||||
@ApiModelProperty(value = "结束时间",hidden = true)
|
@ApiModelProperty(value = "结束时间",hidden = true)
|
||||||
String endTime;
|
String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "多语言切换-查询字段")
|
||||||
|
private String lang;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,4 +31,7 @@ public class PcsStationReq extends StationReq {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "分段类型",hidden = true)
|
@ApiModelProperty(value = "分段类型",hidden = true)
|
||||||
String stationName;
|
String stationName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "多语言切换-查询字段")
|
||||||
|
private String lang;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.ho.business.vo.resp;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主监控汇总信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShipStationRespVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "储能系统累计收益,单位(元)")
|
||||||
|
private Float incomeSum;
|
||||||
|
@ApiModelProperty(value = "储能系统昨⽇收益")
|
||||||
|
private Float incomeYesterday;
|
||||||
|
@ApiModelProperty(value = "储能系统累计充电量,单位(kWh)")
|
||||||
|
private Float positivePowerSum;
|
||||||
|
@ApiModelProperty(value = "储能系统累计放电量,单位(kWh)")
|
||||||
|
private Float reversePowerSum;
|
||||||
|
@ApiModelProperty(value = "储能系统今⽇充电量,单位(kWh)")
|
||||||
|
private Float positivePowerToday;
|
||||||
|
@ApiModelProperty(value = "储能系统今⽇放电量,单位(kWh)")
|
||||||
|
private Float reversePowerToday;
|
||||||
|
@ApiModelProperty(value = "储能系统实时功率,单位(kw)")
|
||||||
|
private Float realTimePower;
|
||||||
|
@ApiModelProperty(value = "关⼝表电压,单位(v)")
|
||||||
|
private Float voltage;
|
||||||
|
@ApiModelProperty(value = "储能系统剩余电量,单位(kwh)")
|
||||||
|
private Float surplus;
|
||||||
|
@ApiModelProperty(value = "储能系统剩余SOC")
|
||||||
|
private Float soc;
|
||||||
|
@ApiModelProperty(value = "储能系统装机容量,单位(kWh)")
|
||||||
|
private Integer capacity;
|
||||||
|
@ApiModelProperty(value = "储能系统投运时⻓,单位(天)")
|
||||||
|
private Integer operationTime;
|
||||||
|
@ApiModelProperty(value = "储能系统能量链数量,单位(条)")
|
||||||
|
private Integer eLinkNumber;
|
||||||
|
@ApiModelProperty(value = "储能系统在线能量链数量,单位(条)")
|
||||||
|
private Integer eLinkOnline;
|
||||||
|
@ApiModelProperty(value = "储能系统能量块数量,单位(个)")
|
||||||
|
private Integer eBLockNumber;
|
||||||
|
@ApiModelProperty(value = "储能系统在线能量块数量,单位(个)")
|
||||||
|
private Integer eBlockOnline;
|
||||||
|
@ApiModelProperty(value = "储能系统今⽇功率和soc曲线")
|
||||||
|
private JSONArray historyDataList;
|
||||||
|
}
|
||||||
@ -88,4 +88,16 @@ public class EarningsCalculateResp {
|
|||||||
*/
|
*/
|
||||||
private Integer finish;
|
private Integer finish;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "月发电量(mppt)")
|
||||||
|
BigDecimal monthReleaseElec;
|
||||||
|
@ApiModelProperty(value = "月收益(mppt)")
|
||||||
|
BigDecimal monthIncone;
|
||||||
|
@ApiModelProperty(value = "累计发电量(mppt)")
|
||||||
|
BigDecimal totalReleaseElec;
|
||||||
|
@ApiModelProperty(value = "累计收益(mppt)")
|
||||||
|
BigDecimal totalIncome;
|
||||||
|
@ApiModelProperty(value = "额定功率(mppt)")
|
||||||
|
BigDecimal pvPower;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,4 +36,6 @@ public class AnnualChartValue {
|
|||||||
@ApiModelProperty(value = "容量")
|
@ApiModelProperty(value = "容量")
|
||||||
BigDecimal stationCapacity;
|
BigDecimal stationCapacity;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "mppt发电量")
|
||||||
|
BigDecimal release;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,8 @@ public class AnnualOverviewResp {
|
|||||||
@ApiModelProperty(value = "年总充")
|
@ApiModelProperty(value = "年总充")
|
||||||
BigDecimal yearCharge;
|
BigDecimal yearCharge;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "今日收益")
|
||||||
|
BigDecimal todayProfit;
|
||||||
|
|
||||||
@ApiModelProperty(value = "昨日收益")
|
@ApiModelProperty(value = "昨日收益")
|
||||||
BigDecimal yestProfit;
|
BigDecimal yestProfit;
|
||||||
|
|||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.ho.business.vo.resp.iargeScreen;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AnnualPvOverviewResp {
|
||||||
|
|
||||||
|
//装机容量
|
||||||
|
@ApiModelProperty(value = "装机容量")
|
||||||
|
BigDecimal capacity;
|
||||||
|
|
||||||
|
//电站总数
|
||||||
|
@ApiModelProperty(value = "电站总数")
|
||||||
|
Integer stationNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "日发电量(mppt)")
|
||||||
|
BigDecimal dailyReleaseElec;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "年发电量(mppt)")
|
||||||
|
BigDecimal yearReleaseElec;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "累计发电量(mppt)")
|
||||||
|
BigDecimal totalReleaseElec;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "日收益(mppt)")
|
||||||
|
BigDecimal todayIncone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "年收益(mppt)")
|
||||||
|
BigDecimal yearIncone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "累计收益(mppt)")
|
||||||
|
BigDecimal totalIncome;
|
||||||
|
}
|
||||||
@ -52,4 +52,7 @@ public class Subdata {
|
|||||||
//年总充()
|
//年总充()
|
||||||
@ApiModelProperty(value = "总充")
|
@ApiModelProperty(value = "总充")
|
||||||
BigDecimal charge;
|
BigDecimal charge;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "mppt总发电量")
|
||||||
|
BigDecimal release;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.ho.business.vo.resp.mppt;
|
||||||
|
|
||||||
|
import com.ho.business.vo.DeviceTransfer;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MpptActiveVo {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "mppt有功功率")
|
||||||
|
BigDecimal pvActivePower;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "mppt总发电量")
|
||||||
|
BigDecimal totalRelease;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "mppt日发电量")
|
||||||
|
BigDecimal dailyReleaseElec;
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.ho.business.vo.resp.mppt;
|
||||||
|
|
||||||
|
import com.ho.business.vo.DeviceTransfer;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MpptVo {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "mppt有功功率")
|
||||||
|
DeviceTransfer pvActivePower;
|
||||||
|
@ApiModelProperty(value = "mppt总发电量")
|
||||||
|
DeviceTransfer totalRelease;
|
||||||
|
@ApiModelProperty(value = "mppt 日发电量-起始")
|
||||||
|
DeviceTransfer pvDailyReleaseStart;
|
||||||
|
|
||||||
|
}
|
||||||
@ -43,4 +43,18 @@ public class PcsTotalData {
|
|||||||
@ApiModelProperty(value = "额定容量")
|
@ApiModelProperty(value = "额定容量")
|
||||||
BigDecimal rateCapacity;
|
BigDecimal rateCapacity;
|
||||||
|
|
||||||
|
//2025-11-13 储能加入mppt模块开发
|
||||||
|
@ApiModelProperty(value = "当前功率(mppt)")
|
||||||
|
BigDecimal pvCurrentPower;
|
||||||
|
@ApiModelProperty(value = "日发电量(mppt)")
|
||||||
|
BigDecimal dailyReleaseElec;
|
||||||
|
@ApiModelProperty(value = "日收益(mppt)")
|
||||||
|
BigDecimal todayIncone;
|
||||||
|
@ApiModelProperty(value = "总发电量(mppt)")
|
||||||
|
BigDecimal totalReleaseElec;
|
||||||
|
@ApiModelProperty(value = "总收益(mppt)")
|
||||||
|
BigDecimal totalIncome;
|
||||||
|
@ApiModelProperty(value = "额定功率(mppt)")
|
||||||
|
BigDecimal pvPower;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,6 +99,9 @@ public interface TdFeignClient {
|
|||||||
@PostMapping(value = ContextConstant.TD_CONTEXT + "device001/getToDayPVCharge")
|
@PostMapping(value = ContextConstant.TD_CONTEXT + "device001/getToDayPVCharge")
|
||||||
DataResult<StationHomeRespVo> getToDayPVCharge(TdBaseTimeQuery tdBaseTimeQuery);
|
DataResult<StationHomeRespVo> getToDayPVCharge(TdBaseTimeQuery tdBaseTimeQuery);
|
||||||
|
|
||||||
|
@PostMapping(value = ContextConstant.TD_CONTEXT + "device001/getToDayPVMpptCharge")
|
||||||
|
DataResult<StationHomeRespVo> getToDayPVMpptCharge(TdBaseTimeQuery tdBaseTimeQuery);
|
||||||
|
|
||||||
//查询遥信值五遥
|
//查询遥信值五遥
|
||||||
@PostMapping(value = ContextConstant.TD_CONTEXT + "device001/querySignal")
|
@PostMapping(value = ContextConstant.TD_CONTEXT + "device001/querySignal")
|
||||||
DataResult<List<PointCurveResp>> querySignal(@RequestBody TdBaseTimeQuery tdBaseTimeQuery);
|
DataResult<List<PointCurveResp>> querySignal(@RequestBody TdBaseTimeQuery tdBaseTimeQuery);
|
||||||
|
|||||||
@ -168,6 +168,12 @@ public class TdFeignClientFallback implements TdFeignClient{
|
|||||||
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataResult<StationHomeRespVo> getToDayPVMpptCharge(TdBaseTimeQuery tdBaseTimeQuery) {
|
||||||
|
log.error("调用 [TdClient.getToDayPVCharge] 异常!");
|
||||||
|
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataResult modifyHistoryData(TdBaseTimeQuery tdBaseTimeQuery) {
|
public DataResult modifyHistoryData(TdBaseTimeQuery tdBaseTimeQuery) {
|
||||||
log.error("调用 [TdClient.modifyHistoryData] 异常!");
|
log.error("调用 [TdClient.modifyHistoryData] 异常!");
|
||||||
|
|||||||
@ -17,18 +17,18 @@ import java.math.BigDecimal;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xwz
|
* @author xwz
|
||||||
* @description 针对表【earnings_calculate】的数据库操作Mapper
|
* @description 针对表【earnings_calculate】的数据库操作Mapper
|
||||||
* @createDate 2023-09-26
|
* @createDate 2023-09-26
|
||||||
* @Entity com.ho.business.entity.EarningsCalculate
|
* @Entity com.ho.business.entity.EarningsCalculate
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface EarningsCalculateMapper {
|
public interface EarningsCalculateMapper {
|
||||||
|
|
||||||
int insertSelective(EarningsCalculate record);
|
int insertSelective(EarningsCalculate record);
|
||||||
|
|
||||||
int deleteByDay(@Param("day") String day, @Param("typeList") List<Integer> typeList);
|
int deleteByDay(@Param("day") String day, @Param("typeList") List<Integer> typeList);
|
||||||
|
int deleteByStationAndDay(@Param("day") String day, @Param("typeList") List<Integer> typeList, @Param("stationId") Integer stationId);
|
||||||
int insertBatch(List<EarningsCalculate> list);
|
int insertBatch(List<EarningsCalculate> list);
|
||||||
// 类型是传入多个
|
// 类型是传入多个
|
||||||
//List<EarningsCalculate> selectList(@Param("stationId") Integer stationId, @Param("typeList") List<Integer> typeList, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
|
//List<EarningsCalculate> selectList(@Param("stationId") Integer stationId, @Param("typeList") List<Integer> typeList, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
|
||||||
@ -48,7 +48,7 @@ public interface EarningsCalculateMapper {
|
|||||||
*/
|
*/
|
||||||
List<EarningsCalculate> totalListByDay(@Param("ec") EarningsCalculateReq earningsCalculateReq);
|
List<EarningsCalculate> totalListByDay(@Param("ec") EarningsCalculateReq earningsCalculateReq);
|
||||||
|
|
||||||
public List<EarningsCalculateSub> queryElecTemplateSubByStationId(@Param("stationId")Integer stationId, @Param("templateType")Integer templateType,@Param("date")String date);
|
public List<EarningsCalculateSub> queryElecTemplateSubByStationId(@Param("stationId")Integer stationId, @Param("templateType")Integer templateType,@Param("date")String date,@Param("elecType")Integer elecType);
|
||||||
|
|
||||||
public List<EarningsCalculateSub> queryElecRateTemplateSubByStationId(@Param("stationId")Integer stationId, @Param("templateType")Integer templateType,@Param("date")String date);
|
public List<EarningsCalculateSub> queryElecRateTemplateSubByStationId(@Param("stationId")Integer stationId, @Param("templateType")Integer templateType,@Param("date")String date);
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.ho.business.mapper;
|
||||||
|
|
||||||
|
import com.ho.business.entity.EarningsCalculate;
|
||||||
|
import com.ho.business.entity.EarningsCalculateMppt;
|
||||||
|
import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
|
||||||
|
import com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO;
|
||||||
|
import com.ho.business.vo.resp.profit.DayProfitType;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface EarningsCalculateMpptMapper {
|
||||||
|
|
||||||
|
int deleteByDay(@Param("day") String day, @Param("typeList") List<Integer> typeList);
|
||||||
|
|
||||||
|
int insertBatch(List<EarningsCalculateMppt> list);
|
||||||
|
|
||||||
|
List<PowerGenerateRespVO> countPvIncome(@Param("stationId") Integer stationId, @Param("beginTime")String beginTime, @Param("endTime")String endTime);
|
||||||
|
|
||||||
|
BigDecimal countAllPvIncome(@Param("stationId")Integer stationId,@Param("beginTime")String beginTime, @Param("endTime")String endTime);
|
||||||
|
|
||||||
|
List<DayProfitType> getProfit(@Param("beginTime")String begin, @Param("endTime")String end, @Param("groupId")Integer groupId);
|
||||||
|
|
||||||
|
String getFirstTime();
|
||||||
|
|
||||||
|
List<DayProfitType> getEarningsByParam(CommonBigScreenReq req);
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ package com.ho.business.mapper;
|
|||||||
import com.ho.business.entity.ElecMeterValue;
|
import com.ho.business.entity.ElecMeterValue;
|
||||||
import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
|
import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
|
||||||
import com.ho.business.vo.req.carbin.ElecMeterReq;
|
import com.ho.business.vo.req.carbin.ElecMeterReq;
|
||||||
|
import com.ho.business.vo.resp.profit.DayProfitType;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -54,4 +55,7 @@ public interface ElecMeterValueMapper {
|
|||||||
|
|
||||||
List<ElecMeterValue> selectAllList(@Param("stationId") Integer stationId, @Param("typeList") List<Integer> typeList, @Param("beginTime") String beginTime, @Param("endTime") String endTime,
|
List<ElecMeterValue> selectAllList(@Param("stationId") Integer stationId, @Param("typeList") List<Integer> typeList, @Param("beginTime") String beginTime, @Param("endTime") String endTime,
|
||||||
@Param("deviceTypeList") List<Integer> deviceTypeList);
|
@Param("deviceTypeList") List<Integer> deviceTypeList);
|
||||||
|
|
||||||
|
List<DayProfitType> getElec(@Param("beginTime") String beginTime,@Param("endTime")String endTime,
|
||||||
|
@Param("groupId") Integer groupId, @Param("type")Integer type,List<Integer> stationIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.ho.business.mapper;
|
||||||
|
|
||||||
|
import com.ho.business.entity.StationRemoteControl;
|
||||||
|
import com.ho.business.vo.req.StationRemoteControlPageVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface StationRemoteControlMapper {
|
||||||
|
void insert(@Param("entity") StationRemoteControl entity);
|
||||||
|
|
||||||
|
void update(@Param("entity") StationRemoteControl entity);
|
||||||
|
|
||||||
|
void delete(@Param("id") Integer id);
|
||||||
|
|
||||||
|
StationRemoteControl search(@Param("stationId") Integer stationId);
|
||||||
|
|
||||||
|
List<StationRemoteControl> selectList(@Param("vo") StationRemoteControlPageVo vo);
|
||||||
|
}
|
||||||
@ -0,0 +1,354 @@
|
|||||||
|
package com.ho.business.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.ho.business.constant.DeviceTypeConstant;
|
||||||
|
import com.ho.business.entity.EarningsCalculate;
|
||||||
|
import com.ho.business.entity.ElecMeterValue;
|
||||||
|
import com.ho.business.mapper.EarningsCalculateMapper;
|
||||||
|
import com.ho.business.vo.req.carbin.EarningsCalculateReq;
|
||||||
|
import com.ho.business.vo.resp.ShipStationRespVO;
|
||||||
|
import com.ho.common.tools.constant.CommonConstant;
|
||||||
|
import com.ho.common.tools.service.RedisService;
|
||||||
|
import com.ho.common.tools.util.HttpUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成都巨石 能源 储能
|
||||||
|
* 成都巨石能源 API 接口 服务
|
||||||
|
*
|
||||||
|
* @author kerwin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class BoulderEnergyService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取token 参数 appAccount
|
||||||
|
*/
|
||||||
|
private static final String APP_ACCOUNT = "cdjs_app";
|
||||||
|
/**
|
||||||
|
* 获取token 参数 appSecretKey
|
||||||
|
*/
|
||||||
|
private static final String APP_SECRET_KEY = "cdjs@0108";
|
||||||
|
/**
|
||||||
|
* 中车- 获取电站id
|
||||||
|
*/
|
||||||
|
private static final Integer BOULDER_STATION_ID = 11006;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中车- 获取token Url
|
||||||
|
*/
|
||||||
|
private static final String TOKEN_URL = "http://111.15.176.77:18082/gate-newpc/zhny-openapi/openapi/v1/authentication/getAccessToken";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中车- 统计数据 Url
|
||||||
|
*/
|
||||||
|
private static final String BOULDER_DATA_URL = "http://111.15.176.77:18082/gate-newpc/zhny-openapi/openapi/v1/statistics/station/qryIncDayBill";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ElecMeterValueService elecMeterValueService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
EarningsCalculateMapper earningsCalculateMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中车能源 - 获取token
|
||||||
|
* @return token
|
||||||
|
*/
|
||||||
|
public String getToken(){
|
||||||
|
String token = null;
|
||||||
|
if(redisService.hasKey(CommonConstant.BOULDER_ENERGY_TOKEN_KEY)){
|
||||||
|
token = (String)redisService.get(CommonConstant.BOULDER_ENERGY_TOKEN_KEY);
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
Map<String, Object> params = Maps.newHashMap();
|
||||||
|
params.put("appAccount",APP_ACCOUNT);
|
||||||
|
params.put("appSecretKey",APP_SECRET_KEY);
|
||||||
|
try {
|
||||||
|
String json = HttpUtils.postWithJson(TOKEN_URL,params);
|
||||||
|
log.info("json:" + TOKEN_URL);
|
||||||
|
log.info("json:" + json);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||||
|
Integer code = jsonObject.getInteger("code");
|
||||||
|
if(CommonConstant.HttpCode.SUCCESS_CODE.equals(code)){
|
||||||
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
|
token = data.getString("accessToken");
|
||||||
|
//redis 缓存
|
||||||
|
redisService.set(CommonConstant.BOULDER_ENERGY_TOKEN_KEY,token,50, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中车能源 - 统计数据
|
||||||
|
* @param beginTime 开始时间
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getBoulderData(String beginTime){
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", getToken());
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("stationCode","SC020075040001");
|
||||||
|
params.put("time",beginTime);
|
||||||
|
String contentType = "application/json; charset=utf-8";
|
||||||
|
try {
|
||||||
|
String json = HttpUtils.postWithHeaders(BOULDER_DATA_URL,HttpUtils.mapToJson(params),contentType,headers);
|
||||||
|
log.info("MAIN_URL:" + BOULDER_DATA_URL);
|
||||||
|
log.info("json:" + json);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||||
|
Integer code = jsonObject.getInteger("code");
|
||||||
|
if(CommonConstant.HttpCode.SUCCESS_CODE.equals(code)){
|
||||||
|
String data = jsonObject.getString("data");
|
||||||
|
JSONObject dataJson = JSONObject.parseObject(data);
|
||||||
|
return dataJson.getString("records");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/*****************************************业务处理******************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中车 - 获取电站历史收益、充放电数据并存储
|
||||||
|
*/
|
||||||
|
public void getBoulderEleIncome(String beginTime){
|
||||||
|
DateTime yesterday = DateUtil.yesterday();
|
||||||
|
String yesterdayStr = DateUtil.formatDate(yesterday);
|
||||||
|
if(beginTime==null){
|
||||||
|
beginTime = yesterdayStr;
|
||||||
|
}
|
||||||
|
long timestamp = dateStringToTimestamp(beginTime);
|
||||||
|
String records = getBoulderData(String.valueOf(timestamp));
|
||||||
|
JSONArray data = JSON.parseArray(records);
|
||||||
|
String finalBeginTime = beginTime;
|
||||||
|
data.forEach(i->{
|
||||||
|
List<EarningsCalculate> list = new ArrayList<>();
|
||||||
|
List<ElecMeterValue> elecList = new ArrayList<>();
|
||||||
|
JSONObject obj = (JSONObject) i;
|
||||||
|
String date = timestampToDateString(obj.getLong("balanceDate"));
|
||||||
|
if(finalBeginTime.equals(date)){
|
||||||
|
//收益-充-尖
|
||||||
|
EarningsCalculate sharpCharge = new EarningsCalculate();
|
||||||
|
BigDecimal sharpChargeEle = obj.getBigDecimal("sharpChargeElectricity");
|
||||||
|
sharpCharge.setElec(sharpChargeEle);
|
||||||
|
sharpCharge.setType(0);
|
||||||
|
sharpCharge.setRateType(CommonConstant.RateType.TIP);
|
||||||
|
sharpCharge.setPrice(BigDecimal.ZERO);
|
||||||
|
sharpCharge.setDigital(BigDecimal.ZERO);
|
||||||
|
sharpCharge.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(sharpCharge);
|
||||||
|
//收益-充-峰
|
||||||
|
EarningsCalculate peakCharge = new EarningsCalculate();
|
||||||
|
BigDecimal peakChargeEle = obj.getBigDecimal("peakChargeElectricity");
|
||||||
|
peakCharge.setElec(peakChargeEle);
|
||||||
|
peakCharge.setType(0);
|
||||||
|
peakCharge.setRateType(CommonConstant.RateType.PEAK);
|
||||||
|
peakCharge.setPrice(BigDecimal.ZERO);
|
||||||
|
peakCharge.setDigital(BigDecimal.ZERO);
|
||||||
|
peakCharge.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(peakCharge);
|
||||||
|
//收益-充-平
|
||||||
|
EarningsCalculate flatCharge = new EarningsCalculate();
|
||||||
|
BigDecimal flatChargeEle = obj.getBigDecimal("flatChargeElectricity");
|
||||||
|
flatCharge.setElec(flatChargeEle);
|
||||||
|
flatCharge.setType(0);
|
||||||
|
flatCharge.setRateType(CommonConstant.RateType.FLAT);
|
||||||
|
flatCharge.setPrice(BigDecimal.ZERO);
|
||||||
|
flatCharge.setDigital(BigDecimal.ZERO);
|
||||||
|
flatCharge.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(flatCharge);
|
||||||
|
//收益-充-谷
|
||||||
|
EarningsCalculate valleyCharge = new EarningsCalculate();
|
||||||
|
BigDecimal valleyChargeEle = obj.getBigDecimal("valleyChargeElectricity");
|
||||||
|
valleyCharge.setElec(valleyChargeEle);
|
||||||
|
valleyCharge.setType(0);
|
||||||
|
valleyCharge.setRateType(CommonConstant.RateType.VALLEY);
|
||||||
|
valleyCharge.setPrice(BigDecimal.ZERO);
|
||||||
|
valleyCharge.setDigital(BigDecimal.ZERO);
|
||||||
|
valleyCharge.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(valleyCharge);
|
||||||
|
//收益-充-深谷
|
||||||
|
EarningsCalculate deepValleyCharge = new EarningsCalculate();
|
||||||
|
BigDecimal deepValleyChargeEle = obj.getBigDecimal("deepValleyChargeElectricity");
|
||||||
|
deepValleyCharge.setElec(deepValleyChargeEle);
|
||||||
|
deepValleyCharge.setType(0);
|
||||||
|
deepValleyCharge.setRateType(CommonConstant.RateType.DEEP_VALLEY);
|
||||||
|
deepValleyCharge.setPrice(BigDecimal.ZERO);
|
||||||
|
deepValleyCharge.setDigital(BigDecimal.ZERO);
|
||||||
|
deepValleyCharge.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(deepValleyCharge);
|
||||||
|
//收益-放-尖
|
||||||
|
EarningsCalculate sharpDischarge = new EarningsCalculate();
|
||||||
|
BigDecimal reverseSharp = obj.getBigDecimal("sharpDischargeElectricity");
|
||||||
|
sharpDischarge.setElec(reverseSharp);
|
||||||
|
sharpDischarge.setType(1);
|
||||||
|
sharpDischarge.setRateType(CommonConstant.RateType.TIP);
|
||||||
|
sharpDischarge.setPrice(BigDecimal.ZERO);
|
||||||
|
sharpDischarge.setDigital(BigDecimal.ZERO);
|
||||||
|
sharpDischarge.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(sharpDischarge);
|
||||||
|
//收益-放-峰
|
||||||
|
EarningsCalculate peakDischarge = new EarningsCalculate();
|
||||||
|
BigDecimal peakDischargeEle = obj.getBigDecimal("peakDischargeElectricity");
|
||||||
|
peakDischarge.setElec(peakDischargeEle);
|
||||||
|
peakDischarge.setType(1);
|
||||||
|
peakDischarge.setRateType(CommonConstant.RateType.PEAK);
|
||||||
|
peakDischarge.setPrice(BigDecimal.ZERO);
|
||||||
|
peakDischarge.setDigital(BigDecimal.ZERO);
|
||||||
|
peakDischarge.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(peakDischarge);
|
||||||
|
//收益-放-平
|
||||||
|
EarningsCalculate flatDischarge = new EarningsCalculate();
|
||||||
|
BigDecimal flatDischargeEle = obj.getBigDecimal("flatDischargeElectricity");
|
||||||
|
flatDischarge.setElec(flatDischargeEle);
|
||||||
|
flatDischarge.setType(1);
|
||||||
|
flatDischarge.setRateType(CommonConstant.RateType.FLAT);
|
||||||
|
flatDischarge.setPrice(BigDecimal.ZERO);
|
||||||
|
flatDischarge.setDigital(BigDecimal.ZERO);
|
||||||
|
flatDischarge.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(flatDischarge);
|
||||||
|
//收益-放-谷
|
||||||
|
EarningsCalculate valleyDischarge = new EarningsCalculate();
|
||||||
|
BigDecimal valleyDischargeEle = obj.getBigDecimal("valleyDischargeElectricity");
|
||||||
|
valleyDischarge.setElec(valleyDischargeEle);
|
||||||
|
valleyDischarge.setType(1);
|
||||||
|
valleyDischarge.setRateType(CommonConstant.RateType.VALLEY);
|
||||||
|
valleyDischarge.setPrice(BigDecimal.ZERO);
|
||||||
|
valleyDischarge.setDigital(BigDecimal.ZERO);
|
||||||
|
valleyDischarge.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(valleyDischarge);
|
||||||
|
//收益-放-深谷
|
||||||
|
EarningsCalculate deepValleyDischarge = new EarningsCalculate();
|
||||||
|
BigDecimal deepValleyDischargeEle = obj.getBigDecimal("deepValleyDischargeElectricity");
|
||||||
|
BigDecimal income = obj.getBigDecimal("income");
|
||||||
|
deepValleyDischarge.setElec(deepValleyDischargeEle);
|
||||||
|
deepValleyDischarge.setType(1);
|
||||||
|
deepValleyDischarge.setRateType(CommonConstant.RateType.DEEP_VALLEY);
|
||||||
|
deepValleyDischarge.setPrice(BigDecimal.ZERO);
|
||||||
|
deepValleyDischarge.setDigital(income);
|
||||||
|
deepValleyDischarge.setTotal(income);
|
||||||
|
list.add(deepValleyDischarge);
|
||||||
|
// 充电
|
||||||
|
ElecMeterValue charge = new ElecMeterValue();
|
||||||
|
BigDecimal chargeEle = obj.getBigDecimal("chargeElectricity");
|
||||||
|
charge.setDigital(chargeEle);
|
||||||
|
charge.setType(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.CHARGE);
|
||||||
|
charge.setStatus(CommonConstant.STATUS_FLAG);
|
||||||
|
elecList.add(charge);
|
||||||
|
// 放电
|
||||||
|
ElecMeterValue disCharge = new ElecMeterValue();
|
||||||
|
BigDecimal dischargeEle = obj.getBigDecimal("dischargeElectricity");
|
||||||
|
disCharge.setDigital(dischargeEle);
|
||||||
|
disCharge.setType(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.DISCHARGE);
|
||||||
|
disCharge.setStatus(CommonConstant.STATUS_FLAG);
|
||||||
|
elecList.add(disCharge);
|
||||||
|
|
||||||
|
if(elecList.size()>0){
|
||||||
|
//删除
|
||||||
|
elecMeterValueService.deleteByStationAndDay(BOULDER_STATION_ID,date,null);
|
||||||
|
elecList.forEach(eleMeter -> {
|
||||||
|
eleMeter.setGroupId(155);
|
||||||
|
eleMeter.setStationId(BOULDER_STATION_ID);
|
||||||
|
eleMeter.setCreateTime(new Date());
|
||||||
|
eleMeter.setDay(date);
|
||||||
|
//新增
|
||||||
|
elecMeterValueService.insert(eleMeter);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(list.size()>0){
|
||||||
|
//删除
|
||||||
|
earningsCalculateMapper.deleteByStationAndDay(date,null,BOULDER_STATION_ID);
|
||||||
|
list.forEach(a->{
|
||||||
|
a.setGroupId(155);
|
||||||
|
a.setStationId(BOULDER_STATION_ID);
|
||||||
|
a.setCreateTime(new Date());
|
||||||
|
a.setDay(date);
|
||||||
|
a.setDiscount(BigDecimal.ONE);
|
||||||
|
//新增
|
||||||
|
earningsCalculateMapper.insertSelective(a);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void getCacheBoulderData(){
|
||||||
|
ShipStationRespVO vo = new ShipStationRespVO();
|
||||||
|
//查询电站收益数据
|
||||||
|
EarningsCalculateReq ec = new EarningsCalculateReq();
|
||||||
|
//昨日
|
||||||
|
DateTime yesterday = DateUtil.yesterday();
|
||||||
|
String yesterdayStr = DateUtil.formatDate(yesterday);
|
||||||
|
//今日
|
||||||
|
DateTime nowDay = DateUtil.date();
|
||||||
|
String nowDayStr = DateUtil.formatDate(nowDay);
|
||||||
|
//查询电站所有收益数据-组装参数
|
||||||
|
ec.setStationId(BOULDER_STATION_ID);
|
||||||
|
ec.setBeginTime(earningsCalculateMapper.getFirstTime());
|
||||||
|
ec.setEndTime(nowDayStr);
|
||||||
|
List<EarningsCalculate> earnList = earningsCalculateMapper.selectList(ec);
|
||||||
|
// 累计充电、放电、收益
|
||||||
|
BigDecimal incomeSum = earnList.stream().map(EarningsCalculate::getDigital).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
BigDecimal positivePowerSum = earnList.stream().filter(i->i.getType().equals(CommonConstant.ZERO)).map(EarningsCalculate::getElec).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
BigDecimal reversePowerSum = earnList.stream().filter(i->i.getType().equals(CommonConstant.ONE)).map(EarningsCalculate::getElec).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
vo.setIncomeSum(incomeSum.floatValue());
|
||||||
|
vo.setPositivePowerSum(positivePowerSum.floatValue());
|
||||||
|
vo.setReversePowerSum(reversePowerSum.floatValue());
|
||||||
|
// 昨日收益
|
||||||
|
BigDecimal incomeYesterday = earnList.stream().filter(i->i.getDay().equals(yesterdayStr)).map(EarningsCalculate::getDigital).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
vo.setIncomeYesterday(incomeYesterday.floatValue());
|
||||||
|
// 今日充、放电
|
||||||
|
BigDecimal positivePowerToday = earnList.stream().filter(i->i.getDay().equals(nowDayStr)&&i.getType().equals(CommonConstant.ZERO)).map(EarningsCalculate::getElec).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
vo.setPositivePowerToday(positivePowerToday.floatValue());
|
||||||
|
BigDecimal reversePowerToday = earnList.stream().filter(i->i.getDay().equals(nowDayStr)&&i.getType().equals(CommonConstant.ONE)).map(EarningsCalculate::getElec).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
vo.setReversePowerToday(reversePowerToday.floatValue());
|
||||||
|
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + BOULDER_STATION_ID;
|
||||||
|
redisService.set(mainKey,JSONObject.toJSONString(vo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间日期 转换为时间戳
|
||||||
|
* @param dateStr yyyy-MM-dd
|
||||||
|
* @return long 时间戳
|
||||||
|
*/
|
||||||
|
public static long dateStringToTimestamp(String dateStr) {
|
||||||
|
LocalDate localDate = LocalDate.parse(dateStr, DateTimeFormatter.ISO_LOCAL_DATE);
|
||||||
|
return localDate.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 毫秒级时间戳 转换为日期 yyyy-MM-dd
|
||||||
|
* @param timestamp long 时间戳
|
||||||
|
* @return yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
public static String timestampToDateString(long timestamp) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CommonConstant.DATE_YMD);
|
||||||
|
return Instant.ofEpochMilli(timestamp)
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.format(formatter);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.ho.business.service;
|
||||||
|
|
||||||
|
import com.ho.business.entity.Station;
|
||||||
|
import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
|
||||||
|
import com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO;
|
||||||
|
import com.ho.business.vo.resp.profit.DayProfitType;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description Mppt 尖峰平谷电量收益计算
|
||||||
|
* @Author zjl
|
||||||
|
* @Date 2025/11/19
|
||||||
|
*/
|
||||||
|
public interface EarningsCalculateMpptService {
|
||||||
|
|
||||||
|
int deleteByDay(String transDayStr, List<Integer> typeList);
|
||||||
|
|
||||||
|
public void allMpptIncome(List<Station> stations, String beginTime);
|
||||||
|
|
||||||
|
void todayMpptIncome(List<Station> stations, String beginTime);
|
||||||
|
|
||||||
|
List<PowerGenerateRespVO> countPvIncome(Integer stationId, String beginTime, String endTime);
|
||||||
|
|
||||||
|
BigDecimal countAllPvIncome(Integer id,String beginTime, String endTime);
|
||||||
|
|
||||||
|
List<DayProfitType> getProfit(String begin, String end, Integer groupId);
|
||||||
|
|
||||||
|
Date getFirstTime();
|
||||||
|
|
||||||
|
List<DayProfitType> getEarningsByParam(CommonBigScreenReq req);
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@ import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
|
|||||||
import com.ho.business.vo.req.carbin.EarningsCalculateReq;
|
import com.ho.business.vo.req.carbin.EarningsCalculateReq;
|
||||||
import com.ho.business.vo.req.pcsStation.PcsStationReq;
|
import com.ho.business.vo.req.pcsStation.PcsStationReq;
|
||||||
import com.ho.business.vo.req.report.ReportReqVO;
|
import com.ho.business.vo.req.report.ReportReqVO;
|
||||||
|
import com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO;
|
||||||
import com.ho.business.vo.resp.cabin.EarningsCalculateCountResp;
|
import com.ho.business.vo.resp.cabin.EarningsCalculateCountResp;
|
||||||
import com.ho.business.vo.resp.cabin.EarningsCalculateResp;
|
import com.ho.business.vo.resp.cabin.EarningsCalculateResp;
|
||||||
import com.ho.business.vo.resp.income.RevenueOverview;
|
import com.ho.business.vo.resp.income.RevenueOverview;
|
||||||
@ -137,4 +138,5 @@ public interface EarningsCalculateService {
|
|||||||
|
|
||||||
List<DayProfitType> getEarningsByParam(CommonBigScreenReq req);
|
List<DayProfitType> getEarningsByParam(CommonBigScreenReq req);
|
||||||
|
|
||||||
|
List<PowerGenerateRespVO> getPvMonthData(EarningsCalculateReq req);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ho.business.service;
|
|||||||
import com.ho.business.entity.ElecMeterValue;
|
import com.ho.business.entity.ElecMeterValue;
|
||||||
import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
|
import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
|
||||||
import com.ho.business.vo.req.carbin.ElecMeterReq;
|
import com.ho.business.vo.req.carbin.ElecMeterReq;
|
||||||
|
import com.ho.business.vo.resp.profit.DayProfitType;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -50,4 +51,6 @@ public interface ElecMeterValueService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ElecMeterValue> selectGroupByDay(CommonBigScreenReq req);
|
List<ElecMeterValue> selectGroupByDay(CommonBigScreenReq req);
|
||||||
|
|
||||||
|
List<DayProfitType> getElec(String begin, String end, Integer groupId, Integer type,List<Integer> stationIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,4 +118,18 @@ public interface IargeScreenShowService {
|
|||||||
*/
|
*/
|
||||||
List<EventDayNum> getCommonEventCount(SimpleUser user);
|
List<EventDayNum> getCommonEventCount(SimpleUser user);
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
|
List<Subdata> getCommonPvRegionList(List<Integer> byDeptId);
|
||||||
|
|
||||||
|
AnnualPvOverviewResp getPvOverviewData(List<Integer> stationIds);
|
||||||
|
|
||||||
|
EnergySavingRespVo getPvEnergySaving(List<Integer> stationIds);
|
||||||
|
|
||||||
|
List<AnnualChartValue> getPVCommonProfitCurve(CockpitReqVO vo,List<Integer> stationIds);
|
||||||
|
|
||||||
|
List<Subdata> getPvCommonProfit(String beginString, String endString,List<Integer> stationIds);
|
||||||
|
|
||||||
|
List<Subdata> getPvCommonElec(String beginString, String endString, List<Integer> stationIds);
|
||||||
|
|
||||||
|
List<AnnualChartValue> getCommonPvRelease(List<Integer> stationIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.ho.business.vo.req.StationReq;
|
|||||||
import com.ho.business.vo.req.pcsStation.PcsStationReq;
|
import com.ho.business.vo.req.pcsStation.PcsStationReq;
|
||||||
import com.ho.business.vo.resp.DeviceRespVO;
|
import com.ho.business.vo.resp.DeviceRespVO;
|
||||||
import com.ho.business.vo.resp.cabin.CircleCtrlResp;
|
import com.ho.business.vo.resp.cabin.CircleCtrlResp;
|
||||||
|
import com.ho.business.vo.resp.mppt.MpptActiveVo;
|
||||||
import com.ho.business.vo.resp.pcsStation.HomePageStationDataResp;
|
import com.ho.business.vo.resp.pcsStation.HomePageStationDataResp;
|
||||||
import com.ho.business.vo.resp.station.ActiveReactivePower;
|
import com.ho.business.vo.resp.station.ActiveReactivePower;
|
||||||
import com.ho.common.tools.util.PageResult;
|
import com.ho.common.tools.util.PageResult;
|
||||||
@ -24,6 +25,8 @@ public interface OpenStationService {
|
|||||||
|
|
||||||
ActiveReactivePower getAcPower(Integer stationId);
|
ActiveReactivePower getAcPower(Integer stationId);
|
||||||
|
|
||||||
|
MpptActiveVo getPvActivePower(Integer stationId);
|
||||||
|
|
||||||
//环控
|
//环控
|
||||||
List<CircleCtrlResp> getCircle(List<DeviceRespVO> deviceList );
|
List<CircleCtrlResp> getCircle(List<DeviceRespVO> deviceList );
|
||||||
|
|
||||||
@ -42,7 +45,7 @@ public interface OpenStationService {
|
|||||||
* @param req
|
* @param req
|
||||||
* @param response
|
* @param response
|
||||||
*/
|
*/
|
||||||
void exportEleData(PcsStationReq req, HttpServletResponse response);
|
void exportEleData(PcsStationReq req, HttpServletResponse response,String lang);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询日冻结数据
|
* 查询日冻结数据
|
||||||
|
|||||||
@ -25,6 +25,8 @@ public interface OutApiService {
|
|||||||
|
|
||||||
void dayPVCharge(MonitorQuery monitorQuery);
|
void dayPVCharge(MonitorQuery monitorQuery);
|
||||||
|
|
||||||
|
void dayPVMpptCharge(MonitorQuery monitorQuery);
|
||||||
|
|
||||||
//天小时的充放电量
|
//天小时的充放电量
|
||||||
void hourChargeDeal(MonitorQuery monitorQuery) throws ParseException;
|
void hourChargeDeal(MonitorQuery monitorQuery) throws ParseException;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,446 @@
|
|||||||
|
package com.ho.business.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import com.ho.business.constant.DeviceTypeConstant;
|
||||||
|
import com.ho.business.entity.EarningsCalculate;
|
||||||
|
import com.ho.business.entity.ElecMeterValue;
|
||||||
|
import com.ho.business.entity.Station;
|
||||||
|
import com.ho.business.mapper.EarningsCalculateMapper;
|
||||||
|
import com.ho.business.vo.req.StationReqVO;
|
||||||
|
import com.ho.business.vo.resp.ShipStationRespVO;
|
||||||
|
import com.ho.common.tools.constant.CommonConstant;
|
||||||
|
import com.ho.common.tools.exception.BaseResponseCode;
|
||||||
|
import com.ho.common.tools.exception.BusinessException;
|
||||||
|
import com.ho.common.tools.service.RedisService;
|
||||||
|
import com.ho.common.tools.util.HttpUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.jsf.FacesContextUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 西安寄点能源股份有限公司
|
||||||
|
* 西安寄点能源 API 接口 服务
|
||||||
|
*
|
||||||
|
* @author kerwin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class ShipEnergyService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取token 参数 platform
|
||||||
|
*/
|
||||||
|
private static final String PLATFORM = "f9599b6c79a5efbfc6ddce5fed1bbed5";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取token 参数 platformsecret
|
||||||
|
*/
|
||||||
|
private static final String PLATFORM_SECRET = "2928b16f9cb8e85199a4caa6ba3b6620";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寄点能源- 获取token Url
|
||||||
|
*/
|
||||||
|
private static final String TOKEN_URL = "https://www.emind2000.cloud/rest-api/gettoken";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寄点能源- 获取项目列表 Url
|
||||||
|
*/
|
||||||
|
private static final String STATION_URL = "https://www.emind2000.cloud/rest-api/getStations";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寄点能源- 主监控汇总 Url
|
||||||
|
*/
|
||||||
|
private static final String MAIN_URL = "https://www.emind2000.cloud/rest-api/getMainTotal";
|
||||||
|
/**
|
||||||
|
* 寄点能源- 历史收益 Url
|
||||||
|
*/
|
||||||
|
private static final String INCOME_HIS_URL = "https://www.emind2000.cloud/rest-api/getIncomeHis";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StationService stationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ElecMeterValueService elecMeterValueService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
EarningsCalculateMapper earningsCalculateMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寄点能源 - 获取token
|
||||||
|
* @return token
|
||||||
|
*/
|
||||||
|
public String getToken(){
|
||||||
|
String token = null;
|
||||||
|
if(redisService.hasKey(CommonConstant.SHIP_ENERGY_TOKEN_KEY)){
|
||||||
|
token = (String)redisService.get(CommonConstant.SHIP_ENERGY_TOKEN_KEY);
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
Map<String, String> params = Maps.newHashMap();
|
||||||
|
params.put("platform",PLATFORM);
|
||||||
|
params.put("platformsecret",PLATFORM_SECRET);
|
||||||
|
try {
|
||||||
|
String json = HttpUtils.getWithForm(TOKEN_URL,params);
|
||||||
|
log.info("json:" + TOKEN_URL);
|
||||||
|
log.info("json:" + json);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||||
|
Integer code = jsonObject.getInteger("code");
|
||||||
|
if(CommonConstant.HttpCode.SUCCESS_CODE.equals(code)){
|
||||||
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
|
token = data.getString("access_token");
|
||||||
|
//redis 缓存
|
||||||
|
redisService.set(CommonConstant.SHIP_ENERGY_TOKEN_KEY,token,10, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寄点能源 - 获取 项目列表
|
||||||
|
* @return 项目列表 json 字符串
|
||||||
|
*/
|
||||||
|
public String getStations(){
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", getToken());
|
||||||
|
try {
|
||||||
|
String json = HttpUtils.getWithHeaders(STATION_URL,null,headers);
|
||||||
|
log.info("json:" + STATION_URL);
|
||||||
|
log.info("json:" + json);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||||
|
Integer code = jsonObject.getInteger("code");
|
||||||
|
if(CommonConstant.HttpCode.SUCCESS_CODE.equals(code)){
|
||||||
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
|
return data.getString("rows");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 寄点能源 - 获取 主监控汇总信息
|
||||||
|
* @param stationId 电站id
|
||||||
|
* @return 返回对应电站汇总信息
|
||||||
|
*/
|
||||||
|
public String getMainTotal(Integer stationId){
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", getToken());
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("stationId",stationId.toString());
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
String json = HttpUtils.getWithHeaders(MAIN_URL,params,headers);
|
||||||
|
log.info("MAIN_URL:" + MAIN_URL);
|
||||||
|
log.info("json:" + json);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||||
|
Integer code = jsonObject.getInteger("code");
|
||||||
|
if(CommonConstant.HttpCode.SUCCESS_CODE.equals(code)){
|
||||||
|
return jsonObject.getString("data");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 寄点能源 - 获取 历史收益查询
|
||||||
|
*/
|
||||||
|
public String getIncomeHis(Integer stationId,String beginTime){
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("Authorization", getToken());
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("stationId",stationId.toString());
|
||||||
|
params.put("startTime",beginTime+CommonConstant.START_SUFFIX_TIMESTAMP);
|
||||||
|
params.put("endTime",beginTime+CommonConstant.END_SUFFIX_TIMESTAMP);
|
||||||
|
try {
|
||||||
|
String json = HttpUtils.getWithHeaders(INCOME_HIS_URL,params,headers);
|
||||||
|
log.info("INCOME_HIS_URL:" + INCOME_HIS_URL);
|
||||||
|
log.info("json:" + json);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||||
|
Integer code = jsonObject.getInteger("code");
|
||||||
|
if(CommonConstant.HttpCode.SUCCESS_CODE.equals(code)){
|
||||||
|
return jsonObject.getString("data");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/*****************************************业务处理******************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寄点能源 - 电站信息融合储能平台处理
|
||||||
|
*/
|
||||||
|
public void addShipEnergyStation(){
|
||||||
|
String json = getStations();
|
||||||
|
JSONArray jsonStation = JSON.parseArray(json);
|
||||||
|
jsonStation.forEach(i->{
|
||||||
|
JSONObject jsonObj = (JSONObject) i;
|
||||||
|
Integer stationId = jsonObj.getInteger("stationId");
|
||||||
|
String name = jsonObj.getString("name");
|
||||||
|
String address = jsonObj.getString("address");
|
||||||
|
String province = jsonObj.getString("province");
|
||||||
|
String city = jsonObj.getString("city");
|
||||||
|
BigDecimal longitude = jsonObj.getBigDecimal("longitude");
|
||||||
|
BigDecimal latitude = jsonObj.getBigDecimal("latitude");
|
||||||
|
BigDecimal maxPower = jsonObj.getBigDecimal("maxPower");
|
||||||
|
BigDecimal capacity = jsonObj.getBigDecimal("capacity");
|
||||||
|
Date commossioningTime = jsonObj.getDate("commossioningTime");
|
||||||
|
StationReqVO vo = new StationReqVO();
|
||||||
|
vo.setId(stationId+10000);
|
||||||
|
vo.setName(name);
|
||||||
|
vo.setAddress(address);
|
||||||
|
vo.setLongitude(longitude);
|
||||||
|
vo.setLatitude(latitude);
|
||||||
|
vo.setCapacity(capacity);
|
||||||
|
vo.setRatePower(maxPower);
|
||||||
|
vo.setGridTime(commossioningTime);
|
||||||
|
vo.setGroupId(155);
|
||||||
|
vo.setDeptId(592);
|
||||||
|
vo.setStatus(1);
|
||||||
|
vo.setType(7);
|
||||||
|
vo.setPId(0);
|
||||||
|
vo.setIsDailyCount(0);
|
||||||
|
vo.setTopologyType(1);
|
||||||
|
vo.setCupboardType(2);
|
||||||
|
Station station = stationService.selectByName(vo.getName());
|
||||||
|
if (station != null) {
|
||||||
|
throw new BusinessException(BaseResponseCode.STATION_ALREADY_EXISTS);
|
||||||
|
}
|
||||||
|
stationService.insertStation(vo);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 寄点能源 - 缓存电站监控信息
|
||||||
|
*/
|
||||||
|
public void getShipEnergyTotal(){
|
||||||
|
String stations = getStations();
|
||||||
|
JSONArray jsonStation = JSON.parseArray(stations);
|
||||||
|
jsonStation.forEach(i->{
|
||||||
|
JSONObject jsonObj = (JSONObject) i;
|
||||||
|
Integer stationId = jsonObj.getInteger("stationId");
|
||||||
|
String json = getMainTotal(stationId);
|
||||||
|
Integer finalStationId = stationId +10000;
|
||||||
|
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + finalStationId;
|
||||||
|
redisService.set(mainKey,json);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寄点能源 - 获取寄点电站历史收益 并存储
|
||||||
|
*/
|
||||||
|
public void getStationIncomeHis(String beginTime){
|
||||||
|
DateTime yesterday = DateUtil.yesterday();
|
||||||
|
String yesterdayStr = DateUtil.formatDate(yesterday);
|
||||||
|
if(beginTime==null){
|
||||||
|
beginTime = yesterdayStr;
|
||||||
|
}
|
||||||
|
String stations = getStations();
|
||||||
|
JSONArray jsonStation = JSON.parseArray(stations);
|
||||||
|
String finalBeginTime = beginTime;
|
||||||
|
log.info("传入参数-统计时间:{}",beginTime);
|
||||||
|
jsonStation.forEach(i->{
|
||||||
|
JSONObject jsonObj = (JSONObject) i;
|
||||||
|
Integer stationId = jsonObj.getInteger("stationId");
|
||||||
|
String incomeHis = getIncomeHis(stationId, finalBeginTime);
|
||||||
|
JSONArray incomes = JSON.parseArray(incomeHis);
|
||||||
|
log.info("远程查询-历史收益数据:{}",incomes);
|
||||||
|
incomes.forEach(j->{
|
||||||
|
JSONObject income = (JSONObject) j;
|
||||||
|
String date = income.getString("date");
|
||||||
|
String price = income.getString("price");
|
||||||
|
JsonObject jsonPrice = JsonParser.parseString(price).getAsJsonObject();
|
||||||
|
List<EarningsCalculate> list = new ArrayList<>();
|
||||||
|
List<ElecMeterValue> elecList = new ArrayList<>();
|
||||||
|
BigDecimal inTotalIncome = BigDecimal.ZERO;
|
||||||
|
BigDecimal outTotalIncome = BigDecimal.ZERO;
|
||||||
|
log.info("远程查询-统计日期:{}",date);
|
||||||
|
if(finalBeginTime.equals(date)){
|
||||||
|
//收益-充-尖
|
||||||
|
EarningsCalculate inSharp = new EarningsCalculate();
|
||||||
|
BigDecimal positiveSharp = income.getBigDecimal("sum_e_positive_sharp");
|
||||||
|
inSharp.setElec(positiveSharp);
|
||||||
|
inSharp.setType(0);
|
||||||
|
inSharp.setRateType(CommonConstant.RateType.TIP);
|
||||||
|
BigDecimal inSharpPrice = jsonPrice.get("in_sharp_price").getAsBigDecimal();
|
||||||
|
inSharp.setPrice(inSharpPrice);
|
||||||
|
inSharp.setDigital(positiveSharp.multiply(inSharpPrice));
|
||||||
|
inTotalIncome = inTotalIncome.add(inSharp.getDigital());
|
||||||
|
inSharp.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(inSharp);
|
||||||
|
//收益-充-峰
|
||||||
|
EarningsCalculate inPeak = new EarningsCalculate();
|
||||||
|
BigDecimal positivePeak = income.getBigDecimal("sum_e_positive_peak");
|
||||||
|
inPeak.setElec(positivePeak);
|
||||||
|
inPeak.setType(0);
|
||||||
|
inPeak.setRateType(CommonConstant.RateType.PEAK);
|
||||||
|
BigDecimal inPeakPrice = jsonPrice.get("in_peak_price").getAsBigDecimal();
|
||||||
|
inPeak.setPrice(inPeakPrice);
|
||||||
|
inPeak.setDigital(positivePeak.multiply(inPeakPrice));
|
||||||
|
inTotalIncome = inTotalIncome.add(inPeak.getDigital());
|
||||||
|
inPeak.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(inPeak);
|
||||||
|
//收益-充-平
|
||||||
|
EarningsCalculate inFlat = new EarningsCalculate();
|
||||||
|
BigDecimal positiveFlat = income.getBigDecimal("sum_e_positive_flat");
|
||||||
|
inFlat.setElec(positiveFlat);
|
||||||
|
inFlat.setType(0);
|
||||||
|
inFlat.setRateType(CommonConstant.RateType.FLAT);
|
||||||
|
BigDecimal inFlatPrice = jsonPrice.get("in_flat_price").getAsBigDecimal();
|
||||||
|
inFlat.setPrice(inFlatPrice);
|
||||||
|
inFlat.setDigital(positiveFlat.multiply(inFlatPrice));
|
||||||
|
inTotalIncome = inTotalIncome.add(inFlat.getDigital());
|
||||||
|
inFlat.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(inFlat);
|
||||||
|
//收益-充-谷
|
||||||
|
EarningsCalculate inValley = new EarningsCalculate();
|
||||||
|
BigDecimal positiveValley = income.getBigDecimal("sum_e_positive_valley");
|
||||||
|
inValley.setElec(positiveValley);
|
||||||
|
inValley.setType(0);
|
||||||
|
inValley.setRateType(CommonConstant.RateType.VALLEY);
|
||||||
|
BigDecimal inValleyPrice = jsonPrice.get("in_valley_price").getAsBigDecimal();
|
||||||
|
inValley.setPrice(inValleyPrice);
|
||||||
|
inValley.setDigital(positiveValley.multiply(inValleyPrice));
|
||||||
|
inTotalIncome = inTotalIncome.add(inValley.getDigital());
|
||||||
|
inValley.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(inValley);
|
||||||
|
//收益-充-深谷
|
||||||
|
EarningsCalculate inDeepValley = new EarningsCalculate();
|
||||||
|
BigDecimal positiveDeepValley = income.getBigDecimal("sum_e_positive_deep_valley");
|
||||||
|
inDeepValley.setElec(positiveDeepValley);
|
||||||
|
inDeepValley.setType(0);
|
||||||
|
inDeepValley.setRateType(CommonConstant.RateType.DEEP_VALLEY);
|
||||||
|
BigDecimal inDeepValleyPrice = jsonPrice.get("in_deep_valley_price").getAsBigDecimal();
|
||||||
|
inDeepValley.setPrice(inDeepValleyPrice);
|
||||||
|
inDeepValley.setDigital(positiveDeepValley.multiply(inDeepValleyPrice));
|
||||||
|
inTotalIncome = inTotalIncome.add(inValley.getDigital());
|
||||||
|
inDeepValley.setTotal(inTotalIncome);
|
||||||
|
list.add(inDeepValley);
|
||||||
|
//收益-放-尖
|
||||||
|
EarningsCalculate outSharp = new EarningsCalculate();
|
||||||
|
BigDecimal reverseSharp = income.getBigDecimal("sum_e_reverse_sharp");
|
||||||
|
outSharp.setElec(reverseSharp);
|
||||||
|
outSharp.setType(1);
|
||||||
|
outSharp.setRateType(CommonConstant.RateType.TIP);
|
||||||
|
BigDecimal outSharpPrice = jsonPrice.get("out_sharp_price").getAsBigDecimal();
|
||||||
|
outSharp.setPrice(outSharpPrice);
|
||||||
|
outSharp.setDigital(reverseSharp.multiply(outSharpPrice));
|
||||||
|
outTotalIncome = outTotalIncome.add(outSharp.getDigital());
|
||||||
|
outSharp.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(outSharp);
|
||||||
|
//收益-放-峰
|
||||||
|
EarningsCalculate outPeak = new EarningsCalculate();
|
||||||
|
BigDecimal reversePeak = income.getBigDecimal("sum_e_reverse_peak");
|
||||||
|
outPeak.setElec(reversePeak);
|
||||||
|
outPeak.setType(1);
|
||||||
|
outPeak.setRateType(CommonConstant.RateType.PEAK);
|
||||||
|
BigDecimal outPeakPrice = jsonPrice.get("out_peak_price").getAsBigDecimal();
|
||||||
|
outPeak.setPrice(outPeakPrice);
|
||||||
|
outPeak.setDigital(reversePeak.multiply(outPeakPrice));
|
||||||
|
outTotalIncome = outTotalIncome.add(outPeak.getDigital());
|
||||||
|
outPeak.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(outPeak);
|
||||||
|
//收益-放-平
|
||||||
|
EarningsCalculate outFlat = new EarningsCalculate();
|
||||||
|
BigDecimal reverseFlat = income.getBigDecimal("sum_e_reverse_flat");
|
||||||
|
outFlat.setElec(reverseFlat);
|
||||||
|
outFlat.setType(1);
|
||||||
|
outFlat.setRateType(CommonConstant.RateType.FLAT);
|
||||||
|
BigDecimal outFlatPrice = jsonPrice.get("out_flat_price").getAsBigDecimal();
|
||||||
|
outFlat.setPrice(outFlatPrice);
|
||||||
|
outFlat.setDigital(reverseFlat.multiply(outFlatPrice));
|
||||||
|
outTotalIncome = outTotalIncome.add(outFlat.getDigital());
|
||||||
|
outFlat.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(outFlat);
|
||||||
|
//收益-放-谷
|
||||||
|
EarningsCalculate outValley = new EarningsCalculate();
|
||||||
|
BigDecimal reverseValley = income.getBigDecimal("sum_e_reverse_valley");
|
||||||
|
outValley.setElec(reverseValley);
|
||||||
|
outValley.setType(1);
|
||||||
|
outValley.setRateType(CommonConstant.RateType.VALLEY);
|
||||||
|
BigDecimal outValleyPrice = jsonPrice.get("out_valley_price").getAsBigDecimal();
|
||||||
|
outValley.setPrice(outValleyPrice);
|
||||||
|
outValley.setDigital(reverseValley.multiply(outValleyPrice));
|
||||||
|
outTotalIncome = outTotalIncome.add(outValley.getDigital());
|
||||||
|
outValley.setTotal(BigDecimal.ZERO);
|
||||||
|
list.add(outValley);
|
||||||
|
//收益-放-深谷
|
||||||
|
EarningsCalculate outDeepValley = new EarningsCalculate();
|
||||||
|
BigDecimal reverseDeepValley = income.getBigDecimal("sum_e_reverse_deep_valley");
|
||||||
|
outDeepValley.setElec(reverseDeepValley);
|
||||||
|
outDeepValley.setType(1);
|
||||||
|
outDeepValley.setRateType(CommonConstant.RateType.DEEP_VALLEY);
|
||||||
|
BigDecimal outDeepValleyPrice = jsonPrice.get("out_deep_valley_price").getAsBigDecimal();
|
||||||
|
outDeepValley.setPrice(outDeepValleyPrice);
|
||||||
|
outDeepValley.setDigital(reverseDeepValley.multiply(outDeepValleyPrice));
|
||||||
|
outTotalIncome = outTotalIncome.add(outDeepValley.getDigital());
|
||||||
|
outDeepValley.setTotal(outTotalIncome);
|
||||||
|
list.add(outDeepValley);
|
||||||
|
// 充电
|
||||||
|
ElecMeterValue charge = new ElecMeterValue();
|
||||||
|
BigDecimal sumEPositive = income.getBigDecimal("sum_e_positive");
|
||||||
|
charge.setDigital(sumEPositive);
|
||||||
|
charge.setType(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.CHARGE);
|
||||||
|
charge.setStatus(CommonConstant.STATUS_FLAG);
|
||||||
|
elecList.add(charge);
|
||||||
|
// 放电
|
||||||
|
ElecMeterValue disCharge = new ElecMeterValue();
|
||||||
|
BigDecimal sumEReverse = income.getBigDecimal("sum_e_reverse");
|
||||||
|
disCharge.setDigital(sumEReverse);
|
||||||
|
disCharge.setType(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.DISCHARGE);
|
||||||
|
disCharge.setStatus(CommonConstant.STATUS_FLAG);
|
||||||
|
elecList.add(disCharge);
|
||||||
|
}
|
||||||
|
if(elecList.size()>0){
|
||||||
|
//删除
|
||||||
|
elecMeterValueService.deleteByStationAndDay(stationId+10000,date,null);
|
||||||
|
elecList.forEach(eleMeter -> {
|
||||||
|
eleMeter.setGroupId(155);
|
||||||
|
eleMeter.setStationId(stationId+10000);
|
||||||
|
eleMeter.setCreateTime(new Date());
|
||||||
|
eleMeter.setDay(date);
|
||||||
|
//新增
|
||||||
|
elecMeterValueService.insert(eleMeter);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(list.size()>0){
|
||||||
|
//删除
|
||||||
|
earningsCalculateMapper.deleteByStationAndDay(date,null,stationId+10000);
|
||||||
|
list.forEach(a->{
|
||||||
|
a.setGroupId(155);
|
||||||
|
a.setStationId(stationId+10000);
|
||||||
|
a.setCreateTime(new Date());
|
||||||
|
a.setDay(date);
|
||||||
|
a.setDiscount(BigDecimal.ONE);
|
||||||
|
//新增
|
||||||
|
earningsCalculateMapper.insertSelective(a);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -8,6 +8,7 @@ import com.ho.business.vo.resp.AppRealTimeCurveRespVo;
|
|||||||
import com.ho.business.vo.resp.CountEleData;
|
import com.ho.business.vo.resp.CountEleData;
|
||||||
import com.ho.business.vo.resp.DeviceColData;
|
import com.ho.business.vo.resp.DeviceColData;
|
||||||
import com.ho.business.vo.resp.DeviceRespVO;
|
import com.ho.business.vo.resp.DeviceRespVO;
|
||||||
|
import com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO;
|
||||||
import com.ho.business.vo.resp.cabin.TemperatureHumidityResp;
|
import com.ho.business.vo.resp.cabin.TemperatureHumidityResp;
|
||||||
import com.ho.business.vo.resp.pcsStation.OutStationData;
|
import com.ho.business.vo.resp.pcsStation.OutStationData;
|
||||||
import com.ho.business.vo.resp.pcsStation.PcsElecData;
|
import com.ho.business.vo.resp.pcsStation.PcsElecData;
|
||||||
@ -72,6 +73,8 @@ public interface StationHomeService {
|
|||||||
*/
|
*/
|
||||||
List<AppRealTimeCurveRespVo> getOpticalStorageCurve(MonitorQuery monitorQuery);
|
List<AppRealTimeCurveRespVo> getOpticalStorageCurve(MonitorQuery monitorQuery);
|
||||||
|
|
||||||
|
List<AppRealTimeCurveRespVo> pvCurve(MonitorQuery monitorQuery);
|
||||||
|
|
||||||
List<TemperatureHumidityResp> getTemperatureHumidityCurve(MonitorQuery monitorQuery);
|
List<TemperatureHumidityResp> getTemperatureHumidityCurve(MonitorQuery monitorQuery);
|
||||||
|
|
||||||
CountEleData getCountEleData(StationReq req);
|
CountEleData getCountEleData(StationReq req);
|
||||||
@ -96,6 +99,6 @@ public interface StationHomeService {
|
|||||||
*/
|
*/
|
||||||
OutStationData getStationData(StationReq req);
|
OutStationData getStationData(StationReq req);
|
||||||
|
|
||||||
List<PcsElecData> getPvChargeElec(PcsStationReq req);
|
List<PowerGenerateRespVO> getPvData(PcsStationReq req);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.ho.business.service;
|
||||||
|
|
||||||
|
import com.ho.business.entity.StationRemoteControl;
|
||||||
|
import com.ho.business.vo.req.StationRemoteControlPageVo;
|
||||||
|
import com.ho.common.tools.util.PageResult;
|
||||||
|
|
||||||
|
public interface StationRemoteControlService {
|
||||||
|
void insert(StationRemoteControl entity);
|
||||||
|
|
||||||
|
void update(StationRemoteControl entity);
|
||||||
|
|
||||||
|
void delete(Integer id);
|
||||||
|
|
||||||
|
StationRemoteControl search(Integer stationId);
|
||||||
|
|
||||||
|
PageResult<StationRemoteControl> selectPageList(StationRemoteControlPageVo vo);
|
||||||
|
}
|
||||||
@ -0,0 +1,212 @@
|
|||||||
|
package com.ho.business.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.ho.business.constant.DeviceTypeConstant;
|
||||||
|
import com.ho.business.entity.*;
|
||||||
|
import com.ho.business.feignclient.TdFeignClient;
|
||||||
|
import com.ho.business.mapper.EarningsCalculateMapper;
|
||||||
|
import com.ho.business.mapper.EarningsCalculateMpptMapper;
|
||||||
|
import com.ho.business.service.*;
|
||||||
|
import com.ho.business.util.QueuesUtil;
|
||||||
|
import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
|
||||||
|
import com.ho.business.vo.req.device.DeviceTypeQuery;
|
||||||
|
import com.ho.business.vo.resp.DeviceRespVO;
|
||||||
|
import com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO;
|
||||||
|
import com.ho.business.vo.resp.profit.DayProfitType;
|
||||||
|
import com.ho.common.tools.constant.CommonConstant;
|
||||||
|
import com.ho.common.tools.constant.RedisKeyConstant;
|
||||||
|
import com.ho.common.tools.exception.DataResult;
|
||||||
|
import com.ho.common.tools.service.RedisService;
|
||||||
|
import com.ho.common.tools.vo.req.StationHomeRespVo;
|
||||||
|
import com.ho.td.api.entity.query.TdBaseTimeQuery;
|
||||||
|
import jodd.util.CollectionUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class EarningsCalculateMpptServiceImpl implements EarningsCalculateMpptService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
EarningsCalculateMpptMapper earningsCalculateMpptMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceService deviceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ModelDeviceService modelDeviceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceTypeConfigService deviceTypeConfigService;
|
||||||
|
|
||||||
|
public static final String TOTAL_RELEASE = "totalRelease";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RedisService redisService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
EarningsCalculateMapper earningsCalculateMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TdFeignClient tdFeignClient;
|
||||||
|
@Override
|
||||||
|
public int deleteByDay(String day, List<Integer> typeList) {
|
||||||
|
int i = earningsCalculateMpptMapper.deleteByDay(day, typeList);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算光伏收益
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<EarningsCalculateMppt> countMpptIncome(Station station,String beginTime){
|
||||||
|
List<EarningsCalculateMppt> list =new ArrayList<>();
|
||||||
|
Integer stationId = station.getId();
|
||||||
|
// 总发
|
||||||
|
List<DeviceRespVO> deviceRespVOS = deviceService.getListByDeviceType(stationId, DeviceTypeConstant.MPPT);
|
||||||
|
if (deviceRespVOS.isEmpty()) {
|
||||||
|
deviceRespVOS = deviceService.getListByFuzzyDeviceType(stationId, DeviceTypeConstant.MPPT);
|
||||||
|
}
|
||||||
|
for (DeviceRespVO vo : deviceRespVOS) {
|
||||||
|
// 查询光伏Mppt 放电量关联字段 如果没关联,则不计算
|
||||||
|
List<ModelDeviceColComp> deviceCp = modelDeviceService.getCompListByType("device", vo.getDeviceType(), TOTAL_RELEASE);
|
||||||
|
if(deviceCp == null ){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 查询设备模型,没查询到则返回,不计算
|
||||||
|
DeviceTypeQuery deviceTypeQuery = new DeviceTypeQuery();
|
||||||
|
deviceTypeQuery.setGroupId(station.getGroupId());
|
||||||
|
deviceTypeQuery.setDeviceType(deviceCp.get(0).getDeviceType());
|
||||||
|
List<DeviceTypeConfig> deviceTypeConfigs = deviceTypeConfigService.queryListByCondition(deviceTypeQuery);
|
||||||
|
if (deviceTypeConfigs == null){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//开始计算
|
||||||
|
//1:组装时序数据库查询参数
|
||||||
|
DateTime beginDate = DateUtil.beginOfDay(DateUtil.parse(beginTime));
|
||||||
|
DateTime endDate = DateUtil.endOfDay(beginDate);
|
||||||
|
TdBaseTimeQuery tdBaseQuery = new TdBaseTimeQuery();
|
||||||
|
tdBaseQuery.setBeginTime(beginDate.toMsStr());
|
||||||
|
tdBaseQuery.setEndTime(endDate.toMsStr());
|
||||||
|
tdBaseQuery.setTime("1m");
|
||||||
|
tdBaseQuery.setStationId(station.getId());
|
||||||
|
tdBaseQuery.setGroupId(station.getGroupId());
|
||||||
|
tdBaseQuery.setModelName((deviceTypeConfigs.get(0)).getModelName());
|
||||||
|
tdBaseQuery.setCol(deviceCp.get(0).getDeviceCol());
|
||||||
|
tdBaseQuery.setSrcId(vo.getSrcId());
|
||||||
|
// 查询设备时序数据,如果为空则不计算
|
||||||
|
DataResult<List<StationHomeRespVo>> listDataResult = tdFeignClient.queryPointTableList(tdBaseQuery);
|
||||||
|
List<StationHomeRespVo> datas = listDataResult.getData();
|
||||||
|
if(datas ==null){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 获取电价分时段计算收益
|
||||||
|
List<EarningsCalculateSub> elecTemplateSubs = earningsCalculateMapper.queryElecTemplateSubByStationId(station.getId(), 0, beginTime,2);
|
||||||
|
BigDecimal lastelec = BigDecimal.ZERO;
|
||||||
|
BigDecimal elec = BigDecimal.ZERO;
|
||||||
|
int num = 0 ;
|
||||||
|
for (EarningsCalculateSub sub : elecTemplateSubs ){
|
||||||
|
String earnBegin = sub.getBeginTime();
|
||||||
|
String earnEnd = sub.getEndTime();
|
||||||
|
DateTime earnBeginDate = DateUtil.parse(beginTime + " " + earnBegin + ":00");
|
||||||
|
DateTime earnEndate = DateUtil.parse(beginTime + " " + earnEnd + ":59");
|
||||||
|
List<StationHomeRespVo> subData = datas.stream().filter(i->DateUtil.isIn(DateUtil.parse(i.getDate()),earnBeginDate,earnEndate)).collect(Collectors.toList());
|
||||||
|
if(subData.size()>0){
|
||||||
|
if(num==0){
|
||||||
|
elec = subData.get(subData.size()-1).getDigital().subtract(subData.get(0).getDigital());
|
||||||
|
}else {
|
||||||
|
elec = subData.get(subData.size() - 1).getDigital().subtract(lastelec);
|
||||||
|
}
|
||||||
|
lastelec = subData.get(subData.size()-1).getDigital();
|
||||||
|
num++;
|
||||||
|
EarningsCalculateMppt earn =new EarningsCalculateMppt();
|
||||||
|
earn.setDay(beginTime);
|
||||||
|
earn.setGroupId(station.getGroupId());
|
||||||
|
earn.setStationId(station.getId());
|
||||||
|
earn.setSrcId(tdBaseQuery.getSrcId());
|
||||||
|
earn.setPrice(sub.getPrice());
|
||||||
|
earn.setRateType(sub.getType());
|
||||||
|
earn.setType(1);
|
||||||
|
earn.setCreateTime(new Date());
|
||||||
|
BigDecimal discount = sub.getDiscount() == null ? BigDecimal.ONE : sub.getDiscount();
|
||||||
|
earn.setTotal(BigDecimal.ZERO);
|
||||||
|
earn.setElec(elec);
|
||||||
|
earn.setDiscount(discount);
|
||||||
|
earn.setDigital(new BigDecimal(String.format("%.4f",elec.multiply(sub.getPrice()))));
|
||||||
|
list.add(earn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void todayMpptIncome(List<Station> stations,String beginTime){
|
||||||
|
if(stations != null && stations.size() > 0){
|
||||||
|
for (Station station:stations){
|
||||||
|
List<EarningsCalculateMppt> list = countMpptIncome(station,beginTime);
|
||||||
|
// 缓存今日收益
|
||||||
|
if(list.size()>0){
|
||||||
|
String key = RedisKeyConstant.PV.STATION_PV_TODAY_PROFIT + station.getId();
|
||||||
|
BigDecimal todayIncone = list.stream().map(EarningsCalculateMppt::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add);
|
||||||
|
redisService.set(key, todayIncone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PowerGenerateRespVO> countPvIncome(Integer stationId, String beginTime, String endTime) {
|
||||||
|
return earningsCalculateMpptMapper.countPvIncome(stationId,beginTime,endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal countAllPvIncome(Integer stationId,String beginTime, String endTime) {
|
||||||
|
BigDecimal data = earningsCalculateMpptMapper.countAllPvIncome(stationId,beginTime,endTime);
|
||||||
|
return data==null?BigDecimal.ZERO:data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DayProfitType> getProfit(String begin, String end, Integer groupId) {
|
||||||
|
return earningsCalculateMpptMapper.getProfit(begin, end, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date getFirstTime() {
|
||||||
|
String day = earningsCalculateMpptMapper.getFirstTime();
|
||||||
|
DateTime date = null;
|
||||||
|
if(day!=null){
|
||||||
|
date = DateUtil.parse(day, CommonConstant.DATE_YMD);
|
||||||
|
}
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DayProfitType> getEarningsByParam(CommonBigScreenReq req) {
|
||||||
|
return earningsCalculateMpptMapper.getEarningsByParam(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void allMpptIncome(List<Station> stations,String beginTime) {
|
||||||
|
if(stations != null && stations.size() > 0){
|
||||||
|
for (Station station:stations){
|
||||||
|
List<EarningsCalculateMppt> list = countMpptIncome(station,beginTime);
|
||||||
|
// 数据插入
|
||||||
|
if(list.size()>0){
|
||||||
|
int a = this.earningsCalculateMpptMapper.insertBatch(list);
|
||||||
|
System.err.println("修改的行数:" + a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUnit;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.excel.util.DateUtils;
|
import com.alibaba.excel.util.DateUtils;
|
||||||
import com.alibaba.excel.util.StringUtils;
|
import com.alibaba.excel.util.StringUtils;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.ho.business.constant.DeviceTypeConstant;
|
import com.ho.business.constant.DeviceTypeConstant;
|
||||||
import com.ho.business.entity.*;
|
import com.ho.business.entity.*;
|
||||||
import com.ho.business.feignclient.UserFeignClient;
|
import com.ho.business.feignclient.UserFeignClient;
|
||||||
@ -24,11 +25,14 @@ import com.ho.business.vo.req.pcsStation.PcsStationReq;
|
|||||||
import com.ho.business.vo.req.report.ReportReqVO;
|
import com.ho.business.vo.req.report.ReportReqVO;
|
||||||
import com.ho.business.vo.resp.CountEleData;
|
import com.ho.business.vo.resp.CountEleData;
|
||||||
import com.ho.business.vo.resp.DeviceRespVO;
|
import com.ho.business.vo.resp.DeviceRespVO;
|
||||||
|
import com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO;
|
||||||
|
import com.ho.business.vo.resp.ShipStationRespVO;
|
||||||
import com.ho.business.vo.resp.cabin.EarningsCalculateCountResp;
|
import com.ho.business.vo.resp.cabin.EarningsCalculateCountResp;
|
||||||
import com.ho.business.vo.resp.cabin.EarningsCalculateResp;
|
import com.ho.business.vo.resp.cabin.EarningsCalculateResp;
|
||||||
import com.ho.business.vo.resp.colCount.ColCountResp;
|
import com.ho.business.vo.resp.colCount.ColCountResp;
|
||||||
import com.ho.business.vo.resp.income.RevenueOverview;
|
import com.ho.business.vo.resp.income.RevenueOverview;
|
||||||
import com.ho.business.vo.resp.income.RevenueOverviewData;
|
import com.ho.business.vo.resp.income.RevenueOverviewData;
|
||||||
|
import com.ho.business.vo.resp.mppt.MpptActiveVo;
|
||||||
import com.ho.business.vo.resp.pcsStation.EarningsCalculateData;
|
import com.ho.business.vo.resp.pcsStation.EarningsCalculateData;
|
||||||
import com.ho.business.vo.resp.pcsStation.PcsElecData;
|
import com.ho.business.vo.resp.pcsStation.PcsElecData;
|
||||||
import com.ho.business.vo.resp.profit.DayProfitType;
|
import com.ho.business.vo.resp.profit.DayProfitType;
|
||||||
@ -41,6 +45,7 @@ import com.ho.common.tools.exception.BusinessException;
|
|||||||
import com.ho.common.tools.service.RedisService;
|
import com.ho.common.tools.service.RedisService;
|
||||||
import com.ho.datacollect.api.constant.DataCollectConstant;
|
import com.ho.datacollect.api.constant.DataCollectConstant;
|
||||||
import com.ho.user.api.vo.req.SysSubDictVO;
|
import com.ho.user.api.vo.req.SysSubDictVO;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@ -101,6 +106,12 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
UserFeignClient userFeignClient;
|
UserFeignClient userFeignClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
OpenStationService openStationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
EarningsCalculateMpptService earningsCalculateMpptService;
|
||||||
|
|
||||||
public static final String DICT_TYPE = "electrovalence_type";
|
public static final String DICT_TYPE = "electrovalence_type";
|
||||||
|
|
||||||
/** start */
|
/** start */
|
||||||
@ -160,6 +171,10 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
|||||||
if (station == null || station.getId() == null) {
|
if (station == null || station.getId() == null) {
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
boolean flag = false;
|
||||||
|
if(DataCollectConstant.ONE.equals(station.getInverterFlag())){
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
Integer stationId = station.getId();
|
Integer stationId = station.getId();
|
||||||
String deviceType = colCountService.getDeviceType(stationId);
|
String deviceType = colCountService.getDeviceType(stationId);
|
||||||
List<DeviceRespVO> deviceRespVOS = deviceService.getListByDeviceType(stationId, deviceType);
|
List<DeviceRespVO> deviceRespVOS = deviceService.getListByDeviceType(stationId, deviceType);
|
||||||
@ -194,11 +209,17 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
|||||||
|
|
||||||
String time = earningsCalculateReq.getTime();
|
String time = earningsCalculateReq.getTime();
|
||||||
ec.setMonth(time.substring(time.length() - 2, time.length()));
|
ec.setMonth(time.substring(time.length() - 2, time.length()));
|
||||||
|
String reportName = CommonConstant.REPORT_NAME;
|
||||||
|
String billName = CommonConstant.BILL_NAME;
|
||||||
|
if(CommonConstant.langTemp.EN_US.equals(earningsCalculateReq.getLang())){
|
||||||
|
reportName = CommonConstant.REPORT_NAME_EN;
|
||||||
|
billName = CommonConstant.BILL_NAME_EN;
|
||||||
|
}
|
||||||
// 电站名称(报表标题)
|
// 电站名称(报表标题)
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
ec.setStationName(station.getName() + "( " + time + " ) 月度报表");
|
ec.setStationName(station.getName() + "( " + time + " ) "+reportName);
|
||||||
} else {
|
} else {
|
||||||
ec.setStationName(station.getName() + "( " + time + " ) 月度账单");
|
ec.setStationName(station.getName() + "( " + time + " ) "+billName);
|
||||||
}
|
}
|
||||||
ec.setList(list);
|
ec.setList(list);
|
||||||
//充电收益
|
//充电收益
|
||||||
@ -220,6 +241,10 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
|||||||
BigDecimal dailyChargeElec = BigDecimal.ZERO;
|
BigDecimal dailyChargeElec = BigDecimal.ZERO;
|
||||||
//日放电量
|
//日放电量
|
||||||
BigDecimal dailyDischargeElec = BigDecimal.ZERO;
|
BigDecimal dailyDischargeElec = BigDecimal.ZERO;
|
||||||
|
//今日收益(mppt)
|
||||||
|
BigDecimal todayIncone = BigDecimal.ZERO;
|
||||||
|
//今日发电量(mppt)
|
||||||
|
BigDecimal dailyReleaseElec = BigDecimal.ZERO;
|
||||||
//当月则叠加当日,否则不叠加
|
//当月则叠加当日,否则不叠加
|
||||||
if (sameMonth) {
|
if (sameMonth) {
|
||||||
//将当日的日充日放叠加到日冻结中
|
//将当日的日充日放叠加到日冻结中
|
||||||
@ -234,8 +259,26 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
|||||||
dailyChargeElec = countEleData.getDailyChargeElec();
|
dailyChargeElec = countEleData.getDailyChargeElec();
|
||||||
//日放电量
|
//日放电量
|
||||||
dailyDischargeElec = countEleData.getDailyDischargeElec();
|
dailyDischargeElec = countEleData.getDailyDischargeElec();
|
||||||
|
if(flag){
|
||||||
|
//今日收益(mppt)
|
||||||
|
String key = RedisKeyConstant.PV.STATION_PV_TODAY_PROFIT + station.getId();
|
||||||
|
todayIncone = (BigDecimal)redisService.get(key)==null?BigDecimal.ZERO:(BigDecimal)redisService.get(key);
|
||||||
|
//今日发电量(mppt)
|
||||||
|
MpptActiveVo pv = openStationService.getPvActivePower(stationId);
|
||||||
|
dailyReleaseElec = pv.getDailyReleaseElec();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(flag){
|
||||||
|
BigDecimal monthIncone = earningsCalculateMpptService.countAllPvIncome(station.getId(),earningsCalculateReq.getBeginTime(),earningsCalculateReq.getEndTime());
|
||||||
|
ec.setMonthIncone(monthIncone.add(todayIncone));
|
||||||
|
BigDecimal monthReleaseElec = elecMeterValueService.selectSumByType(station.getId(),DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE,earningsCalculateReq.getBeginTime(),earningsCalculateReq.getEndTime(),null);
|
||||||
|
ec.setMonthReleaseElec(monthReleaseElec.add(dailyReleaseElec));
|
||||||
|
BigDecimal totalIncome = earningsCalculateMpptService.countAllPvIncome(station.getId(),null,null);
|
||||||
|
ec.setTotalIncome(totalIncome.add(todayIncone));
|
||||||
|
BigDecimal totalReleaseElec = elecMeterValueService.selectSumValue(station.getId(),DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE,null);
|
||||||
|
ec.setTotalReleaseElec(totalReleaseElec.add(dailyReleaseElec));
|
||||||
|
ec.setPvPower(station.getPvPower());
|
||||||
}
|
}
|
||||||
|
|
||||||
ec.setTotalChargeElec(pcsElecData.stream().map(PcsElecData::getChargeElec).reduce(BigDecimal.ZERO, BigDecimal::add).add(dailyChargeElec));
|
ec.setTotalChargeElec(pcsElecData.stream().map(PcsElecData::getChargeElec).reduce(BigDecimal.ZERO, BigDecimal::add).add(dailyChargeElec));
|
||||||
ec.setTotalDischargeElec(pcsElecData.stream().map(PcsElecData::getDischargeElec).reduce(BigDecimal.ZERO, BigDecimal::add).add(dailyDischargeElec));
|
ec.setTotalDischargeElec(pcsElecData.stream().map(PcsElecData::getDischargeElec).reduce(BigDecimal.ZERO, BigDecimal::add).add(dailyDischargeElec));
|
||||||
|
|
||||||
@ -649,7 +692,8 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
|||||||
if (dateStr != null && !"".equals(dateStr)) {
|
if (dateStr != null && !"".equals(dateStr)) {
|
||||||
date = dateStr.substring(0, 7);
|
date = dateStr.substring(0, 7);
|
||||||
}
|
}
|
||||||
earningsCalculateSubs = earningsCalculateMapper.queryElecTemplateSubByStationId(stationId, templateType, dateStr);
|
Integer elecType = 1;
|
||||||
|
earningsCalculateSubs = earningsCalculateMapper.queryElecTemplateSubByStationId(stationId, templateType, dateStr,elecType);
|
||||||
if (earningsCalculateSubs != null && earningsCalculateSubs.size() > 0) {
|
if (earningsCalculateSubs != null && earningsCalculateSubs.size() > 0) {
|
||||||
return earningsCalculateSubs;
|
return earningsCalculateSubs;
|
||||||
}
|
}
|
||||||
@ -1403,6 +1447,16 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
|||||||
revenueOverview.setStationName(station.getName());
|
revenueOverview.setStationName(station.getName());
|
||||||
revenueOverview.setCapacity(station.getCapacity());
|
revenueOverview.setCapacity(station.getCapacity());
|
||||||
revenueOverview.setOperationDays((int) operationDays);
|
revenueOverview.setOperationDays((int) operationDays);
|
||||||
|
if(station.getId()==11003 || station.getId()==10942 ||station.getId()==11006){
|
||||||
|
// 寄点电站数据
|
||||||
|
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + station.getId();
|
||||||
|
String json = (String)redisService.get(mainKey);
|
||||||
|
ShipStationRespVO respVO = JSON.parseObject(json,ShipStationRespVO.class);
|
||||||
|
revenueOverview.setCharging(respVO.getPositivePowerSum()==null?BigDecimal.ZERO:BigDecimal.valueOf(respVO.getPositivePowerSum()));
|
||||||
|
revenueOverview.setDischarging(respVO.getReversePowerSum()==null?BigDecimal.ZERO:BigDecimal.valueOf(respVO.getReversePowerSum()));
|
||||||
|
revenueOverview.setTotalRevenue(respVO.getIncomeSum()==null?BigDecimal.ZERO:BigDecimal.valueOf(respVO.getIncomeSum()));
|
||||||
|
return revenueOverview;
|
||||||
|
}
|
||||||
|
|
||||||
List<RevenueOverviewData> list = getRevenueOverviewData(vo);
|
List<RevenueOverviewData> list = getRevenueOverviewData(vo);
|
||||||
|
|
||||||
@ -1534,6 +1588,56 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
|||||||
return earningsCalculateMapper.getEarningsByParam(req);
|
return earningsCalculateMapper.getEarningsByParam(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PowerGenerateRespVO> getPvMonthData(EarningsCalculateReq req) {
|
||||||
|
List<PowerGenerateRespVO> list = new ArrayList<>();
|
||||||
|
LocalDateTime mDate = DateUtil.parse(req.getTime(), CommonConstant.DATE_YM).toLocalDateTime();
|
||||||
|
LocalDateTime begin = mDate.with(TemporalAdjusters.firstDayOfMonth());
|
||||||
|
LocalDateTime end = mDate.with(TemporalAdjusters.lastDayOfMonth());
|
||||||
|
String beginTime= DateUtil.format(begin, CommonConstant.DATE_YMD);
|
||||||
|
String endTime = DateUtil.format(end, CommonConstant.DATE_YMD);
|
||||||
|
String nowTime = DateUtil.format(new Date(), CommonConstant.DATE_YMD);
|
||||||
|
//光伏收益
|
||||||
|
List<PowerGenerateRespVO> pvIncome = earningsCalculateMpptService.countPvIncome(req.getStationId(),beginTime, endTime);
|
||||||
|
Map<String,List<PowerGenerateRespVO>> mapIncome = pvIncome.stream().collect(Collectors.groupingBy(i ->i.getDate()));
|
||||||
|
//光伏放电
|
||||||
|
List<Integer> types = new ArrayList<>();
|
||||||
|
types.add(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE);
|
||||||
|
List<ElecMeterValue> elecMeterValues = elecMeterValueService.selectList(req.getStationId(), types, beginTime, endTime);
|
||||||
|
Map<String, List<ElecMeterValue>> mapMeter = elecMeterValues.stream().collect(Collectors.groupingBy(i ->i.getDay()));
|
||||||
|
|
||||||
|
//根据天获取时间段
|
||||||
|
List<DateTime> dateTimes = DateUtil.rangeToList(DateUtil.parse(beginTime), DateUtil.parse(endTime), DateField.DAY_OF_MONTH);
|
||||||
|
for (DateTime dateTime : dateTimes){
|
||||||
|
String date = DateUtil.format(dateTime, CommonConstant.DATE_YMD);
|
||||||
|
PowerGenerateRespVO pv = new PowerGenerateRespVO();
|
||||||
|
pv.setDate(date);
|
||||||
|
List<PowerGenerateRespVO> pvIn = mapIncome.get(date);
|
||||||
|
//收益
|
||||||
|
if(pvIn != null){
|
||||||
|
pv.setProfit(pvIn.get(0).getProfit());
|
||||||
|
}
|
||||||
|
//放电
|
||||||
|
List<ElecMeterValue> elecs = mapMeter.get(date);
|
||||||
|
if(elecs != null){
|
||||||
|
pv.setPowerGenerate(elecs.stream().map(ElecMeterValue::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add));
|
||||||
|
}
|
||||||
|
if(date.equals(nowTime)){
|
||||||
|
String key = RedisKeyConstant.PV.STATION_PV_TODAY_PROFIT + req.getStationId();
|
||||||
|
//获取今日收益
|
||||||
|
BigDecimal todayIncone = (BigDecimal)redisService.get(key);
|
||||||
|
pv.setProfit(todayIncone);
|
||||||
|
//获取今日发电
|
||||||
|
//当前功率(光伏)、总发电量、日发电量
|
||||||
|
MpptActiveVo todayPv = openStationService.getPvActivePower(req.getStationId());
|
||||||
|
pv.setPowerGenerate(todayPv.getDailyReleaseElec());
|
||||||
|
|
||||||
|
}
|
||||||
|
list.add(pv);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
public static ArrayList<BigDecimal> list(EarningsCalculateSub earningsCalculateSub) {
|
public static ArrayList<BigDecimal> list(EarningsCalculateSub earningsCalculateSub) {
|
||||||
BigDecimal[] bigDecimal = new BigDecimal[49];
|
BigDecimal[] bigDecimal = new BigDecimal[49];
|
||||||
ArrayList<BigDecimal> list = new ArrayList<BigDecimal>(Arrays.asList(bigDecimal));
|
ArrayList<BigDecimal> list = new ArrayList<BigDecimal>(Arrays.asList(bigDecimal));
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.ho.business.mapper.ElecMeterValueMapper;
|
|||||||
import com.ho.business.service.ElecMeterValueService;
|
import com.ho.business.service.ElecMeterValueService;
|
||||||
import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
|
import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
|
||||||
import com.ho.business.vo.req.carbin.ElecMeterReq;
|
import com.ho.business.vo.req.carbin.ElecMeterReq;
|
||||||
|
import com.ho.business.vo.resp.profit.DayProfitType;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ public class ElecMeterValueServiceImpl implements ElecMeterValueService {
|
|||||||
@Override
|
@Override
|
||||||
public BigDecimal selectSumByType(Integer stationId, Integer type, String beginTime, String endTime,Integer srcId) {
|
public BigDecimal selectSumByType(Integer stationId, Integer type, String beginTime, String endTime,Integer srcId) {
|
||||||
BigDecimal sum = elecMeterValueMapper.selectSumByType(stationId, type, beginTime, endTime,srcId);
|
BigDecimal sum = elecMeterValueMapper.selectSumByType(stationId, type, beginTime, endTime,srcId);
|
||||||
return sum;
|
return sum == null ? BigDecimal.ZERO:sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
//按日期和类型删除
|
//按日期和类型删除
|
||||||
@ -77,7 +78,7 @@ public class ElecMeterValueServiceImpl implements ElecMeterValueService {
|
|||||||
@Override
|
@Override
|
||||||
public BigDecimal selectSumValue(Integer stationId, Integer type,Integer srcId) {
|
public BigDecimal selectSumValue(Integer stationId, Integer type,Integer srcId) {
|
||||||
BigDecimal sum = elecMeterValueMapper.selectSumValue(stationId, type,srcId);
|
BigDecimal sum = elecMeterValueMapper.selectSumValue(stationId, type,srcId);
|
||||||
return sum;
|
return sum == null ? BigDecimal.ZERO:sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -96,4 +97,9 @@ public class ElecMeterValueServiceImpl implements ElecMeterValueService {
|
|||||||
public List<ElecMeterValue> selectGroupByDay(CommonBigScreenReq req) {
|
public List<ElecMeterValue> selectGroupByDay(CommonBigScreenReq req) {
|
||||||
return elecMeterValueMapper.selectGroupByDay(req);
|
return elecMeterValueMapper.selectGroupByDay(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DayProfitType> getElec(String begin, String end, Integer groupId, Integer type,List<Integer> stationIds) {
|
||||||
|
return elecMeterValueMapper.getElec(begin,end,groupId,type,stationIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ho.business.service.impl;
|
|||||||
import cn.hutool.core.date.DateField;
|
import cn.hutool.core.date.DateField;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.ho.business.constant.DeviceTypeConstant;
|
import com.ho.business.constant.DeviceTypeConstant;
|
||||||
import com.ho.business.entity.Device;
|
import com.ho.business.entity.Device;
|
||||||
import com.ho.business.entity.ElecMeterValue;
|
import com.ho.business.entity.ElecMeterValue;
|
||||||
@ -17,10 +18,13 @@ import com.ho.business.vo.req.colCount.ColCountReq;
|
|||||||
import com.ho.business.vo.resp.CountEleData;
|
import com.ho.business.vo.resp.CountEleData;
|
||||||
import com.ho.business.vo.resp.DeviceRespVO;
|
import com.ho.business.vo.resp.DeviceRespVO;
|
||||||
import com.ho.business.vo.resp.ProvinceStation;
|
import com.ho.business.vo.resp.ProvinceStation;
|
||||||
|
import com.ho.business.vo.resp.ShipStationRespVO;
|
||||||
import com.ho.business.vo.resp.colCount.ColCountResp;
|
import com.ho.business.vo.resp.colCount.ColCountResp;
|
||||||
import com.ho.business.vo.resp.iargeScreen.*;
|
import com.ho.business.vo.resp.iargeScreen.*;
|
||||||
|
import com.ho.business.vo.resp.mppt.MpptActiveVo;
|
||||||
import com.ho.business.vo.resp.profit.DayProfitType;
|
import com.ho.business.vo.resp.profit.DayProfitType;
|
||||||
import com.ho.common.tools.constant.CommonConstant;
|
import com.ho.common.tools.constant.CommonConstant;
|
||||||
|
import com.ho.common.tools.constant.RedisKeyConstant;
|
||||||
import com.ho.common.tools.entity.SimpleUser;
|
import com.ho.common.tools.entity.SimpleUser;
|
||||||
import com.ho.common.tools.service.RedisService;
|
import com.ho.common.tools.service.RedisService;
|
||||||
import com.ho.common.tools.util.BigDecimalUtil;
|
import com.ho.common.tools.util.BigDecimalUtil;
|
||||||
@ -77,6 +81,12 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
TranslateProvinceMapper translateProvinceMapper;
|
TranslateProvinceMapper translateProvinceMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
OpenStationService openStationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
EarningsCalculateMpptService earningsCalculateMpptService;
|
||||||
|
|
||||||
|
|
||||||
private final static BigDecimal value = new BigDecimal("0.475");
|
private final static BigDecimal value = new BigDecimal("0.475");
|
||||||
private final static BigDecimal parameter = new BigDecimal("18.3");
|
private final static BigDecimal parameter = new BigDecimal("18.3");
|
||||||
@ -201,6 +211,62 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
return annualOverviewResp;
|
return annualOverviewResp;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
private AnnualPvOverviewResp getPvOverviewDatas(List<Station> list){
|
||||||
|
AnnualPvOverviewResp annualOverviewResp = new AnnualPvOverviewResp();
|
||||||
|
//装机容量
|
||||||
|
BigDecimal capacity = BigDecimal.ZERO;
|
||||||
|
//电站总数
|
||||||
|
Integer stationNumber = list.size();
|
||||||
|
BigDecimal todayIncone = BigDecimal.ZERO;
|
||||||
|
BigDecimal dailyReleaseElec = BigDecimal.ZERO;
|
||||||
|
BigDecimal yearIncone = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalIncome = BigDecimal.ZERO;
|
||||||
|
BigDecimal yearReleaseElec = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalReleaseElec = BigDecimal.ZERO;
|
||||||
|
//今年开始时间、结束时间
|
||||||
|
DateTime begin = DateUtil.beginOfYear(new Date());
|
||||||
|
String beginString = DateUtil.format(begin, CommonConstant.DATE_YMD);
|
||||||
|
String endString = DateUtil.format(DateUtil.endOfYear(new Date()), CommonConstant.DATE_YMD);
|
||||||
|
for (Station station : list) {
|
||||||
|
//装机容量进行累加
|
||||||
|
BigDecimal capacityStation = station.getCapacity();
|
||||||
|
if (capacityStation != null) {
|
||||||
|
capacity = capacity.add(capacityStation);
|
||||||
|
}
|
||||||
|
String key = RedisKeyConstant.PV.STATION_PV_TODAY_PROFIT + station.getId();
|
||||||
|
// 今日收益
|
||||||
|
BigDecimal tIncone = (BigDecimal)redisService.get(key);
|
||||||
|
todayIncone = todayIncone.add(tIncone==null?BigDecimal.ZERO:tIncone);
|
||||||
|
// 年收益
|
||||||
|
BigDecimal yIncone = earningsCalculateMpptService.countAllPvIncome(station.getId(),beginString,endString);
|
||||||
|
yearIncone = yearIncone.add(yIncone);
|
||||||
|
// 累计收益
|
||||||
|
BigDecimal allIncone = earningsCalculateMpptService.countAllPvIncome(station.getId(),null,null);
|
||||||
|
totalIncome = totalIncome.add(allIncone);
|
||||||
|
// 日发电
|
||||||
|
MpptActiveVo todayPv = openStationService.getPvActivePower(station.getId());
|
||||||
|
dailyReleaseElec = dailyReleaseElec.add(todayPv.getDailyReleaseElec());
|
||||||
|
// 年发电
|
||||||
|
BigDecimal yReleaseElec = elecMeterValueService.selectSumByType(station.getId(),DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE,beginString,endString,null);
|
||||||
|
yearReleaseElec = yearReleaseElec.add(yReleaseElec);
|
||||||
|
// 累计发电
|
||||||
|
BigDecimal allReleaseElec = elecMeterValueService.selectSumValue(station.getId(),DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE,null);
|
||||||
|
totalReleaseElec = totalReleaseElec.add(allReleaseElec);
|
||||||
|
}
|
||||||
|
//装机容量、电站数量
|
||||||
|
annualOverviewResp.setCapacity(capacity);
|
||||||
|
annualOverviewResp.setStationNumber(stationNumber);
|
||||||
|
// 今日收益、年收益、累计收益
|
||||||
|
annualOverviewResp.setTodayIncone(todayIncone);
|
||||||
|
annualOverviewResp.setYearIncone(yearIncone.add(todayIncone));
|
||||||
|
annualOverviewResp.setTotalIncome(totalIncome.add(todayIncone));
|
||||||
|
//今日发电量、年发电量、累计发电量
|
||||||
|
annualOverviewResp.setDailyReleaseElec(dailyReleaseElec);
|
||||||
|
annualOverviewResp.setYearReleaseElec(yearReleaseElec.add(dailyReleaseElec));
|
||||||
|
annualOverviewResp.setTotalReleaseElec(totalReleaseElec.add(dailyReleaseElec));
|
||||||
|
return annualOverviewResp;
|
||||||
|
}
|
||||||
|
|
||||||
private AnnualOverviewResp getOverviewDatas(List<Station> list) {
|
private AnnualOverviewResp getOverviewDatas(List<Station> list) {
|
||||||
AnnualOverviewResp annualOverviewResp = new AnnualOverviewResp();
|
AnnualOverviewResp annualOverviewResp = new AnnualOverviewResp();
|
||||||
List<Station> stations = new ArrayList<>();
|
List<Station> stations = new ArrayList<>();
|
||||||
@ -223,22 +289,10 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
BigDecimal dayCharge = BigDecimal.ZERO;
|
BigDecimal dayCharge = BigDecimal.ZERO;
|
||||||
BigDecimal dayDischarge = BigDecimal.ZERO;
|
BigDecimal dayDischarge = BigDecimal.ZERO;
|
||||||
StringBuffer stationDayLog = new StringBuffer();
|
StringBuffer stationDayLog = new StringBuffer();
|
||||||
// ColCountReq colCountReq = new ColCountReq();
|
|
||||||
// colCountReq.setCol(DataCollectConstant.Elec_Meter.TOTAL_CHARGE);
|
|
||||||
// List<Integer> ids = stations.stream().map(Station::getId).collect(Collectors.toList());
|
|
||||||
// colCountReq.setIds(ids);
|
|
||||||
// List<ColCountResp> colCountResps = colCountService.selectByParam(colCountReq);
|
|
||||||
// Map<Integer, String> stationMapAndType = new HashMap<>();
|
|
||||||
// if (colCountResps != null) {
|
|
||||||
// stationMapAndType = colCountResps.stream().collect(Collectors.toMap(ColCountResp::getStationId, ColCountResp::getDeviceType, (k1, k2) -> k1));
|
|
||||||
// }
|
|
||||||
for (Station station : stations) {
|
for (Station station : stations) {
|
||||||
// StationReq req = new StationReq();
|
|
||||||
// req.setStationId(station.getId());
|
|
||||||
// req.setDeviceType(stationMapAndType.get(req.getStationId()));
|
|
||||||
BigDecimal dailyChargeElec = BigDecimal.ZERO;
|
BigDecimal dailyChargeElec = BigDecimal.ZERO;
|
||||||
BigDecimal dailyDischargeElec = BigDecimal.ZERO;
|
BigDecimal dailyDischargeElec = BigDecimal.ZERO;
|
||||||
// CountEleData countEleData = stationHomeService.getCountEleData(req);
|
|
||||||
CountEleData countEleData = getByRedisData(station.getId());
|
CountEleData countEleData = getByRedisData(station.getId());
|
||||||
if (null == countEleData || null == countEleData.getDailyChargeElec() || null == countEleData.getDailyDischargeElec()) {
|
if (null == countEleData || null == countEleData.getDailyChargeElec() || null == countEleData.getDailyDischargeElec()) {
|
||||||
dailyChargeElec = BigDecimal.ZERO;
|
dailyChargeElec = BigDecimal.ZERO;
|
||||||
@ -293,6 +347,19 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
annualOverviewResp.setTotalCharge(incomeShow1.getYearCharge());
|
annualOverviewResp.setTotalCharge(incomeShow1.getYearCharge());
|
||||||
annualOverviewResp.setTotalDischarge(incomeShow1.getYearDischarge());
|
annualOverviewResp.setTotalDischarge(incomeShow1.getYearDischarge());
|
||||||
}
|
}
|
||||||
|
// 寄点站点数据融合
|
||||||
|
stations.forEach(s->{
|
||||||
|
if(s.getId()==11003 || s.getId()==10942 || s.getId()==11006) {
|
||||||
|
// 寄点电站数据
|
||||||
|
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + s.getId();
|
||||||
|
String json = (String) redisService.get(mainKey);
|
||||||
|
ShipStationRespVO respVO = JSON.parseObject(json, ShipStationRespVO.class);
|
||||||
|
// 日充
|
||||||
|
annualOverviewResp.setDayCharge(annualOverviewResp.getDayCharge().add(respVO.getPositivePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(respVO.getPositivePowerToday())));
|
||||||
|
// 日放
|
||||||
|
annualOverviewResp.setDayDischarge(annualOverviewResp.getDayDischarge().add(respVO.getReversePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(respVO.getReversePowerToday())));
|
||||||
|
}
|
||||||
|
});
|
||||||
return annualOverviewResp;
|
return annualOverviewResp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,7 +534,23 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
List<Station> list = stationService.selectAll();
|
List<Station> list = stationService.selectAll();
|
||||||
return getEnergySavingRespVo(list);
|
return getEnergySavingRespVo(list);
|
||||||
}
|
}
|
||||||
|
private EnergySavingRespVo getPvEnergySavingRespVo(List<Station> list){
|
||||||
|
EnergySavingRespVo energySavingRespVo = new EnergySavingRespVo();
|
||||||
|
AnnualPvOverviewResp vo = getPvOverviewDatas(list);
|
||||||
|
BigDecimal totalReleaseElec = vo.getTotalReleaseElec();
|
||||||
|
BigDecimal reductionCO2 = totalReleaseElec.multiply(value);
|
||||||
|
energySavingRespVo.setReductionCO2(reductionCO2);
|
||||||
|
|
||||||
|
//等效植树量 等效植树量=等效减排CO2/183/40
|
||||||
|
BigDecimal treePlanting = reductionCO2.divide(parameter, 6, BigDecimal.ROUND_HALF_UP).divide(fours, 6, BigDecimal.ROUND_HALF_UP);
|
||||||
|
energySavingRespVo.setTreePlanting(treePlanting);
|
||||||
|
//等效节约煤 等效节约煤=所有电站总充*节约标准煤转换系数(04)
|
||||||
|
BigDecimal equivalentCoal = totalReleaseElec.multiply(four);
|
||||||
|
energySavingRespVo.setEquivalentCoal(equivalentCoal);
|
||||||
|
//等效经济收入 等效经济收入=等效节约煤*煤价 (600元/吨) 等效节约煤此处单位为kg,故而单价调整为0.6元/kg
|
||||||
|
energySavingRespVo.setIncome(equivalentCoal.multiply(coalPrice));
|
||||||
|
return energySavingRespVo;
|
||||||
|
}
|
||||||
private EnergySavingRespVo getEnergySavingRespVo(List<Station> list) {
|
private EnergySavingRespVo getEnergySavingRespVo(List<Station> list) {
|
||||||
EnergySavingRespVo energySavingRespVo = new EnergySavingRespVo();
|
EnergySavingRespVo energySavingRespVo = new EnergySavingRespVo();
|
||||||
List<Station> stations = new ArrayList<>();
|
List<Station> stations = new ArrayList<>();
|
||||||
@ -518,6 +601,56 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
return subdataList;
|
return subdataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Subdata> getPvElec(String beginString, String endString, List<Station> stations){
|
||||||
|
Map<Integer, Station> stationMap = stations.stream().collect(Collectors.toMap(Station::getId, Function.identity()));
|
||||||
|
Integer groupId = null;
|
||||||
|
for (Station station : stations) {
|
||||||
|
groupId = station.getGroupId();
|
||||||
|
}
|
||||||
|
List<DayProfitType> stationElec = elecMeterValueService.getElec(beginString, endString, groupId,DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE,null);
|
||||||
|
Map<Integer, List<DayProfitType>> profitMap = stationElec.stream().collect(Collectors.groupingBy(DayProfitType::getStationId));
|
||||||
|
//创建返回对象
|
||||||
|
List<Subdata> subdataList = new ArrayList<>();
|
||||||
|
profitMap.forEach((k, v) -> {
|
||||||
|
Subdata subdata = new Subdata();
|
||||||
|
//收益
|
||||||
|
BigDecimal result = v.stream().map(DayProfitType::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add);
|
||||||
|
if (stationMap.containsKey(k)) {
|
||||||
|
Station station = stationMap.get(k);
|
||||||
|
subdata.setStationId(k);
|
||||||
|
subdata.setStationName(station.getName());
|
||||||
|
subdata.setRelease(result);
|
||||||
|
subdataList.add(subdata);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
subdataList.sort(Comparator.comparing((Subdata::getIncomeValue)).reversed());
|
||||||
|
return subdataList;
|
||||||
|
}
|
||||||
|
private List<Subdata> getPvSubdata(String beginString, String endString, List<Station> stations){
|
||||||
|
Map<Integer, Station> stationMap = stations.stream().collect(Collectors.toMap(Station::getId, Function.identity()));
|
||||||
|
Integer groupId = null;
|
||||||
|
for (Station station : stations) {
|
||||||
|
groupId = station.getGroupId();
|
||||||
|
}
|
||||||
|
List<DayProfitType> stationProfit = earningsCalculateMpptService.getProfit(beginString, endString, groupId);
|
||||||
|
Map<Integer, List<DayProfitType>> profitMap = stationProfit.stream().collect(Collectors.groupingBy(DayProfitType::getStationId));
|
||||||
|
//创建返回对象
|
||||||
|
List<Subdata> subdataList = new ArrayList<>();
|
||||||
|
profitMap.forEach((k, v) -> {
|
||||||
|
Subdata subdata = new Subdata();
|
||||||
|
//收益
|
||||||
|
BigDecimal result = v.stream().map(DayProfitType::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add);
|
||||||
|
if (stationMap.containsKey(k)) {
|
||||||
|
Station station = stationMap.get(k);
|
||||||
|
subdata.setStationId(k);
|
||||||
|
subdata.setStationName(station.getName());
|
||||||
|
subdata.setIncomeValue(result);
|
||||||
|
subdataList.add(subdata);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
subdataList.sort(Comparator.comparing((Subdata::getIncomeValue)).reversed());
|
||||||
|
return subdataList;
|
||||||
|
}
|
||||||
@NotNull
|
@NotNull
|
||||||
private List<Subdata> getSubdata(String beginString, String endString, List<Station> stations) {
|
private List<Subdata> getSubdata(String beginString, String endString, List<Station> stations) {
|
||||||
Map<Integer, Station> stationMap = stations.stream().collect(Collectors.toMap(Station::getId, Function.identity()));
|
Map<Integer, Station> stationMap = stations.stream().collect(Collectors.toMap(Station::getId, Function.identity()));
|
||||||
@ -571,6 +704,76 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
return subdataList;
|
return subdataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Subdata> getPvElecByDay(String beginString, String endString, List<Station> stations){
|
||||||
|
Map<Integer, Station> stationMap = stations.stream().collect(Collectors.toMap(Station::getId, Function.identity()));
|
||||||
|
Integer groupId = null;
|
||||||
|
List<Integer> ids = new ArrayList<>();
|
||||||
|
for (Station station : stations) {
|
||||||
|
groupId = station.getGroupId();
|
||||||
|
ids.add(station.getId());
|
||||||
|
}
|
||||||
|
CommonBigScreenReq req = new CommonBigScreenReq();
|
||||||
|
req.setBeginTime(beginString);
|
||||||
|
req.setEndTime(endString);
|
||||||
|
req.setStationIds(ids);
|
||||||
|
req.setGroupId(groupId);
|
||||||
|
List<DayProfitType> stationElec = elecMeterValueService.getElec(beginString, endString, groupId,DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE,ids);
|
||||||
|
Map<String, List<DayProfitType>> elecMap = stationElec.stream().collect(Collectors.groupingBy(s -> s.getStationId() + "," + s.getDay()));
|
||||||
|
//创建返回对象
|
||||||
|
List<Subdata> subdataList = new ArrayList<>();
|
||||||
|
elecMap.forEach((k, v) -> {
|
||||||
|
Subdata subdata = new Subdata();
|
||||||
|
// 收益
|
||||||
|
BigDecimal result = v.stream().map(DayProfitType::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add);
|
||||||
|
String[] split = k.split(",");
|
||||||
|
Integer stationId = Integer.parseInt(split[0]);
|
||||||
|
if (stationMap.containsKey(stationId)) {
|
||||||
|
Station station = stationMap.get(stationId);
|
||||||
|
subdata.setStationId(stationId);
|
||||||
|
subdata.setStationName(split[1] + station.getName());
|
||||||
|
subdata.setRelease(result);
|
||||||
|
subdataList.add(subdata);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
subdataList.sort(Comparator.comparing((Subdata::getIncomeValue)).reversed());
|
||||||
|
return subdataList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Subdata> getPvSubdataByDay(String beginString, String endString, List<Station> stations){
|
||||||
|
Map<Integer, Station> stationMap = stations.stream().collect(Collectors.toMap(Station::getId, Function.identity()));
|
||||||
|
Integer groupId = null;
|
||||||
|
List<Integer> ids = new ArrayList<>();
|
||||||
|
for (Station station : stations) {
|
||||||
|
groupId = station.getGroupId();
|
||||||
|
ids.add(station.getId());
|
||||||
|
}
|
||||||
|
CommonBigScreenReq req = new CommonBigScreenReq();
|
||||||
|
req.setBeginTime(beginString);
|
||||||
|
req.setEndTime(endString);
|
||||||
|
req.setStationIds(ids);
|
||||||
|
req.setGroupId(groupId);
|
||||||
|
List<DayProfitType> stationProfit = earningsCalculateMpptService.getEarningsByParam(req);
|
||||||
|
Map<String, List<DayProfitType>> profitMap = stationProfit.stream().collect(Collectors.groupingBy(s -> s.getStationId() + "," + s.getDay()));
|
||||||
|
//创建返回对象
|
||||||
|
List<Subdata> subdataList = new ArrayList<>();
|
||||||
|
profitMap.forEach((k, v) -> {
|
||||||
|
Subdata subdata = new Subdata();
|
||||||
|
// 收益
|
||||||
|
BigDecimal result = v.stream().map(DayProfitType::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add);
|
||||||
|
String[] split = k.split(",");
|
||||||
|
Integer stationId = Integer.parseInt(split[0]);
|
||||||
|
if (stationMap.containsKey(stationId)) {
|
||||||
|
Station station = stationMap.get(stationId);
|
||||||
|
subdata.setStationId(stationId);
|
||||||
|
subdata.setStationName(split[1] + station.getName());
|
||||||
|
subdata.setIncomeValue(result);
|
||||||
|
subdataList.add(subdata);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
subdataList.sort(Comparator.comparing((Subdata::getIncomeValue)).reversed());
|
||||||
|
return subdataList;
|
||||||
|
}
|
||||||
|
|
||||||
private List<Subdata> getSubdataByDay(String beginString, String endString, List<Station> stations) {
|
private List<Subdata> getSubdataByDay(String beginString, String endString, List<Station> stations) {
|
||||||
Map<Integer, Station> stationMap = stations.stream().collect(Collectors.toMap(Station::getId, Function.identity()));
|
Map<Integer, Station> stationMap = stations.stream().collect(Collectors.toMap(Station::getId, Function.identity()));
|
||||||
@ -967,48 +1170,15 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<ProvinceStation> getProvince(List<Station> stations) {
|
private List<ProvinceStation> getProvince(List<Station> stations) {
|
||||||
//地址选取前三个字
|
Map<String, List<Station>> natioMap = stations.stream().filter(s->s.getProvince()!=null).collect(Collectors.groupingBy(Station::getNation));
|
||||||
// Map<String, List<Station>> provincesMap = stations.stream().sorted(Comparator.comparing(Station::getName)).collect(Collectors.groupingBy(s -> {
|
List<ProvinceStation> list = new ArrayList<>();
|
||||||
// return s.getAddress().substring(0, 3);
|
natioMap.forEach((k, v) -> {
|
||||||
// }));
|
|
||||||
// //创建返回值集合
|
|
||||||
// List<ProvinceStation> provinceList = new ArrayList<>();
|
|
||||||
// provincesMap.forEach((k, v) -> {
|
|
||||||
// ProvinceStation provinceStation = new ProvinceStation();
|
|
||||||
// if (k.contains("省")) {
|
|
||||||
// provinceStation.setName(k.replace("省", ""));
|
|
||||||
// } else if (k.contains("广西")) {
|
|
||||||
// provinceStation.setName(CommonConstant.ChineseProvinces.guangxi);
|
|
||||||
// } else if (k.contains("宁夏")) {
|
|
||||||
// provinceStation.setName(CommonConstant.ChineseProvinces.ningxia);
|
|
||||||
// } else if (k.contains("内蒙古")) {
|
|
||||||
// provinceStation.setName(CommonConstant.ChineseProvinces.neimenggu);
|
|
||||||
// } else if (k.contains("新疆")) {
|
|
||||||
// provinceStation.setName(CommonConstant.ChineseProvinces.xinjiang);
|
|
||||||
// } else if (k.contains("西藏")) {
|
|
||||||
// provinceStation.setName(CommonConstant.ChineseProvinces.xizang);
|
|
||||||
// } else if (k.contains("香港")) {
|
|
||||||
// provinceStation.setName(CommonConstant.ChineseProvinces.xianggang);
|
|
||||||
// } else if (k.contains("澳门")) {
|
|
||||||
// provinceStation.setName(CommonConstant.ChineseProvinces.aomen);
|
|
||||||
// } else {
|
|
||||||
// provinceStation.setName(k.replaceFirst("市", ""));
|
|
||||||
// }
|
|
||||||
// provinceStation.setList(v);
|
|
||||||
// provinceList.add(provinceStation);
|
|
||||||
// });
|
|
||||||
List<TranslateProvince> dictProvince = translateProvinceMapper.getDictProvince();
|
|
||||||
Map<String, String> provinceMap = dictProvince.stream().collect(Collectors.toMap(s -> s.getName(), s -> s.getNameEn(), (k1, k2) -> k1));
|
|
||||||
Map<String, List<Station>> provincesMap = stations.stream().filter(s->s.getProvince()!=null).collect(Collectors.groupingBy(Station::getProvince));
|
|
||||||
List<ProvinceStation> provinceList = new ArrayList<>();
|
|
||||||
provincesMap.forEach((k, v) -> {
|
|
||||||
ProvinceStation provinceStation = new ProvinceStation();
|
ProvinceStation provinceStation = new ProvinceStation();
|
||||||
provinceStation.setName(k);
|
provinceStation.setName(k);
|
||||||
provinceStation.setNameEn(provinceMap.get(k));
|
|
||||||
provinceStation.setList(v);
|
provinceStation.setList(v);
|
||||||
provinceList.add(provinceStation);
|
list.add(provinceStation);
|
||||||
});
|
});
|
||||||
return provinceList;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1064,6 +1234,36 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
return getAnnualChartValues(stations);
|
return getAnnualChartValues(stations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<AnnualChartValue> getAnnualReleaseValues(List<Station> stations){
|
||||||
|
Integer groupId = null;
|
||||||
|
for (Station station : stations) {
|
||||||
|
groupId = station.getGroupId();
|
||||||
|
}
|
||||||
|
//时间(近30天)
|
||||||
|
Date date = DateUtil.yesterday();
|
||||||
|
Date startDate = DateUtils.addDays(date, -maxSize);
|
||||||
|
Date endDate = DateUtil.endOfDay(date);
|
||||||
|
List<DateTime> dateTimes = DateUtil.rangeToList(startDate, endDate, DateField.DAY_OF_MONTH);
|
||||||
|
String beginTime = DateUtil.format(startDate, CommonConstant.DATE_YMD);
|
||||||
|
String endTime = DateUtil.format(endDate, CommonConstant.DATE_YMD);
|
||||||
|
List<DayProfitType> stationElec = elecMeterValueService.getElec(beginTime, endTime, groupId,DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE,null);
|
||||||
|
Map<String, List<DayProfitType>> elecMap = stationElec.stream().collect(Collectors.groupingBy(s -> s.getDay()));
|
||||||
|
List<AnnualChartValue> resultList = new ArrayList<>();
|
||||||
|
for (DateTime dateTime:dateTimes){
|
||||||
|
AnnualChartValue annualChartValue = new AnnualChartValue();
|
||||||
|
BigDecimal release = BigDecimal.ZERO;
|
||||||
|
String time = DateUtil.format(dateTime, CommonConstant.DATE_YMD);
|
||||||
|
List<DayProfitType> elecList = elecMap.get(time);
|
||||||
|
if(elecList != null && elecList.size()>0){
|
||||||
|
release = elecList.stream().map(DayProfitType::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add);
|
||||||
|
}
|
||||||
|
annualChartValue.setTime(time);
|
||||||
|
annualChartValue.setRelease(release);
|
||||||
|
resultList.add(annualChartValue);
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
private List<AnnualChartValue> getAnnualChartValues(List<Station> stations) {
|
private List<AnnualChartValue> getAnnualChartValues(List<Station> stations) {
|
||||||
//时间(近30天)
|
//时间(近30天)
|
||||||
Date date = DateUtil.yesterday();
|
Date date = DateUtil.yesterday();
|
||||||
@ -1133,47 +1333,6 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
annualChartValue.setDayDischarge(totalDischarge);
|
annualChartValue.setDayDischarge(totalDischarge);
|
||||||
resultList.add(annualChartValue);
|
resultList.add(annualChartValue);
|
||||||
}
|
}
|
||||||
/*********************************************************/
|
|
||||||
// List<AnnualChartValue> annualChartList = new ArrayList<>();
|
|
||||||
// annualChartList = dateTimes.stream().map(s -> {
|
|
||||||
// AnnualChartValue annualChartValue = new AnnualChartValue();
|
|
||||||
// String dateString = s + "";
|
|
||||||
// String substring = dateString.substring(0, 10);
|
|
||||||
// annualChartValue.setTime(substring);
|
|
||||||
// annualChartValue.setDayCharge(BigDecimal.ZERO);
|
|
||||||
// annualChartValue.setDayDischarge(BigDecimal.ZERO);
|
|
||||||
// return annualChartValue;
|
|
||||||
// }).collect(Collectors.toList());
|
|
||||||
// for (AnnualChartValue annualChartValue : annualChartList) {
|
|
||||||
// String time = annualChartValue.getTime();
|
|
||||||
// //年总充/年总放(日冻结表计算)或者总充/总放
|
|
||||||
// BigDecimal yearCharge = BigDecimal.ZERO;
|
|
||||||
// BigDecimal yearDischarge = BigDecimal.ZERO;
|
|
||||||
// List<ElecMeterValue> byTimeList = getByTimeList(stations, time, time);
|
|
||||||
// List<ElecMeterValue> chargeList = new ArrayList<>();
|
|
||||||
// byTimeList.stream().filter(i -> DeviceTypeConstant.ELEC_METER_VALUE_TYPE.CHARGE.equals(i.getType())).forEach(s -> chargeList.add(s));
|
|
||||||
// List<ElecMeterValue> disList = new ArrayList<>();
|
|
||||||
// byTimeList.stream().filter(i -> DeviceTypeConstant.ELEC_METER_VALUE_TYPE.DISCHARGE.equals(i.getType())).forEach(s -> disList.add(s));
|
|
||||||
// for (ElecMeterValue elecMeterValue : chargeList) {
|
|
||||||
// if (FENGStationId == elecMeterValue.getStationId()) {
|
|
||||||
// yearCharge = yearCharge.add(elecMeterValue.getDigital().multiply(new BigDecimal("1000")));
|
|
||||||
// } else {
|
|
||||||
// yearCharge = yearCharge.add(elecMeterValue.getDigital());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// for (ElecMeterValue elecMeterValue : disList) {
|
|
||||||
// if (FENGStationId == elecMeterValue.getStationId()) {
|
|
||||||
// yearDischarge = yearDischarge.add(elecMeterValue.getDigital().multiply(new BigDecimal("1000")));
|
|
||||||
// } else {
|
|
||||||
// yearDischarge = yearDischarge.add(elecMeterValue.getDigital());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// annualChartValue.setDayCharge(yearCharge);
|
|
||||||
// annualChartValue.setDayDischarge(yearDischarge);
|
|
||||||
// }
|
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1299,6 +1458,34 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
return annualOverviewResp;
|
return annualOverviewResp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AnnualPvOverviewResp getPvOverviewData(List<Integer> stationIds) {
|
||||||
|
if (stationIds == null) {
|
||||||
|
return new AnnualPvOverviewResp();
|
||||||
|
}
|
||||||
|
List<Station> list = getCountPvStations(stationIds);
|
||||||
|
AnnualPvOverviewResp annualOverviewResp = getPvOverviewDatas(list);
|
||||||
|
return annualOverviewResp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnergySavingRespVo getPvEnergySaving(List<Integer> stationIds) {
|
||||||
|
if (stationIds == null) {
|
||||||
|
return new EnergySavingRespVo();
|
||||||
|
}
|
||||||
|
List<Station> list = getCountPvStations(stationIds);
|
||||||
|
return getPvEnergySavingRespVo(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AnnualChartValue> getPVCommonProfitCurve(CockpitReqVO vo, List<Integer> stationIds) {
|
||||||
|
if (stationIds == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<Station> list = getCountPvStations(stationIds);
|
||||||
|
return getPvProfitCurve(vo, list);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Subdata> getCommonRegionList(List<Integer> stationIds) {
|
public List<Subdata> getCommonRegionList(List<Integer> stationIds) {
|
||||||
if (stationIds == null) {
|
if (stationIds == null) {
|
||||||
@ -1306,16 +1493,39 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
}
|
}
|
||||||
List<Station> list = getCountStations(stationIds);
|
List<Station> list = getCountStations(stationIds);
|
||||||
List<Subdata> regionList = new ArrayList<>();
|
List<Subdata> regionList = new ArrayList<>();
|
||||||
Map<String, List<Station>> provinceMap = list.stream().filter(i -> i.getProvince() != null).collect(Collectors.groupingBy(Station::getProvince));
|
Map<String, List<Station>> nationMap = list.stream().filter(i -> i.getProvince() != null).collect(Collectors.groupingBy(Station::getNation));
|
||||||
|
if (nationMap.size() > CommonConstant.ONE) {
|
||||||
|
regionList = getListSubdata(nationMap);
|
||||||
|
} else {
|
||||||
|
Map<String, List<Station>> provinceMap = list.stream().filter(i -> i.getCity() != null).collect(Collectors.groupingBy(Station::getProvince));
|
||||||
if (provinceMap.size() > CommonConstant.ONE) {
|
if (provinceMap.size() > CommonConstant.ONE) {
|
||||||
regionList = getListSubdata(provinceMap);
|
regionList = getListSubdata(provinceMap);
|
||||||
} else {
|
} else {
|
||||||
Map<String, List<Station>> cityMap = list.stream().filter(i -> i.getCity() != null).collect(Collectors.groupingBy(Station::getCity));
|
Map<String, List<Station>> cityMap = list.stream().filter(i -> i.getDistrict() != null).collect(Collectors.groupingBy(Station::getCity));
|
||||||
if (cityMap.size() > CommonConstant.ONE) {
|
|
||||||
regionList = getListSubdata(cityMap);
|
regionList = getListSubdata(cityMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return regionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Subdata> getCommonPvRegionList(List<Integer> stationIds) {
|
||||||
|
if (stationIds == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<Station> list = getCountPvStations(stationIds);
|
||||||
|
List<Subdata> regionList = new ArrayList<>();
|
||||||
|
Map<String, List<Station>> nationMap = list.stream().filter(i -> i.getProvince() != null).collect(Collectors.groupingBy(Station::getNation));
|
||||||
|
if (nationMap.size() > CommonConstant.ONE) {
|
||||||
|
regionList = getListSubdata(nationMap);
|
||||||
} else {
|
} else {
|
||||||
Map<String, List<Station>> districtMap = list.stream().filter(i -> i.getDistrict() != null).collect(Collectors.groupingBy(Station::getDistrict));
|
Map<String, List<Station>> provinceMap = list.stream().filter(i -> i.getCity() != null).collect(Collectors.groupingBy(Station::getProvince));
|
||||||
regionList = getListSubdata(districtMap);
|
if (provinceMap.size() > CommonConstant.ONE) {
|
||||||
|
regionList = getListSubdata(provinceMap);
|
||||||
|
} else {
|
||||||
|
Map<String, List<Station>> cityMap = list.stream().filter(i -> i.getDistrict() != null).collect(Collectors.groupingBy(Station::getCity));
|
||||||
|
regionList = getListSubdata(cityMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return regionList;
|
return regionList;
|
||||||
@ -1332,7 +1542,22 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
}
|
}
|
||||||
return regionList;
|
return regionList;
|
||||||
}
|
}
|
||||||
|
public List<AnnualChartValue> getPvProfitCurve(CockpitReqVO vo, List<Station> stations){
|
||||||
|
List<AnnualChartValue> curveResult = new ArrayList<>();
|
||||||
|
Integer groupId = null;
|
||||||
|
for (Station station : stations) {
|
||||||
|
groupId = station.getGroupId();
|
||||||
|
}
|
||||||
|
if (CommonConstant.DAY.equals(vo.getType())) {
|
||||||
|
setDayPvCurveResult(curveResult, groupId, stations);
|
||||||
|
} else if (CommonConstant.YEAR.equals(vo.getType())) {
|
||||||
|
setYearPVCurveResult(curveResult, groupId, stations);
|
||||||
|
} else {
|
||||||
|
setMonthPvCurveResult(curveResult, groupId, stations);
|
||||||
|
}
|
||||||
|
|
||||||
|
return curveResult;
|
||||||
|
}
|
||||||
public List<AnnualChartValue> getProfitCurve(CockpitReqVO vo, List<Station> stations) {
|
public List<AnnualChartValue> getProfitCurve(CockpitReqVO vo, List<Station> stations) {
|
||||||
List<AnnualChartValue> curveResult = new ArrayList<>();
|
List<AnnualChartValue> curveResult = new ArrayList<>();
|
||||||
Integer groupId = null;
|
Integer groupId = null;
|
||||||
@ -1376,6 +1601,59 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
return getAnnualChartValues(getCountStations(stationIds));
|
return getAnnualChartValues(getCountStations(stationIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AnnualChartValue> getCommonPvRelease(List<Integer> stationIds){
|
||||||
|
if (stationIds == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return getAnnualReleaseValues(getCountPvStations(stationIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Subdata> getPvCommonElec(String beginString, String endString,List<Integer> stationIds){
|
||||||
|
List<Subdata> subdata = new ArrayList<>();
|
||||||
|
if (stationIds == null) {
|
||||||
|
return subdata;
|
||||||
|
}
|
||||||
|
List<Station> countStations = getCountPvStations(stationIds);
|
||||||
|
if (countStations != null && !countStations.isEmpty()) {
|
||||||
|
if (countStations.size() >= CommonConstant.FIVE) {
|
||||||
|
subdata = getPvElec(beginString,endString,countStations);
|
||||||
|
} else {
|
||||||
|
//电站数目小于5个
|
||||||
|
Date date = DateUtil.yesterday();
|
||||||
|
Date startDate = DateUtils.addDays(date, -CommonConstant.FIVE);
|
||||||
|
Date endDate = DateUtil.endOfDay(date);
|
||||||
|
beginString = DateUtil.format(startDate, CommonConstant.DATE_YMD);
|
||||||
|
endString = DateUtil.format(endDate, CommonConstant.DATE_YMD);
|
||||||
|
subdata = getPvElecByDay(beginString, endString, countStations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return subdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Subdata> getPvCommonProfit(String beginString, String endString,List<Integer> stationIds){
|
||||||
|
List<Subdata> subdata = new ArrayList<>();
|
||||||
|
if (stationIds == null) {
|
||||||
|
return subdata;
|
||||||
|
}
|
||||||
|
List<Station> countStations = getCountPvStations(stationIds);
|
||||||
|
if (countStations != null && !countStations.isEmpty()) {
|
||||||
|
if (countStations.size() >= CommonConstant.FIVE) {
|
||||||
|
subdata = getPvSubdata(beginString,endString,countStations);
|
||||||
|
} else {
|
||||||
|
//电站数目小于5个
|
||||||
|
Date date = DateUtil.yesterday();
|
||||||
|
Date startDate = DateUtils.addDays(date, -CommonConstant.FIVE);
|
||||||
|
Date endDate = DateUtil.endOfDay(date);
|
||||||
|
beginString = DateUtil.format(startDate, CommonConstant.DATE_YMD);
|
||||||
|
endString = DateUtil.format(endDate, CommonConstant.DATE_YMD);
|
||||||
|
subdata = getPvSubdataByDay(beginString, endString, countStations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return subdata;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public List<Subdata> getCommonProfit(String beginString, String endString, List<Integer> stationIds) {
|
public List<Subdata> getCommonProfit(String beginString, String endString, List<Integer> stationIds) {
|
||||||
List<Subdata> subdata = new ArrayList<>();
|
List<Subdata> subdata = new ArrayList<>();
|
||||||
@ -1427,6 +1705,16 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
return subdata;
|
return subdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setMonthPvCurveResult(List<AnnualChartValue> curveResult, Integer groupId, List<Station> stations) {
|
||||||
|
Date date = DateUtil.yesterday();
|
||||||
|
Date startDate = DateUtil.beginOfYear(date);
|
||||||
|
Date endDate = DateUtil.endOfDay(date);
|
||||||
|
String begin = DateUtil.format(startDate, CommonConstant.DATE_YMD);
|
||||||
|
String end = DateUtil.format(endDate, CommonConstant.DATE_YMD);
|
||||||
|
List<DateTime> dateTime = DateUtil.rangeToList(startDate, endDate, DateField.MONTH);
|
||||||
|
setPvProfitByDayFormat(curveResult, groupId, dateTime, begin, end, CommonConstant.DATE_YM, stations);
|
||||||
|
}
|
||||||
|
|
||||||
private void setMonthCurveResult(List<AnnualChartValue> curveResult, Integer groupId, List<Station> stations) {
|
private void setMonthCurveResult(List<AnnualChartValue> curveResult, Integer groupId, List<Station> stations) {
|
||||||
Date date = DateUtil.yesterday();
|
Date date = DateUtil.yesterday();
|
||||||
Date startDate = DateUtil.beginOfYear(date);
|
Date startDate = DateUtil.beginOfYear(date);
|
||||||
@ -1437,6 +1725,19 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
setProfitByDayFormat(curveResult, groupId, dateTime, begin, end, CommonConstant.DATE_YM, stations);
|
setProfitByDayFormat(curveResult, groupId, dateTime, begin, end, CommonConstant.DATE_YM, stations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setYearPVCurveResult(List<AnnualChartValue> curveResult, Integer groupId, List<Station> stations) {
|
||||||
|
//查询数据的最小日期
|
||||||
|
Date beginDate = earningsCalculateMpptService.getFirstTime();
|
||||||
|
if(beginDate != null){
|
||||||
|
Date date = DateUtil.yesterday();
|
||||||
|
Date startDate = DateUtil.beginOfYear(beginDate);
|
||||||
|
Date endDate = DateUtil.endOfDay(date);
|
||||||
|
String begin = DateUtil.format(startDate, CommonConstant.DATE_YMD);
|
||||||
|
String end = DateUtil.format(endDate, CommonConstant.DATE_YMD);
|
||||||
|
List<DateTime> dateTime = DateUtil.rangeToList(startDate, endDate, DateField.YEAR);
|
||||||
|
setPvProfitByDayFormat(curveResult, groupId, dateTime, begin, end, CommonConstant.DATE_Y, stations);
|
||||||
|
}
|
||||||
|
}
|
||||||
private void setYearCurveResult(List<AnnualChartValue> curveResult, Integer groupId, List<Station> stations) {
|
private void setYearCurveResult(List<AnnualChartValue> curveResult, Integer groupId, List<Station> stations) {
|
||||||
//查询数据的最小日期
|
//查询数据的最小日期
|
||||||
Date beginDate = earningsCalculateService.getFirstTime();
|
Date beginDate = earningsCalculateService.getFirstTime();
|
||||||
@ -1450,6 +1751,16 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
setProfitByDayFormat(curveResult, groupId, dateTime, begin, end, CommonConstant.DATE_Y, stations);
|
setProfitByDayFormat(curveResult, groupId, dateTime, begin, end, CommonConstant.DATE_Y, stations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void setDayPvCurveResult(List<AnnualChartValue> curveResult, Integer groupId, List<Station> stations) {
|
||||||
|
//开始结束时间为30天
|
||||||
|
Date date = DateUtil.yesterday();
|
||||||
|
Date startDate = DateUtils.addDays(date, -maxSize);
|
||||||
|
Date endDate = DateUtil.endOfDay(date);
|
||||||
|
String begin = DateUtil.format(startDate, CommonConstant.DATE_YMD);
|
||||||
|
String end = DateUtil.format(endDate, CommonConstant.DATE_YMD);
|
||||||
|
List<DateTime> dateTime = DateUtil.rangeToList(startDate, endDate, DateField.DAY_OF_MONTH);
|
||||||
|
setPvProfitByDayFormat(curveResult, groupId, dateTime, begin, end, CommonConstant.DATE_YMD, stations);
|
||||||
|
}
|
||||||
|
|
||||||
private void setDayCurveResult(List<AnnualChartValue> curveResult, Integer groupId, List<Station> stations) {
|
private void setDayCurveResult(List<AnnualChartValue> curveResult, Integer groupId, List<Station> stations) {
|
||||||
//开始结束时间为30天
|
//开始结束时间为30天
|
||||||
@ -1462,6 +1773,37 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
setProfitByDayFormat(curveResult, groupId, dateTime, begin, end, CommonConstant.DATE_YMD, stations);
|
setProfitByDayFormat(curveResult, groupId, dateTime, begin, end, CommonConstant.DATE_YMD, stations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setPvProfitByDayFormat(List<AnnualChartValue> curveResult, Integer groupId, List<DateTime> dateTimes, String begin, String end, String type, List<Station> stations) {
|
||||||
|
Map<Integer, List<Station>> stationMap = stations.stream().collect(Collectors.groupingBy(Station::getId));
|
||||||
|
//查询收益
|
||||||
|
List<DayProfitType> dayProfit = earningsCalculateMpptService.getProfit(begin, end, groupId);
|
||||||
|
//在使用之前将不要的电站过滤
|
||||||
|
List<DayProfitType> profitList = new ArrayList<>();
|
||||||
|
for (DayProfitType dayProfitType : dayProfit) {
|
||||||
|
if (stationMap.containsKey(dayProfitType.getStationId())) {
|
||||||
|
profitList.add(dayProfitType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, List<DayProfitType>> dayMap = profitList.stream().collect(Collectors.groupingBy(DayProfitType::getDay));
|
||||||
|
for (DateTime dateTime : dateTimes) {
|
||||||
|
AnnualChartValue annualChartValue = new AnnualChartValue();
|
||||||
|
String day = DateUtil.format(dateTime, type);
|
||||||
|
List<DayProfitType> dayProfitTypes = new ArrayList<>();
|
||||||
|
Set<String> dayList = dayMap.keySet();
|
||||||
|
for (String key : dayList) {
|
||||||
|
if (key.contains(day)) {
|
||||||
|
dayProfitTypes.addAll(dayMap.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//收益
|
||||||
|
BigDecimal profit = dayProfitTypes.stream().map(DayProfitType::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add);
|
||||||
|
// BigDecimal result = profit.divide(new BigDecimal("10000"));
|
||||||
|
annualChartValue.setProfit(profit);
|
||||||
|
annualChartValue.setTime(day);
|
||||||
|
curveResult.add(annualChartValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setProfitByDayFormat(List<AnnualChartValue> curveResult, Integer groupId, List<DateTime> dateTimes, String begin, String end, String type, List<Station> stations) {
|
private void setProfitByDayFormat(List<AnnualChartValue> curveResult, Integer groupId, List<DateTime> dateTimes, String begin, String end, String type, List<Station> stations) {
|
||||||
//直接查询需要的电站
|
//直接查询需要的电站
|
||||||
// List<Station> list = stationService.selectAll();
|
// List<Station> list = stationService.selectAll();
|
||||||
@ -1708,6 +2050,13 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
return oneList;
|
return oneList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Station> getCountPvStations(List<Integer> stationIds) {
|
||||||
|
List<Station> list = stationService.selectStationsByIds(stationIds);
|
||||||
|
List<Station> oneList = list.stream().filter(i -> CommonConstant.ONE.equals(i.getStatus()) && CommonConstant.ONE.equals(i.getInverterFlag())).collect(Collectors.toList());
|
||||||
|
return oneList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Subdata> getCommonCapacity(List<Integer> stationIds) {
|
public List<Subdata> getCommonCapacity(List<Integer> stationIds) {
|
||||||
List<Subdata> subDataList = new ArrayList<>();
|
List<Subdata> subDataList = new ArrayList<>();
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ho.business.constant.DeviceTypeConstant;
|
import com.ho.business.constant.DeviceTypeConstant;
|
||||||
@ -22,11 +23,14 @@ import com.ho.business.vo.resp.DeviceRespVO;
|
|||||||
import com.ho.business.vo.resp.VirtualDeviceColResp;
|
import com.ho.business.vo.resp.VirtualDeviceColResp;
|
||||||
import com.ho.business.vo.resp.cabin.CircleCtrlResp;
|
import com.ho.business.vo.resp.cabin.CircleCtrlResp;
|
||||||
import com.ho.business.vo.resp.colCount.ColCountResp;
|
import com.ho.business.vo.resp.colCount.ColCountResp;
|
||||||
|
import com.ho.business.vo.resp.mppt.MpptActiveVo;
|
||||||
|
import com.ho.business.vo.resp.mppt.MpptVo;
|
||||||
import com.ho.business.vo.resp.openStationHome.OpenStationMiddleOrig;
|
import com.ho.business.vo.resp.openStationHome.OpenStationMiddleOrig;
|
||||||
import com.ho.business.vo.resp.pcsStation.*;
|
import com.ho.business.vo.resp.pcsStation.*;
|
||||||
import com.ho.business.vo.resp.station.ActiveReactivePower;
|
import com.ho.business.vo.resp.station.ActiveReactivePower;
|
||||||
import com.ho.common.tools.constant.CommonConstant;
|
import com.ho.common.tools.constant.CommonConstant;
|
||||||
import com.ho.common.tools.constant.DefineConstant;
|
import com.ho.common.tools.constant.DefineConstant;
|
||||||
|
import com.ho.common.tools.constant.RedisKeyConstant;
|
||||||
import com.ho.common.tools.entity.PointCurveSrcCol;
|
import com.ho.common.tools.entity.PointCurveSrcCol;
|
||||||
import com.ho.common.tools.exception.BaseResponseCode;
|
import com.ho.common.tools.exception.BaseResponseCode;
|
||||||
import com.ho.common.tools.exception.BusinessException;
|
import com.ho.common.tools.exception.BusinessException;
|
||||||
@ -131,6 +135,71 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
}
|
}
|
||||||
return acList;
|
return acList;
|
||||||
}
|
}
|
||||||
|
public MpptActiveVo getPvActivePower(Integer stationId){
|
||||||
|
DeviceReqVO deviceReqVO = new DeviceReqVO();
|
||||||
|
deviceReqVO.setStationId(stationId);
|
||||||
|
List<DeviceRespVO> pcsList = deviceService.getListByDeviceType(stationId, DeviceTypeConstant.MPPT);
|
||||||
|
if(pcsList.isEmpty()){
|
||||||
|
pcsList = deviceService.getListByFuzzyDeviceType(stationId, DeviceTypeConstant.MPPT);
|
||||||
|
}
|
||||||
|
MpptActiveVo mpptActiveVo =new MpptActiveVo();
|
||||||
|
BigDecimal pvActivePower = new BigDecimal(CommonConstant.ZERO);
|
||||||
|
BigDecimal totalRelease = new BigDecimal(CommonConstant.ZERO);
|
||||||
|
BigDecimal dailyReleaseElec = new BigDecimal(CommonConstant.ZERO);
|
||||||
|
String nowDay = DateUtil.format(new Date(), CommonConstant.DATE_YMD);
|
||||||
|
if (!pcsList.isEmpty()) {
|
||||||
|
for (DeviceRespVO deviceRespVO : pcsList) {
|
||||||
|
//在缓存里拿映射字段
|
||||||
|
String key = deviceRespVO.getDeviceType() + ":" + stationId + ":" + deviceRespVO.getSrcId();
|
||||||
|
if (redisService.hasKey(key)) {
|
||||||
|
Map<Object, Object> mpptMap = redisService.hgetall(key);
|
||||||
|
if (mpptMap != null) {
|
||||||
|
MpptVo vo = JSON.parseObject(JSON.toJSONString(mpptMap), MpptVo.class);
|
||||||
|
if (vo != null) {
|
||||||
|
// 今日功率
|
||||||
|
BigDecimal pvActivePowerMppt = BigDecimal.ZERO;
|
||||||
|
if(vo.getPvActivePower() != null){
|
||||||
|
if(nowDay.equals(DateUtil.format(vo.getPvActivePower().getUpdateTime(), CommonConstant.DATE_YMD))){
|
||||||
|
pvActivePowerMppt = vo.getPvActivePower().getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 累计发电量
|
||||||
|
BigDecimal totalReleaseMppt = vo.getTotalRelease() == null ? BigDecimal.ZERO : vo.getTotalRelease().getValue();
|
||||||
|
// 今日发电起始值
|
||||||
|
BigDecimal pvDailyReleaseStart = BigDecimal.ZERO;
|
||||||
|
if(vo.getPvDailyReleaseStart() != null){
|
||||||
|
if(nowDay.equals(DateUtil.format(vo.getPvDailyReleaseStart().getUpdateTime(), CommonConstant.DATE_YMD))){
|
||||||
|
pvDailyReleaseStart = vo.getPvDailyReleaseStart().getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 今日更新的累计发电量
|
||||||
|
BigDecimal totalReleaseMppt1 = BigDecimal.ZERO;
|
||||||
|
if(vo.getTotalRelease() != null){
|
||||||
|
if(nowDay.equals(DateUtil.format(vo.getTotalRelease().getUpdateTime(), CommonConstant.DATE_YMD))){
|
||||||
|
totalReleaseMppt1 = vo.getTotalRelease().getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计算今日发电量 = 今日更新的累计发电量 - 今日发电起始值
|
||||||
|
BigDecimal dailyReleaseElecMppt = BigDecimal.ZERO;
|
||||||
|
if(totalReleaseMppt1.compareTo(BigDecimal.ZERO)>0&&pvDailyReleaseStart.compareTo(BigDecimal.ZERO)>0){
|
||||||
|
dailyReleaseElecMppt = totalReleaseMppt1.subtract(pvDailyReleaseStart);
|
||||||
|
}
|
||||||
|
// 如果计算到的今日发电量小于0 则设置为0
|
||||||
|
dailyReleaseElecMppt = dailyReleaseElecMppt.compareTo(BigDecimal.ZERO)<0?BigDecimal.ZERO:dailyReleaseElecMppt;
|
||||||
|
// 最后组装值
|
||||||
|
pvActivePower = pvActivePower.add(pvActivePowerMppt);
|
||||||
|
totalRelease = totalRelease.add(totalReleaseMppt);
|
||||||
|
dailyReleaseElec = dailyReleaseElec.add(dailyReleaseElecMppt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mpptActiveVo.setPvActivePower(pvActivePower);
|
||||||
|
mpptActiveVo.setTotalRelease(totalRelease);
|
||||||
|
mpptActiveVo.setDailyReleaseElec(dailyReleaseElec);
|
||||||
|
return mpptActiveVo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActiveReactivePower getAcPower(Integer stationId) {
|
public ActiveReactivePower getAcPower(Integer stationId) {
|
||||||
@ -554,7 +623,7 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportEleData(PcsStationReq req, HttpServletResponse response) {
|
public void exportEleData(PcsStationReq req, HttpServletResponse response,String lang) {
|
||||||
try {
|
try {
|
||||||
List<Integer> stationIds = req.getStationIds();
|
List<Integer> stationIds = req.getStationIds();
|
||||||
List<Station> stations = stationService.selectStationsByIds(stationIds);
|
List<Station> stations = stationService.selectStationsByIds(stationIds);
|
||||||
@ -567,6 +636,10 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
String name = "";
|
String name = "";
|
||||||
String summary = DefineConstant.SUMMARY;
|
String summary = DefineConstant.SUMMARY;
|
||||||
String summaryData = DefineConstant.SUMMARY_DATA_STATION;
|
String summaryData = DefineConstant.SUMMARY_DATA_STATION;
|
||||||
|
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||||
|
summary = DefineConstant.SUMMARY_EN;
|
||||||
|
summaryData = DefineConstant.SUMMARY_DATA_STATION_EN;
|
||||||
|
}
|
||||||
if("segment".equals(segmentType)){
|
if("segment".equals(segmentType)){
|
||||||
List<EarningsCalculateData> totalList = new ArrayList<>();
|
List<EarningsCalculateData> totalList = new ArrayList<>();
|
||||||
BigDecimal chargeTip = BigDecimal.ZERO;
|
BigDecimal chargeTip = BigDecimal.ZERO;
|
||||||
@ -595,7 +668,7 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
name = idNameMap.get(stationId);
|
name = idNameMap.get(stationId);
|
||||||
if(dataList.size()>0){
|
if(dataList.size()>0){
|
||||||
dataList.add(calculateData);
|
dataList.add(calculateData);
|
||||||
setSheetEarningsData(sheetsList, name==null?"":name.replaceAll("/", " "), dataList);
|
setSheetEarningsData(sheetsList, name==null?"":name.replaceAll("/", " "), dataList,lang);
|
||||||
}
|
}
|
||||||
charge = charge.add(calculateData.getChargeElec());
|
charge = charge.add(calculateData.getChargeElec());
|
||||||
discharge = discharge.add(calculateData.getDischargeElec());
|
discharge = discharge.add(calculateData.getDischargeElec());
|
||||||
@ -626,7 +699,7 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
calculateData.setDischargeElec(discharge);
|
calculateData.setDischargeElec(discharge);
|
||||||
calculateData.setDate(summary);
|
calculateData.setDate(summary);
|
||||||
totalList.add(calculateData);
|
totalList.add(calculateData);
|
||||||
setSheetEarningsData(sheetsList, summaryData, totalList);
|
setSheetEarningsData(sheetsList, summaryData, totalList,lang);
|
||||||
}
|
}
|
||||||
ExcelUtil.exportExcel(sheetsList,response);
|
ExcelUtil.exportExcel(sheetsList,response);
|
||||||
}else{
|
}else{
|
||||||
@ -649,7 +722,7 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
name = idNameMap.get(stationId);
|
name = idNameMap.get(stationId);
|
||||||
if(dataList.size()>0){
|
if(dataList.size()>0){
|
||||||
dataList.add(pcsElecData);
|
dataList.add(pcsElecData);
|
||||||
setSheetElecData(sheetsList, name==null?"":name.replaceAll("/", " "), dataList);
|
setSheetElecData(sheetsList, name==null?"":name.replaceAll("/", " "), dataList,lang);
|
||||||
}
|
}
|
||||||
charge = charge.add(pcsElecData.getChargeElec());
|
charge = charge.add(pcsElecData.getChargeElec());
|
||||||
discharge = discharge.add(pcsElecData.getDischargeElec());
|
discharge = discharge.add(pcsElecData.getDischargeElec());
|
||||||
@ -664,7 +737,7 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
pcsElecData.setDischargeElec(discharge);
|
pcsElecData.setDischargeElec(discharge);
|
||||||
pcsElecData.setDate(summary);
|
pcsElecData.setDate(summary);
|
||||||
totalList.add(pcsElecData);
|
totalList.add(pcsElecData);
|
||||||
setSheetElecData(sheetsList, summaryData, totalList);
|
setSheetElecData(sheetsList, summaryData, totalList,lang);
|
||||||
}
|
}
|
||||||
ExcelUtil.exportExcel(sheetsList,response);
|
ExcelUtil.exportExcel(sheetsList,response);
|
||||||
}
|
}
|
||||||
@ -728,6 +801,9 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
String segmentType = req.getSegmentType();
|
String segmentType = req.getSegmentType();
|
||||||
String name = "";
|
String name = "";
|
||||||
String summary = DefineConstant.SUMMARY;
|
String summary = DefineConstant.SUMMARY;
|
||||||
|
if(CommonConstant.langTemp.EN_US.equals(req.getLang())){
|
||||||
|
summary = DefineConstant.SUMMARY_EN;
|
||||||
|
}
|
||||||
if(CommonConstant.SEGMENT.equals(segmentType)){
|
if(CommonConstant.SEGMENT.equals(segmentType)){
|
||||||
List<EarningsCalculateData> resultList = new ArrayList<>();
|
List<EarningsCalculateData> resultList = new ArrayList<>();
|
||||||
BigDecimal chargeTip = BigDecimal.ZERO;
|
BigDecimal chargeTip = BigDecimal.ZERO;
|
||||||
@ -1024,7 +1100,7 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSheetElecData(List<Map<String, Object>> sheetsList, String name, List<PcsElecData> dataList) {
|
private void setSheetElecData(List<Map<String, Object>> sheetsList, String name, List<PcsElecData> dataList,String lang) {
|
||||||
// 创建参数对象(用来设定excel的sheet1内容等信息)
|
// 创建参数对象(用来设定excel的sheet1内容等信息)
|
||||||
ExportParams userExportParams = new ExportParams();
|
ExportParams userExportParams = new ExportParams();
|
||||||
// 设置sheet得名称
|
// 设置sheet得名称
|
||||||
@ -1034,13 +1110,25 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
// title的参数为ExportParams类型,目前仅仅在ExportParams中设置了sheetName
|
// title的参数为ExportParams类型,目前仅仅在ExportParams中设置了sheetName
|
||||||
userExportMap.put("title", userExportParams);
|
userExportMap.put("title", userExportParams);
|
||||||
// 模版导出对应得实体类型
|
// 模版导出对应得实体类型
|
||||||
|
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||||
|
userExportMap.put("entity", PcsElecDataEn.class);
|
||||||
|
List<PcsElecDataEn> enList=new ArrayList<>();
|
||||||
|
dataList.stream().forEach(s->{
|
||||||
|
PcsElecDataEn en = new PcsElecDataEn();
|
||||||
|
BeanUtils.copyProperties(s, en);
|
||||||
|
enList.add(en);
|
||||||
|
});
|
||||||
|
// sheet1中要填充得数据
|
||||||
|
userExportMap.put("data", enList);
|
||||||
|
}else{
|
||||||
userExportMap.put("entity", PcsElecData.class);
|
userExportMap.put("entity", PcsElecData.class);
|
||||||
// sheet1中要填充得数据
|
// sheet1中要填充得数据
|
||||||
userExportMap.put("data", dataList);
|
userExportMap.put("data", dataList);
|
||||||
|
}
|
||||||
sheetsList.add(userExportMap);
|
sheetsList.add(userExportMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSheetEarningsData(List<Map<String, Object>> sheetsList, String name, List<EarningsCalculateData> dataList) {
|
private void setSheetEarningsData(List<Map<String, Object>> sheetsList, String name, List<EarningsCalculateData> dataList,String lang) {
|
||||||
// 创建参数对象(用来设定excel的sheet1内容等信息)
|
// 创建参数对象(用来设定excel的sheet1内容等信息)
|
||||||
ExportParams userExportParams = new ExportParams();
|
ExportParams userExportParams = new ExportParams();
|
||||||
// 设置sheet得名称
|
// 设置sheet得名称
|
||||||
@ -1050,9 +1138,21 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
// title的参数为ExportParams类型,目前仅仅在ExportParams中设置了sheetName
|
// title的参数为ExportParams类型,目前仅仅在ExportParams中设置了sheetName
|
||||||
userExportMap.put("title", userExportParams);
|
userExportMap.put("title", userExportParams);
|
||||||
// 模版导出对应得实体类型
|
// 模版导出对应得实体类型
|
||||||
|
if(CommonConstant.langTemp.EN_US.equals(lang)){
|
||||||
|
userExportMap.put("entity", EarningsCalculateDataEn.class);
|
||||||
|
List<EarningsCalculateDataEn> enList=new ArrayList<>();
|
||||||
|
dataList.stream().forEach(s->{
|
||||||
|
EarningsCalculateDataEn en = new EarningsCalculateDataEn();
|
||||||
|
BeanUtils.copyProperties(s, en);
|
||||||
|
enList.add(en);
|
||||||
|
});
|
||||||
|
// sheet1中要填充得数据
|
||||||
|
userExportMap.put("data", enList);
|
||||||
|
}else{
|
||||||
userExportMap.put("entity", EarningsCalculateData.class);
|
userExportMap.put("entity", EarningsCalculateData.class);
|
||||||
// sheet1中要填充得数据
|
// sheet1中要填充得数据
|
||||||
userExportMap.put("data", dataList);
|
userExportMap.put("data", dataList);
|
||||||
|
}
|
||||||
sheetsList.add(userExportMap);
|
sheetsList.add(userExportMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,29 +174,9 @@ public class OutApiServiceImpl implements OutApiService {
|
|||||||
stations.add(station);
|
stations.add(station);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Integer> groupIds = new ArrayList<>();
|
|
||||||
Map<Integer, List<Station>> groupMap = new HashMap<>();
|
|
||||||
groupIds = stations.stream().map(s -> {
|
|
||||||
return s.getGroupId();
|
|
||||||
}).distinct().collect(Collectors.toList());
|
|
||||||
if (EnvConstant.EXP.equals(env) || EnvConstant.DEV.equals(env)) {
|
|
||||||
//只增加集团为1的
|
|
||||||
//groupIds = new ArrayList<>();
|
|
||||||
//groupIds.add(1);
|
|
||||||
}
|
|
||||||
//groupMap = stations.stream().collect(Collectors.groupingBy(Station::getGroupId));
|
|
||||||
log.info("dayChargeDeal groupMap:" + groupMap);
|
|
||||||
//todo 先用349来跑
|
|
||||||
/* List<Station> stations = new ArrayList<>();
|
|
||||||
Station s349 = stationService.selectById(monitorQuery.getStationId());
|
|
||||||
stations.add(s349);*/
|
|
||||||
String deviceType = DeviceTypeConstant.BMS;
|
String deviceType = DeviceTypeConstant.BMS;
|
||||||
log.info("stations.size:" + stations.size());
|
log.info("stations.size:" + stations.size());
|
||||||
//查询柴发冻结
|
stations = stations.stream().filter(i->i.getId()!=11003 && i.getId()!=10942 && i.getId()!=11006).collect(Collectors.toList());
|
||||||
SysSubDictVO sysSubDictVO = new SysSubDictVO();
|
|
||||||
sysSubDictVO.setType(CommonConstant.CF_FROZEN);
|
|
||||||
Map<String, String> cfMap = userFeignClient.getSysSubDict(sysSubDictVO);
|
|
||||||
for (Station station : stations) {
|
for (Station station : stations) {
|
||||||
try {
|
try {
|
||||||
//先删除站的当日数据
|
//先删除站的当日数据
|
||||||
@ -259,15 +239,6 @@ public class OutApiServiceImpl implements OutApiService {
|
|||||||
//当日的零点时间
|
//当日的零点时间
|
||||||
tdBaseTimeQuery.setBegin(beginOfDay);
|
tdBaseTimeQuery.setBegin(beginOfDay);
|
||||||
tdBaseTimeQuery.setEnd(endOfDay);
|
tdBaseTimeQuery.setEnd(endOfDay);
|
||||||
// if (station.getId() == 349) {
|
|
||||||
// deviceType = deviceRespVO.getDeviceType().split("_")[0];
|
|
||||||
// if (!DeviceTypeConstant.BMS.equals(deviceType)) {
|
|
||||||
// //日充电量
|
|
||||||
// dailyChargeElec = new BigDecimal(CommonConstant.ZERO);
|
|
||||||
// //日放电量
|
|
||||||
// dailyDischargeElec = new BigDecimal(CommonConstant.ZERO);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//查询模型表
|
//查询模型表
|
||||||
DeviceTypeConfig deviceTypeConfig = deviceTypeConfigService.selectByDeviceType(deviceRespVO.getDeviceType(), deviceRespVO.getGroupId());
|
DeviceTypeConfig deviceTypeConfig = deviceTypeConfigService.selectByDeviceType(deviceRespVO.getDeviceType(), deviceRespVO.getGroupId());
|
||||||
if (deviceTypeConfig == null) {
|
if (deviceTypeConfig == null) {
|
||||||
@ -324,16 +295,6 @@ public class OutApiServiceImpl implements OutApiService {
|
|||||||
elecMeterValueService.insert(elecMeterValues);
|
elecMeterValueService.insert(elecMeterValues);
|
||||||
log.info("dayChargeDeal elecMeterValueService.insert OK");
|
log.info("dayChargeDeal elecMeterValueService.insert OK");
|
||||||
}
|
}
|
||||||
if(cfMap!=null && cfMap.size()>0){
|
|
||||||
Integer stationId = station.getId();
|
|
||||||
if(cfMap.get(String.valueOf(stationId))!=null){
|
|
||||||
deviceRespVOS = deviceService.getListByDeviceType(station.getId(), DeviceTypeConstant.CF);
|
|
||||||
if (deviceRespVOS.isEmpty()) {
|
|
||||||
deviceRespVOS = deviceService.getListByFuzzyDeviceType(station.getId(), DeviceTypeConstant.CF);
|
|
||||||
}
|
|
||||||
cfInsert(beginOfDay, endOfDay, dataProcessReqVO, station, deviceRespVOS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -1274,7 +1235,110 @@ public class OutApiServiceImpl implements OutApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dayPVMpptCharge(MonitorQuery monitorQuery){
|
||||||
|
//根据参数计算 beginTime 这天的起止时间
|
||||||
|
SimpleDateFormat sdfDay = new SimpleDateFormat(CommonConstant.DATE_YMD);
|
||||||
|
SimpleDateFormat sdfDateTime = new SimpleDateFormat(CommonConstant.DATE);
|
||||||
|
//转成Date格式
|
||||||
|
String transDayStr = null;
|
||||||
|
//时间格式的交易日期
|
||||||
|
Date transDay = null;
|
||||||
|
if (monitorQuery != null) {
|
||||||
|
if (monitorQuery.getBeginTime() != null) {
|
||||||
|
transDayStr = monitorQuery.getBeginTime();
|
||||||
|
try {
|
||||||
|
transDay = sdfDay.parse(monitorQuery.getBeginTime());
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DateTime yesterdayTime = DateUtil.yesterday();
|
||||||
|
transDayStr = sdfDay.format(yesterdayTime);
|
||||||
|
transDay = yesterdayTime;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DateTime yesterdayTime = DateUtil.yesterday();
|
||||||
|
transDayStr = sdfDay.format(yesterdayTime);
|
||||||
|
transDay = yesterdayTime;
|
||||||
|
}
|
||||||
|
log.info("dayChargeDeal transDay:" + transDay);
|
||||||
|
//昨天的开始时间,昨天的结束时间
|
||||||
|
DateTime beginOfDay = DateUtil.beginOfDay(transDay);
|
||||||
|
DateTime endOfDay = DateUtil.endOfDay(transDay);
|
||||||
|
String beginTime = sdfDateTime.format(beginOfDay);
|
||||||
|
String endTime = sdfDateTime.format(endOfDay);
|
||||||
|
DataProcessReqVO dataProcessReqVO = new DataProcessReqVO();
|
||||||
|
dataProcessReqVO.setStartDayTime(beginTime);
|
||||||
|
dataProcessReqVO.setEndDayTime(endTime);
|
||||||
|
//业务发生日期
|
||||||
|
dataProcessReqVO.setDay(transDayStr);
|
||||||
|
List<Station> stations = stationService.selectAll();
|
||||||
|
stations = stations.stream().filter(i->CommonConstant.ONE.equals(i.getInverterFlag())).collect(Collectors.toList());
|
||||||
|
for (Station station :stations){
|
||||||
|
//先删除站的当日数据
|
||||||
|
List<Integer> typeList = Arrays.asList(
|
||||||
|
DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE
|
||||||
|
);
|
||||||
|
//使用elecMeterValue
|
||||||
|
elecMeterValueService.deleteByStationAndDay(station.getId(), transDayStr, typeList);
|
||||||
|
//光伏总发电量
|
||||||
|
List<DeviceRespVO> deviceRespVOS = deviceService.getListByDeviceType(station.getId(), DeviceTypeConstant.MPPT);
|
||||||
|
if (deviceRespVOS.isEmpty()) {
|
||||||
|
deviceRespVOS = deviceService.getListByFuzzyDeviceType(station.getId(), DeviceTypeConstant.MPPT);
|
||||||
|
}
|
||||||
|
//判断是否存在电表设备
|
||||||
|
if (deviceRespVOS.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
log.info("deviceRespVOS.size():" + deviceRespVOS.size());
|
||||||
|
for (DeviceRespVO deviceRespVO : deviceRespVOS) {
|
||||||
|
//创建远程调用的查询参数
|
||||||
|
TdBaseTimeQuery tdBaseTimeQuery = new TdBaseTimeQuery();
|
||||||
|
//由于mppt没有日发总电量,走计算 昨日最晚总发-昨日做早总发=昨日总发
|
||||||
|
List<ModelDeviceColComp> totalRelease = modelDeviceService.getCompListByType("device", deviceRespVO.getDeviceType(), DataCollectConstant.PV_CHARGE_POINT.TOTAL_RELEASE);
|
||||||
|
Map<Integer, String> colNameMap = new HashMap<>();
|
||||||
|
if (!totalRelease.isEmpty()) {
|
||||||
|
colNameMap.put(deviceRespVO.getSrcId(), totalRelease.get(0).getDeviceCol());
|
||||||
|
}
|
||||||
|
tdBaseTimeQuery.setBeginTime(beginTime);
|
||||||
|
tdBaseTimeQuery.setEndTime(endTime);
|
||||||
|
tdBaseTimeQuery.setSrcId(deviceRespVO.getSrcId());
|
||||||
|
tdBaseTimeQuery.setMap(colNameMap);
|
||||||
|
tdBaseTimeQuery.setGroupId(deviceRespVO.getGroupId());
|
||||||
|
tdBaseTimeQuery.setStationId(deviceRespVO.getStationId());
|
||||||
|
tdBaseTimeQuery.setDeviceType(deviceRespVO.getDeviceType());
|
||||||
|
|
||||||
|
//当日的零点时间
|
||||||
|
tdBaseTimeQuery.setBegin(beginOfDay);
|
||||||
|
tdBaseTimeQuery.setEnd(endOfDay);
|
||||||
|
//查询模型表
|
||||||
|
DeviceTypeConfig deviceTypeConfig = deviceTypeConfigService.selectByDeviceType(deviceRespVO.getDeviceType(), deviceRespVO.getGroupId());
|
||||||
|
if (deviceTypeConfig == null) {
|
||||||
|
log.info("电站{}未匹配到模型{}", deviceRespVO.getStationId(), deviceRespVO.getDeviceType());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
tdBaseTimeQuery.setModelName(deviceTypeConfig.getModelName());
|
||||||
|
//远程调用查询
|
||||||
|
log.info("查设备数据: start :" + new Date());
|
||||||
|
DataResult<StationHomeRespVo> result = tdFeignClient.getToDayPVMpptCharge(tdBaseTimeQuery);
|
||||||
|
log.info("dayChargeDeal tdFeignClient.getTodayPowerGeneration, result: {}", result);
|
||||||
|
StationHomeRespVo data = result.getData();
|
||||||
|
ElecMeterValue elecMeterValue = new ElecMeterValue();
|
||||||
|
elecMeterValue.setDigital(data.getDigital());
|
||||||
|
elecMeterValue.setSrcId(deviceRespVO.getSrcId());
|
||||||
|
elecMeterValue.setDeptId(station.getDeptId());
|
||||||
|
elecMeterValue.setStationId(station.getId());
|
||||||
|
elecMeterValue.setGroupId(station.getGroupId());
|
||||||
|
elecMeterValue.setDay(dataProcessReqVO.getDay());
|
||||||
|
elecMeterValue.setCreateTime(new Date());
|
||||||
|
elecMeterValue.setType(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE);
|
||||||
|
elecMeterValue.setStatus(CommonConstant.STATUS_FLAG);
|
||||||
|
elecMeterValueService.insert(elecMeterValue);
|
||||||
|
log.info("dayChargeDeal elecMeterValueService.insert OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//加工昨天光伏充放电量
|
//加工昨天光伏充放电量
|
||||||
@Override
|
@Override
|
||||||
public void dayPVCharge(MonitorQuery monitorQuery) {
|
public void dayPVCharge(MonitorQuery monitorQuery) {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateField;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ho.business.constant.DeviceTypeConstant;
|
import com.ho.business.constant.DeviceTypeConstant;
|
||||||
import com.ho.business.entity.*;
|
import com.ho.business.entity.*;
|
||||||
@ -21,10 +22,12 @@ import com.ho.business.vo.req.device.DeviceTypeQuery;
|
|||||||
import com.ho.business.vo.req.dynamicConfig.DynamicConfigQuery;
|
import com.ho.business.vo.req.dynamicConfig.DynamicConfigQuery;
|
||||||
import com.ho.business.vo.req.pcsStation.PcsStationReq;
|
import com.ho.business.vo.req.pcsStation.PcsStationReq;
|
||||||
import com.ho.business.vo.resp.*;
|
import com.ho.business.vo.resp.*;
|
||||||
|
import com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO;
|
||||||
import com.ho.business.vo.resp.cabin.TemperatureHumidityResp;
|
import com.ho.business.vo.resp.cabin.TemperatureHumidityResp;
|
||||||
import com.ho.business.vo.resp.cabin.TemperatureValue;
|
import com.ho.business.vo.resp.cabin.TemperatureValue;
|
||||||
import com.ho.business.vo.resp.colCount.ColCountResp;
|
import com.ho.business.vo.resp.colCount.ColCountResp;
|
||||||
import com.ho.business.vo.resp.dynamicConfig.CurveConfigResp;
|
import com.ho.business.vo.resp.dynamicConfig.CurveConfigResp;
|
||||||
|
import com.ho.business.vo.resp.mppt.MpptActiveVo;
|
||||||
import com.ho.business.vo.resp.pcsStation.OutStationData;
|
import com.ho.business.vo.resp.pcsStation.OutStationData;
|
||||||
import com.ho.business.vo.resp.pcsStation.PcsElecData;
|
import com.ho.business.vo.resp.pcsStation.PcsElecData;
|
||||||
import com.ho.business.vo.resp.pcsStation.PcsStationData;
|
import com.ho.business.vo.resp.pcsStation.PcsStationData;
|
||||||
@ -33,6 +36,7 @@ import com.ho.business.vo.resp.station.ActiveReactivePower;
|
|||||||
import com.ho.business.vo.resp.station.NewRealTimeCurveVo;
|
import com.ho.business.vo.resp.station.NewRealTimeCurveVo;
|
||||||
import com.ho.common.tools.constant.CommonConstant;
|
import com.ho.common.tools.constant.CommonConstant;
|
||||||
import com.ho.common.tools.constant.DefineConstant;
|
import com.ho.common.tools.constant.DefineConstant;
|
||||||
|
import com.ho.common.tools.constant.RedisKeyConstant;
|
||||||
import com.ho.common.tools.entity.PointCurveSrcCol;
|
import com.ho.common.tools.entity.PointCurveSrcCol;
|
||||||
import com.ho.common.tools.exception.BaseResponseCode;
|
import com.ho.common.tools.exception.BaseResponseCode;
|
||||||
import com.ho.common.tools.exception.BusinessException;
|
import com.ho.common.tools.exception.BusinessException;
|
||||||
@ -129,6 +133,10 @@ public class StationHomeServiceImpl implements StationHomeService {
|
|||||||
|
|
||||||
private List<AppRealTimeCurveRespVo> list;
|
private List<AppRealTimeCurveRespVo> list;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
EarningsCalculateMpptService earningsCalculateMpptService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NewRealTimeCurveVo> getRealtimeCurve(StationReq stationReq) {
|
public List<NewRealTimeCurveVo> getRealtimeCurve(StationReq stationReq) {
|
||||||
Station station = stationService.selectById(stationReq.getStationId());
|
Station station = stationService.selectById(stationReq.getStationId());
|
||||||
@ -651,24 +659,6 @@ public class StationHomeServiceImpl implements StationHomeService {
|
|||||||
|
|
||||||
//计算系统转化效率
|
//计算系统转化效率
|
||||||
BigDecimal systemEfficiency = BigDecimal.ZERO;
|
BigDecimal systemEfficiency = BigDecimal.ZERO;
|
||||||
// List<DeviceRespVO> deviceRespVOList = deviceService.getListByDeviceType(stationId, DeviceTypeConstant.OUTSIDE_ELE);
|
|
||||||
// if (!deviceRespVOList.isEmpty()) {
|
|
||||||
// DeviceRespVO deviceRespVO = deviceRespVOList.get(0);
|
|
||||||
// //拼接rediskey
|
|
||||||
// String redisKey = deviceRespVO.getDeviceType() + ":" + stationId + ":" + deviceRespVO.getSrcId();
|
|
||||||
// if (redisService.hasKey(redisKey)) {
|
|
||||||
// Map<Object, Object> map = redisService.hgetall(redisKey);
|
|
||||||
// DeviceTransfer charge = (DeviceTransfer) map.get(DeviceTypeConstant.TOTAL_CHARGE);
|
|
||||||
// DeviceTransfer discharge = (DeviceTransfer) map.get(DeviceTypeConstant.TOTAL_DISCHARGE);
|
|
||||||
//
|
|
||||||
// BigDecimal totalCharge = charge != null ? charge.getValue() : BigDecimal.ZERO;
|
|
||||||
// BigDecimal totalDisCharge = discharge != null ? discharge.getValue() : BigDecimal.ZERO;
|
|
||||||
//
|
|
||||||
// if (!totalCharge.equals(BigDecimal.ZERO)) {
|
|
||||||
// systemEfficiency = totalDisCharge.divide(totalCharge, 4, BigDecimal.ROUND_HALF_UP);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
CountEleData countEleData = getCountEleData(req);
|
CountEleData countEleData = getCountEleData(req);
|
||||||
//总充电量
|
//总充电量
|
||||||
BigDecimal totalChargeElec = countEleData.getTotalChargeElec();
|
BigDecimal totalChargeElec = countEleData.getTotalChargeElec();
|
||||||
@ -678,98 +668,6 @@ public class StationHomeServiceImpl implements StationHomeService {
|
|||||||
BigDecimal dailyChargeElec = countEleData.getDailyChargeElec();
|
BigDecimal dailyChargeElec = countEleData.getDailyChargeElec();
|
||||||
//日放电量
|
//日放电量
|
||||||
BigDecimal dailyDischargeElec = countEleData.getDailyDischargeElec();
|
BigDecimal dailyDischargeElec = countEleData.getDailyDischargeElec();
|
||||||
// //总充电量
|
|
||||||
// BigDecimal totalChargeElec = BigDecimal.ZERO;
|
|
||||||
// //总放电量
|
|
||||||
// BigDecimal totalDischargeElec = BigDecimal.ZERO;
|
|
||||||
// //日充电量 来自于PCS
|
|
||||||
// BigDecimal dailyChargeElec = BigDecimal.ZERO;
|
|
||||||
// //日放电量
|
|
||||||
// BigDecimal dailyDischargeElec = BigDecimal.ZERO;
|
|
||||||
//总充,总放默认来自于 BMS
|
|
||||||
// String deviceType = req.getDeviceType() == null ? DeviceTypeConstant.BMS : req.getDeviceType();
|
|
||||||
// //日充电量开始
|
|
||||||
// BigDecimal dailyChargeStartElec = BigDecimal.ZERO;
|
|
||||||
// //日放电量开始
|
|
||||||
// BigDecimal dailyDischargeStartElec = BigDecimal.ZERO;
|
|
||||||
// boolean hasStart = false;
|
|
||||||
// //总充,总放来自于BMS ,日充, 日放也来自于BMS
|
|
||||||
// List<DeviceRespVO> deviceRespVOS = deviceService.getListByDeviceType(stationId, deviceType);
|
|
||||||
// if(deviceRespVOS.isEmpty()){
|
|
||||||
// deviceRespVOS = deviceService.getListByFuzzyDeviceType(stationId, deviceType);
|
|
||||||
// }
|
|
||||||
// //从缓存中获取累计充电量与放电量
|
|
||||||
// boolean flag = true;
|
|
||||||
// for (DeviceRespVO deviceRespVO : deviceRespVOS) {
|
|
||||||
// //拼接电表缓存key
|
|
||||||
// String redisKey = deviceRespVO.getDeviceType() + ":" + deviceRespVO.getStationId() + ":" + deviceRespVO.getSrcId();
|
|
||||||
// //判断电表换是否存在
|
|
||||||
// if (redisService.hasKey(redisKey)) {
|
|
||||||
// Map<Object, Object> map = redisService.hgetall(redisKey);
|
|
||||||
// if (map != null) {
|
|
||||||
// //总充, 总放
|
|
||||||
// Object objTotalCharge = map.get(DataCollectConstant.Elec_Meter.TOTAL_CHARGE);
|
|
||||||
// if (objTotalCharge instanceof DeviceTransfer) {
|
|
||||||
// DeviceTransfer totalCharge = (DeviceTransfer) map.get(DataCollectConstant.Elec_Meter.TOTAL_CHARGE);
|
|
||||||
// totalChargeElec = totalCharge.getValue() != null ? totalChargeElec.add(totalCharge.getValue()) : totalChargeElec;
|
|
||||||
// }
|
|
||||||
// Object objTotalDischarge = map.get(DataCollectConstant.Elec_Meter.TOTAL_DISCHARGE);
|
|
||||||
// if (objTotalDischarge instanceof DeviceTransfer) {
|
|
||||||
// DeviceTransfer totalDischarge = (DeviceTransfer) map.get(DataCollectConstant.Elec_Meter.TOTAL_DISCHARGE);
|
|
||||||
// totalDischargeElec = totalDischarge.getValue() != null ? totalDischargeElec.add(totalDischarge.getValue()) : totalDischargeElec;
|
|
||||||
// }
|
|
||||||
// //日充
|
|
||||||
// DeviceTransfer dailyChargeObj = (DeviceTransfer) map.get(DataCollectConstant.PCS_POINT.dailyCharge);
|
|
||||||
// log.info("dailyChargeObj:{},stationId:{}", dailyChargeObj, stationId);
|
|
||||||
// if (null != dailyChargeObj) {
|
|
||||||
// DeviceTransfer dailyChargeTransfer = (DeviceTransfer) map.get(DataCollectConstant.PCS_POINT.dailyCharge);
|
|
||||||
// dailyChargeElec = dailyChargeTransfer.getValue() != null ? dailyChargeElec.add(dailyChargeTransfer.getValue()) : dailyChargeElec;
|
|
||||||
// flag = false;
|
|
||||||
// }
|
|
||||||
// //日放
|
|
||||||
// Object dailyDischargeObj = map.get(DataCollectConstant.PCS_POINT.dailyDischarge);
|
|
||||||
// if (dailyDischargeObj instanceof DeviceTransfer) {
|
|
||||||
// DeviceTransfer dailyDischargeTransfer = (DeviceTransfer) map.get(DataCollectConstant.PCS_POINT.dailyDischarge);
|
|
||||||
// dailyDischargeElec = dailyDischargeTransfer.getValue() != null ? dailyDischargeElec.add(dailyDischargeTransfer.getValue()) : dailyDischargeElec;
|
|
||||||
// }
|
|
||||||
// //日充电量开始
|
|
||||||
// DeviceTransfer dailyChargeStart = (DeviceTransfer) map.get(DataCollectConstant.PCS_POINT.DAILY_CHARGE_START);
|
|
||||||
// if(dailyChargeStart!=null){
|
|
||||||
// Date updateTime = dailyChargeStart.getUpdateTime();
|
|
||||||
// DateTime beginOfDay = DateUtil.beginOfDay(new Date());
|
|
||||||
// if(updateTime.getTime()==beginOfDay.getTime()){
|
|
||||||
// dailyChargeStartElec = dailyChargeStart.getValue() != null ? dailyChargeStartElec.add(dailyChargeStart.getValue()) : dailyChargeStartElec;
|
|
||||||
// hasStart = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //日放电量开始
|
|
||||||
// DeviceTransfer dailyDischargeStart = (DeviceTransfer) map.get(DataCollectConstant.PCS_POINT.DAILY_DISCHARGE_START);
|
|
||||||
// if(dailyDischargeStart!=null){
|
|
||||||
// Date updateTime = dailyDischargeStart.getUpdateTime();
|
|
||||||
// DateTime beginOfDay = DateUtil.beginOfDay(new Date());
|
|
||||||
// if(updateTime.getTime()==beginOfDay.getTime()){
|
|
||||||
// dailyDischargeStartElec = dailyDischargeStart.getValue() != null ? dailyDischargeStartElec.add(dailyDischargeStart.getValue()) : dailyDischargeStartElec;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //若查不到,走计算
|
|
||||||
// if (flag) {
|
|
||||||
// if(hasStart){
|
|
||||||
// dailyChargeElec = totalChargeElec.subtract(dailyChargeStartElec);
|
|
||||||
// dailyDischargeElec = totalDischargeElec.subtract(dailyDischargeStartElec);
|
|
||||||
// }else{
|
|
||||||
// MonitorQuery monitorQuery = new MonitorQuery();
|
|
||||||
// monitorQuery.setStationId(stationId);
|
|
||||||
// monitorQuery.setEndTime(req.getEndTime());
|
|
||||||
// JSONObject info = outApiService.getDayChargeDeal(monitorQuery, deviceType);
|
|
||||||
// DeviceTransfer dailyChargeTransfer = (DeviceTransfer) info.get(DataCollectConstant.PCS_POINT.dailyCharge);
|
|
||||||
// dailyChargeElec = dailyChargeTransfer.getValue();
|
|
||||||
// DeviceTransfer dailyDischargeTransfer = (DeviceTransfer) info.get(DataCollectConstant.PCS_POINT.dailyDischarge);
|
|
||||||
// dailyDischargeElec = dailyDischargeTransfer.getValue();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
ColCountReq colCountReq = new ColCountReq();
|
ColCountReq colCountReq = new ColCountReq();
|
||||||
colCountReq.setStationId(station.getId());
|
colCountReq.setStationId(station.getId());
|
||||||
colCountReq.setCol(DataCollectConstant.Elec_Meter.TOTAL_CHARGE);
|
colCountReq.setCol(DataCollectConstant.Elec_Meter.TOTAL_CHARGE);
|
||||||
@ -843,6 +741,26 @@ public class StationHomeServiceImpl implements StationHomeService {
|
|||||||
data.setSystemEfficiency(systemEfficiency);
|
data.setSystemEfficiency(systemEfficiency);
|
||||||
//当前功率
|
//当前功率
|
||||||
ActiveReactivePower acPower = openStationService.getAcPower(stationId);
|
ActiveReactivePower acPower = openStationService.getAcPower(stationId);
|
||||||
|
//2025-11-13 start 储能加入mppt模块开发
|
||||||
|
//如果接入光伏mppt模块-则统计光伏模块监控数据
|
||||||
|
if(DataCollectConstant.ONE.equals(station.getInverterFlag())){
|
||||||
|
//当前功率(光伏)、总发电量、日发电量
|
||||||
|
MpptActiveVo pv = openStationService.getPvActivePower(stationId);
|
||||||
|
data.setPvCurrentPower(pv.getPvActivePower());
|
||||||
|
data.setDailyReleaseElec(pv.getDailyReleaseElec());
|
||||||
|
//计算累计发电量
|
||||||
|
BigDecimal totalReleaseElec = elecMeterValueService.selectSumValue(station.getId(),DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE,null);
|
||||||
|
data.setTotalReleaseElec(totalReleaseElec);
|
||||||
|
//今日收益
|
||||||
|
String key = RedisKeyConstant.PV.STATION_PV_TODAY_PROFIT + station.getId();
|
||||||
|
BigDecimal todayIncone = (BigDecimal)redisService.get(key);
|
||||||
|
data.setTodayIncone(todayIncone);
|
||||||
|
//累计收益
|
||||||
|
BigDecimal totalIncome = earningsCalculateMpptService.countAllPvIncome(station.getId(),null,null);
|
||||||
|
data.setTotalIncome(totalIncome);
|
||||||
|
//额定功率(光伏)
|
||||||
|
data.setPvPower(station.getPvPower());
|
||||||
|
}
|
||||||
if (acPower != null) {
|
if (acPower != null) {
|
||||||
data.setCurrentPower(acPower.getActivePowerPCS());
|
data.setCurrentPower(acPower.getActivePowerPCS());
|
||||||
}
|
}
|
||||||
@ -1042,6 +960,14 @@ public class StationHomeServiceImpl implements StationHomeService {
|
|||||||
dailyDischargeElec = new BigDecimal(dailyDischargeElecStr);
|
dailyDischargeElec = new BigDecimal(dailyDischargeElecStr);
|
||||||
pcsElecData.setChargeElec(dailyChargeElec);
|
pcsElecData.setChargeElec(dailyChargeElec);
|
||||||
pcsElecData.setDischargeElec(dailyDischargeElec);
|
pcsElecData.setDischargeElec(dailyDischargeElec);
|
||||||
|
if(req.getStationId()==11003 || req.getStationId()==10942 || req.getStationId()==11006){
|
||||||
|
// 寄点电站数据
|
||||||
|
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + req.getStationId();
|
||||||
|
String json = (String)redisService.get(mainKey);
|
||||||
|
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
|
||||||
|
pcsElecData.setChargeElec(vo.getPositivePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getPositivePowerToday()));
|
||||||
|
pcsElecData.setDischargeElec(vo.getReversePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getReversePowerToday()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1051,141 +977,58 @@ public class StationHomeServiceImpl implements StationHomeService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PcsElecData> getPvChargeElec(PcsStationReq req) {
|
public List<PowerGenerateRespVO> getPvData(PcsStationReq req) {
|
||||||
req.setDeviceType(DeviceTypeConstant.PLANCURVE);
|
// 获取今日光伏收益
|
||||||
DeviceTransfer countPvData = getCountPvData(req);
|
String type = req.getType();
|
||||||
//创建返回值
|
|
||||||
List<PcsElecData> list = new ArrayList<>();
|
|
||||||
|
|
||||||
//查询冻结值
|
|
||||||
List<Integer> types = new ArrayList<>();
|
|
||||||
//光伏充
|
|
||||||
types.add(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE);
|
|
||||||
|
|
||||||
//根据传入类型判断
|
|
||||||
//当前时间
|
|
||||||
Date end = new Date();
|
Date end = new Date();
|
||||||
String endTime = DateUtil.format(end, CommonConstant.DATE_YMD);
|
String endTime = DateUtil.format(end, CommonConstant.DATE_YMD);
|
||||||
String type = req.getType();
|
List<PowerGenerateRespVO> list = new ArrayList<>();
|
||||||
boolean isToday = true;
|
DateTime begin;
|
||||||
if (CommonConstant.HOUR.equals(type)) {
|
if (CommonConstant.DAY.equals(type)){
|
||||||
return list;
|
begin = DateUtil.offsetDay(end, -6);
|
||||||
} else if (CommonConstant.DAY.equals(type)) {
|
}else if(CommonConstant.MONTH.equals(type)){
|
||||||
//查询最近七天
|
begin = DateUtil.offsetDay(end, -29);
|
||||||
//七天前的时间
|
}else{
|
||||||
DateTime begin = DateUtil.offsetDay(end, -6);
|
|
||||||
String beginTime = DateUtil.format(begin, CommonConstant.DATE_YMD);
|
|
||||||
List<ElecMeterValue> elecMeterValues = elecMeterValueService.selectList(req.getStationId(), types, beginTime, endTime);
|
|
||||||
elecMeterValues = getMeterValues(req, elecMeterValues);
|
|
||||||
//根据天获取时间段
|
|
||||||
List<DateTime> dateTimes = DateUtil.rangeToList(begin, end, DateField.DAY_OF_MONTH);
|
|
||||||
setDataByTime(dateTimes, elecMeterValues, list);
|
|
||||||
//根据类型进行分组
|
|
||||||
// Map<Integer, List<ElecMeterValue>> map = elecMeterValues.stream().collect(Collectors.groupingBy(ElecMeterValue::getType));
|
|
||||||
// setDataByTime(dateTimes, map, list);
|
|
||||||
} else if (CommonConstant.RANGE_TIME.equals(type)) {
|
|
||||||
list = new ArrayList<>();
|
|
||||||
//查询时间范围数据
|
|
||||||
List<Integer> typeHourList = new ArrayList<>();
|
|
||||||
typeHourList.add(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.HOUR_CHARGE);
|
|
||||||
typeHourList.add(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.HOUR_DISCHARGE);
|
|
||||||
DateTime begin = new DateTime(DateUtils.addDays(new DateTime(req.getBeginTime()), -1));
|
|
||||||
DateTime dateTime = new DateTime(req.getEndTime());
|
|
||||||
String beginTime = DateUtil.format(begin, CommonConstant.DATE);
|
|
||||||
List<ElecMeterValue> elecMeterValues = elecMeterValueService.selectList(req.getStationId(), typeHourList, beginTime, req.getEndTime());
|
|
||||||
Map<Integer, List<ElecMeterValue>> map = elecMeterValues.stream().collect(Collectors.groupingBy(ElecMeterValue::getType));
|
|
||||||
List<DateTime> days = DateUtil.rangeToList(begin, dateTime, DateField.DAY_OF_MONTH);
|
|
||||||
setRangeTime(days, map, list);
|
|
||||||
} else if (CommonConstant.MONTH.equals(type)) {
|
|
||||||
//七天前的时间
|
|
||||||
DateTime begin = DateUtil.offsetDay(end, -29);
|
|
||||||
String beginTime = DateUtil.format(begin, CommonConstant.DATE_YMD);
|
|
||||||
List<ElecMeterValue> elecMeterValues = elecMeterValueService.selectList(req.getStationId(), types, beginTime, endTime);
|
|
||||||
elecMeterValues = getMeterValues(req, elecMeterValues);
|
|
||||||
//根据天获取时间段
|
|
||||||
List<DateTime> dateTimes = DateUtil.rangeToList(begin, end, DateField.DAY_OF_MONTH);
|
|
||||||
setDataByTime(dateTimes, elecMeterValues, list);
|
|
||||||
//根据类型进行分组
|
|
||||||
// Map<Integer, List<ElecMeterValue>> map = elecMeterValues.stream().collect(Collectors.groupingBy(ElecMeterValue::getType));
|
|
||||||
// setDataByTime(dateTimes, map, list);
|
|
||||||
} else if (CommonConstant.YEAR.equals(type)) {
|
|
||||||
DateTime begin = DateUtil.offsetDay(end, -364);
|
|
||||||
String beginTime = DateUtil.format(begin, CommonConstant.DATE_YMD);
|
|
||||||
List<ElecMeterValue> elecMeterValues = elecMeterValueService.selectList(req.getStationId(), types, beginTime, endTime);
|
|
||||||
elecMeterValues = getMeterValues(req, elecMeterValues);
|
|
||||||
//根据类型进行分组
|
|
||||||
Map<Integer, List<ElecMeterValue>> map = elecMeterValues.stream().collect(Collectors.groupingBy(ElecMeterValue::getType));
|
|
||||||
//充电量
|
|
||||||
List<ElecMeterValue> chargeList = map.get(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.CHARGE);
|
|
||||||
Map<String, List<ElecMeterValue>> monthChargeList = new HashMap<>();
|
|
||||||
if (chargeList != null) {
|
|
||||||
monthChargeList = chargeList.stream().collect(Collectors.groupingBy(s -> {
|
|
||||||
String month = s.getDay().substring(0, 7);
|
|
||||||
return month;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
//放电量
|
|
||||||
List<ElecMeterValue> dischargeList = map.get(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.DISCHARGE);
|
|
||||||
Map<String, List<ElecMeterValue>> monthDischargeList = new HashMap<>();
|
|
||||||
if (dischargeList != null) {
|
|
||||||
monthDischargeList = dischargeList.stream().collect(Collectors.groupingBy(s -> {
|
|
||||||
String month = s.getDay().substring(0, 7);
|
|
||||||
return month;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
//根据天获取时间段
|
|
||||||
List<DateTime> dateTimes = DateUtil.rangeToList(begin, end, DateField.MONTH);
|
|
||||||
for (DateTime dateTime : dateTimes) {
|
|
||||||
String yearMonth = DateUtil.format(dateTime, CommonConstant.DATE_YM);
|
|
||||||
PcsElecData pcsElecData = new PcsElecData();
|
|
||||||
pcsElecData.setDate(yearMonth);
|
|
||||||
BigDecimal charge = BigDecimal.ZERO;
|
|
||||||
BigDecimal disCharge = BigDecimal.ZERO;
|
|
||||||
//按yyyy-MM分组
|
|
||||||
//分别计算充电,放电
|
|
||||||
if (monthChargeList.containsKey(yearMonth)) {
|
|
||||||
List<ElecMeterValue> elecMeterValues1 = monthChargeList.get(yearMonth);
|
|
||||||
for (ElecMeterValue elecMeterValue : elecMeterValues1) {
|
|
||||||
charge = charge.add(elecMeterValue.getDigital());
|
|
||||||
}
|
|
||||||
pcsElecData.setChargeElec(charge);
|
|
||||||
}
|
|
||||||
if (monthDischargeList.containsKey(yearMonth)) {
|
|
||||||
List<ElecMeterValue> elecMeterValues1 = monthDischargeList.get(yearMonth);
|
|
||||||
|
|
||||||
for (ElecMeterValue elecMeterValue : elecMeterValues1) {
|
|
||||||
disCharge = disCharge.add(elecMeterValue.getDigital());
|
|
||||||
}
|
|
||||||
pcsElecData.setDischargeElec(disCharge);
|
|
||||||
}
|
|
||||||
|
|
||||||
list.add(pcsElecData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//根据时间排序
|
|
||||||
list.stream().
|
|
||||||
|
|
||||||
sorted((s1, s2) ->
|
|
||||||
|
|
||||||
{
|
|
||||||
return s1.getDate().compareTo(s2.getDate());
|
|
||||||
}).
|
|
||||||
|
|
||||||
collect(Collectors.toList());
|
|
||||||
if (!isToday) {
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
//查询今天的数据,set到返回值中
|
String beginTime = DateUtil.format(begin, CommonConstant.DATE_YMD);
|
||||||
String nowDay = DateUtil.format(new Date(), CommonConstant.DATE_YMD);
|
//光伏收益
|
||||||
String format = DateUtil.format(countPvData.getUpdateTime(), CommonConstant.DATE_YMD);
|
List<PowerGenerateRespVO> pvIncome = earningsCalculateMpptService.countPvIncome(req.getStationId(),beginTime, endTime);
|
||||||
if (nowDay.equals(format)) {
|
Map<String,List<PowerGenerateRespVO>> mapIncome = pvIncome.stream().collect(Collectors.groupingBy(i ->i.getDate()));
|
||||||
for (PcsElecData pcsElecData : list) {
|
//光伏放电
|
||||||
if (nowDay.equals(pcsElecData.getDate())) {
|
List<Integer> types = new ArrayList<>();
|
||||||
pcsElecData.setPvChargeElec(countPvData.getValue());
|
types.add(DeviceTypeConstant.ELEC_METER_VALUE_TYPE.PV_CHARGE);
|
||||||
}
|
List<ElecMeterValue> elecMeterValues = elecMeterValueService.selectList(req.getStationId(), types, beginTime, endTime);
|
||||||
|
Map<String, List<ElecMeterValue>> mapMeter = elecMeterValues.stream().collect(Collectors.groupingBy(i ->i.getDay()));
|
||||||
|
//根据天获取时间段
|
||||||
|
List<DateTime> dateTimes = DateUtil.rangeToList(begin, end, DateField.DAY_OF_MONTH);
|
||||||
|
for (DateTime dateTime : dateTimes){
|
||||||
|
String date = DateUtil.format(dateTime, CommonConstant.DATE_YMD);
|
||||||
|
PowerGenerateRespVO pv = new PowerGenerateRespVO();
|
||||||
|
pv.setDate(date);
|
||||||
|
List<PowerGenerateRespVO> pvIn = mapIncome.get(date);
|
||||||
|
//收益
|
||||||
|
if(pvIn != null){
|
||||||
|
pv.setProfit(pvIn.get(0).getProfit());
|
||||||
}
|
}
|
||||||
|
//放电
|
||||||
|
List<ElecMeterValue> elecs = mapMeter.get(date);
|
||||||
|
if(elecs != null){
|
||||||
|
pv.setPowerGenerate(elecs.stream().map(ElecMeterValue::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add));
|
||||||
}
|
}
|
||||||
|
if(date.equals(endTime)){
|
||||||
|
String key = RedisKeyConstant.PV.STATION_PV_TODAY_PROFIT + req.getStationId();
|
||||||
|
//获取今日收益
|
||||||
|
BigDecimal todayIncone = (BigDecimal)redisService.get(key);
|
||||||
|
pv.setProfit(todayIncone);
|
||||||
|
//获取今日发电
|
||||||
|
//当前功率(光伏)、总发电量、日发电量
|
||||||
|
MpptActiveVo todayPv = openStationService.getPvActivePower(req.getStationId());
|
||||||
|
pv.setPowerGenerate(todayPv.getDailyReleaseElec());
|
||||||
|
|
||||||
|
}
|
||||||
|
list.add(pv);
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1994,6 +1837,13 @@ public class StationHomeServiceImpl implements StationHomeService {
|
|||||||
return pcsCurveCurveList;
|
return pcsCurveCurveList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AppRealTimeCurveRespVo> pvCurve(MonitorQuery monitorQuery) {
|
||||||
|
//mppt总发电量、有功功率
|
||||||
|
List<AppRealTimeCurveRespVo> appRealTimeCurveRespVos = getAppRealTimeCurveRespVos(monitorQuery, "totalRelease", "pvActivePower");
|
||||||
|
return appRealTimeCurveRespVos;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AppRealTimeCurveRespVo> getOpticalStorageCurve(MonitorQuery monitorQuery) {
|
public List<AppRealTimeCurveRespVo> getOpticalStorageCurve(MonitorQuery monitorQuery) {
|
||||||
//逆变有功功率、PV输出功率
|
//逆变有功功率、PV输出功率
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.ho.business.service.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ho.business.entity.StationRemoteControl;
|
||||||
|
import com.ho.business.mapper.StationRemoteControlMapper;
|
||||||
|
import com.ho.business.service.StationRemoteControlService;
|
||||||
|
import com.ho.business.vo.req.StationRemoteControlPageVo;
|
||||||
|
import com.ho.common.tools.util.PageResult;
|
||||||
|
import com.ho.common.tools.util.PageUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class StationRemoteControlServiceImpl implements StationRemoteControlService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
StationRemoteControlMapper stationRemoteControlMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(StationRemoteControl entity) {
|
||||||
|
stationRemoteControlMapper.insert(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(StationRemoteControl entity) {
|
||||||
|
stationRemoteControlMapper.update(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(Integer id) {
|
||||||
|
stationRemoteControlMapper.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StationRemoteControl search(Integer stationId) {
|
||||||
|
return stationRemoteControlMapper.search(stationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<StationRemoteControl> selectPageList(StationRemoteControlPageVo vo) {
|
||||||
|
PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
|
||||||
|
List<StationRemoteControl> list = stationRemoteControlMapper.selectList(vo);
|
||||||
|
return PageUtils.getPageResult(new PageInfo<>(list));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -147,9 +147,9 @@
|
|||||||
and date_format(#{date},'%Y-%m-%d') >= tem.validity_start_time and date_format(#{date},'%Y-%m-%d') <=
|
and date_format(#{date},'%Y-%m-%d') >= tem.validity_start_time and date_format(#{date},'%Y-%m-%d') <=
|
||||||
tem.validity_end_time
|
tem.validity_end_time
|
||||||
</if>
|
</if>
|
||||||
<!-- <if test="templateType != null">-->
|
<if test="elecType != null">
|
||||||
<!-- and template_type = #{templateType}-->
|
and tem.elec_type = #{elecType}
|
||||||
<!-- </if>-->
|
</if>
|
||||||
order by begin_time
|
order by begin_time
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,104 @@
|
|||||||
|
<?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.ho.business.mapper.EarningsCalculateMpptMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<delete id="deleteByDay">
|
||||||
|
delete
|
||||||
|
from earnings_calculate_mppt
|
||||||
|
<where>
|
||||||
|
and day = #{day}
|
||||||
|
<if test="typeList !=null and typeList.size() !=0">
|
||||||
|
and type in
|
||||||
|
<foreach collection="typeList" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="insertBatch">
|
||||||
|
INSERT INTO earnings_calculate_mppt
|
||||||
|
(group_id, pid, station_id, src_id, dept_id, create_time, day, type,
|
||||||
|
digital,elec,rate_type,price,total,discount)
|
||||||
|
VALUES
|
||||||
|
<foreach item="item" collection="list" index="index" separator=",">
|
||||||
|
(
|
||||||
|
#{item.groupId},#{item.pid},#{item.stationId},#{item.srcId},#{item.deptId}, now(),
|
||||||
|
#{item.day},#{item.type},#{item.digital},#{item.elec},#{item.rateType},#{item.price},#{item.total},#{item.discount}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="countPvIncome" resultType="com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO">
|
||||||
|
SELECT DAY date,sum( digital ) profit
|
||||||
|
FROM
|
||||||
|
earnings_calculate_mppt
|
||||||
|
WHERE
|
||||||
|
station_id = #{stationId}
|
||||||
|
AND DAY BETWEEN #{beginTime}
|
||||||
|
AND #{endTime}
|
||||||
|
GROUP BY DAY
|
||||||
|
</select>
|
||||||
|
<select id="countAllPvIncome" resultType="java.math.BigDecimal">
|
||||||
|
SELECT sum( digital )
|
||||||
|
FROM
|
||||||
|
earnings_calculate_mppt
|
||||||
|
WHERE
|
||||||
|
station_id = #{stationId}
|
||||||
|
<if test="beginTime != null">
|
||||||
|
and day >= #{beginTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
and day <= #{endTime}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="getProfit" resultType="com.ho.business.vo.resp.profit.DayProfitType">
|
||||||
|
select
|
||||||
|
station_id,day,type,sum(digital) as digital
|
||||||
|
from earnings_calculate_mppt
|
||||||
|
<where>
|
||||||
|
digital > 0
|
||||||
|
<if test="groupId != null">
|
||||||
|
and group_id = #{groupId}
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
||||||
|
and day BETWEEN #{beginTime}
|
||||||
|
AND #{endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
group by station_id, day,type
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getFirstTime" resultType="java.lang.String">
|
||||||
|
SELECT min(day) day
|
||||||
|
FROM earnings_calculate_mppt;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getEarningsByParam" resultType="com.ho.business.vo.resp.profit.DayProfitType">
|
||||||
|
select
|
||||||
|
station_id,day,type,sum(digital) as digital
|
||||||
|
from earnings_calculate_mppt
|
||||||
|
<where>
|
||||||
|
digital > 0
|
||||||
|
<if test="groupId != null">
|
||||||
|
and group_id = #{groupId}
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
||||||
|
and day BETWEEN #{beginTime}
|
||||||
|
AND #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="stationIds != null and stationIds.size() != 0">
|
||||||
|
and station_id in
|
||||||
|
<foreach collection="stationIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
group by station_id, day,type
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -201,6 +201,31 @@
|
|||||||
group by type,station_id,day
|
group by type,station_id,day
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getElec" resultType="com.ho.business.vo.resp.profit.DayProfitType">
|
||||||
|
select
|
||||||
|
station_id,day,type,sum(digital) as digital
|
||||||
|
from elec_meter_value
|
||||||
|
<where>
|
||||||
|
digital > 0
|
||||||
|
<if test="type != null">
|
||||||
|
and type = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="groupId != null">
|
||||||
|
and group_id = #{groupId}
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
||||||
|
and day BETWEEN #{beginTime}
|
||||||
|
AND #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="stationIds != null and stationIds.size() != 0">
|
||||||
|
and station_id in
|
||||||
|
<foreach collection="stationIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
group by station_id, day,type;
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
delete
|
delete
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
latitude,capacity,rate_power,
|
latitude,capacity,rate_power,
|
||||||
status,type,create_time,
|
status,type,create_time,
|
||||||
contact,contact_details,grid_time,
|
contact,contact_details,grid_time,
|
||||||
update_time,deleted,is_enable,cabin_num,district,ad_code,is_daily_count,topology_type,cupboard_type,plan_version,inverter_flag,icc_id,province,city,
|
update_time,deleted,is_enable,cabin_num,district,ad_code,is_daily_count,topology_type,cupboard_type,plan_version,inverter_flag,pv_power,icc_id,province,city,
|
||||||
electricity_type,customer_type,voltage_level,batch_number,nation
|
electricity_type,customer_type,voltage_level,batch_number,nation
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
@ -217,6 +217,7 @@
|
|||||||
<if test="record.cupboardType != null">cupboard_type,</if>
|
<if test="record.cupboardType != null">cupboard_type,</if>
|
||||||
<if test="record.planVersion != null">plan_version,</if>
|
<if test="record.planVersion != null">plan_version,</if>
|
||||||
<if test="record.inverterFlag != null">inverter_flag,</if>
|
<if test="record.inverterFlag != null">inverter_flag,</if>
|
||||||
|
<if test="record.pvPower != null">pv_power,</if>
|
||||||
<if test="record.iccId != null">icc_id,</if>
|
<if test="record.iccId != null">icc_id,</if>
|
||||||
<if test="record.province != null">province,</if>
|
<if test="record.province != null">province,</if>
|
||||||
<if test="record.city != null">city,</if>
|
<if test="record.city != null">city,</if>
|
||||||
@ -254,6 +255,7 @@
|
|||||||
<if test="record.cupboardType != null">#{record.cupboardType},</if>
|
<if test="record.cupboardType != null">#{record.cupboardType},</if>
|
||||||
<if test="record.planVersion != null">#{record.planVersion},</if>
|
<if test="record.planVersion != null">#{record.planVersion},</if>
|
||||||
<if test="record.inverterFlag != null">#{record.inverterFlag},</if>
|
<if test="record.inverterFlag != null">#{record.inverterFlag},</if>
|
||||||
|
<if test="record.pvPower != null">#{record.pvPower},</if>
|
||||||
<if test="record.iccId != null">#{record.iccId},</if>
|
<if test="record.iccId != null">#{record.iccId},</if>
|
||||||
<if test="record.province != null">#{record.province},</if>
|
<if test="record.province != null">#{record.province},</if>
|
||||||
<if test="record.city != null">#{record.city},</if>
|
<if test="record.city != null">#{record.city},</if>
|
||||||
@ -343,6 +345,9 @@
|
|||||||
<if test="record.inverterFlag != null">
|
<if test="record.inverterFlag != null">
|
||||||
inverter_flag = #{record.inverterFlag},
|
inverter_flag = #{record.inverterFlag},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.pvPower != null">
|
||||||
|
pv_power = #{record.pvPower,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
<if test="record.iccId != null">
|
<if test="record.iccId != null">
|
||||||
icc_id = #{record.iccId},
|
icc_id = #{record.iccId},
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@ -0,0 +1,99 @@
|
|||||||
|
<?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.ho.business.mapper.StationRemoteControlMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ho.business.entity.StationRemoteControl"
|
||||||
|
useGeneratedKeys="true">
|
||||||
|
insert into station_remote_control
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="entity.id != null">id,</if>
|
||||||
|
<if test="entity.stationId != null">station_id,</if>
|
||||||
|
<if test="entity.ip != null">ip,</if>
|
||||||
|
<if test="entity.port != null">port,</if>
|
||||||
|
<if test="entity.userName != null">user_name,</if>
|
||||||
|
<if test="entity.password != null">password,</if>
|
||||||
|
<if test="entity.intranetIp != null">intranet_ip,</if>
|
||||||
|
<if test="entity.type != null">type,</if>
|
||||||
|
<if test="entity.createTime != null">create_time,</if>
|
||||||
|
<if test="entity.updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="entity.id != null">#{entity.id,jdbcType=INTEGER},</if>
|
||||||
|
<if test="entity.stationId != null">#{entity.stationId,jdbcType=INTEGER},</if>
|
||||||
|
<if test="entity.ip != null">#{entity.ip,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.port != null">#{entity.port,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.userName != null">#{entity.userName,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.password != null">#{entity.password,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.intranetIp != null">#{entity.intranetIp,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.type != null">#{entity.type,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.createTime != null">#{entity.createTime,jdbcType=TIMESTAMP},</if>
|
||||||
|
<if test="entity.updateTime != null">#{entity.updateTime,jdbcType=TIMESTAMP},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="update" parameterType="com.ho.business.entity.StationRemoteControl">
|
||||||
|
update station_remote_control
|
||||||
|
<set>
|
||||||
|
<if test="entity.ip != null">
|
||||||
|
ip = #{entity.ip,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.port != null">
|
||||||
|
port = #{entity.port,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.userName != null">
|
||||||
|
user_name = #{entity.userName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.password != null">
|
||||||
|
password = #{entity.password,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.intranetIp != null">
|
||||||
|
intranet_ip = #{entity.intranetIp,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.type != null">
|
||||||
|
type = #{entity.type,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.updateTime != null">
|
||||||
|
update_time = #{entity.updateTime,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{entity.id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<delete id="delete">
|
||||||
|
delete from station_remote_control where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="search" resultType="com.ho.business.entity.StationRemoteControl">
|
||||||
|
select s.*,t.name stationName from station_remote_control s
|
||||||
|
left join station t on s.station_id = t.id
|
||||||
|
<where>
|
||||||
|
<if test="stationId != null and stationId !=''">
|
||||||
|
and s.station_id = #{stationId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectList" resultType="com.ho.business.entity.StationRemoteControl">
|
||||||
|
select s.*,t.name stationName from station_remote_control s
|
||||||
|
left join station t on s.station_id = t.id
|
||||||
|
<where>
|
||||||
|
<if test="vo.stationId != null and vo.stationId !=''">
|
||||||
|
and s.station_id = #{vo.stationId}
|
||||||
|
</if>
|
||||||
|
<if test="vo.stationName != null and vo.stationName !=''">
|
||||||
|
and t.name like concat('%',#{vo.stationName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="vo.intranetIp != null and vo.intranetIp !=''">
|
||||||
|
and s.intranet_ip like concat('%',#{vo.intranetIp},'%')
|
||||||
|
</if>
|
||||||
|
<if test="vo.ip != null and vo.ip !=''">
|
||||||
|
and s.ip like concat('%',#{vo.ip},'%')
|
||||||
|
</if>
|
||||||
|
<if test="vo.type != null and vo.type !=''">
|
||||||
|
and s.type = #{vo.type}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by s.create_time desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.ho.business.controller;
|
||||||
|
|
||||||
|
import com.ho.business.service.BoulderEnergyService;
|
||||||
|
import com.ho.common.tools.annotation.TokenIgnore;
|
||||||
|
import com.ho.common.tools.constant.ContextConstant;
|
||||||
|
import com.ho.common.tools.exception.DataResult;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@RequestMapping(ContextConstant.BUSINESS + "boulderEnergyStation")
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "业务模块-中车能源电站管理")
|
||||||
|
@Slf4j
|
||||||
|
public class BoulderEnergyController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
BoulderEnergyService boulderEnergyService;
|
||||||
|
|
||||||
|
@PostMapping("getToken")
|
||||||
|
@ApiOperation(value = "获取token")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult<String> getToken() {
|
||||||
|
return DataResult.success(boulderEnergyService.getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("getBoulderEleIncome")
|
||||||
|
@ApiOperation(value = "中车-统计缓存充放电、及收益数据")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult getBoulderEleIncome(@RequestBody(required = false) String beginTime) {
|
||||||
|
log.info("参数: {} ", beginTime);
|
||||||
|
// beginTime ==null 时统计昨日充放电、及收益数据
|
||||||
|
// beginTime !=null 时统计beginTime充放电、及收益数据
|
||||||
|
boulderEnergyService.getBoulderEleIncome(beginTime);
|
||||||
|
if(beginTime!=null){
|
||||||
|
//beginTime !=null 缓存中车电站累计数据
|
||||||
|
boulderEnergyService.getCacheBoulderData();
|
||||||
|
}
|
||||||
|
return DataResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -8,11 +8,13 @@ import com.alibaba.excel.write.metadata.WriteSheet;
|
|||||||
import com.alibaba.excel.write.metadata.fill.FillConfig;
|
import com.alibaba.excel.write.metadata.fill.FillConfig;
|
||||||
import com.alibaba.excel.write.metadata.fill.FillWrapper;
|
import com.alibaba.excel.write.metadata.fill.FillWrapper;
|
||||||
import com.ho.business.entity.*;
|
import com.ho.business.entity.*;
|
||||||
|
import com.ho.business.service.EarningsCalculateMpptService;
|
||||||
import com.ho.business.service.EarningsCalculateService;
|
import com.ho.business.service.EarningsCalculateService;
|
||||||
import com.ho.business.service.StationService;
|
import com.ho.business.service.StationService;
|
||||||
import com.ho.business.util.QueuesUtil;
|
import com.ho.business.util.QueuesUtil;
|
||||||
import com.ho.business.vo.OneKeyComputationVo;
|
import com.ho.business.vo.OneKeyComputationVo;
|
||||||
import com.ho.business.vo.req.carbin.EarningsCalculateReq;
|
import com.ho.business.vo.req.carbin.EarningsCalculateReq;
|
||||||
|
import com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO;
|
||||||
import com.ho.business.vo.resp.cabin.EarningsCalculateResp;
|
import com.ho.business.vo.resp.cabin.EarningsCalculateResp;
|
||||||
import com.ho.common.tools.annotation.HzPermission;
|
import com.ho.common.tools.annotation.HzPermission;
|
||||||
import com.ho.common.tools.annotation.TokenIgnore;
|
import com.ho.common.tools.annotation.TokenIgnore;
|
||||||
@ -23,6 +25,7 @@ import com.ho.common.tools.exception.BaseResponseCode;
|
|||||||
import com.ho.common.tools.exception.BusinessException;
|
import com.ho.common.tools.exception.BusinessException;
|
||||||
import com.ho.common.tools.exception.DataResult;
|
import com.ho.common.tools.exception.DataResult;
|
||||||
import com.ho.common.tools.service.RedisService;
|
import com.ho.common.tools.service.RedisService;
|
||||||
|
import com.ho.common.tools.util.BigDecimalUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -59,9 +62,15 @@ public class EarningsCalculateController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
EarningsCalculateService earningsCalculateService;
|
EarningsCalculateService earningsCalculateService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
EarningsCalculateMpptService earningsCalculateMpptService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StationService stationService;
|
private StationService stationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
BigDecimalUtil bigDecimalUtil;
|
||||||
|
|
||||||
@PostMapping("/getTotal")
|
@PostMapping("/getTotal")
|
||||||
@ApiOperation(value = "获取月发电量报表")
|
@ApiOperation(value = "获取月发电量报表")
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
@ -85,6 +94,17 @@ public class EarningsCalculateController {
|
|||||||
return DataResult.success(total);
|
return DataResult.success(total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getPvMonthData")
|
||||||
|
@ApiOperation(value = "mppt月发电、收益(使用mppt计算)")
|
||||||
|
public DataResult<List<PowerGenerateRespVO>> getPvMonthData(@RequestBody EarningsCalculateReq req) {
|
||||||
|
//获取光伏放电、收益
|
||||||
|
List<PowerGenerateRespVO> pvList = earningsCalculateService.getPvMonthData(req);
|
||||||
|
for (PowerGenerateRespVO pcsElecData : pvList) {
|
||||||
|
bigDecimalUtil.keepTwoDecimalPlaces(pcsElecData);
|
||||||
|
bigDecimalUtil.ifIsNUll(pcsElecData);
|
||||||
|
}
|
||||||
|
return DataResult.success(pvList);
|
||||||
|
}
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
@PostMapping("/all")
|
@PostMapping("/all")
|
||||||
@ApiOperation(value = "查询所有电站接口")
|
@ApiOperation(value = "查询所有电站接口")
|
||||||
@ -111,6 +131,48 @@ public class EarningsCalculateController {
|
|||||||
stations = stations.stream().filter(i -> CommonConstant.ONE.equals(i.getStatus())).collect(Collectors.toList());
|
stations = stations.stream().filter(i -> CommonConstant.ONE.equals(i.getStatus())).collect(Collectors.toList());
|
||||||
earningsCalculateService.queryDeviceByStationId(stations,null,beginTime);
|
earningsCalculateService.queryDeviceByStationId(stations,null,beginTime);
|
||||||
}
|
}
|
||||||
|
@TokenIgnore
|
||||||
|
@PostMapping("/allMpptIncome")
|
||||||
|
@ApiOperation(value = "计算所有电站Mppt电价收益")
|
||||||
|
public void allMpptIncome(@RequestBody(required = false) String beginTime) {
|
||||||
|
try {
|
||||||
|
/*
|
||||||
|
* 定时任务 如果没有时间参数 就每天跑昨日数据
|
||||||
|
* 如果有 beginTime 参数不为空,则先清除beginTime 时间的收益数据重新计算
|
||||||
|
*/
|
||||||
|
DateTime yesterday = DateUtil.yesterday();
|
||||||
|
String yesterdayStr = DateUtil.formatDate(yesterday);
|
||||||
|
if ( beginTime != null ) {
|
||||||
|
int i = earningsCalculateMpptService.deleteByDay(beginTime, null);
|
||||||
|
} else {
|
||||||
|
beginTime = yesterdayStr;
|
||||||
|
int i = earningsCalculateMpptService.deleteByDay(yesterdayStr, null);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("删除昨日数据失败:{}",e.getMessage());
|
||||||
|
}
|
||||||
|
List<Station> stations = stationService.selectAll();
|
||||||
|
//批量算的时候只计算电站是在投的,且是接入光伏mppt的
|
||||||
|
stations = stations.stream().filter(i -> CommonConstant.ONE.equals(i.getStatus())
|
||||||
|
&&CommonConstant.ONE.equals(i.getInverterFlag())).collect(Collectors.toList());
|
||||||
|
earningsCalculateMpptService.allMpptIncome(stations,beginTime);
|
||||||
|
}
|
||||||
|
@TokenIgnore
|
||||||
|
@PostMapping("/allTodayMpptIncome")
|
||||||
|
@ApiOperation(value = "计算所有电站Mppt-今日收益")
|
||||||
|
public void allTodayMpptIncome(@RequestBody(required = false) String beginTime) {
|
||||||
|
DateTime nowDay = DateUtil.date();
|
||||||
|
String nowDayStr = DateUtil.formatDate(nowDay);
|
||||||
|
if ( beginTime == null ) {
|
||||||
|
beginTime = nowDayStr;
|
||||||
|
}
|
||||||
|
List<Station> stations = stationService.selectAll();
|
||||||
|
//批量算的时候只计算电站是在投的,且是接入光伏mppt的
|
||||||
|
stations = stations.stream().filter(i -> CommonConstant.ONE.equals(i.getStatus())
|
||||||
|
&&CommonConstant.ONE.equals(i.getInverterFlag())).collect(Collectors.toList());
|
||||||
|
earningsCalculateMpptService.todayMpptIncome(stations,beginTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<String> getBetweenDate(String begin,String end){
|
private List<String> getBetweenDate(String begin,String end){
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
@ -134,7 +196,43 @@ public class EarningsCalculateController {
|
|||||||
}
|
}
|
||||||
return betweenList;
|
return betweenList;
|
||||||
}
|
}
|
||||||
|
@TokenIgnore
|
||||||
|
@PostMapping("/exportPv")
|
||||||
|
@ApiOperation(value = "pv导出")
|
||||||
|
public void exportPv(HttpServletRequest req, HttpServletResponse response, @RequestBody EarningsCalculateReq earningsCalculateReq){
|
||||||
|
String lang = req.getHeader(CommonConstant.LANG);
|
||||||
|
earningsCalculateReq.setLang(lang);
|
||||||
|
EarningsCalculateResp total = earningsCalculateService.getTotal(earningsCalculateReq,PAGE_LIST_TYPE);
|
||||||
|
ServletOutputStream out = null;
|
||||||
|
try {
|
||||||
|
out = response.getOutputStream();
|
||||||
|
response.setContentType("multipart/form-data");
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
//文件名字
|
||||||
|
String fileName = "demo.xlsx";
|
||||||
|
response.setHeader("Content-disposition", "attachment;filename=" +fileName);
|
||||||
|
String path="template/earningsPvTemplate.xlsx";
|
||||||
|
//文件模板输入流
|
||||||
|
InputStream inputStream = new ClassPathResource(path).getInputStream();
|
||||||
|
ExcelWriter writer = EasyExcel.write(out).withTemplate(inputStream).build();
|
||||||
|
WriteSheet sheet = EasyExcel.writerSheet().build();
|
||||||
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build();
|
||||||
|
|
||||||
|
List<PowerGenerateRespVO> pvList = earningsCalculateService.getPvMonthData(earningsCalculateReq);
|
||||||
|
for (PowerGenerateRespVO pcsElecData : pvList) {
|
||||||
|
bigDecimalUtil.keepTwoDecimalPlaces(pcsElecData);
|
||||||
|
bigDecimalUtil.ifIsNUll(pcsElecData);
|
||||||
|
}
|
||||||
|
writer.fill(new FillWrapper("vo", pvList), fillConfig, sheet);
|
||||||
|
//填充数据
|
||||||
|
writer.fill(total,fillConfig,sheet);
|
||||||
|
//填充完成
|
||||||
|
writer.finish();
|
||||||
|
out.flush();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ApiOperation(value = "导出")
|
@ApiOperation(value = "导出")
|
||||||
|
|||||||
@ -7,10 +7,7 @@ import com.ho.business.service.IargeScreenShowService;
|
|||||||
import com.ho.business.service.StationService;
|
import com.ho.business.service.StationService;
|
||||||
import com.ho.business.vo.req.cockpit.CockpitReqVO;
|
import com.ho.business.vo.req.cockpit.CockpitReqVO;
|
||||||
import com.ho.business.vo.resp.DeviceRespVO;
|
import com.ho.business.vo.resp.DeviceRespVO;
|
||||||
import com.ho.business.vo.resp.iargeScreen.AnnualChartValue;
|
import com.ho.business.vo.resp.iargeScreen.*;
|
||||||
import com.ho.business.vo.resp.iargeScreen.AnnualOverviewResp;
|
|
||||||
import com.ho.business.vo.resp.iargeScreen.EnergySavingRespVo;
|
|
||||||
import com.ho.business.vo.resp.iargeScreen.Subdata;
|
|
||||||
import com.ho.common.tools.annotation.CommonLargeScreenToken;
|
import com.ho.common.tools.annotation.CommonLargeScreenToken;
|
||||||
import com.ho.common.tools.annotation.TokenIgnore;
|
import com.ho.common.tools.annotation.TokenIgnore;
|
||||||
import com.ho.common.tools.constant.ContextConstant;
|
import com.ho.common.tools.constant.ContextConstant;
|
||||||
@ -419,5 +416,88 @@ public class IargeScreenShowController {
|
|||||||
return DataResult.success(regionList);
|
return DataResult.success(regionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************/
|
/*********************************以下为中自-光伏大屏接口***************************************/
|
||||||
|
|
||||||
|
@PostMapping("getZhongZiPvDistribution")
|
||||||
|
@ApiOperation(value = "中自-光伏电站区域分布")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult<List<Subdata>> getZhongZiPvDistribution(@RequestBody CockpitReqVO vo) {
|
||||||
|
List<Subdata> regionList = iargeScreenShowService.getCommonPvRegionList((getByDeptId(vo.getDeptId())));
|
||||||
|
regionList.sort(Comparator.comparing((Subdata::getRegionValue)).reversed());
|
||||||
|
return DataResult.success(regionList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("getZhongZiPvOverviewData")
|
||||||
|
@ApiOperation(value = "中自储能-光伏年度概览/年度收益概览接口返回")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult<AnnualPvOverviewResp> getZhongZiPvOverviewData(@RequestBody CockpitReqVO vo) {
|
||||||
|
AnnualPvOverviewResp annualOverviewResp = iargeScreenShowService.getPvOverviewData(getByDeptId(vo.getDeptId()));
|
||||||
|
bigDecimalUtil.keepTwoDecimalPlaces(annualOverviewResp);
|
||||||
|
bigDecimalUtil.ifIsNUll(annualOverviewResp);
|
||||||
|
return DataResult.success(annualOverviewResp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("getZhongZiPvEnergySaving")
|
||||||
|
@ApiOperation(value = "中自-光伏节能减排")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult<EnergySavingRespVo> getZhongZiPvEnergySaving(@RequestBody CockpitReqVO vo) {
|
||||||
|
EnergySavingRespVo energySaving = iargeScreenShowService.getPvEnergySaving(getByDeptId(vo.getDeptId()));
|
||||||
|
bigDecimalUtil.keepTwoDecimalPlaces(energySaving);
|
||||||
|
bigDecimalUtil.ifIsNUll(energySaving);
|
||||||
|
return DataResult.success(energySaving);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("getZhongZiPvIncomeCurve")
|
||||||
|
@ApiOperation(value = "中自光伏收益曲线")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult<List<AnnualChartValue>> getZhongZiPvIncomeCurve(@RequestBody CockpitReqVO vo) {
|
||||||
|
List<AnnualChartValue> list = iargeScreenShowService.getPVCommonProfitCurve(vo, getByDeptId(vo.getDeptId()));
|
||||||
|
for (AnnualChartValue annualChartValue : list) {
|
||||||
|
bigDecimalUtil.keepTwoDecimalPlaces(annualChartValue);
|
||||||
|
bigDecimalUtil.ifIsNUll(annualChartValue);
|
||||||
|
}
|
||||||
|
return DataResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("getZhongZiPvIncomeList")
|
||||||
|
@ApiOperation(value = "中自-光伏电站收益排名")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult<List<Subdata>> getZhongZiPvIncomeList(@RequestBody CockpitReqVO vo) {
|
||||||
|
List<Subdata> regionList = iargeScreenShowService.getPvCommonProfit(null,null,getByDeptId(vo.getDeptId()));
|
||||||
|
if (regionList.size() > maxSize) {
|
||||||
|
regionList = regionList.subList(0, maxSize);
|
||||||
|
}
|
||||||
|
for (Subdata subdata : regionList) {
|
||||||
|
bigDecimalUtil.keepTwoDecimalPlaces(subdata);
|
||||||
|
bigDecimalUtil.ifIsNUll(subdata);
|
||||||
|
}
|
||||||
|
return DataResult.success(regionList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("getZhongZiPvElecList")
|
||||||
|
@ApiOperation(value = "中自-光伏电站发电量排名")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult<List<Subdata>> getZhongZiPvElecList(@RequestBody CockpitReqVO vo) {
|
||||||
|
List<Subdata> regionList = iargeScreenShowService.getPvCommonElec(null,null,getByDeptId(vo.getDeptId()));
|
||||||
|
if (regionList.size() > maxSize) {
|
||||||
|
regionList = regionList.subList(0, maxSize);
|
||||||
|
}
|
||||||
|
for (Subdata subdata : regionList) {
|
||||||
|
bigDecimalUtil.keepTwoDecimalPlaces(subdata);
|
||||||
|
bigDecimalUtil.ifIsNUll(subdata);
|
||||||
|
}
|
||||||
|
return DataResult.success(regionList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("getZhongZiPvRelease")
|
||||||
|
@ApiOperation(value = "中自pv日发电量")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult<List<AnnualChartValue>> getZhongZiPvRelease(@RequestBody CockpitReqVO vo) {
|
||||||
|
List<AnnualChartValue> list = iargeScreenShowService.getCommonPvRelease(getByDeptId(vo.getDeptId()));
|
||||||
|
for (AnnualChartValue subdata : list) {
|
||||||
|
bigDecimalUtil.keepTwoDecimalPlaces(subdata);
|
||||||
|
bigDecimalUtil.ifIsNUll(subdata);
|
||||||
|
}
|
||||||
|
return DataResult.success(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.ho.business.controller;
|
package com.ho.business.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ho.business.constant.DeviceTypeConstant;
|
import com.ho.business.constant.DeviceTypeConstant;
|
||||||
import com.ho.business.entity.Station;
|
import com.ho.business.entity.Station;
|
||||||
import com.ho.business.service.*;
|
import com.ho.business.service.*;
|
||||||
@ -10,6 +12,8 @@ import com.ho.business.vo.req.StationReq;
|
|||||||
import com.ho.business.vo.req.dynamicConfig.DynamicConfigQuery;
|
import com.ho.business.vo.req.dynamicConfig.DynamicConfigQuery;
|
||||||
import com.ho.business.vo.req.pcsStation.PcsStationReq;
|
import com.ho.business.vo.req.pcsStation.PcsStationReq;
|
||||||
import com.ho.business.vo.resp.DeviceRespVO;
|
import com.ho.business.vo.resp.DeviceRespVO;
|
||||||
|
import com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO;
|
||||||
|
import com.ho.business.vo.resp.ShipStationRespVO;
|
||||||
import com.ho.business.vo.resp.cabin.CircleCtrlResp;
|
import com.ho.business.vo.resp.cabin.CircleCtrlResp;
|
||||||
import com.ho.business.vo.resp.cabin.EarningsCalculateCountResp;
|
import com.ho.business.vo.resp.cabin.EarningsCalculateCountResp;
|
||||||
import com.ho.business.vo.resp.openStationHome.OpenStationMiddle;
|
import com.ho.business.vo.resp.openStationHome.OpenStationMiddle;
|
||||||
@ -25,6 +29,7 @@ import com.ho.business.vo.resp.station.NewRealTimeCurveVo;
|
|||||||
import com.ho.common.tools.annotation.TokenIgnore;
|
import com.ho.common.tools.annotation.TokenIgnore;
|
||||||
import com.ho.common.tools.constant.CommonConstant;
|
import com.ho.common.tools.constant.CommonConstant;
|
||||||
import com.ho.common.tools.constant.ContextConstant;
|
import com.ho.common.tools.constant.ContextConstant;
|
||||||
|
import com.ho.common.tools.constant.RedisKeyConstant;
|
||||||
import com.ho.common.tools.exception.DataResult;
|
import com.ho.common.tools.exception.DataResult;
|
||||||
import com.ho.common.tools.service.RedisService;
|
import com.ho.common.tools.service.RedisService;
|
||||||
import com.ho.common.tools.util.BigDecimalUtil;
|
import com.ho.common.tools.util.BigDecimalUtil;
|
||||||
@ -40,10 +45,13 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -89,6 +97,9 @@ public class OpenStationController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
EarningsCalculateService earningsCalculateService;
|
EarningsCalculateService earningsCalculateService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ShipEnergyService shipEnergyService;
|
||||||
|
|
||||||
@PostMapping("statusMonitor")
|
@PostMapping("statusMonitor")
|
||||||
@ApiOperation(value = "状态监控")
|
@ApiOperation(value = "状态监控")
|
||||||
public DataResult<StatusMonitorVo> statusMonitor(@RequestBody StationReq stationReq) {
|
public DataResult<StatusMonitorVo> statusMonitor(@RequestBody StationReq stationReq) {
|
||||||
@ -102,10 +113,43 @@ public class OpenStationController {
|
|||||||
|
|
||||||
@PostMapping("/realtimeCurve")
|
@PostMapping("/realtimeCurve")
|
||||||
@ApiOperation(value = "实时曲线")
|
@ApiOperation(value = "实时曲线")
|
||||||
|
@TokenIgnore
|
||||||
//@Cacheable(cacheManager = "towMinuteCacheManager", value = "stationRealtimeCurve", key = "#stationReq.stationId", sync = true)
|
//@Cacheable(cacheManager = "towMinuteCacheManager", value = "stationRealtimeCurve", key = "#stationReq.stationId", sync = true)
|
||||||
public DataResult<List<NewRealTimeCurveVo>> realtimeCurve(@RequestBody StationReq stationReq) {
|
public DataResult<List<NewRealTimeCurveVo>> realtimeCurve(@RequestBody StationReq stationReq) {
|
||||||
log.info("realtimeCurve.stationRealtimeCurve:" + stationReq);
|
log.info("realtimeCurve.stationRealtimeCurve:" + stationReq);
|
||||||
List<NewRealTimeCurveVo> resList = stationHomeService.getRealtimeCurve(stationReq);
|
List<NewRealTimeCurveVo> resList = stationHomeService.getRealtimeCurve(stationReq);
|
||||||
|
// 寄点电站功率、soc曲线
|
||||||
|
if(stationReq.getStationId()==11003 || stationReq.getStationId()==10942 || stationReq.getStationId()==11006){
|
||||||
|
// 寄点电站数据
|
||||||
|
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + stationReq.getStationId();
|
||||||
|
String json = (String)redisService.get(mainKey);
|
||||||
|
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
|
||||||
|
JSONArray historyDataList = vo.getHistoryDataList();
|
||||||
|
if(historyDataList!=null){
|
||||||
|
NewRealTimeCurveVo soc = new NewRealTimeCurveVo();
|
||||||
|
soc.setName("SOC");
|
||||||
|
List<StationHomeRespVo> soclist =new ArrayList<>();
|
||||||
|
NewRealTimeCurveVo p = new NewRealTimeCurveVo();
|
||||||
|
p.setName("实时功率");
|
||||||
|
List<StationHomeRespVo> plist =new ArrayList<>();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CommonConstant.DATE);
|
||||||
|
historyDataList.forEach(i->{
|
||||||
|
JSONObject obj = (JSONObject) i;
|
||||||
|
StationHomeRespVo socCurve = new StationHomeRespVo();
|
||||||
|
socCurve.setDate(ZonedDateTime.parse(obj.getString("record_time")).format(formatter));
|
||||||
|
socCurve.setDigital(obj.getBigDecimal("soc"));
|
||||||
|
soclist.add(socCurve);
|
||||||
|
StationHomeRespVo pCurve = new StationHomeRespVo();
|
||||||
|
pCurve.setDate(ZonedDateTime.parse(obj.getString("record_time")).format(formatter));
|
||||||
|
pCurve.setDigital(obj.getBigDecimal("p_total"));
|
||||||
|
plist.add(pCurve);
|
||||||
|
});
|
||||||
|
soc.setList(soclist);
|
||||||
|
p.setList(plist);
|
||||||
|
resList.add(soc);
|
||||||
|
resList.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
//返回值的BigDecimal类型保留两位小数
|
//返回值的BigDecimal类型保留两位小数
|
||||||
for (NewRealTimeCurveVo newRealTimeCurveVo : resList) {
|
for (NewRealTimeCurveVo newRealTimeCurveVo : resList) {
|
||||||
List<StationHomeRespVo> list = newRealTimeCurveVo.getList();
|
List<StationHomeRespVo> list = newRealTimeCurveVo.getList();
|
||||||
@ -221,6 +265,21 @@ public class OpenStationController {
|
|||||||
req.setDeviceType(deviceType);
|
req.setDeviceType(deviceType);
|
||||||
}
|
}
|
||||||
PcsTotalData data = stationHomeService.getPcsTotalData(req);
|
PcsTotalData data = stationHomeService.getPcsTotalData(req);
|
||||||
|
if(req.getStationId()==11003 || req.getStationId()==10942 || req.getStationId()==11006){
|
||||||
|
// 寄点电站数据
|
||||||
|
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + req.getStationId();
|
||||||
|
String json = (String)redisService.get(mainKey);
|
||||||
|
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
|
||||||
|
// 数据转换
|
||||||
|
data.setTotalChargeElec(vo.getPositivePowerSum()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getPositivePowerSum()));
|
||||||
|
data.setTotalDischargeElec(vo.getReversePowerSum()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getReversePowerSum()));
|
||||||
|
data.setDailyChargeElec(vo.getPositivePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getPositivePowerToday()));
|
||||||
|
data.setDailyDischargeElec(vo.getReversePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getReversePowerToday()));
|
||||||
|
data.setCurrentPower(vo.getRealTimePower()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getRealTimePower()));
|
||||||
|
if(data.getTotalChargeElec().compareTo(BigDecimal.ZERO)>0){
|
||||||
|
data.setSystemEfficiency(data.getTotalDischargeElec().divide(data.getTotalChargeElec(), 4, BigDecimal.ROUND_HALF_UP));
|
||||||
|
}
|
||||||
|
}
|
||||||
BigDecimal systemEfficiency = data.getSystemEfficiency();
|
BigDecimal systemEfficiency = data.getSystemEfficiency();
|
||||||
bigDecimalUtil.keepTwoDecimalPlaces(data);
|
bigDecimalUtil.keepTwoDecimalPlaces(data);
|
||||||
bigDecimalUtil.ifIsNUll(data);
|
bigDecimalUtil.ifIsNUll(data);
|
||||||
@ -269,19 +328,7 @@ public class OpenStationController {
|
|||||||
req.setDeviceType(deviceType);
|
req.setDeviceType(deviceType);
|
||||||
}
|
}
|
||||||
List<PcsElecData> list = stationHomeService.getPcsElecData(req);
|
List<PcsElecData> list = stationHomeService.getPcsElecData(req);
|
||||||
//获取光伏充电
|
|
||||||
List<PcsElecData> pvList = stationHomeService.getPvChargeElec(req);
|
|
||||||
Map<String, List<PcsElecData>> dataMap = pvList.stream().collect(Collectors.groupingBy(PcsElecData::getDate));
|
|
||||||
|
|
||||||
|
|
||||||
for (PcsElecData pcsElecData : list) {
|
|
||||||
if (dataMap.containsKey(pcsElecData.getDate())) {
|
|
||||||
List<PcsElecData> pcsElecData1 = dataMap.get(pcsElecData.getDate());
|
|
||||||
if (pcsElecData1.get(CommonConstant.ZERO).getPvChargeElec() != null) {
|
|
||||||
pcsElecData.setPvChargeElec(pcsElecData1.get(CommonConstant.ZERO).getPvChargeElec());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (PcsElecData pcsElecData : list) {
|
for (PcsElecData pcsElecData : list) {
|
||||||
bigDecimalUtil.keepTwoDecimalPlaces(pcsElecData);
|
bigDecimalUtil.keepTwoDecimalPlaces(pcsElecData);
|
||||||
bigDecimalUtil.ifIsNUll(pcsElecData);
|
bigDecimalUtil.ifIsNUll(pcsElecData);
|
||||||
@ -289,6 +336,18 @@ public class OpenStationController {
|
|||||||
return DataResult.success(list);
|
return DataResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getPvData")
|
||||||
|
@ApiOperation(value = "mppt放电、收益(使用mppt计算)")
|
||||||
|
public DataResult<List<PowerGenerateRespVO>> getPvData(@RequestBody PcsStationReq req) throws ParseException {
|
||||||
|
//获取光伏放电、收益
|
||||||
|
List<PowerGenerateRespVO> pvList = stationHomeService.getPvData(req);
|
||||||
|
for (PowerGenerateRespVO pcsElecData : pvList) {
|
||||||
|
bigDecimalUtil.keepTwoDecimalPlaces(pcsElecData);
|
||||||
|
bigDecimalUtil.ifIsNUll(pcsElecData);
|
||||||
|
}
|
||||||
|
return DataResult.success(pvList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出累计充放电量数据
|
* 导出累计充放电量数据
|
||||||
*
|
*
|
||||||
@ -298,9 +357,10 @@ public class OpenStationController {
|
|||||||
@ApiOperation(value = "多电站导出累计充放电量数据")
|
@ApiOperation(value = "多电站导出累计充放电量数据")
|
||||||
//@LogAnnotation(title = "累计充放电量", action = "导出累计充放电量数据")
|
//@LogAnnotation(title = "累计充放电量", action = "导出累计充放电量数据")
|
||||||
//@HzPermission(value = {PermissionConstant.REMOTECONTROL_COMMAND_EXPORT,PermissionConstant.DATA_SHOW_EXPORT,PermissionConstant.REMOTECONTROL_COMMAND_EXPORT})
|
//@HzPermission(value = {PermissionConstant.REMOTECONTROL_COMMAND_EXPORT,PermissionConstant.DATA_SHOW_EXPORT,PermissionConstant.REMOTECONTROL_COMMAND_EXPORT})
|
||||||
public void exportExcel(@RequestBody @Valid PcsStationReq req, HttpServletResponse response) {
|
public void exportExcel(@RequestBody @Valid PcsStationReq req, HttpServletResponse response, HttpServletRequest request) {
|
||||||
|
String lang = request.getHeader(RedisKeyConstant.User.LANG);
|
||||||
//功能描述:把同一个表格多个sheet测试结果重新输出,
|
//功能描述:把同一个表格多个sheet测试结果重新输出,
|
||||||
openStationService.exportEleData(req, response);
|
openStationService.exportEleData(req, response,lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -420,8 +420,10 @@ public class OuterApiController {
|
|||||||
public DataResult jobIntegratedCabinet(@RequestBody MonitorQuery monitorQuery) {
|
public DataResult jobIntegratedCabinet(@RequestBody MonitorQuery monitorQuery) {
|
||||||
log.info("jobIntegratedCabinet, {}", monitorQuery);
|
log.info("jobIntegratedCabinet, {}", monitorQuery);
|
||||||
outApiService.dayChargeDeal(monitorQuery);
|
outApiService.dayChargeDeal(monitorQuery);
|
||||||
outApiService.currentMonthYearDeal(monitorQuery);
|
// outApiService.currentMonthYearDeal(monitorQuery);
|
||||||
outApiService.dayPVCharge(monitorQuery);
|
// outApiService.dayPVCharge(monitorQuery);
|
||||||
|
outApiService.dayPVMpptCharge(monitorQuery);
|
||||||
|
|
||||||
return DataResult.success();
|
return DataResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,6 +77,18 @@ public class PcsController {
|
|||||||
return DataResult.success(resList);
|
return DataResult.success(resList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/pvCurve")
|
||||||
|
@ApiOperation(value = "mppt曲线")
|
||||||
|
public DataResult<List<AppRealTimeCurveRespVo>> pvCurve(@RequestBody MonitorQuery monitorQuery) {
|
||||||
|
List<AppRealTimeCurveRespVo> resList = stationHomeService.pvCurve(monitorQuery);
|
||||||
|
|
||||||
|
//返回值的BigDecimal类型保留两位小数
|
||||||
|
for (AppRealTimeCurveRespVo realTimeCurveRespVo : resList) {
|
||||||
|
bigDecimalUtil.keepTwoDecimalPlaces(realTimeCurveRespVo);
|
||||||
|
bigDecimalUtil.ifIsNUll(realTimeCurveRespVo);
|
||||||
|
}
|
||||||
|
return DataResult.success(resList);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/opticalStorageCurve")
|
@PostMapping("/opticalStorageCurve")
|
||||||
@ApiOperation(value = "光储逆变器曲线")
|
@ApiOperation(value = "光储逆变器曲线")
|
||||||
|
|||||||
@ -0,0 +1,52 @@
|
|||||||
|
package com.ho.business.controller;
|
||||||
|
|
||||||
|
import com.ho.business.service.ShipEnergyService;
|
||||||
|
import com.ho.business.vo.resp.ShipStationRespVO;
|
||||||
|
import com.ho.common.tools.annotation.TokenIgnore;
|
||||||
|
import com.ho.common.tools.constant.ContextConstant;
|
||||||
|
import com.ho.common.tools.exception.DataResult;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@RequestMapping(ContextConstant.BUSINESS + "shipEnergyStation")
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "业务模块-寄点能源电站管理")
|
||||||
|
public class ShipEnergyController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ShipEnergyService shipEnergyService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("add")
|
||||||
|
@ApiOperation(value = "新增电站接口")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult add() {
|
||||||
|
shipEnergyService.addShipEnergyStation();
|
||||||
|
return DataResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("getMainTotal")
|
||||||
|
@ApiOperation(value = "获取主监控汇总信息")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult getMainTotal() {
|
||||||
|
shipEnergyService.getShipEnergyTotal();
|
||||||
|
return DataResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("getStationIncomeHis")
|
||||||
|
@ApiOperation(value = "获取寄点电站历史收益")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult getStationIncomeHis(@RequestBody(required = false) String beginTime) {
|
||||||
|
shipEnergyService.getStationIncomeHis(beginTime);
|
||||||
|
return DataResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
package com.ho.business.controller;
|
||||||
|
|
||||||
|
import com.ho.business.entity.StationRemoteControl;
|
||||||
|
import com.ho.business.service.StationRemoteControlService;
|
||||||
|
import com.ho.business.vo.req.StationRemoteControlPageVo;
|
||||||
|
import com.ho.common.tools.annotation.LogAnnotation;
|
||||||
|
import com.ho.common.tools.constant.ContextConstant;
|
||||||
|
import com.ho.common.tools.exception.BaseResponseCode;
|
||||||
|
import com.ho.common.tools.exception.BusinessException;
|
||||||
|
import com.ho.common.tools.exception.DataResult;
|
||||||
|
import com.ho.common.tools.util.PageResult;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@RequestMapping(ContextConstant.BUSINESS + "stationRemote")
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "业务模块-电站远控管理")
|
||||||
|
public class StationRemoteController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StationRemoteControlService stationRemoteControlService;
|
||||||
|
|
||||||
|
@PostMapping("saveOrUpdate")
|
||||||
|
@ApiOperation(value = "新增/修改远控电站信息")
|
||||||
|
@LogAnnotation(title = "电站远控管理", action = "新增/修改新增远控电站信息")
|
||||||
|
public DataResult saveOrUpdate(@RequestBody @Valid StationRemoteControl entity) {
|
||||||
|
if(entity==null){
|
||||||
|
throw new BusinessException(BaseResponseCode.DATA_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
if(entity.getId()==null){
|
||||||
|
//新增
|
||||||
|
StationRemoteControl stationRemoteControl = stationRemoteControlService.search(entity.getStationId());
|
||||||
|
if (stationRemoteControl != null) {
|
||||||
|
throw new BusinessException(BaseResponseCode.STATION_ALREADY_EXISTS);
|
||||||
|
}
|
||||||
|
entity.setCreateTime(new Date());
|
||||||
|
stationRemoteControlService.insert(entity);
|
||||||
|
}else{
|
||||||
|
//修改
|
||||||
|
entity.setUpdateTime(new Date());
|
||||||
|
stationRemoteControlService.update(entity);
|
||||||
|
}
|
||||||
|
return DataResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("delete")
|
||||||
|
@ApiOperation(value = "删除远控电站信息")
|
||||||
|
@LogAnnotation(title = "电站远控管理", action = "删除远控电站信息")
|
||||||
|
public DataResult delete(@RequestBody Integer id) {
|
||||||
|
stationRemoteControlService.delete(id);
|
||||||
|
return DataResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("search")
|
||||||
|
@ApiOperation(value = "查询远控电站信息")
|
||||||
|
public DataResult<StationRemoteControl> search(@RequestBody StationRemoteControlPageVo vo) {
|
||||||
|
StationRemoteControl stationRemoteControl=stationRemoteControlService.search(vo.getStationId());
|
||||||
|
return DataResult.success(stationRemoteControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("pageList")
|
||||||
|
@ApiOperation(value = "查询远控电站信息")
|
||||||
|
public DataResult<PageResult<StationRemoteControl>> pageList(@RequestBody StationRemoteControlPageVo vo) {
|
||||||
|
PageResult<StationRemoteControl> page = stationRemoteControlService.selectPageList(vo);
|
||||||
|
return DataResult.success(page);
|
||||||
|
}
|
||||||
|
}
|
||||||
58
business-service/src/main/resources/application-test.yml
Normal file
58
business-service/src/main/resources/application-test.yml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
server:
|
||||||
|
port: 8011
|
||||||
|
servlet:
|
||||||
|
context-path: /api
|
||||||
|
|
||||||
|
#swagger2配置
|
||||||
|
swagger2:
|
||||||
|
enable: true #开启swagger
|
||||||
|
projectName: 云平台--business-前端接口
|
||||||
|
controllerPath: com.ho.business.controller
|
||||||
|
|
||||||
|
spring:
|
||||||
|
jackson:
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
name: business-service
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://192.168.0.139:3306/business_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||||
|
username: business_db
|
||||||
|
password: zzkj@688737
|
||||||
|
druid:
|
||||||
|
initialSize: 5
|
||||||
|
minIdle: 5
|
||||||
|
maxActive: 5
|
||||||
|
keepAlive: true #保持长连接
|
||||||
|
connection-error-retry-attempts: 3
|
||||||
|
#Redis
|
||||||
|
redis:
|
||||||
|
port: 6379 #端口
|
||||||
|
timeout: 50000ms #连接超时
|
||||||
|
host: 192.168.0.139 #单机
|
||||||
|
password: 123456
|
||||||
|
database: 0
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8 #连接池最大连接 默认8
|
||||||
|
max-idle: 8 #连接池中最大空闲连接 默认8
|
||||||
|
min-idle: 1 #连接池中最小空闲连接 默认0
|
||||||
|
max-wait: 2000ms #连接池最大阻塞等待时间 使用负值表示没有限制
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
client:
|
||||||
|
url: http://localhost:8019/boot
|
||||||
|
|
||||||
|
minio:
|
||||||
|
accessKey: minioadmin
|
||||||
|
secretKey: minioadmin
|
||||||
|
endpoint: http://1.95.170.86:9000
|
||||||
|
prefixUrl: http://1.95.170.86:9000
|
||||||
|
|
||||||
|
formula:
|
||||||
|
fieldmap:
|
||||||
|
RT_FIELD_BEAN: RT_FIELD_BEAN
|
||||||
Binary file not shown.
@ -146,6 +146,16 @@
|
|||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20231013</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -994,4 +994,64 @@ public interface CommonConstant {
|
|||||||
String CF_FROZEN = "cfFrozen";
|
String CF_FROZEN = "cfFrozen";
|
||||||
//将数据库统配符合“_”变成普通字符
|
//将数据库统配符合“_”变成普通字符
|
||||||
String JOIN_STATION_ID = "\\_";
|
String JOIN_STATION_ID = "\\_";
|
||||||
|
|
||||||
|
String REPORT_NAME="月度报表";
|
||||||
|
String REPORT_NAME_EN="Monthly report";
|
||||||
|
|
||||||
|
String BILL_NAME="月度账单";
|
||||||
|
String BILL_NAME_EN="Monthly bill";
|
||||||
|
|
||||||
|
// 语言切换
|
||||||
|
String LANG = "lang";
|
||||||
|
interface lang{
|
||||||
|
// 中文
|
||||||
|
String ZH = "zh";
|
||||||
|
// 英语
|
||||||
|
String EN = "en";
|
||||||
|
// 法语
|
||||||
|
String FRA = "fra";
|
||||||
|
// 西班牙
|
||||||
|
String SPA = "spa";
|
||||||
|
// 德语
|
||||||
|
String DE = "de";
|
||||||
|
// 波兰
|
||||||
|
String PL = "pl";
|
||||||
|
// 阿拉伯语
|
||||||
|
String ARA = "ara";
|
||||||
|
}
|
||||||
|
|
||||||
|
interface langTemp{
|
||||||
|
// 简体中文
|
||||||
|
String ZH_CN="zh_CN";
|
||||||
|
// 美式英语
|
||||||
|
String EN_US="en_US";
|
||||||
|
// 法语
|
||||||
|
String FR_FR="fr_FR";
|
||||||
|
// 西班牙语
|
||||||
|
String ES_ES="es_ES";
|
||||||
|
// 德语
|
||||||
|
String DE_DE="de_DE";
|
||||||
|
// 波兰语
|
||||||
|
String PL_PL="pl_PL";
|
||||||
|
// 阿拉伯语
|
||||||
|
String AR_EG="ar_EG";
|
||||||
|
}
|
||||||
|
|
||||||
|
interface HttpCode {
|
||||||
|
// 调用成功code
|
||||||
|
Integer SUCCESS_CODE = 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寄点 token 缓存 key
|
||||||
|
*/
|
||||||
|
String SHIP_ENERGY_TOKEN_KEY = "ShipEnergyToken";
|
||||||
|
/**
|
||||||
|
* 中车 token 缓存 key
|
||||||
|
*/
|
||||||
|
String BOULDER_ENERGY_TOKEN_KEY = "BoulderEnergyToken";
|
||||||
|
/**
|
||||||
|
* 监控数据
|
||||||
|
*/
|
||||||
|
String SHIP_ENERGY_MAIN = "ShipEnergyMain:";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,9 +26,12 @@ public interface DefineConstant {
|
|||||||
String SHARP = "尖";
|
String SHARP = "尖";
|
||||||
|
|
||||||
String SUMMARY = "汇总";
|
String SUMMARY = "汇总";
|
||||||
|
String SUMMARY_EN = "Summary";
|
||||||
|
|
||||||
String SUMMARY_DATA_STATION = "电站汇总数据";
|
String SUMMARY_DATA_STATION = "电站汇总数据";
|
||||||
|
|
||||||
|
String SUMMARY_DATA_STATION_EN = "Summary data of power station";
|
||||||
|
|
||||||
interface PeakShaving {
|
interface PeakShaving {
|
||||||
String ADD_TEMPLATE_SUCCESS = "新增计划曲线模板成功";
|
String ADD_TEMPLATE_SUCCESS = "新增计划曲线模板成功";
|
||||||
String TEMPLATE_CHECK_SIZE = "至少有一个时段和一个计划用电,请确认后重试!";
|
String TEMPLATE_CHECK_SIZE = "至少有一个时段和一个计划用电,请确认后重试!";
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public class AddressUntils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static JSONObject getLocationInfo(String lat, String lng) throws IOException {
|
public static JSONObject getLocationInfo(String lat, String lng) throws IOException {
|
||||||
String urlString = "https://apis.map.qq.com/ws/geocoder/v1/?location=" + lat + "," + lng + "&key=" + secretKey;
|
String urlString = "http://apis.map.qq.com/ws/geocoder/v1/?location=" + lat + "," + lng + "&key=" + secretKey;
|
||||||
System.out.println("请求经纬度url:" + urlString);
|
System.out.println("请求经纬度url:" + urlString);
|
||||||
URL url = new URL(urlString);
|
URL url = new URL(urlString);
|
||||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
|
|||||||
@ -0,0 +1,342 @@
|
|||||||
|
package com.ho.common.tools.util;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP工具类 - 支持GET/POST请求,支持表单和JSON传参
|
||||||
|
*/
|
||||||
|
public class HttpUtils {
|
||||||
|
/**
|
||||||
|
* 连接超时时间(毫秒)
|
||||||
|
*/
|
||||||
|
private static final int CONNECT_TIMEOUT = 10000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取超时时间(毫秒)
|
||||||
|
*/
|
||||||
|
private static final int READ_TIMEOUT = 30000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送GET请求(表单参数模式)
|
||||||
|
*
|
||||||
|
* @param url 请求URL
|
||||||
|
* @param params 表单参数
|
||||||
|
* @return 响应字符串
|
||||||
|
* @throws IOException 网络异常
|
||||||
|
*/
|
||||||
|
public static String getWithForm(String url, Map<String, String> params) throws IOException {
|
||||||
|
return get(url, buildFormParams(params), "application/x-www-form-urlencoded");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送GET请求(JSON参数模式)
|
||||||
|
*
|
||||||
|
* @param url 请求URL
|
||||||
|
* @param jsonParams JSON参数字符串
|
||||||
|
* @return 响应字符串
|
||||||
|
* @throws IOException 网络异常
|
||||||
|
*/
|
||||||
|
public static String getWithJson(String url, String jsonParams) throws IOException {
|
||||||
|
// 注意:GET请求通常不支持请求体中的JSON参数
|
||||||
|
// 但某些API可能支持,这里将其作为查询参数传递
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("json", jsonParams);
|
||||||
|
return get(url, buildFormParams(params), "application/x-www-form-urlencoded");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送POST请求(表单参数模式)
|
||||||
|
*
|
||||||
|
* @param url 请求URL
|
||||||
|
* @param params 表单参数
|
||||||
|
* @return 响应字符串
|
||||||
|
* @throws IOException 网络异常
|
||||||
|
*/
|
||||||
|
public static String postWithForm(String url, Map<String, String> params) throws IOException {
|
||||||
|
return post(url, buildFormParams(params), "application/x-www-form-urlencoded");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送POST请求(JSON参数模式)
|
||||||
|
*
|
||||||
|
* @param url 请求URL
|
||||||
|
* @param jsonParams JSON参数字符串
|
||||||
|
* @return 响应字符串
|
||||||
|
* @throws IOException 网络异常
|
||||||
|
*/
|
||||||
|
public static String postWithJson(String url, String jsonParams) throws IOException {
|
||||||
|
return post(url, jsonParams, "application/json; charset=utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送POST请求(JSON参数模式,使用Map自动转换为JSON)
|
||||||
|
*
|
||||||
|
* @param url 请求URL
|
||||||
|
* @param params 参数Map
|
||||||
|
* @return 响应字符串
|
||||||
|
* @throws IOException 网络异常
|
||||||
|
*/
|
||||||
|
public static String postWithJson(String url, Map<String, Object> params) throws IOException {
|
||||||
|
String jsonParams = mapToJson(params);
|
||||||
|
return postWithJson(url, jsonParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送GET请求(基础方法)
|
||||||
|
*/
|
||||||
|
private static String get(String url, String queryParams, String contentType) throws IOException {
|
||||||
|
String fullUrl = url;
|
||||||
|
if (queryParams != null && !queryParams.isEmpty()) {
|
||||||
|
fullUrl = url + "?" + queryParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpURLConnection connection = null;
|
||||||
|
BufferedReader reader = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
URL requestUrl = new URL(fullUrl);
|
||||||
|
connection = (HttpURLConnection) requestUrl.openConnection();
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
connection.setConnectTimeout(CONNECT_TIMEOUT);
|
||||||
|
connection.setReadTimeout(READ_TIMEOUT);
|
||||||
|
connection.setRequestProperty("Content-Type", contentType);
|
||||||
|
connection.setRequestProperty("User-Agent", "HttpUtils/1.0");
|
||||||
|
|
||||||
|
int responseCode = connection.getResponseCode();
|
||||||
|
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||||
|
reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
|
||||||
|
return readResponse(reader);
|
||||||
|
} else {
|
||||||
|
reader = new BufferedReader(new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8));
|
||||||
|
String errorResponse = readResponse(reader);
|
||||||
|
throw new IOException("HTTP GET Request Failed with Error Code: " + responseCode + ", Response: " + errorResponse);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
reader.close();
|
||||||
|
connection.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送POST请求(基础方法)
|
||||||
|
*/
|
||||||
|
private static String post(String url, String requestBody, String contentType) throws IOException {
|
||||||
|
HttpURLConnection connection = null;
|
||||||
|
OutputStream outputStream = null;
|
||||||
|
BufferedReader reader = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
URL requestUrl = new URL(url);
|
||||||
|
connection = (HttpURLConnection) requestUrl.openConnection();
|
||||||
|
connection.setRequestMethod("POST");
|
||||||
|
connection.setConnectTimeout(CONNECT_TIMEOUT);
|
||||||
|
connection.setReadTimeout(READ_TIMEOUT);
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
connection.setRequestProperty("Content-Type", contentType);
|
||||||
|
connection.setRequestProperty("User-Agent", "HttpUtils/1.0");
|
||||||
|
connection.setRequestProperty("Accept", "application/json, text/plain, */*");
|
||||||
|
|
||||||
|
// 写入请求体
|
||||||
|
if (requestBody != null && !requestBody.isEmpty()) {
|
||||||
|
outputStream = connection.getOutputStream();
|
||||||
|
outputStream.write(requestBody.getBytes(StandardCharsets.UTF_8));
|
||||||
|
outputStream.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
int responseCode = connection.getResponseCode();
|
||||||
|
if (responseCode == HttpURLConnection.HTTP_OK ||
|
||||||
|
responseCode == HttpURLConnection.HTTP_CREATED ||
|
||||||
|
responseCode == HttpURLConnection.HTTP_ACCEPTED) {
|
||||||
|
reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
|
||||||
|
return readResponse(reader);
|
||||||
|
} else {
|
||||||
|
reader = new BufferedReader(new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8));
|
||||||
|
String errorResponse = readResponse(reader);
|
||||||
|
throw new IOException("HTTP POST Request Failed with Error Code: " + responseCode + ", Response: " + errorResponse);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
outputStream.close();
|
||||||
|
reader.close();
|
||||||
|
connection.connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建表单参数字符串
|
||||||
|
*/
|
||||||
|
private static String buildFormParams(Map<String, String> params) throws UnsupportedEncodingException {
|
||||||
|
if (params == null || params.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringJoiner joiner = new StringJoiner("&");
|
||||||
|
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||||
|
String encodedKey = URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8.toString());
|
||||||
|
String encodedValue = URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString());
|
||||||
|
joiner.add(encodedKey + "=" + encodedValue);
|
||||||
|
}
|
||||||
|
return joiner.toString();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 将Map转换为JSON字符串(简单实现,实际项目中建议使用Jackson/Gson等库)
|
||||||
|
*/
|
||||||
|
public static String mapToJson(Map<String, Object> params) {
|
||||||
|
if (params == null || params.isEmpty()) {
|
||||||
|
return "{}";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder jsonBuilder = new StringBuilder("{");
|
||||||
|
boolean first = true;
|
||||||
|
|
||||||
|
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||||
|
if (!first) {
|
||||||
|
jsonBuilder.append(",");
|
||||||
|
}
|
||||||
|
first = false;
|
||||||
|
|
||||||
|
jsonBuilder.append("\"").append(escapeJson(entry.getKey())).append("\":");
|
||||||
|
|
||||||
|
Object value = entry.getValue();
|
||||||
|
if (value == null) {
|
||||||
|
jsonBuilder.append("null");
|
||||||
|
} else if (value instanceof String) {
|
||||||
|
jsonBuilder.append("\"").append(escapeJson((String) value)).append("\"");
|
||||||
|
} else if (value instanceof Number || value instanceof Boolean) {
|
||||||
|
jsonBuilder.append(value);
|
||||||
|
} else {
|
||||||
|
// 复杂对象需要序列化,这里简单处理
|
||||||
|
jsonBuilder.append("\"").append(escapeJson(value.toString())).append("\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonBuilder.append("}");
|
||||||
|
return jsonBuilder.toString();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 转义JSON特殊字符
|
||||||
|
*/
|
||||||
|
private static String escapeJson(String input) {
|
||||||
|
if (input == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return input.replace("\\", "\\\\")
|
||||||
|
.replace("\"", "\\\"")
|
||||||
|
.replace("\b", "\\b")
|
||||||
|
.replace("\f", "\\f")
|
||||||
|
.replace("\n", "\\n")
|
||||||
|
.replace("\r", "\\r")
|
||||||
|
.replace("\t", "\\t");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 读取响应内容
|
||||||
|
*/
|
||||||
|
private static String readResponse(BufferedReader reader) throws IOException {
|
||||||
|
StringBuilder response = new StringBuilder();
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
response.append(line);
|
||||||
|
}
|
||||||
|
return response.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送带请求头的GET请求(扩展方法)
|
||||||
|
*/
|
||||||
|
public static String getWithHeaders(String url, Map<String, String> params, Map<String, String> headers) throws IOException {
|
||||||
|
String fullUrl = url;
|
||||||
|
if (params != null && !params.isEmpty()) {
|
||||||
|
fullUrl = url + "?" + buildFormParams(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpURLConnection connection = null;
|
||||||
|
BufferedReader reader = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
URL requestUrl = new URL(fullUrl);
|
||||||
|
connection = (HttpURLConnection) requestUrl.openConnection();
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
connection.setConnectTimeout(CONNECT_TIMEOUT);
|
||||||
|
connection.setReadTimeout(READ_TIMEOUT);
|
||||||
|
connection.setRequestProperty("User-Agent", "HttpUtils/1.0");
|
||||||
|
|
||||||
|
// 添加自定义请求头
|
||||||
|
if (headers != null) {
|
||||||
|
for (Map.Entry<String, String> header : headers.entrySet()) {
|
||||||
|
connection.setRequestProperty(header.getKey(), header.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int responseCode = connection.getResponseCode();
|
||||||
|
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||||
|
reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
|
||||||
|
return readResponse(reader);
|
||||||
|
} else {
|
||||||
|
reader = new BufferedReader(new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8));
|
||||||
|
String errorResponse = readResponse(reader);
|
||||||
|
throw new IOException("HTTP GET Request Failed with Error Code: " + responseCode + ", Response: " + errorResponse);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
reader.close();
|
||||||
|
connection.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送带请求头的POST请求(扩展方法)
|
||||||
|
*/
|
||||||
|
public static String postWithHeaders(String url, String requestBody, String contentType, Map<String, String> headers) throws IOException {
|
||||||
|
HttpURLConnection connection = null;
|
||||||
|
OutputStream outputStream = null;
|
||||||
|
BufferedReader reader = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
URL requestUrl = new URL(url);
|
||||||
|
connection = (HttpURLConnection) requestUrl.openConnection();
|
||||||
|
connection.setRequestMethod("POST");
|
||||||
|
connection.setConnectTimeout(CONNECT_TIMEOUT);
|
||||||
|
connection.setReadTimeout(READ_TIMEOUT);
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
connection.setRequestProperty("Content-Type", contentType);
|
||||||
|
connection.setRequestProperty("User-Agent", "HttpUtils/1.0");
|
||||||
|
|
||||||
|
// 添加自定义请求头
|
||||||
|
if (headers != null) {
|
||||||
|
for (Map.Entry<String, String> header : headers.entrySet()) {
|
||||||
|
connection.setRequestProperty(header.getKey(), header.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 写入请求体
|
||||||
|
if (requestBody != null && !requestBody.isEmpty()) {
|
||||||
|
outputStream = connection.getOutputStream();
|
||||||
|
outputStream.write(requestBody.getBytes(StandardCharsets.UTF_8));
|
||||||
|
outputStream.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
int responseCode = connection.getResponseCode();
|
||||||
|
if (responseCode == HttpURLConnection.HTTP_OK ||
|
||||||
|
responseCode == HttpURLConnection.HTTP_CREATED ||
|
||||||
|
responseCode == HttpURLConnection.HTTP_ACCEPTED) {
|
||||||
|
reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
|
||||||
|
return readResponse(reader);
|
||||||
|
} else {
|
||||||
|
reader = new BufferedReader(new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8));
|
||||||
|
String errorResponse = readResponse(reader);
|
||||||
|
throw new IOException("HTTP POST Request Failed with Error Code: " + responseCode + ", Response: " + errorResponse);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
outputStream.close();
|
||||||
|
reader.close();
|
||||||
|
connection.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
package com.ho.common.tools.util;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import okhttp3.*;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
/**
|
||||||
|
* @author kerwin
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class TranslateUtils {
|
||||||
|
|
||||||
|
public static final String API_KEY = "hNDgbvTzhQymYvVvcAhCWEkh";
|
||||||
|
public static final String SECRET_KEY = "tkgqkVDEJi8xBSrToNPdJdV2CYFNZM31";
|
||||||
|
|
||||||
|
public static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().readTimeout(300, TimeUnit.SECONDS).build();
|
||||||
|
|
||||||
|
|
||||||
|
// 静态翻译方法:输入待翻译文本,返回目标语言文本
|
||||||
|
public static String translate(String text) throws IOException {
|
||||||
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
|
// 动态构建请求体(支持任意文本)
|
||||||
|
String jsonBody = String.format("{\"from\":\"zh\",\"to\":\"en\",\"q\":\"%s\"}", text);
|
||||||
|
RequestBody body = RequestBody.create(mediaType, jsonBody);
|
||||||
|
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url("https://aip.baidubce.com/rpc/2.0/mt/texttrans/v1?access_token=" + getAccessToken())
|
||||||
|
.post(body)
|
||||||
|
.addHeader("Content-Type", "application/json")
|
||||||
|
.addHeader("Accept", "application/json")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try (Response response = HTTP_CLIENT.newCall(request).execute()) {
|
||||||
|
String responseBody = response.body().string();
|
||||||
|
// 解析JSON获取dst值
|
||||||
|
return parseDstFromResponse(responseBody);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析JSON响应并提取dst
|
||||||
|
private static String parseDstFromResponse(String jsonResponse) {
|
||||||
|
JSONObject root = new JSONObject(jsonResponse);
|
||||||
|
JSONObject result = root.getJSONObject("result");
|
||||||
|
JSONArray transResult = result.getJSONArray("trans_result");
|
||||||
|
// 获取第一条翻译结果的dst字段
|
||||||
|
return transResult.getJSONObject(0).getString("dst");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 示例调用
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
String translated = translate("PCS环境过温降额[恢复]");
|
||||||
|
System.out.println("翻译结果: " + translated); // 输出: active power
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从用户的AK,SK生成鉴权签名(Access Token)
|
||||||
|
*
|
||||||
|
* @return 鉴权签名(Access Token)
|
||||||
|
* @throws IOException IO异常
|
||||||
|
*/
|
||||||
|
static String getAccessToken() throws IOException {
|
||||||
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||||
|
RequestBody body = RequestBody.create(mediaType, "grant_type=client_credentials&client_id=" + API_KEY
|
||||||
|
+ "&client_secret=" + SECRET_KEY);
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url("https://aip.baidubce.com/oauth/2.0/token")
|
||||||
|
.method("POST", body)
|
||||||
|
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
.build();
|
||||||
|
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||||
|
return new JSONObject(response.body().string()).getString("access_token");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -215,6 +215,8 @@ public interface DataCollectConstant {
|
|||||||
interface PV_CHARGE_POINT {
|
interface PV_CHARGE_POINT {
|
||||||
//光伏
|
//光伏
|
||||||
String PV_DAILY_CHARGING_ENERGY = "pvDailyChargingEnergy";
|
String PV_DAILY_CHARGING_ENERGY = "pvDailyChargingEnergy";
|
||||||
|
// Mppt 总发
|
||||||
|
String TOTAL_RELEASE = "totalRelease";
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BMS_POINT {
|
interface BMS_POINT {
|
||||||
|
|||||||
@ -128,7 +128,10 @@ public class MqttConfigUtil {
|
|||||||
"+/device/cd6cb4a64b42bda5",
|
"+/device/cd6cb4a64b42bda5",
|
||||||
"+/device/436de647bbf01b22",
|
"+/device/436de647bbf01b22",
|
||||||
"+/device/e9eee97d793756fa",
|
"+/device/e9eee97d793756fa",
|
||||||
"+/device/8c062827b5c1548b"
|
"+/device/8c062827b5c1548b",
|
||||||
|
"+/device/d143856d757625e1",
|
||||||
|
"+/device/3522ab4e7faf28b8",
|
||||||
|
"1/device/+"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
81
data-collect-service/src/main/resources/application-test.yml
Normal file
81
data-collect-service/src/main/resources/application-test.yml
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
server:
|
||||||
|
port: 8010
|
||||||
|
servlet:
|
||||||
|
context-path: /api
|
||||||
|
|
||||||
|
#swagger2配置
|
||||||
|
swagger2:
|
||||||
|
enable: true #开启swagger
|
||||||
|
projectName: 云平台--business-前端接口
|
||||||
|
controllerPath: com.ho.datacollect.controller
|
||||||
|
|
||||||
|
#mqtt
|
||||||
|
mqtt:
|
||||||
|
url: tcp://1.95.170.86:1883
|
||||||
|
userName: admin
|
||||||
|
passWord: zzkj688737
|
||||||
|
timeout: 5000
|
||||||
|
keepAlive: 60
|
||||||
|
|
||||||
|
#密钥
|
||||||
|
secret:
|
||||||
|
loginSecret: 6131231@#42a765#
|
||||||
|
|
||||||
|
#topic
|
||||||
|
topic:
|
||||||
|
edgeLoginRequest: +/device/+/login/request
|
||||||
|
cloudLoginResponse: +/cloud/+/login/response
|
||||||
|
|
||||||
|
cloudReadRequest: +/cloud/+/read/request
|
||||||
|
edgeReadResponse: +/device/+/read/response
|
||||||
|
cloudWriteRequest: +/cloud/+/write/request
|
||||||
|
edgeWriteResponse: +/device/+/write/response
|
||||||
|
|
||||||
|
cloudReportPush: +/cloud/+/report/push
|
||||||
|
edgeReportPush: +/device/+/report/push
|
||||||
|
|
||||||
|
cloudControlRequest: +/cloud/+/control/request
|
||||||
|
edgeControlResponse: +/device/+/control/response
|
||||||
|
|
||||||
|
spring:
|
||||||
|
jackson:
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
name: datacollect-service
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://192.168.0.139:3306/business_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||||
|
username: business_db
|
||||||
|
password: zzkj@688737
|
||||||
|
druid:
|
||||||
|
initialSize: 5
|
||||||
|
minIdle: 5
|
||||||
|
maxActive: 5
|
||||||
|
keepAlive: true #保持长连接
|
||||||
|
connection-error-retry-attempts: 3
|
||||||
|
#Redis
|
||||||
|
redis:
|
||||||
|
port: 6379 #端口
|
||||||
|
timeout: 3000ms #连接超时
|
||||||
|
host: 192.168.0.139 #单机
|
||||||
|
password: 123456
|
||||||
|
database: 0
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8 #连接池最大连接 默认8
|
||||||
|
max-idle: 8 #连接池中最大空闲连接 默认8
|
||||||
|
min-idle: 1 #连接池中最小空闲连接 默认0
|
||||||
|
max-wait: 2000ms #连接池最大阻塞等待时间 使用负值表示没有限制
|
||||||
|
|
||||||
|
minio:
|
||||||
|
accessKey: minioadmin
|
||||||
|
secretKey: minioadmin
|
||||||
|
endpoint: http://1.95.170.86:9000
|
||||||
|
prefixUrl: http://1.95.170.86:9000
|
||||||
|
|
||||||
|
#跳过登录:true ,不跳过:false
|
||||||
|
skipLogin: false
|
||||||
@ -18,6 +18,7 @@ import com.ho.common.tools.util.PageResult;
|
|||||||
import com.ho.filecenter.entity.MediaFile;
|
import com.ho.filecenter.entity.MediaFile;
|
||||||
import com.ho.filecenter.service.AnotherFileService;
|
import com.ho.filecenter.service.AnotherFileService;
|
||||||
import com.ho.filecenter.service.FileService;
|
import com.ho.filecenter.service.FileService;
|
||||||
|
import com.ho.filecenter.service.MqttTopicService;
|
||||||
import com.ho.filecenter.util.MqttConfigUtil;
|
import com.ho.filecenter.util.MqttConfigUtil;
|
||||||
import com.ho.filecenter.vo.mqtt.*;
|
import com.ho.filecenter.vo.mqtt.*;
|
||||||
import com.ho.filecenter.vo.resp.*;
|
import com.ho.filecenter.vo.resp.*;
|
||||||
@ -58,6 +59,9 @@ public class FileController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
AnotherFileService anotherFileService;
|
AnotherFileService anotherFileService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MqttTopicService mqttTopicService;
|
||||||
@PostMapping("filePage")
|
@PostMapping("filePage")
|
||||||
@ApiOperation(value = "分页查询文件")
|
@ApiOperation(value = "分页查询文件")
|
||||||
public DataResult<PageResult<MediaFile>> filePage(@RequestBody FilePageVO vo, HttpServletRequest request) {
|
public DataResult<PageResult<MediaFile>> filePage(@RequestBody FilePageVO vo, HttpServletRequest request) {
|
||||||
@ -158,7 +162,7 @@ public class FileController {
|
|||||||
return DataResult.success(fileAttributeResp);
|
return DataResult.success(fileAttributeResp);
|
||||||
}
|
}
|
||||||
String serialNo = vo.getSerialNo();
|
String serialNo = vo.getSerialNo();
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||||
fileAttributeResp = fileService.getFileAttribute(vo);
|
fileAttributeResp = fileService.getFileAttribute(vo);
|
||||||
}else{
|
}else{
|
||||||
@ -180,7 +184,7 @@ public class FileController {
|
|||||||
return DataResult.success(fileDeleteResp);
|
return DataResult.success(fileDeleteResp);
|
||||||
}
|
}
|
||||||
String serialNo = fileDeleteReqVO.getSerialNo();
|
String serialNo = fileDeleteReqVO.getSerialNo();
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||||
fileDeleteResp = fileService.deleteDeviceFiles(fileDeleteReqVO);
|
fileDeleteResp = fileService.deleteDeviceFiles(fileDeleteReqVO);
|
||||||
}else{
|
}else{
|
||||||
@ -210,7 +214,7 @@ public class FileController {
|
|||||||
resp.setMsg(CommonConstant.Heartbeat.MSG + serialNo + CommonConstant.Heartbeat.SUCCESS);
|
resp.setMsg(CommonConstant.Heartbeat.MSG + serialNo + CommonConstant.Heartbeat.SUCCESS);
|
||||||
resp.setHeartbeatStatus(CommonConstant.ONE);
|
resp.setHeartbeatStatus(CommonConstant.ONE);
|
||||||
log.info("文件上传(向边端上传)开始上传");
|
log.info("文件上传(向边端上传)开始上传");
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||||
fileService.fileUploadForDevice(file, stationId, serialNo, filePath);
|
fileService.fileUploadForDevice(file, stationId, serialNo, filePath);
|
||||||
}else{
|
}else{
|
||||||
@ -240,7 +244,7 @@ public class FileController {
|
|||||||
log.info("文件下载(从边端下载到云端)开始下载");
|
log.info("文件下载(从边端下载到云端)开始下载");
|
||||||
fileService.downloadFromDevice(fileForDeviceReqVO);
|
fileService.downloadFromDevice(fileForDeviceReqVO);
|
||||||
String serialNo = fileForDeviceReqVO.getSerialNo();
|
String serialNo = fileForDeviceReqVO.getSerialNo();
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||||
fileService.downloadFromDevice(fileForDeviceReqVO);
|
fileService.downloadFromDevice(fileForDeviceReqVO);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import com.ho.common.tools.util.PageResult;
|
|||||||
import com.ho.filecenter.feignclient.BusinessFeignClient;
|
import com.ho.filecenter.feignclient.BusinessFeignClient;
|
||||||
import com.ho.filecenter.feignclient.UserFeignClient;
|
import com.ho.filecenter.feignclient.UserFeignClient;
|
||||||
import com.ho.filecenter.service.AnotherOrderSendService;
|
import com.ho.filecenter.service.AnotherOrderSendService;
|
||||||
|
import com.ho.filecenter.service.MqttTopicService;
|
||||||
import com.ho.filecenter.service.OrderSendService;
|
import com.ho.filecenter.service.OrderSendService;
|
||||||
import com.ho.filecenter.util.MqttConfigUtil;
|
import com.ho.filecenter.util.MqttConfigUtil;
|
||||||
import com.ho.filecenter.vo.mqtt.*;
|
import com.ho.filecenter.vo.mqtt.*;
|
||||||
@ -65,6 +66,9 @@ public class OrderSendController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AnotherOrderSendService anotherOrderSendService;
|
AnotherOrderSendService anotherOrderSendService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MqttTopicService mqttTopicService;
|
||||||
|
|
||||||
public static final Long TIME_LIMIT = 90L;
|
public static final Long TIME_LIMIT = 90L;
|
||||||
|
|
||||||
@PostMapping("orderIssued")
|
@PostMapping("orderIssued")
|
||||||
@ -163,8 +167,8 @@ public class OrderSendController {
|
|||||||
return DataResult.success(heartbeatResp);
|
return DataResult.success(heartbeatResp);
|
||||||
}
|
}
|
||||||
log.info("指令下发正常开始下发");
|
log.info("指令下发正常开始下发");
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
if(snList.contains(sn)){
|
if(snList.stream().anyMatch(s -> s.contains(sn))){
|
||||||
orderSendService.orderIssued(vo);
|
orderSendService.orderIssued(vo);
|
||||||
}else{
|
}else{
|
||||||
anotherOrderSendService.orderIssued(vo);
|
anotherOrderSendService.orderIssued(vo);
|
||||||
@ -333,9 +337,9 @@ public class OrderSendController {
|
|||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public DataResult<HeartbeatResp> sendPlanPowerOrder(@RequestBody OrderPlanPowerReq vo) {
|
public DataResult<HeartbeatResp> sendPlanPowerOrder(@RequestBody OrderPlanPowerReq vo) {
|
||||||
String sn = vo.getSn();
|
String sn = vo.getSn();
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
HeartbeatResp heartbeatResp = null;
|
HeartbeatResp heartbeatResp = null;
|
||||||
if(snList.contains(sn)){
|
if(snList.stream().anyMatch(s -> s.contains(sn))){
|
||||||
heartbeatResp = orderSendService.sendPlanPowerOrder(vo);
|
heartbeatResp = orderSendService.sendPlanPowerOrder(vo);
|
||||||
}else{
|
}else{
|
||||||
heartbeatResp = anotherOrderSendService.sendPlanPowerOrder(vo);
|
heartbeatResp = anotherOrderSendService.sendPlanPowerOrder(vo);
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.ho.filecenter.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kerwin
|
||||||
|
*/
|
||||||
|
public interface MqttTopicMapper {
|
||||||
|
List<String> getSnList();
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.ho.filecenter.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kerwin
|
||||||
|
*/
|
||||||
|
public interface MqttTopicService {
|
||||||
|
|
||||||
|
List<String> getSnList();
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.ho.filecenter.service.impl;
|
||||||
|
|
||||||
|
import com.ho.filecenter.mapper.MqttTopicMapper;
|
||||||
|
import com.ho.filecenter.service.MqttTopicService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kerwin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class MqttTopicServiceImpl implements MqttTopicService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MqttTopicMapper mqttTopicMapper;
|
||||||
|
@Override
|
||||||
|
public List<String> getSnList() {
|
||||||
|
return mqttTopicMapper.getSnList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -133,8 +133,10 @@ public class MqttConfigUtil {
|
|||||||
"+/device/cd6cb4a64b42bda5",
|
"+/device/cd6cb4a64b42bda5",
|
||||||
"+/device/436de647bbf01b22",
|
"+/device/436de647bbf01b22",
|
||||||
"+/device/e9eee97d793756fa",
|
"+/device/e9eee97d793756fa",
|
||||||
"+/device/8c062827b5c1548b"
|
"+/device/8c062827b5c1548b",
|
||||||
|
"+/device/d143856d757625e1",
|
||||||
|
"+/device/3522ab4e7faf28b8",
|
||||||
|
"1/device/+"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -180,13 +182,4 @@ public class MqttConfigUtil {
|
|||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取SN配置合集
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getSnList(){
|
|
||||||
List<String> strings = Arrays.asList(commonTopic);
|
|
||||||
return strings;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
99
file-center/src/main/resources/application-test.yml
Normal file
99
file-center/src/main/resources/application-test.yml
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
#文件中心
|
||||||
|
server:
|
||||||
|
port: 8017
|
||||||
|
servlet:
|
||||||
|
#上下文统一使用api,屏蔽前端路径差异
|
||||||
|
context-path: /api
|
||||||
|
|
||||||
|
#mqtt
|
||||||
|
mqtt:
|
||||||
|
url: tcp://1.95.170.86:1883
|
||||||
|
userName: admin
|
||||||
|
passWord: zzkj688737
|
||||||
|
timeout: 5000
|
||||||
|
keepAlive: 60
|
||||||
|
|
||||||
|
|
||||||
|
#主题 todo
|
||||||
|
topic:
|
||||||
|
cloudFileRequest: +/cloud/+/file/request
|
||||||
|
cloudFileResponse: +/cloud/+/file/response
|
||||||
|
edgeFileResponse: +/device/+/file/response
|
||||||
|
edgeFileRequest: +/device/+/file/request
|
||||||
|
|
||||||
|
cloudControlRequest: +/cloud/+/control/request
|
||||||
|
edgeControlResponse: +/device/+/control/response
|
||||||
|
|
||||||
|
#路径 todo 先再本地
|
||||||
|
path:
|
||||||
|
local: /opt/file_center
|
||||||
|
#下发文件路径
|
||||||
|
copy: /opt/file_copy
|
||||||
|
#天气ip2region.db路径
|
||||||
|
weather: /opt/ip2region.db
|
||||||
|
chartPath: /opt/image/
|
||||||
|
|
||||||
|
#指定字节大小
|
||||||
|
size:
|
||||||
|
byteSize: 102400
|
||||||
|
|
||||||
|
|
||||||
|
#通用文件
|
||||||
|
files:
|
||||||
|
upload:
|
||||||
|
path: D:\upload
|
||||||
|
format: .jpg,.png,.doc,.docx,.xlsx,.xls,.pdf
|
||||||
|
maxByte: 10485760
|
||||||
|
|
||||||
|
#swagger2配置
|
||||||
|
swagger2:
|
||||||
|
enable: true #开启标志 生产环境要关闭
|
||||||
|
projectName: 云平台-文件中心-接口
|
||||||
|
controllerPath: com.ho.filecenter.controller
|
||||||
|
|
||||||
|
spring:
|
||||||
|
jackson:
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
name: file-center
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://192.168.0.139:3306/file_center_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||||
|
username: file_center_db
|
||||||
|
password: zzkj@688737
|
||||||
|
druid:
|
||||||
|
initialSize: 5
|
||||||
|
minIdle: 5
|
||||||
|
maxActive: 5
|
||||||
|
keepAlive: true #保持长连接
|
||||||
|
connection-error-retry-attempts: 3
|
||||||
|
#设备文件上传大小
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 500MB
|
||||||
|
max-request-size: 500MB
|
||||||
|
enabled: true
|
||||||
|
#Redis
|
||||||
|
redis:
|
||||||
|
port: 6379 #端口
|
||||||
|
timeout: 3000ms #连接超时
|
||||||
|
host: 192.168.0.139 #单机
|
||||||
|
password: 123456
|
||||||
|
database: 0
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8 #连接池最大连接 默认8
|
||||||
|
max-idle: 8 #连接池中最大空闲连接 默认8
|
||||||
|
min-idle: 1 #连接池中最小空闲连接 默认0
|
||||||
|
max-wait: 2000ms #连接池最大阻塞等待时间 使用负值表示没有限制
|
||||||
|
|
||||||
|
minio:
|
||||||
|
accessKey: minioadmin
|
||||||
|
secretKey: minioadmin
|
||||||
|
endpoint: http://1.95.170.86:9000
|
||||||
|
prefixUrl: http://1.95.170.86:9000
|
||||||
|
|
||||||
10
file-center/src/main/resources/mapper/MqttTopicMapper.xml
Normal file
10
file-center/src/main/resources/mapper/MqttTopicMapper.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?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.ho.filecenter.mapper.MqttTopicMapper">
|
||||||
|
|
||||||
|
<select id="getSnList" resultType="java.lang.String">
|
||||||
|
select topic from mqtt_topic
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
84
flowable-center/src/main/resources/application-test.yml
Normal file
84
flowable-center/src/main/resources/application-test.yml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#文件中心
|
||||||
|
server:
|
||||||
|
port: 8021
|
||||||
|
servlet:
|
||||||
|
#上下文统一使用api,屏蔽前端路径差异
|
||||||
|
context-path: /api
|
||||||
|
tomcat:
|
||||||
|
min-spare-threads: 30
|
||||||
|
spring:
|
||||||
|
jackson:
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
name: flowable-center
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://192.168.0.139:3306/flow_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||||
|
username: flow_db
|
||||||
|
password: zzkj@688737
|
||||||
|
druid:
|
||||||
|
initialSize: 5
|
||||||
|
minIdle: 5
|
||||||
|
maxActive: 5
|
||||||
|
keepAlive: true #保持长连接
|
||||||
|
connection-error-retry-attempts: 3
|
||||||
|
|
||||||
|
#Redis
|
||||||
|
redis:
|
||||||
|
port: 6379 #端口
|
||||||
|
timeout: 300000ms #连接超时
|
||||||
|
host: 192.168.0.139 #单机
|
||||||
|
password: 123456
|
||||||
|
database: 0
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8 #连接池最大连接 默认8
|
||||||
|
max-idle: 8 #连接池中最大空闲连接 默认8
|
||||||
|
min-idle: 1 #连接池中最小空闲连接 默认0
|
||||||
|
max-wait: 2000ms #连接池最大阻塞等待时间 使用负值表示没有限制
|
||||||
|
#工作流
|
||||||
|
activiti:
|
||||||
|
# 自动部署,验证设置:true-开启(默认)、false-关闭
|
||||||
|
check-process-definitions: false
|
||||||
|
# 保存历史数据
|
||||||
|
history-level: full
|
||||||
|
# 检测历史表是否存在
|
||||||
|
db-history-used: true
|
||||||
|
# 关闭自动部署
|
||||||
|
deployment-mode: never-fail
|
||||||
|
# 对数据库中所有表进行更新操作,如果表不存在,则自动创建
|
||||||
|
# create_drop:启动时创建表,在关闭时删除表(必须手动关闭引擎,才能删除表)
|
||||||
|
# drop-create:启动时删除原来的旧表,然后在创建新表(不需要手动关闭引擎)
|
||||||
|
database-schema-update: true
|
||||||
|
# 解决频繁查询SQL问题
|
||||||
|
async-executor-activate: false
|
||||||
|
use-strong-uuids: false
|
||||||
|
initialDelay: 5
|
||||||
|
flag: 0
|
||||||
|
|
||||||
|
#自定义工作量变量
|
||||||
|
flow:
|
||||||
|
#工单流程配置
|
||||||
|
workOrder:
|
||||||
|
#流程定义的key ,根据实际的名称来
|
||||||
|
procDefKey: workOrder
|
||||||
|
#处理工单的岗位 ,后续可能是多个
|
||||||
|
doing: tro,worker
|
||||||
|
#验收工单的岗位
|
||||||
|
check: tro,worker
|
||||||
|
#评价工单的岗位
|
||||||
|
appraise: ceo
|
||||||
|
|
||||||
|
#swagger2配置
|
||||||
|
swagger2:
|
||||||
|
enable: true #开启swagger
|
||||||
|
projectName: 云平台--flow-前端接口
|
||||||
|
controllerPath: com.ho.flow.controller
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1597,7 +1597,47 @@ public class Device001ApiController {
|
|||||||
}
|
}
|
||||||
return DataResult.success(list);
|
return DataResult.success(list);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 冻结光伏-Mppt日发电量
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("getToDayPVMpptCharge")
|
||||||
|
public DataResult<StationHomeRespVo> getToDayPVMpptCharge(@RequestBody TdBaseTimeQuery query){
|
||||||
|
//拼接后缀表名
|
||||||
|
Map<Integer, String> colNameMap = query.getMap();
|
||||||
|
String modelName = query.getModelName();
|
||||||
|
StationHomeRespVo stationHomeRespVo = new StationHomeRespVo();
|
||||||
|
if (colNameMap != null) {
|
||||||
|
//查询发电量
|
||||||
|
String charge = colNameMap.get(query.getSrcId());
|
||||||
|
if (charge != null) {
|
||||||
|
query.setBeginLong(query.getBegin().getTime());
|
||||||
|
query.setEndLong(query.getEnd().getTime());
|
||||||
|
query.setCol(charge);
|
||||||
|
String tableName = getTableName(query);
|
||||||
|
log.info("charge != null");
|
||||||
|
//计算昨日发电量
|
||||||
|
BigDecimal ele = getPvBigDecimal(query, tableName, modelName, charge, DeviceTypeConstant.PV_DAILY_CHARGE_START);
|
||||||
|
stationHomeRespVo.setDigital(ele);
|
||||||
|
// 缓存今日发电量起始值
|
||||||
|
query.setBeginLong(DateUtil.beginOfDay(DateUtil.date()).getTime());
|
||||||
|
query.setEndLong(DateUtil.endOfDay(DateUtil.date()).getTime());
|
||||||
|
List<StationHomeRespVo> stationHomeRespVos = null;
|
||||||
|
if (DeviceTypeConstant.DEVICE_SIMPLE.equals(modelName)) {
|
||||||
|
stationHomeRespVos = deviceSimpleMapper.selectAll(query, tableName);
|
||||||
|
} else if (DeviceTypeConstant.DEVICE_COMPLEX.equals(modelName)) {
|
||||||
|
stationHomeRespVos = deviceComplexMapper.selectAll(query, tableName);
|
||||||
|
}
|
||||||
|
if (stationHomeRespVos != null && stationHomeRespVos.size() > 0) {
|
||||||
|
BigDecimal startEle = stationHomeRespVos.get(0).getDigital();
|
||||||
|
query.setBegin(DateUtil.beginOfDay(new Date()));
|
||||||
|
cacheObj(query, DeviceTypeConstant.PV_DAILY_CHARGE_START, startEle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DataResult.success(stationHomeRespVo);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 光伏累计充
|
* 光伏累计充
|
||||||
*/
|
*/
|
||||||
@ -1780,6 +1820,31 @@ public class Device001ApiController {
|
|||||||
return ele;
|
return ele;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private BigDecimal getPvBigDecimal(TdBaseTimeQuery query, String tableName, String modelName, String col, String dayCol) {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
List<StationHomeRespVo> stationHomeRespVos = null;
|
||||||
|
if (DeviceTypeConstant.DEVICE_SIMPLE.equals(modelName)) {
|
||||||
|
stationHomeRespVos = deviceSimpleMapper.selectAll(query, tableName);
|
||||||
|
} else if (DeviceTypeConstant.DEVICE_COMPLEX.equals(modelName)) {
|
||||||
|
stationHomeRespVos = deviceComplexMapper.selectAll(query, tableName);
|
||||||
|
}
|
||||||
|
BigDecimal ele = BigDecimal.ZERO;
|
||||||
|
if (stationHomeRespVos != null && stationHomeRespVos.size() > 0) {
|
||||||
|
int len = stationHomeRespVos.size();
|
||||||
|
BigDecimal startEle = stationHomeRespVos.get(0).getDigital();
|
||||||
|
BigDecimal endEle = stationHomeRespVos.get(len - 1).getDigital();
|
||||||
|
ele = endEle.subtract(startEle);
|
||||||
|
//处理异常值
|
||||||
|
ele = handleEle(ele, startEle, endEle, stationHomeRespVos);
|
||||||
|
} else {
|
||||||
|
log.info("getDayPowerGeneration get stationHomeRespVos is empty,col:{},tableName:{},time:{}", col, tableName, new Date());
|
||||||
|
}
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
log.info("getBigDecimal used1:" + (end - start));
|
||||||
|
return ele;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异常值处理
|
* 异常值处理
|
||||||
*
|
*
|
||||||
|
|||||||
39
td-service/src/main/resources/application-test.yml
Normal file
39
td-service/src/main/resources/application-test.yml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
server:
|
||||||
|
port: 8013
|
||||||
|
servlet:
|
||||||
|
context-path: /td
|
||||||
|
|
||||||
|
spring:
|
||||||
|
jackson:
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
name: td-service
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
datasource:
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
|
||||||
|
url: jdbc:TAOS-RS://192.168.0.139:6041/test_td_db?user=root&password=taosdata&charset=UTF-8&locale=zh_CN.UTF-8&timezone=UTC-8
|
||||||
|
username: root
|
||||||
|
password: taosdata
|
||||||
|
druid:
|
||||||
|
initial-size: 6
|
||||||
|
min-idle: 6
|
||||||
|
max-active: 12
|
||||||
|
max-wait: 10000
|
||||||
|
time-between-eviction-runs-millis: 60000
|
||||||
|
validation-query: SELECT 1 as nums
|
||||||
|
#Redis
|
||||||
|
redis:
|
||||||
|
port: 6379 #端口
|
||||||
|
timeout: 3000ms #连接超时
|
||||||
|
host: 192.168.0.139 #单机
|
||||||
|
password: 123456
|
||||||
|
database: 0
|
||||||
|
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
client:
|
||||||
|
url: http://localhost:8019/boot
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.ho.user.api.vo.req;
|
||||||
|
|
||||||
|
import com.ho.common.tools.entity.UserDetailRespVO;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户统一登陆
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserUnifiedLoginVo {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "储能登陆")
|
||||||
|
private UserDetailRespVO energy;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "光伏登陆")
|
||||||
|
private UserDetailRespVO pv;
|
||||||
|
|
||||||
|
}
|
||||||
@ -73,6 +73,7 @@ public class ShiroConfig {
|
|||||||
// 配置不会被拦截的链接 顺序判断
|
// 配置不会被拦截的链接 顺序判断
|
||||||
filterChainDefinitionMap.put("/sys/user/login", "anon");
|
filterChainDefinitionMap.put("/sys/user/login", "anon");
|
||||||
filterChainDefinitionMap.put("/sys/user/getToken", "anon");
|
filterChainDefinitionMap.put("/sys/user/getToken", "anon");
|
||||||
|
filterChainDefinitionMap.put("/sys/user/getUnifiedLogin", "anon");
|
||||||
filterChainDefinitionMap.put("/sys/user/register", "anon");
|
filterChainDefinitionMap.put("/sys/user/register", "anon");
|
||||||
filterChainDefinitionMap.put("/sys/key/decrypt", "anon");
|
filterChainDefinitionMap.put("/sys/key/decrypt", "anon");
|
||||||
filterChainDefinitionMap.put("/mongoId", "anon");
|
filterChainDefinitionMap.put("/mongoId", "anon");
|
||||||
|
|||||||
@ -2,6 +2,10 @@ package com.ho.user.controller;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.crypto.digest.BCrypt;
|
import cn.hutool.crypto.digest.BCrypt;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.ho.business.vo.resp.ShipStationRespVO;
|
||||||
import com.ho.common.tools.annotation.HzPermission;
|
import com.ho.common.tools.annotation.HzPermission;
|
||||||
import com.ho.common.tools.annotation.LogAnnotation;
|
import com.ho.common.tools.annotation.LogAnnotation;
|
||||||
import com.ho.common.tools.annotation.TokenIgnore;
|
import com.ho.common.tools.annotation.TokenIgnore;
|
||||||
@ -18,9 +22,11 @@ import com.ho.common.tools.exception.DataResult;
|
|||||||
import com.ho.common.tools.service.RedisService;
|
import com.ho.common.tools.service.RedisService;
|
||||||
import com.ho.common.tools.util.AESEncryptUtil;
|
import com.ho.common.tools.util.AESEncryptUtil;
|
||||||
import com.ho.common.tools.util.FastUtils;
|
import com.ho.common.tools.util.FastUtils;
|
||||||
|
import com.ho.common.tools.util.HttpUtils;
|
||||||
import com.ho.user.api.entity.SysDept;
|
import com.ho.user.api.entity.SysDept;
|
||||||
import com.ho.user.api.entity.SysUser;
|
import com.ho.user.api.entity.SysUser;
|
||||||
import com.ho.user.api.entity.WorkOrderUser;
|
import com.ho.user.api.entity.WorkOrderUser;
|
||||||
|
import com.ho.user.api.vo.req.UserUnifiedLoginVo;
|
||||||
import com.ho.user.entity.SysTheme;
|
import com.ho.user.entity.SysTheme;
|
||||||
import com.ho.user.service.*;
|
import com.ho.user.service.*;
|
||||||
import com.ho.user.vo.req.*;
|
import com.ho.user.vo.req.*;
|
||||||
@ -543,4 +549,58 @@ public class UserController {
|
|||||||
return DataResult.success();
|
return DataResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "getUnifiedLogin")
|
||||||
|
@ApiOperation(value = "用户统一登录接口")
|
||||||
|
@TokenIgnore
|
||||||
|
public DataResult<UserUnifiedLoginVo> getUnifiedLogin(@RequestBody @Valid LoginReqVO loginReqVO) {
|
||||||
|
UserUnifiedLoginVo unifiedLoginVo = new UserUnifiedLoginVo();
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
try {
|
||||||
|
//储能登陆
|
||||||
|
String enUrl = "http://localhost:8012/api/sys/user/login";
|
||||||
|
String enJson = HttpUtils.postWithJson(enUrl,mapper.writeValueAsString(loginReqVO));
|
||||||
|
JSONObject en = JSONObject.parseObject(enJson);
|
||||||
|
Integer codeEn = en.getInteger("code");
|
||||||
|
if(CommonConstant.HttpCode.SUCCESS_CODE.equals(codeEn)){
|
||||||
|
String enString = en.getString("data");
|
||||||
|
UserDetailRespVO enVo = JSON.parseObject(enString,UserDetailRespVO.class);
|
||||||
|
unifiedLoginVo.setEnergy(enVo);
|
||||||
|
}
|
||||||
|
//光伏登陆
|
||||||
|
String pvUrl = "http://1.95.112.231:18012/api/sys/user/login";
|
||||||
|
String pvJson = HttpUtils.postWithJson(pvUrl,mapper.writeValueAsString(loginReqVO));
|
||||||
|
JSONObject pv = JSONObject.parseObject(pvJson);
|
||||||
|
Integer codePv = pv.getInteger("code");
|
||||||
|
if(CommonConstant.HttpCode.SUCCESS_CODE.equals(codePv)){
|
||||||
|
String pvString = pv.getString("data");
|
||||||
|
UserDetailRespVO pvVo = JSON.parseObject(pvString,UserDetailRespVO.class);
|
||||||
|
unifiedLoginVo.setPv(pvVo);
|
||||||
|
}
|
||||||
|
if(unifiedLoginVo.getEnergy()==null && unifiedLoginVo.getPv()==null){
|
||||||
|
if(BaseResponseCode.NOT_ACCOUNT.getCode()==codeEn
|
||||||
|
&&BaseResponseCode.NOT_ACCOUNT.getCode()==codePv){
|
||||||
|
throw new BusinessException(BaseResponseCode.NOT_ACCOUNT);
|
||||||
|
}
|
||||||
|
if (BaseResponseCode.PASSWORD_ERROR.getCode()==codeEn
|
||||||
|
||BaseResponseCode.PASSWORD_ERROR.getCode()==codePv ){
|
||||||
|
throw new BusinessException(BaseResponseCode.PASSWORD_ERROR);
|
||||||
|
}
|
||||||
|
if (BaseResponseCode.USER_LOCK.getCode()==codeEn
|
||||||
|
||BaseResponseCode.USER_LOCK.getCode()==codePv ){
|
||||||
|
throw new BusinessException(BaseResponseCode.USER_LOCK);
|
||||||
|
}
|
||||||
|
if (BaseResponseCode.LOSE_EFFICACY.getCode()==codeEn
|
||||||
|
||BaseResponseCode.LOSE_EFFICACY.getCode()==codePv ){
|
||||||
|
throw new BusinessException(BaseResponseCode.LOSE_EFFICACY);
|
||||||
|
}
|
||||||
|
if (BaseResponseCode.TO_BELONGING_DEPT_DISABLE.getCode()==codeEn
|
||||||
|
||BaseResponseCode.TO_BELONGING_DEPT_DISABLE.getCode()==codePv ){
|
||||||
|
throw new BusinessException(BaseResponseCode.TO_BELONGING_DEPT_DISABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return DataResult.success(unifiedLoginVo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
66
user-service/src/main/resources/application-test.yml
Normal file
66
user-service/src/main/resources/application-test.yml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#用户中心
|
||||||
|
server:
|
||||||
|
port: 8012
|
||||||
|
servlet:
|
||||||
|
context-path: /api
|
||||||
|
|
||||||
|
#swagger2配置
|
||||||
|
swagger2:
|
||||||
|
enable: true #开启标志 生产环境要关闭
|
||||||
|
projectName: 云平台-用户中心-接口
|
||||||
|
controllerPath: com.ho.user.controller
|
||||||
|
|
||||||
|
spring:
|
||||||
|
jackson:
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
name: user-center
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://192.168.0.139:3306/user_center_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||||
|
username: user_center_db
|
||||||
|
password: zzkj@688737
|
||||||
|
druid:
|
||||||
|
initialSize: 5
|
||||||
|
minIdle: 5
|
||||||
|
maxActive: 5
|
||||||
|
keepAlive: true #保持长连接
|
||||||
|
connection-error-retry-attempts: 3
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
client:
|
||||||
|
url: http://localhost:8019/boot
|
||||||
|
#Redis
|
||||||
|
redis:
|
||||||
|
port: 6379 #端口
|
||||||
|
timeout: 3000ms #连接超时
|
||||||
|
host: 192.168.0.139 #单机
|
||||||
|
password: 123456
|
||||||
|
database: 0
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8 #连接池最大连接 默认8
|
||||||
|
max-idle: 8 #连接池中最大空闲连接 默认8
|
||||||
|
min-idle: 1 #连接池中最小空闲连接 默认0
|
||||||
|
max-wait: 2000ms #连接池最大阻塞等待时间 使用负值表示没有限制
|
||||||
|
|
||||||
|
#jwt配置
|
||||||
|
jwt:
|
||||||
|
secretKey: 78944878877848fg)
|
||||||
|
accessTokenExpireTime: PT2H
|
||||||
|
refreshTokenExpireTime: PT8H
|
||||||
|
refreshTokenExpireAppTime: P30D
|
||||||
|
issuer: hocloudSystem
|
||||||
|
|
||||||
|
#加解密
|
||||||
|
rsa:
|
||||||
|
pubKey: 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuG6ZABNgLQCI9iVPDuJEb7xb5zR9UGKyKXshLuJFZxyNtaEzfpjSMqsshUYA1QpwUvkmZE0lcRE4F4QtZO9rDnH2PoW1FWRbjgg0+MKWOmZr9hSPKM/BIE+knTtTaj4/0TK7QwDd9q/QAIduC1hIyxIIkxfWx0gFuTnxui0waCwIDAQAB'
|
||||||
|
privateKey: 'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAK4bpkAE2AtAIj2JU8O4kRvvFvnNH1QYrIpeyEu4kVnHI21oTN+mNIyqyyFRgDVCnBS+SZkTSVxETgXhC1k72sOcfY+hbUVZFuOCDT4wpY6Zmv2FI8oz8EgT6SdO1NqPj/RMrtDAN32r9AAh24LWEjLEgiTF9bHSAW5OfG6LTBoLAgMBAAECgYA614NfXYO6galQzMmvewAnxa0pLYbqABDIDvJ4jN8qzV+OyVI5v81AwTQ3hXjkBygC5rCu+FKxyS/pUr5oIQ90vbKvy+kozg9l0qWHfa8XrfC+E36CVuDrZYdZzl0C6J6BoNB9osJJ6HCnMA7kWLRRwU5VJBsK8CmgcJlfHNH60QJBAPz4rZgqgor69SonHG4xjRz+u4QkXIP8I+lorBSFEuUF03u22Kcxz7mcOq63m8K+oc22ql0g8QNrq6YPrEgpAPMCQQCwMUQcdZLWJrRbHp1ZA3jbt4vYg7xb1LklAM6Qmz1R9xVY0itDMtFRSTlVnrbTPZ+rldrkLUOzLJwKLHniIQiJAkEAmfeBMKwu6Af2T8GePDNMf+lKmBLJfEtqUBW1JogYB+yT2yhelORsWbwMu2plExKTyHD1H9l812ghAOFpKkJKoQJBAJ7lz2dbIXHAtib3FTCR0Q1WGujI5bZrwg19DM2dM1AYZUgVQq73xY5pWyu8V2VqzfUQ0Le3mracJJ2IPuOQpwECQF/b7Tv3auIHRaO9AD7xWIOCMYGlKhqeheMZb/mDRHedsdRvigiojDaaFbtnkvXlRbWlkOu5P5GNDpv7EuPbUs8='
|
||||||
|
|
||||||
|
phone:
|
||||||
|
regexp: ^[1][3,4,5,6,7,8,9][0-9]{9}$
|
||||||
|
|
||||||
@ -166,11 +166,47 @@ public class JobHandler {
|
|||||||
XxlJobLogger.log("jobEarningsCalculate");
|
XxlJobLogger.log("jobEarningsCalculate");
|
||||||
log.info("jobMaintenanceInsert start !");
|
log.info("jobMaintenanceInsert start !");
|
||||||
Date date = DateUtil.addDays(new Date(), -1);
|
Date date = DateUtil.addDays(new Date(), -1);
|
||||||
|
if(StringUtils.isEmpty(param)){
|
||||||
|
System.out.println(DateUtil.formatDate(date));
|
||||||
businessFeignClient.jobEarningsCalculate(DateUtil.formatDate(date));
|
businessFeignClient.jobEarningsCalculate(DateUtil.formatDate(date));
|
||||||
|
}else{
|
||||||
|
System.out.println(param);
|
||||||
|
businessFeignClient.jobEarningsCalculate(param);
|
||||||
|
}
|
||||||
|
|
||||||
log.info("jobMaintenanceInsert end !");
|
log.info("jobMaintenanceInsert end !");
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算光伏-Mppt收益(昨日)
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@XxlJob("jobEarningsCalculateMppt")
|
||||||
|
public ReturnT<String> jobEarningsCalculateMppt(String param) {
|
||||||
|
XxlJobLogger.log("jobEarningsCalculateMppt");
|
||||||
|
log.info("jobEarningsCalculateMpptInsert start !");
|
||||||
|
Date date = DateUtil.addDays(new Date(), -1);
|
||||||
|
businessFeignClient.jobEarningsCalculateMppt(DateUtil.formatDate(date));
|
||||||
|
log.info("jobEarningsCalculateMpptInsert end !");
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算光伏-Mppt收益(当日)
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@XxlJob("jobEarningsCalculateMpptToDay")
|
||||||
|
public ReturnT<String> jobEarningsCalculateMpptToDay(String param) {
|
||||||
|
XxlJobLogger.log("jobEarningsCalculateMpptToDay");
|
||||||
|
log.info("jobEarningsCalculateMpptToDayInsert start !");
|
||||||
|
Date date = new Date();
|
||||||
|
businessFeignClient.jobEarningsCalculateMpptToDay(DateUtil.formatDate(date));
|
||||||
|
log.info("jobEarningsCalculateMpptToDayInsert end !");
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 计算收益(当日)
|
* 计算收益(当日)
|
||||||
*
|
*
|
||||||
@ -231,4 +267,55 @@ public class JobHandler {
|
|||||||
log.info("jobUpdateMessageInfo end !");
|
log.info("jobUpdateMessageInfo end !");
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寄点-站点监控数据
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@XxlJob("jobCacheShipEnergyMainInfo")
|
||||||
|
public ReturnT<String> jobCacheShipEnergyMainInfo(String param){
|
||||||
|
log.info("jobCacheShipEnergyMainInfo start !");
|
||||||
|
businessFeignClient.jobCacheShipEnergyMainInfo();
|
||||||
|
log.info("jobCacheShipEnergyMainInfo end !");
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 寄点-站点充放电数据
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@XxlJob("jobCacheShipEleIncome")
|
||||||
|
public ReturnT<String> jobCacheShipEleIncome(String param){
|
||||||
|
log.info("jobCacheShipEnergyEle start !");
|
||||||
|
businessFeignClient.jobCacheShipEleIncome(param);
|
||||||
|
log.info("jobCacheShipEnergyEle end !");
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 中车-站点收益、充放电数据 - 昨日
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@XxlJob("jobBoulderEleIncome")
|
||||||
|
public ReturnT<String> jobBoulderEleIncome(String param){
|
||||||
|
log.info("jobCacheShipEnergyEle start !");
|
||||||
|
businessFeignClient.jobBoulderEleIncome(param);
|
||||||
|
log.info("jobCacheShipEnergyEle end !");
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中车-站点收益、充放电数据 - 今日
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@XxlJob("jobBoulderEleIncomeToday")
|
||||||
|
public ReturnT<String> jobBoulderEleIncomeToday(String param){
|
||||||
|
log.info("jobCacheShipEnergyEle start !");
|
||||||
|
businessFeignClient.jobBoulderEleIncome(DateUtil.formatDate(new Date()));
|
||||||
|
log.info("jobCacheShipEnergyEle end !");
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,6 +49,12 @@ public interface BusinessFeignClient {
|
|||||||
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "earningsCalculate/all")
|
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "earningsCalculate/all")
|
||||||
void jobEarningsCalculate(@RequestBody String dateTime);
|
void jobEarningsCalculate(@RequestBody String dateTime);
|
||||||
|
|
||||||
|
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "earningsCalculate/allMpptIncome")
|
||||||
|
void jobEarningsCalculateMppt(@RequestBody String dateTime);
|
||||||
|
|
||||||
|
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "earningsCalculate/allTodayMpptIncome")
|
||||||
|
void jobEarningsCalculateMpptToDay(@RequestBody String dateTime);
|
||||||
|
|
||||||
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "earningsCalculate/freezeMonthTotalEle")
|
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "earningsCalculate/freezeMonthTotalEle")
|
||||||
void jobFreezeMonthTotalEle();
|
void jobFreezeMonthTotalEle();
|
||||||
|
|
||||||
@ -66,5 +72,14 @@ public interface BusinessFeignClient {
|
|||||||
*/
|
*/
|
||||||
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "messageInfo/jobUpdateMessageInfo")
|
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "messageInfo/jobUpdateMessageInfo")
|
||||||
void jobUpdateMessageInfo();
|
void jobUpdateMessageInfo();
|
||||||
|
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "shipEnergyStation/getMainTotal")
|
||||||
|
void jobCacheShipEnergyMainInfo();
|
||||||
|
|
||||||
|
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "shipEnergyStation/getStationIncomeHis")
|
||||||
|
void jobCacheShipEleIncome(@RequestBody String dateTime);
|
||||||
|
|
||||||
|
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "boulderEnergyStation/getBoulderEleIncome")
|
||||||
|
void jobBoulderEleIncome(@RequestBody String dateTime);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,6 +75,18 @@ public class BusinessFeignClientFallback implements BusinessFeignClient {
|
|||||||
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void jobEarningsCalculateMppt(String dateTime) {
|
||||||
|
log.error("BusinessFeignClient.jobEarningsCalculateMppt error!");
|
||||||
|
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void jobEarningsCalculateMpptToDay(String dateTime) {
|
||||||
|
log.error("BusinessFeignClient.jobEarningsCalculateMpptToDay error!");
|
||||||
|
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void jobFreezeMonthTotalEle() {
|
public void jobFreezeMonthTotalEle() {
|
||||||
log.error("BusinessFeignClient.jobFreezeMonthTotalEle error!");
|
log.error("BusinessFeignClient.jobFreezeMonthTotalEle error!");
|
||||||
@ -99,4 +111,21 @@ public class BusinessFeignClientFallback implements BusinessFeignClient {
|
|||||||
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void jobCacheShipEnergyMainInfo() {
|
||||||
|
log.error("BusinessFeignClient.jobCacheShipEnergyMainInfo error!");
|
||||||
|
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void jobCacheShipEleIncome(String dateTime) {
|
||||||
|
log.error("BusinessFeignClient.jobCacheShipEleIncome error!");
|
||||||
|
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void jobBoulderEleIncome(String dateTime) {
|
||||||
|
log.error("BusinessFeignClient.jobBoulderEleIncome error!");
|
||||||
|
throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user