Commit 727d40d3 authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/developer_bw' into developer_bw

parents bfb61503 18c69a38
......@@ -102,6 +102,9 @@ public class GolangRequestUtil {
JSONObject page = data.getJSONObject("page");
responePages = page.getInteger("pages");
}
if(Objects.isNull(responePages)){
responePages=0;
}
if (responePages <= pageNo){
break;
} else {
......
......@@ -96,7 +96,7 @@ public class GoodWeRequestUtil {
//处理其他页数的数据
JSONObject responeJSON = JSONObject.parseObject(respone);
JSONObject data = responeJSON.getJSONObject("data");
Integer record = data.getInteger("record");
Integer record = data.getInteger("record") == null ? 0:data.getInteger("record");
Integer pageSize= requestInfo.get("page_size")==null || (Integer)requestInfo.get("page_size")==0? 1:(Integer)requestInfo.get("page_size");
Integer responePages=(record/pageSize)+1;
if (responePages <= pageNo){
......
......@@ -131,7 +131,7 @@ public class SofarRequestUtil {
thirdStationLogService.saveLog(hygfThirdStationLog);
//处理其他页数的数据
JSONObject responeJSON = JSONObject.parseObject(respone);
Integer total = responeJSON.getInteger("total");
Integer total = responeJSON.getInteger("total")==null ? 0:responeJSON.getInteger("total");
Integer pageSize= requestInfo.get("size")==null || (Integer)requestInfo.get("size")==0? 1:(Integer)requestInfo.get("size");
Integer responePages=(total/pageSize)+1;
if (responePages <= pageNo){
......
......@@ -253,7 +253,7 @@ public class SunlightUtil {
hygfThirdStationLog.setResBody(res);
thirdStationLogService.saveLog(hygfThirdStationLog);
//处理其他页数的数据
Integer rowCount = resultData.getInt("rowCount");
Integer rowCount = resultData.getInt("rowCount") ==null ? 0: resultData.getInt("rowCount");
Integer pageSize= bodyparam.get("size")==null || (Integer)bodyparam.get("size")==0? 1:(Integer)bodyparam.get("size");
Integer responePages=(rowCount/pageSize)+1;
if (responePages <= pageNo){
......
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*;
import com.yeejoin.amos.api.householdapi.face.service.*;
import com.yeejoin.amos.api.householdapi.face.service.business.*;
import com.yeejoin.amos.api.householdapi.face.service.impl.ImasterDataServiceImpl;
import com.yeejoin.amos.api.householdapi.face.service.impl.JpStationServiceImpl;
import com.yeejoin.amos.api.householdapi.face.service.impl.SofarDataAcquisitionServiceImpl;
import fastjson.JSON;
import io.swagger.annotations.Api;
......@@ -77,6 +78,20 @@ public class HouseholdTestController {
@Autowired
private TanYinDataAcquisitionService tanYinDataAcquisitionService;
@Autowired
private JpStationServiceImpl jpStationService;
/**
* 新增户用光伏-厂商API haders
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/testInitStation")
@ApiOperation(httpMethod = "GET", value = "测试初始化场站", notes = "测试初始化场站")
public void testInitStation() throws IOException {
jpStationService.initStationValue();
}
/**
* 新增户用光伏-厂商API haders
......
......@@ -123,9 +123,13 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
BeanUtil.copyProperties(goodWeStationMonitorDto, goodWeStationList);
goodWeStationList.setCreatedTime(System.currentTimeMillis());
goodWeStationMonitorListMapper.insert(goodWeStationList);
JpStation jpStation = jpStationMapper
.selectOne(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.GDW.getCode())
List<JpStation> jpStationList = jpStationMapper
.selectList(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.GDW.getCode())
.eq("third_station_id", goodWeStationList.getPowerstation_id()));
JpStation jpStation=null;
if(CollectionUtil.isNotEmpty(jpStationList)){
jpStation=jpStationList.get(0);
}
if (ObjectUtils.isEmpty(jpStation)) {
jpStation = new JpStation();
}
......@@ -258,11 +262,15 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
TdHYGFStationMonthGenerateMapper.insert(TdHYGFStationMonthGenerate);
}
// 户用场站月发电量
TdHYGFStationYearGenerate TdHYGFStationYearGenerate = TdHYGFStationYearGenerateMapper
.selectOne(new QueryWrapper<TdHYGFStationYearGenerate>()
List<TdHYGFStationYearGenerate> tdHYGFStationYearGenerateList = TdHYGFStationYearGenerateMapper
.selectList(new QueryWrapper<TdHYGFStationYearGenerate>()
.eq("third_station_id", jpStation.getThirdStationId())
.eq("month_time", DateUtil.format(today1, "yyyy-MM"))
.eq("year", DateUtil.format(today1, "yyyy")));
TdHYGFStationYearGenerate TdHYGFStationYearGenerate=null;
if(CollectionUtil.isNotEmpty(tdHYGFStationYearGenerateList)){
TdHYGFStationYearGenerate=tdHYGFStationYearGenerateList.get(0);
}
if (org.springframework.util.ObjectUtils.isEmpty(TdHYGFStationYearGenerate)) {
TdHYGFStationYearGenerate = new TdHYGFStationYearGenerate();
}
......@@ -287,11 +295,16 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
TdHYGFStationYearGenerateMapper.insert(TdHYGFStationYearGenerate);
}
// 户用场站年发电量
TdHYGFStationAllGenerate TdHYGFStationAllGenerate = TdHYGFStationAllGenerateMapper
.selectOne(new QueryWrapper<TdHYGFStationAllGenerate>()
List<TdHYGFStationAllGenerate> tdHYGFStationAllGenerateList = TdHYGFStationAllGenerateMapper
.selectList(new QueryWrapper<TdHYGFStationAllGenerate>()
.eq("third_station_id", jpStation.getThirdStationId())
.eq("year_time", DateUtil.format(today1, "yyyy"))
.eq("year", DateUtil.format(today1, "yyyy")));
TdHYGFStationAllGenerate TdHYGFStationAllGenerate=null;
if(CollectionUtil.isNotEmpty(tdHYGFStationAllGenerateList)){
TdHYGFStationAllGenerate=tdHYGFStationAllGenerateList.get(0);
}
if (org.springframework.util.ObjectUtils.isEmpty(TdHYGFStationAllGenerate)) {
TdHYGFStationAllGenerate = new TdHYGFStationAllGenerate();
}
......
package com.yeejoin.amos.api.householdapi.face.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Service
public class JpStationServiceImpl {
@Autowired
JpStationMapper jpStationMapper;
@Scheduled(cron = "${dataRequstScheduled.initStation:0 0 0 * * ?}")
@Async
public void initStationValue(){
LambdaUpdateWrapper<JpStation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(JpStation::getCapacity,0.0)
.set(JpStation::getRealTimePower,0.0)
.set(JpStation::getAccumulatedPower,0.0)
.set(JpStation::getDayGenerate,0.0)
.set(JpStation::getMonthGenerate,0.0)
.set(JpStation::getYearGenerate,0.0)
.set(JpStation::getDayIncome,0.0)
.set(JpStation::getMonthIncome,0.0)
.set(JpStation::getYearIncome,0.0)
.set(JpStation::getCumulativeIncome,0.0)
.set(JpStation::getDayPowerUse,0.0)
.set(JpStation::getMonthPowerUse,0.0)
.set(JpStation::getYearPowerUse,0.0)
.set(JpStation::getRatedPower,0.0);
jpStationMapper.update(null,wrapper);
}
}
......@@ -244,39 +244,61 @@ public class SunlightServiceImpl implements SunlightService {
jpStation.setSnCode(sunlightDto.getPs_id().toString());// sncode
try {
Map<String, String> map = sunlightDto.getTotal_capcity();
if (map != null && map.get("unit") != null && !map.get("unit").isEmpty()
&& !"--".equals(map.get("value"))) {
jpStation.setCapacity(SunlightUtil.zj.get(String.valueOf(map.get("unit")))
* Double.valueOf(String.valueOf(map.get("value"))));// 装机容量
try {
Map<String, String> map = sunlightDto.getTotal_capcity();
if (map != null && map.get("unit") != null && !map.get("unit").isEmpty()
&& !"--".equals(map.get("value"))) {
jpStation.setCapacity(SunlightUtil.zj.get(String.valueOf(map.get("unit")))
* Double.valueOf(String.valueOf(map.get("value"))));// 装机容量
}
}catch (Exception e){
jpStation.setCapacity(0.0);
}
Map<String, String> map1 = sunlightDto.getCurr_power();
if (map1 != null && map1.get("unit") != null && !map1.get("unit").isEmpty()
&& !"--".equals(map1.get("value"))) {
jpStation.setRealTimePower(SunlightUtil.GL.get(String.valueOf(map1.get("unit")))
* Double.valueOf(String.valueOf(map1.get("value"))));// 实时功率
try {
Map<String, String> map1 = sunlightDto.getCurr_power();
if (map1 != null && map1.get("unit") != null && !map1.get("unit").isEmpty()
&& !"--".equals(map1.get("value"))) {
jpStation.setRealTimePower(SunlightUtil.GL.get(String.valueOf(map1.get("unit")))
* Double.valueOf(String.valueOf(map1.get("value"))));// 实时功率
}
}catch (Exception e){
jpStation.setRealTimePower(0.0);
}
Map<String, String> map2 = sunlightDto.getToday_energy();
if (map2 != null && map2.get("unit") != null && !map2.get("unit").isEmpty()
&& !"--".equals(map2.get("value"))) {
jpStation.setDayGenerate(SunlightUtil.fd.get(String.valueOf(map2.get("unit")))
* Double.valueOf(String.valueOf(map2.get("value"))));// 日发电量
try {
Map<String, String> map2 = sunlightDto.getToday_energy();
if (map2 != null && map2.get("unit") != null && !map2.get("unit").isEmpty()
&& !"--".equals(map2.get("value"))) {
jpStation.setDayGenerate(SunlightUtil.fd.get(String.valueOf(map2.get("unit")))
* Double.valueOf(String.valueOf(map2.get("value"))));// 日发电量
}
}catch (Exception e){
jpStation.setDayGenerate(0.0);
}
Map<String, String> map3 = sunlightDto.getTotal_energy();
if (map3 != null && map3.get("unit") != null && !map3.get("unit").isEmpty()
&& !"--".equals(map3.get("value"))) {
jpStation.setAccumulatedPower(SunlightUtil.fd.get(String.valueOf(map3.get("unit")))
* Double.valueOf(String.valueOf(map3.get("value"))));// 累计发电量
try {
Map<String, String> map3 = sunlightDto.getTotal_energy();
if (map3 != null && map3.get("unit") != null && !map3.get("unit").isEmpty()
&& !"--".equals(map3.get("value"))) {
jpStation.setAccumulatedPower(SunlightUtil.fd.get(String.valueOf(map3.get("unit")))
* Double.valueOf(String.valueOf(map3.get("value"))));// 累计发电量
}
}catch (Exception e){
jpStation.setAccumulatedPower(0.0);
}
Map<String, String> map4 = sunlightDto.getToday_income();
if (map4 != null && map4.get("unit") != null && !map4.get("unit").isEmpty()
&& !"--".equals(map4.get("value"))) {
jpStation.setDayIncome(SunlightUtil.sy.get(String.valueOf(map4.get("unit")))
* Double.valueOf(String.valueOf(map4.get("value"))));// 日收益
try {
Map<String, String> map4 = sunlightDto.getToday_income();
if (map4 != null && map4.get("unit") != null && !map4.get("unit").isEmpty()
&& !"--".equals(map4.get("value"))) {
jpStation.setDayIncome(SunlightUtil.sy.get(String.valueOf(map4.get("unit")))
* Double.valueOf(String.valueOf(map4.get("value"))));// 日收益
}
}catch (Exception e){
jpStation.setDayIncome(0.0);
}
Map<String, String> map5 = sunlightDto.getTotal_income();
......@@ -338,7 +360,7 @@ public class SunlightServiceImpl implements SunlightService {
bodyparamjp.put("size", 3000);
bodyparamjp.put("curPage", 1);
bodyparamjp.put("device_type_list", lif);
JSONObject jsonObject1data = SunlightUtil.getDataList(SunlightUtil.getDeviceList, bodyparamjp);
JSONObject jsonObject1data = SunlightUtil.getdata(SunlightUtil.getDeviceList, bodyparamjp);
List<Device> listd = JSONArray.parseArray(JSON.toJSONString(jsonObject1data.get("pageList")), Device.class);
// 获取电站,月发电量
......@@ -473,11 +495,11 @@ public class SunlightServiceImpl implements SunlightService {
jpStationMapper.insert(jpStation);
}
if (listd != null) {
if (CollectionUtil.isNotEmpty(listd)) {
this.setJpInverte(listd, jpStation, listdtx);
}
if (listd != null) {
if (CollectionUtil.isNotEmpty(listdtx)) {
this.collectorDetail(listdtx, jpStation);
}
......
......@@ -66,12 +66,12 @@ biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
# ??????????
dataRequstScheduled.jinlangyun=0 0/40 8 * *
dataRequstScheduled.huawei=0 0/40 8 * *
dataRequstScheduled.keshida=0 0/40 8 * *
dataRequstScheduled.jinlangyun=0 0/40 * * * *
dataRequstScheduled.huawei=0 0/40 * * * *
dataRequstScheduled.keshida=0 0/40 * * * *
dataRequstScheduled.Sunlight=0 0/40 8 * *
dataRequstScheduled.GoodWe=0 0/40 8 * *
dataRequstScheduled.Sunlight=0 0/40 * * * *
dataRequstScheduled.GoodWe=0 0/40 * * * *
dataRequstScheduled.Sofar=0 0/20 * * * *
......
......@@ -30,7 +30,7 @@
and hph.project_address like concat(concat('%',#{map.province}),'%')
</if>
GROUP BY hps.peasant_household_id
ORDER BY hps.rec_date desc
ORDER BY hps.peasant_household_id desc
</select>
<select id="getBasicInformation" resultType="java.util.Map">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment