Compare commits
7 Commits
3bad829b94
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d3be4fbc5 | |||
| 08a2258b07 | |||
| bdae9986f2 | |||
| 911c5efec9 | |||
| a7f21789f7 | |||
| b6acb9bcf4 | |||
| 1cf6ac1670 |
@ -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;
|
||||
}
|
||||
@ -28,7 +28,7 @@ public interface EarningsCalculateMapper {
|
||||
int insertSelective(EarningsCalculate record);
|
||||
|
||||
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);
|
||||
// 类型是传入多个
|
||||
//List<EarningsCalculate> selectList(@Param("stationId") Integer stationId, @Param("typeList") List<Integer> typeList, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -1,22 +1,34 @@
|
||||
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.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@ -29,10 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
@Slf4j
|
||||
public class ShipEnergyService {
|
||||
|
||||
/**
|
||||
* token 缓存 key
|
||||
*/
|
||||
private static final String SHIP_ENERGY_TOKEN_KEY = "ShipEnergyToken";
|
||||
|
||||
/**
|
||||
* 获取token 参数 platform
|
||||
@ -58,6 +66,10 @@ public class ShipEnergyService {
|
||||
* 寄点能源- 主监控汇总 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;
|
||||
@ -65,27 +77,36 @@ public class ShipEnergyService {
|
||||
@Autowired
|
||||
private StationService stationService;
|
||||
|
||||
@Autowired
|
||||
ElecMeterValueService elecMeterValueService;
|
||||
|
||||
@Autowired
|
||||
EarningsCalculateMapper earningsCalculateMapper;
|
||||
|
||||
/**
|
||||
* 寄点能源 - 获取token
|
||||
* @return token
|
||||
*/
|
||||
public String getToken(){
|
||||
String token = null;
|
||||
if(redisService.hasKey(SHIP_ENERGY_TOKEN_KEY)){
|
||||
token = (String)redisService.get(SHIP_ENERGY_TOKEN_KEY);
|
||||
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(SHIP_ENERGY_TOKEN_KEY,token,10, TimeUnit.HOURS);
|
||||
redisService.set(CommonConstant.SHIP_ENERGY_TOKEN_KEY,token,10, TimeUnit.HOURS);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -98,11 +119,12 @@ public class ShipEnergyService {
|
||||
* @return 项目列表 json 字符串
|
||||
*/
|
||||
public String getStations(){
|
||||
String Authorization = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjo5Nzg2LCJ1c2VyX2tleSI6Ijk3ODY6N2RkNjU0MTgtNDg5ZS00MzgzLWI1ZmYtMTU2MmI5ZTY0NDFkIiwidXNlcm5hbWUiOiJ6emt5YXBpIn0.fQLMlOHaEjmfHeyEu5EcxZmQ8UjRBOUoteNV-tJ2ttAwyJmQidOk7xqL25K_wRIC-OQKt0vFVOpTzMFdH71uhw";
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Authorization",Authorization);
|
||||
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)){
|
||||
@ -121,14 +143,42 @@ public class ShipEnergyService {
|
||||
* @param stationId 电站id
|
||||
* @return 返回对应电站汇总信息
|
||||
*/
|
||||
public String getMainTotal(String stationId){
|
||||
String Authorization = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjo5Nzg2LCJ1c2VyX2tleSI6Ijk3ODY6MmE5YjUzODUtNjNiNC00OWRiLWFjODEtNzhmNWRmNjE0ZDgyIiwidXNlcm5hbWUiOiJ6emt5YXBpIn0.WMi4PgYQByeYXBfOGVM0mc4P5GcyAcGRkDo8F7TK8fXIkj9QZ9D34WmugiVX3GxRGODFs3u1ujH7qJyuQAM99w";
|
||||
public String getMainTotal(Integer stationId){
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Authorization",Authorization);
|
||||
headers.put("Authorization", getToken());
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("stationId",stationId);
|
||||
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)){
|
||||
@ -145,8 +195,8 @@ public class ShipEnergyService {
|
||||
* 寄点能源 - 电站信息融合储能平台处理
|
||||
*/
|
||||
public void addShipEnergyStation(){
|
||||
String stationJson = getStations();
|
||||
JSONArray jsonStation = JSON.parseArray(stationJson);
|
||||
String json = getStations();
|
||||
JSONArray jsonStation = JSON.parseArray(json);
|
||||
jsonStation.forEach(i->{
|
||||
JSONObject jsonObj = (JSONObject) i;
|
||||
Integer stationId = jsonObj.getInteger("stationId");
|
||||
@ -169,9 +219,228 @@ public class ShipEnergyService {
|
||||
vo.setRatePower(maxPower);
|
||||
vo.setGridTime(commossioningTime);
|
||||
vo.setGroupId(155);
|
||||
vo.setDeptId(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);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.excel.util.DateUtils;
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ho.business.constant.DeviceTypeConstant;
|
||||
import com.ho.business.entity.*;
|
||||
import com.ho.business.feignclient.UserFeignClient;
|
||||
@ -25,6 +26,7 @@ import com.ho.business.vo.req.report.ReportReqVO;
|
||||
import com.ho.business.vo.resp.CountEleData;
|
||||
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.EarningsCalculateResp;
|
||||
import com.ho.business.vo.resp.colCount.ColCountResp;
|
||||
@ -1445,6 +1447,16 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
||||
revenueOverview.setStationName(station.getName());
|
||||
revenueOverview.setCapacity(station.getCapacity());
|
||||
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);
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.ho.business.service.impl;
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ho.business.constant.DeviceTypeConstant;
|
||||
import com.ho.business.entity.Device;
|
||||
import com.ho.business.entity.ElecMeterValue;
|
||||
@ -17,6 +18,7 @@ import com.ho.business.vo.req.colCount.ColCountReq;
|
||||
import com.ho.business.vo.resp.CountEleData;
|
||||
import com.ho.business.vo.resp.DeviceRespVO;
|
||||
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.iargeScreen.*;
|
||||
import com.ho.business.vo.resp.mppt.MpptActiveVo;
|
||||
@ -287,22 +289,10 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
||||
BigDecimal dayCharge = BigDecimal.ZERO;
|
||||
BigDecimal dayDischarge = BigDecimal.ZERO;
|
||||
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) {
|
||||
// StationReq req = new StationReq();
|
||||
// req.setStationId(station.getId());
|
||||
// req.setDeviceType(stationMapAndType.get(req.getStationId()));
|
||||
BigDecimal dailyChargeElec = BigDecimal.ZERO;
|
||||
BigDecimal dailyDischargeElec = BigDecimal.ZERO;
|
||||
// CountEleData countEleData = stationHomeService.getCountEleData(req);
|
||||
CountEleData countEleData = getByRedisData(station.getId());
|
||||
if (null == countEleData || null == countEleData.getDailyChargeElec() || null == countEleData.getDailyDischargeElec()) {
|
||||
dailyChargeElec = BigDecimal.ZERO;
|
||||
@ -357,6 +347,19 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
||||
annualOverviewResp.setTotalCharge(incomeShow1.getYearCharge());
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -176,6 +176,7 @@ public class OutApiServiceImpl implements OutApiService {
|
||||
}
|
||||
String deviceType = DeviceTypeConstant.BMS;
|
||||
log.info("stations.size:" + stations.size());
|
||||
stations = stations.stream().filter(i->i.getId()!=11003 && i.getId()!=10942 && i.getId()!=11006).collect(Collectors.toList());
|
||||
for (Station station : stations) {
|
||||
try {
|
||||
//先删除站的当日数据
|
||||
|
||||
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ho.business.constant.DeviceTypeConstant;
|
||||
import com.ho.business.entity.*;
|
||||
@ -959,6 +960,14 @@ public class StationHomeServiceImpl implements StationHomeService {
|
||||
dailyDischargeElec = new BigDecimal(dailyDischargeElecStr);
|
||||
pcsElecData.setChargeElec(dailyChargeElec);
|
||||
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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
package com.ho.business.controller;
|
||||
|
||||
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.entity.Station;
|
||||
import com.ho.business.service.*;
|
||||
@ -11,6 +13,7 @@ import com.ho.business.vo.req.dynamicConfig.DynamicConfigQuery;
|
||||
import com.ho.business.vo.req.pcsStation.PcsStationReq;
|
||||
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.EarningsCalculateCountResp;
|
||||
import com.ho.business.vo.resp.openStationHome.OpenStationMiddle;
|
||||
@ -47,6 +50,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -92,6 +97,9 @@ public class OpenStationController {
|
||||
@Autowired
|
||||
EarningsCalculateService earningsCalculateService;
|
||||
|
||||
@Autowired
|
||||
ShipEnergyService shipEnergyService;
|
||||
|
||||
@PostMapping("statusMonitor")
|
||||
@ApiOperation(value = "状态监控")
|
||||
public DataResult<StatusMonitorVo> statusMonitor(@RequestBody StationReq stationReq) {
|
||||
@ -105,10 +113,43 @@ public class OpenStationController {
|
||||
|
||||
@PostMapping("/realtimeCurve")
|
||||
@ApiOperation(value = "实时曲线")
|
||||
@TokenIgnore
|
||||
//@Cacheable(cacheManager = "towMinuteCacheManager", value = "stationRealtimeCurve", key = "#stationReq.stationId", sync = true)
|
||||
public DataResult<List<NewRealTimeCurveVo>> realtimeCurve(@RequestBody StationReq stationReq) {
|
||||
log.info("realtimeCurve.stationRealtimeCurve:" + 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类型保留两位小数
|
||||
for (NewRealTimeCurveVo newRealTimeCurveVo : resList) {
|
||||
List<StationHomeRespVo> list = newRealTimeCurveVo.getList();
|
||||
@ -224,6 +265,21 @@ public class OpenStationController {
|
||||
req.setDeviceType(deviceType);
|
||||
}
|
||||
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();
|
||||
bigDecimalUtil.keepTwoDecimalPlaces(data);
|
||||
bigDecimalUtil.ifIsNUll(data);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
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;
|
||||
@ -8,9 +9,12 @@ 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 = "业务模块-寄点能源电站管理")
|
||||
@ -29,4 +33,20 @@ public class ShipEnergyController {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ spring:
|
||||
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
|
||||
url: jdbc:mysql://1.95.170.86:3306/business_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
username: business_db
|
||||
password: zzkj@688737
|
||||
druid:
|
||||
@ -33,7 +33,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 50000ms #连接超时
|
||||
host: 192.168.0.139 #单机
|
||||
host: 1.95.170.86 #单机
|
||||
password: 123456
|
||||
database: 0
|
||||
lettuce:
|
||||
|
||||
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
|
||||
@ -1041,4 +1041,17 @@ public interface CommonConstant {
|
||||
// 调用成功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:";
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ public class HttpUtils {
|
||||
/**
|
||||
* 将Map转换为JSON字符串(简单实现,实际项目中建议使用Jackson/Gson等库)
|
||||
*/
|
||||
private static String mapToJson(Map<String, Object> params) {
|
||||
public static String mapToJson(Map<String, Object> params) {
|
||||
if (params == null || params.isEmpty()) {
|
||||
return "{}";
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ spring:
|
||||
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
|
||||
url: jdbc:mysql://1.95.170.86:3306/business_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: business_db
|
||||
password: zzkj@688737
|
||||
druid:
|
||||
@ -61,7 +61,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 3000ms #连接超时
|
||||
host: 192.168.0.139 #单机
|
||||
host: 1.95.170.86 #单机
|
||||
password: 123456
|
||||
database: 0
|
||||
lettuce:
|
||||
|
||||
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
|
||||
@ -62,7 +62,7 @@ spring:
|
||||
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
|
||||
url: jdbc:mysql://1.95.170.86:3306/file_center_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
username: file_center_db
|
||||
password: zzkj@688737
|
||||
druid:
|
||||
@ -81,7 +81,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 3000ms #连接超时
|
||||
host: 192.168.0.139 #单机
|
||||
host: 1.95.170.86 #单机
|
||||
password: 123456
|
||||
database: 0
|
||||
lettuce:
|
||||
|
||||
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
|
||||
|
||||
@ -17,7 +17,7 @@ spring:
|
||||
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
|
||||
url: jdbc:mysql://1.95.170.86:3306/flow_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||
username: flow_db
|
||||
password: zzkj@688737
|
||||
druid:
|
||||
@ -31,7 +31,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 300000ms #连接超时
|
||||
host: 192.168.0.139 #单机
|
||||
host: 1.95.170.86 #单机
|
||||
password: 123456
|
||||
database: 0
|
||||
lettuce:
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ spring:
|
||||
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
|
||||
url: jdbc:TAOS-RS://1.95.170.86:6041/test_td_db?user=root&password=taosdata&charset=UTF-8&locale=zh_CN.UTF-8&timezone=UTC-8
|
||||
username: root
|
||||
password: taosdata
|
||||
druid:
|
||||
@ -29,7 +29,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 3000ms #连接超时
|
||||
host: 192.168.0.139 #单机
|
||||
host: 1.95.170.86 #单机
|
||||
password: 123456
|
||||
database: 0
|
||||
|
||||
|
||||
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/getToken", "anon");
|
||||
filterChainDefinitionMap.put("/sys/user/getUnifiedLogin", "anon");
|
||||
filterChainDefinitionMap.put("/sys/user/register", "anon");
|
||||
filterChainDefinitionMap.put("/sys/key/decrypt", "anon");
|
||||
filterChainDefinitionMap.put("/mongoId", "anon");
|
||||
|
||||
@ -2,6 +2,10 @@ package com.ho.user.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.LogAnnotation;
|
||||
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.util.AESEncryptUtil;
|
||||
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.SysUser;
|
||||
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.service.*;
|
||||
import com.ho.user.vo.req.*;
|
||||
@ -543,4 +549,58 @@ public class UserController {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ spring:
|
||||
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
|
||||
url: jdbc:mysql://1.95.170.86:3306/user_center_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: user_center_db
|
||||
password: zzkj@688737
|
||||
druid:
|
||||
@ -38,7 +38,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 3000ms #连接超时
|
||||
host: 192.168.0.139 #单机
|
||||
host: 1.95.170.86 #单机
|
||||
password: 123456
|
||||
database: 0
|
||||
lettuce:
|
||||
|
||||
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}$
|
||||
|
||||
@ -267,4 +267,55 @@ public class JobHandler {
|
||||
log.info("jobUpdateMessageInfo end !");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,5 +72,14 @@ public interface BusinessFeignClient {
|
||||
*/
|
||||
@PostMapping(value = ContextConstant.ROOT_CONTEXT + ContextConstant.BUSINESS + "messageInfo/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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -111,4 +111,21 @@ public class BusinessFeignClientFallback implements BusinessFeignClient {
|
||||
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