Commit 6e5b6b4e authored by tangwei's avatar tangwei

修改监盘功率bug

parent 323862c1
......@@ -63,6 +63,8 @@ public class ImasterConstant {
public static String baseurl ="https://cn.fusionsolar.huawei.com";
public static String account ="ahsjmg-API";
public static String password ="huawei123";
// public static String account ="xtt163";
// public static String password ="a1234560";
public static String tokenUrl ="/thirdData/login";
......
......@@ -138,7 +138,7 @@ public class HouseholdTestController {
imasterDataService.stationList();
imasterDataService.stationDetail();
imasterDataService.collectorList();
imasterDataService.inverterList();
imasterDataService.inverterDetail();
imasterDataService.inverterList(null);
// imasterDataService.inverterDetail(null);
}
}
......@@ -18,4 +18,9 @@ public class ImasterCollectorList {
private String invType;
private Double longitude;
private Double latitude;
private String addr;
private String collectorSnCode;
}
package com.yeejoin.amos.api.householdapi.face.service;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterCollectorList;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterInverterList;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterInverterListDetails;
import java.util.List;
public interface ImasterDataService {
/**
......@@ -21,11 +27,11 @@ public interface ImasterDataService {
/**
* @descrption 逆变器列表数据入库
*/
void inverterList();
void inverterList(List<ImasterCollectorList> result);
/**
* @descrption 逆变器详情数据入库
*/
void inverterDetail();
void inverterDetail(List<ImasterInverterListDetails> result);
/**
* @descrption 采集器告警列表数据入库
*/
......
......@@ -22,6 +22,7 @@ import com.yeejoin.amos.api.householdapi.face.service.ImasterDataService;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -144,11 +145,11 @@ public class ImasterDataServiceImpl implements ImasterDataService {
List<String> stationList = imasterStationMapper.getStationIds();
String today = DateUtil.today();
String hour = new Date().getHours() + ":00";
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// try {
// TimeUnit.SECONDS.sleep(1);
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// }
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("stationCodes", stationList.stream().collect(Collectors.joining(",")));
requestInfo.put("collectTime", System.currentTimeMillis());
......@@ -174,9 +175,17 @@ public class ImasterDataServiceImpl implements ImasterDataService {
ImasterStationDetailsYear.class
);
List<String> inverterSns = imasterInverterListMapper.getCollectIds();
HashMap<String, Object> requestInfo1 = new HashMap<>();
String collect = inverterSns.stream().collect(Collectors.joining(","));
requestInfo1.put("sns", collect);
requestInfo1.put("devTypeId", 1);
requestInfo1.put("collectTime", System.currentTimeMillis());
String requestParaminfo1 = JSON.toJSONString(requestInfo1);
List<ImasterInverterListDetails> result4 = imasterUtils.getResPonseOther(ImasterConstant.collectorDetailUrl,
GoLangConstant.requestPost,
requestParaminfo,
requestParaminfo1,
ImasterConstant.resovleRule_data_page_records,
ImasterInverterListDetails.class
);
......@@ -320,6 +329,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
hygfjpDayPowerMapper.insert(hygfjpDayPower);
}
}
this.inverterDetail(result4);
}
......@@ -327,11 +337,11 @@ public class ImasterDataServiceImpl implements ImasterDataService {
@Override
public void collectorList() {
List<String> stationIds = imasterStationMapper.getStationIds();
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// try {
// TimeUnit.SECONDS.sleep(1);
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// }
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("stationCodes", stationIds.stream().collect(Collectors.joining(",")));
String requestParaminfo = JSON.toJSONString(requestInfo);
......@@ -407,6 +417,9 @@ public class ImasterDataServiceImpl implements ImasterDataService {
hygfjpCollectorHistoryMapper.insert(hygfjpCollectorHistory);
}
}
this.inverterList(result);
}
@Override
......@@ -415,25 +428,25 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
@Scheduled(cron = "${dataRequstScheduled.huawei}")
// @Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override
public void inverterList() {
List<String> stationIds = imasterStationMapper.getStationIds();
for (int i = 0; i < stationIds.size(); i++) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("stationCodes", stationIds.stream().collect(Collectors.joining(",")));
String requestParaminfo = JSON.toJSONString(requestInfo);
List<ImasterInverterList> result = imasterUtils.getResPonse(ImasterConstant.collectorListUrl,
GoLangConstant.requestPost,
requestParaminfo,
ImasterConstant.resovleRule_data_page_records,
ImasterInverterList.class
);
public void inverterList(List<ImasterCollectorList> result) {
// List<String> stationIds = imasterStationMapper.getStationIds();
// for (int i = 0; i < stationIds.size(); i++) {
// try {
// TimeUnit.SECONDS.sleep(1);
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// }
// HashMap<String, Object> requestInfo = new HashMap<>();
// requestInfo.put("stationCodes", stationIds.stream().collect(Collectors.joining(",")));
// String requestParaminfo = JSON.toJSONString(requestInfo);
// List<ImasterInverterList> result = imasterUtils.getResPonse(ImasterConstant.collectorListUrl,
// GoLangConstant.requestPost,
// requestParaminfo,
// ImasterConstant.resovleRule_data_page_records,
// ImasterInverterList.class
// );
for (int j = 0; j < result.size(); j++) {
QueryWrapper<ImasterStationList> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("plant_code", result.get(j).getStationCode());
......@@ -441,7 +454,10 @@ public class ImasterDataServiceImpl implements ImasterDataService {
List<ImasterStationList> imasterStationListAll = imasterStationMapper.selectList(queryWrapper);
ImasterStationList imasterStationList = imasterStationListAll.get(0);
ImasterInverterList imasterInverterList = result.get(j);
ImasterCollectorList da = result.get(j);
ImasterInverterList imasterInverterList=new ImasterInverterList();
BeanUtils.copyProperties(da, imasterInverterList);
imasterInverterList.setStationName(imasterStationList.getPlantName());
imasterInverterList.setAddr(imasterStationList.getPlantAddress());
imasterInverterList.setCreatedTime(System.currentTimeMillis());
......@@ -449,19 +465,19 @@ public class ImasterDataServiceImpl implements ImasterDataService {
imasterInverterListMapper.insert(imasterInverterList);
}
}
}
// }
}
@Scheduled(cron = "0 0/1 * * * *")
// @Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override
public void inverterDetail() {
public void inverterDetail( List<ImasterInverterListDetails> result) {
List<String> inverterSns = imasterInverterListMapper.getCollectIds();
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// try {
//// TimeUnit.SECONDS.sleep(1);
//// } catch (InterruptedException e) {
//// throw new RuntimeException(e);
//// }
HashMap<String, Object> requestInfo = new HashMap<>();
String collect = inverterSns.stream().collect(Collectors.joining(","));
requestInfo.put("sns", collect);
......@@ -469,12 +485,12 @@ public class ImasterDataServiceImpl implements ImasterDataService {
requestInfo.put("collectTime", System.currentTimeMillis());
String requestParaminfo = JSON.toJSONString(requestInfo);
List<ImasterInverterListDetails> result = imasterUtils.getResPonseOther(ImasterConstant.collectorDetailUrl,
GoLangConstant.requestPost,
requestParaminfo,
ImasterConstant.resovleRule_data_page_records,
ImasterInverterListDetails.class
);
// List<ImasterInverterListDetails> result = imasterUtils.getResPonseOther(ImasterConstant.collectorDetailUrl,
// GoLangConstant.requestPost,
// requestParaminfo,
// ImasterConstant.resovleRule_data_page_records,
// ImasterInverterListDetails.class
// );
List<ImasterInverterMonth> result2 = imasterUtils.getResPonseOther(ImasterConstant.collectorDetailMonthUrl,
GoLangConstant.requestPost,
......@@ -708,8 +724,12 @@ public class ImasterDataServiceImpl implements ImasterDataService {
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
}
}
// JpStation jpStation1 = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
// eq("third_code", PVProducerInfoEnum.HUAWEI.getCode()).
// eq("third_station_id",third_station_id));
//
// jpStation1.setRealTimePower(active_power);
// jpStationMapper.updateById(jpStation1);
}
......@@ -718,12 +738,12 @@ public class ImasterDataServiceImpl implements ImasterDataService {
public void inverAlramInfo() {
List<String> inverterSns = imasterInverterListMapper.getCollectIds();
for (int i = 0; i < inverterSns.size(); i++) {
try {
TimeUnit.MINUTES.sleep(3);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// for (int i = 0; i < inverterSns.size(); i++) {
// try {
// TimeUnit.MINUTES.sleep(3);
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// }
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("sns", inverterSns.stream().collect(Collectors.joining(",")));
......@@ -767,6 +787,6 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
}
}
}
// }
}
}
......@@ -277,28 +277,42 @@ public class JpStationController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = false,ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "工率曲线", notes = "电站监控电量收益")
@GetMapping(value = "/getPowerqx")
public ResponseModel< Map<String, List<Object>>> getPowerqx(JpStationDto reviewDto,String date, String type) {
//获取当前人管理场站
List<String> data=new ArrayList();
if(reviewDto.getThirdStationId()==null){
//获取当前人管理场站
LambdaQueryWrapper<JpPersonStation> qug=new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId,getUserInfo().getUserId());
List<JpPersonStation> pPersonStation=pPersonStationMapper.selectList(qug);
if(pPersonStation!=null&&!pPersonStation.isEmpty()){
Set<String> se=new HashSet<>();
if(reviewDto.getName()!=null){
LambdaQueryWrapper<JpPersonStation> qug1=new LambdaQueryWrapper<>();
qug1.like(JpPersonStation::getStationName,reviewDto.getName());
List<JpPersonStation> pPersonStation1=pPersonStationMapper.selectList(qug1);
if(pPersonStation1!=null&&!pPersonStation1.isEmpty()){
for (JpPersonStation jpPersonStation : pPersonStation1) {
se.add(jpPersonStation.getStationId());
}
}
data.addAll(se);
}else{
if(reviewDto.getThirdStationId()==null){
//获取当前人管理场站
LambdaQueryWrapper<JpPersonStation> qug=new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId,getUserInfo().getUserId());
List<JpPersonStation> pPersonStation=pPersonStationMapper.selectList(qug);
if(pPersonStation!=null&&!pPersonStation.isEmpty()){
for (JpPersonStation jpPersonStation : pPersonStation) {
data.add(jpPersonStation.getStationId());
for (JpPersonStation jpPersonStation : pPersonStation) {
data.add(jpPersonStation.getStationId());
}
}else{
return ResponseHelper.buildResponse(null);
}
}else{
return ResponseHelper.buildResponse(null);
data.add(reviewDto.getThirdStationId());
}
}else{
data.add(reviewDto.getThirdStationId());
}
return ResponseHelper.buildResponse(jpStationServiceImpl.getPowerqx( date, type,data));
}
......
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