Commit c8f05382 authored by tangwei's avatar tangwei

解决冲突

parents a0d84e90 e610372d
......@@ -44,19 +44,21 @@ public class GolangRequestUtil {
}
/**
* @desc 根据请求参数发送http请求并且对于返回的数据进行处理
* @param apiurl 请求url
* @param requestMethod 请求方式
* @param requestParmInfo 请求参数mapper
* @param ResultResolveRule 请求的解析
* @param tClass 需要转换成的bean
* @return List<T> list<Result>
* @param <T> 泛型数据
* @return List<T> list<Result>
* @desc 根据请求参数发送http请求并且对于返回的数据进行处理
*/
public <T> List<T> getResPonse(String apiurl, String requestMethod, String requestParmInfo, String ResultResolveRule, Class<T> tClass) {
String respone = "";
String params = "";
JSONArray jsonArray = null;
List<T> result = new ArrayList<>();
try {
HashMap<String, Object> producerInfo = getHeaderOfGolang();
String baseurl = (String) producerInfo.get("apiurl");
HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
......@@ -66,15 +68,20 @@ public class GolangRequestUtil {
JLYHeaderMapHandler(params, headMap, orginalAuthorization, appsecret, apiurl);
respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
List<T> result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
if (!ObjectUtils.isEmpty(jsonArray)) {
result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
}
} catch (Exception exception) {
return result;
}
return result;
}
/**
* @desc 根据解析规则解析请求返回数据
* @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串
* @return 解析后的数据
* @desc 根据解析规则解析请求返回数据
*/
public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) {
JSONObject jsonObject = JSONObject.parseObject(response);
......@@ -136,10 +143,10 @@ public class GolangRequestUtil {
}
/**
* @desc 根据分页规则 获取分页数
* @param pageSizeResovle
* @param response
* @return
* @desc 根据分页规则 获取分页数
*/
public Integer getPagesize(String pageSizeResovle, String response) {
Integer pageSize = 0;
......
......@@ -56,5 +56,6 @@ public class GoLangConstant {
public static String requestPost = "POST";
public static String datePattern = "yyyy-MM-dd HH:mm:ss.SSS";
public static DateTimeFormatter formatter = DateTimeFormatter.ofPattern(datePattern);
public static Double kwhToMwh =0.0001 ;
public static Double kwhToMwh = 0.0001;
public static Double mwhTokwh = 1000.0;
}
......@@ -56,7 +56,7 @@ public class HouseholdTestController {
@ApiOperation(httpMethod = "POST", value = "锦浪云", notes = "锦浪云")
public void golangnew() throws IOException {
// goLangDataAcquisitionService.stationList();
// goLangDataAcquisitionService.stationDetail();
goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList();
goLangDataAcquisitionService.collectorDetail();
......
......@@ -13,4 +13,6 @@ public class CollectorDetailDto {
private String stationId;
private String rssiLevel;
private String model;
private String addr;
private String stationName;
}
......@@ -115,5 +115,16 @@ public class JpCollector implements Serializable {
*/
@TableField("third_code")
private String thirdCode;
/**
* 场站名称
*/
@TableField("station_name")
private String stationName;
/**
* 场站地址
*/
@TableField("addr")
private String addr;
}
......@@ -174,5 +174,15 @@ public class JpInverter implements Serializable {
*/
@TableField("total_power_generation")
private Double totalPowerGeneration;
/**
* 场站名称
*/
@TableField("station_name")
private String stationName;
/**
* 场站地址
*/
@TableField("addr")
private String addr;
}
......@@ -217,4 +217,6 @@ public class JpStation implements Serializable {
private Double yearPowerUse; // 年用电量
@TableField("email")
private String email; // 电子邮箱
@TableField("rated_power")
private Double ratedPower; // 额定功率
}
......@@ -7,6 +7,6 @@ import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface GolangCollectorListMapper extends BaseMapper<GolangCollectorList> {
@Select("select id from golang_collector_list group by id")
@Select("select id from golang_collector_list where sn is not null group by id")
List<Long> getCollectIds();
}
......@@ -7,8 +7,6 @@ import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface GolangInverterListMapper extends BaseMapper<GolangInverterList> {
@Select("select id from golang_inveter_list group by id")
List<Long> getInverterIds();
@Select("select sn from golang_inveter_list group by sn")
@Select("select sn from golang_inveter_list where sn is not null group by sn")
List<String> getInverterSns();
}
......@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.JsonParser;
import com.yeejoin.amos.api.householdapi.Utils.GolangRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.face.dto.AlarmDto;
......@@ -27,6 +28,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -146,23 +148,28 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation.setLatitude(golangStationDetail.getLatitude());
jpStation.setUserName(golangStationDetail.getUsername());
jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile()));
jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile()).toLowerCase().replace("null",""));
jpStation.setModuleCount(Math.toIntExact(golangStationDetail.getModule()));
jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile()).toLowerCase().replace("null", ""));
jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule()))?0:Math.toIntExact(golangStationDetail.getModule()));
//并网类型
jpStation.setOnGridType(GoLangConstant.stationStaus.get(String.valueOf(golangStationDetail.getState())));
jpStation.setThirdStationId(String.valueOf(golangStationDetail.getId()));
jpStation.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpStation.setRealTimePower(golangStationDetail.getPower());
jpStation.setState(GoLangConstant.intoNetWorkStatus.get(String.valueOf(golangStationDetail.getStationtypenew())));
jpStation.setDayGenerate(golangStationDetail.getDayenergy()*GoLangConstant.kwhToMwh);
jpStation.setMonthGenerate(golangStationDetail.getMonthenergy());
jpStation.setYearGenerate(golangStationDetail.getYearenergy());
jpStation.setDayGenerate(golangStationDetail.getDayenergy());
jpStation.setMonthGenerate(golangStationDetail.getMonthenergy() * GoLangConstant.mwhTokwh);
jpStation.setYearGenerate(golangStationDetail.getYearenergy() * GoLangConstant.mwhTokwh);
jpStation.setAccumulatedPower(golangStationDetail.getAllenergy() * GoLangConstant.mwhTokwh);
jpStation.setDayIncome(golangStationDetail.getDayincome());
jpStation.setMonthIncome(golangStationDetail.getMonthincome());
jpStation.setYearIncome(golangStationDetail.getYearincome());
jpStation.setCumulativeIncome(golangStationDetail.getAllincome());
jpStation.setArea(golangStationDetail.getRegionstr());
jpStation.setEmail(golangStationDetail.getUseremail());
jpStation.setOnGridTime(new Date(golangStationDetail.getFispowertime()));
jpStation.setAccessTime(new Date(golangStationDetail.getFisgeneratetime()));
jpStation.setCreateTime(new Date(golangStationDetail.getCreatedate()));
jpStation.setRatedPower(Double.valueOf(golangStationDetail.getInverterpower()));
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStationMapper.updateById(jpStation);
} else {
......@@ -171,7 +178,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory.setCreatedTime(System.currentTimeMillis());
hygfjpStationPowerHistory.setThirdStationId(jpStation.getThirdStationId());
hygfjpStationPowerHistory.setPower(jpStation.getRealTimePower());
hygfjpStationPowerHistory.setPower(golangStationDetail.getPower());
hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode());
hygfjpStationPowerHistory.setTime(System.currentTimeMillis());
hygfjpStationPowerHistoryMapper.insert(hygfjpStationPowerHistory);
......@@ -278,6 +285,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpCollector.setThirdCode(PVProducerInfoEnum.JLY.getCode());
//第三方厂商标识
jpCollector.setState(GoLangConstant.stationStaus.get(collectorDetailDto.getState()));
jpCollector.setStationName(collectorDetailDto.getStationName());
jpCollector.setAddr(collectorDetailDto.getAddr());
if (ObjectUtils.isEmpty(jpCollector.getSequenceNbr())) {
jpCollectorMapper.insert(jpCollector);
} else {
......@@ -359,10 +368,10 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpInverter.setCollectorSnCode(inverterDetailDto.getCollectorsn());
jpInverter.setUpdateTime(new Date());
jpInverter.setCurrentPower(inverterDetailDto.getPac());
jpInverter.setDayPowerGeneration(inverterDetailDto.getEToday()*GoLangConstant.kwhToMwh);
jpInverter.setMonthPowerGeneration(inverterDetailDto.getEMonth());
jpInverter.setYearPowerGeneration(inverterDetailDto.getEYear());
jpInverter.setTotalPowerGeneration(inverterDetailDto.getETotal());
jpInverter.setDayPowerGeneration(inverterDetailDto.getEToday());
jpInverter.setMonthPowerGeneration(inverterDetailDto.getEMonth() * GoLangConstant.mwhTokwh);
jpInverter.setYearPowerGeneration(inverterDetailDto.getEYear() * GoLangConstant.mwhTokwh);
jpInverter.setTotalPowerGeneration(inverterDetailDto.getETotal() * GoLangConstant.mwhTokwh);
jpInverter.setBrand(inverterDetailDto.getName());
jpInverter.setModel(inverterDetailDto.getProductModel());
jpInverter.setNationalStandard(inverterDetailDto.getNationalStandards());
......@@ -372,6 +381,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpInverter.setCapacity(inverterDetailDto.getPower().intValue());
jpInverter.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
jpInverter.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpInverter.setStationName(inverterDetailDto.getStationName());
if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter);
} else {
......@@ -449,7 +459,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
hygfjpInverterHistory.setSnCode(inverterDetailDto.getSn());
hygfjpInverterHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterHistory.setGenerationHours(inverterDetailDto.getFullHour());
hygfjpInverterHistory.setPowerGeneration(inverterDetailDto.getEToday()*GoLangConstant.kwhToMwh);
hygfjpInverterHistory.setPowerGeneration(inverterDetailDto.getEToday());
if (ObjectUtils.isEmpty(hygfjpInverterHistory.getCreatedTime())) {
hygfjpInverterHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -52,7 +54,21 @@ public class TdHygfJpInverterWarnServiceImpl
String[] s = tdHygfJpInverterWarnDto.getState().split(",");
tdHygfJpInverterWarnDto.setStates(Arrays.asList(s));
}
List<TdHygfJpInverterWarnDto> list = this.baseMapper.list(tdHygfJpInverterWarnDto);
if (tdHygfJpInverterWarnDto.getStationName() != null) {
LambdaQueryWrapper<JpStation> wapper = new LambdaQueryWrapper<JpStation>().like(JpStation::getName,
tdHygfJpInverterWarnDto.getStationName());
if (!tdHygfJpInverterWarnDto.getStationIds().isEmpty()) {
wapper.in(JpStation::getThirdStationId, tdHygfJpInverterWarnDto.getStationIds());
}
List<JpStation> sList = jpStationServiceImpl.list(wapper);
List<String> ids = sList.stream().map(i -> i.getThirdStationId()).collect(Collectors.toList());
tdHygfJpInverterWarnDto.setStationIds(ids);
}
List<TdHygfJpInverterWarnDto> list = new ArrayList<>();
if (tdHygfJpInverterWarnDto.getStationIds().isEmpty()) {
} else {
list = this.baseMapper.list(tdHygfJpInverterWarnDto);
if (!list.isEmpty()) {
list.forEach(i -> {
JpStation jpStation = jpStationServiceImpl.getOne(new LambdaQueryWrapper<JpStation>()
......@@ -67,6 +83,7 @@ public class TdHygfJpInverterWarnServiceImpl
}
});
}
}
PageInfo<TdHygfJpInverterWarnDto> page = new PageInfo(list);
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TdHygfJpInverterWarnDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<TdHygfJpInverterWarnDto>();
pagenew.setCurrent(pageNum);
......
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