Commit c8f05382 authored by tangwei's avatar tangwei

解决冲突

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