Commit 6e5b6b4e authored by tangwei's avatar tangwei

修改监盘功率bug

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