微调
This commit is contained in:
@@ -37,38 +37,10 @@ public class DisPhotovoltaicController {
|
|||||||
private final IBusinessService businessService;
|
private final IBusinessService businessService;
|
||||||
private final DisPhotovoltaicService disPhotovoltaicService;
|
private final DisPhotovoltaicService disPhotovoltaicService;
|
||||||
|
|
||||||
@ApiOperation(value = "获取10kv分布式光伏接入情况")
|
@ApiOperation(value = "查询所有用户的遥测数据")
|
||||||
@PostMapping("/import10")
|
@PostMapping("/queryTelemetryData")
|
||||||
public void importTakeOrder(MultipartFile file, String startTime, String endTime) throws Exception {
|
public void queryTelemetryData(String startTime, String endTime) {
|
||||||
List<ExcelData> list = EasyExcel.read(file.getInputStream())
|
businessService.queryTelemetryData(startTime, endTime);
|
||||||
.head(ExcelData.class)
|
|
||||||
.headRowNumber(2)
|
|
||||||
.sheet(2).doReadSync();
|
|
||||||
//排重
|
|
||||||
list = list.stream()
|
|
||||||
.filter(t -> StrUtil.isNotBlank(t.getGenerationUserID()))
|
|
||||||
.filter(StreamUtil.distinctByKey(ExcelData::getGenerationUserID))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
businessService.testInterfaceByUserId(list, startTime, endTime);
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "获取380kv分布式光伏接入情况")
|
|
||||||
@PostMapping("/import380")
|
|
||||||
public void import380(MultipartFile file, String startTime, String endTime) throws Exception {
|
|
||||||
List<ExcelData> list = EasyExcel.read(file.getInputStream())
|
|
||||||
.head(ExcelData.class)
|
|
||||||
.headRowNumber(2)
|
|
||||||
.sheet(3).doReadSync();
|
|
||||||
//排重
|
|
||||||
list = list.stream()
|
|
||||||
.filter(t -> StrUtil.isNotBlank(t.getGenerationUserID()))
|
|
||||||
.filter(StreamUtil.distinctByKey(ExcelData::getGenerationUserID))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
businessService.testInterfaceByUserId(list, startTime, endTime);
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "导入10kv分布式光伏接入情况", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
@ApiOperation(value = "导入10kv分布式光伏接入情况", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.njcn.jbsyncdata.mapper;
|
|||||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||||
import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -15,4 +17,5 @@ import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
|||||||
public interface PmsPowerGenerationUserMapper extends MppBaseMapper<PmsPowerGenerationUser> {
|
public interface PmsPowerGenerationUserMapper extends MppBaseMapper<PmsPowerGenerationUser> {
|
||||||
|
|
||||||
|
|
||||||
|
List<String> queryAllUserId();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,11 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.jbsyncdata.mapper.PmsPowerGenerationUserMapper">
|
<mapper namespace="com.njcn.jbsyncdata.mapper.PmsPowerGenerationUserMapper">
|
||||||
|
|
||||||
|
<select id="queryAllUserId" resultType="String">
|
||||||
|
select
|
||||||
|
id
|
||||||
|
from
|
||||||
|
pms_power_generation_user
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface IBusinessService {
|
public interface IBusinessService {
|
||||||
|
|
||||||
void testInterfaceByUserId(List<ExcelData> list,String startTime,String endTime);
|
void queryTelemetryData(String startTime,String endTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.njcn.jbsyncdata.service;
|
|||||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||||
import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 发电用户台账 服务类
|
* 发电用户台账 服务类
|
||||||
@@ -13,4 +15,9 @@ import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
|||||||
*/
|
*/
|
||||||
public interface IPmsPowerGenerationUserService extends IMppService<PmsPowerGenerationUser> {
|
public interface IPmsPowerGenerationUserService extends IMppService<PmsPowerGenerationUser> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有客户编号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> queryAllUserId();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.njcn.jbsyncdata.enums.MeasTypeEnum;
|
|||||||
import com.njcn.jbsyncdata.pojo.ExcelData;
|
import com.njcn.jbsyncdata.pojo.ExcelData;
|
||||||
import com.njcn.jbsyncdata.pojo.result.*;
|
import com.njcn.jbsyncdata.pojo.result.*;
|
||||||
import com.njcn.jbsyncdata.service.IBusinessService;
|
import com.njcn.jbsyncdata.service.IBusinessService;
|
||||||
|
import com.njcn.jbsyncdata.service.IPmsPowerGenerationUserService;
|
||||||
import com.njcn.jbsyncdata.util.RestTemplateUtil;
|
import com.njcn.jbsyncdata.util.RestTemplateUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
@@ -38,6 +39,9 @@ public class BusinessServiceImpl implements IBusinessService {
|
|||||||
@Resource
|
@Resource
|
||||||
private InfluxDbUtils influxDbUtils;
|
private InfluxDbUtils influxDbUtils;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPmsPowerGenerationUserService pmsPowerGenerationUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 此方法通过发电客户编号查询数据,该方法存在以下问题
|
* 此方法通过发电客户编号查询数据,该方法存在以下问题
|
||||||
* 问题一:一个发电客户编号同指标返回的数据会有多个,但是目前看到最多2个测量点数据。
|
* 问题一:一个发电客户编号同指标返回的数据会有多个,但是目前看到最多2个测量点数据。
|
||||||
@@ -51,11 +55,9 @@ public class BusinessServiceImpl implements IBusinessService {
|
|||||||
* 2. PageResult的records属性为null---------------------不做处理,直接过
|
* 2. PageResult的records属性为null---------------------不做处理,直接过
|
||||||
* 3. CommonTelemetry的遥测数据集合telemetryValue为null--不做处理,直接过
|
* 3. CommonTelemetry的遥测数据集合telemetryValue为null--不做处理,直接过
|
||||||
* 4. StatisticsData统计数据的实际数值measValue为null-----对应时间、指标的数值设置为0
|
* 4. StatisticsData统计数据的实际数值measValue为null-----对应时间、指标的数值设置为0
|
||||||
*
|
|
||||||
* @param excelDataList 客户编号集合
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void testInterfaceByUserId(List<ExcelData> excelDataList, String startTime, String endTime) {
|
public void queryTelemetryData(String startTime, String endTime) {
|
||||||
RestTemplateUtil restTemplateUtil = new RestTemplateUtil();
|
RestTemplateUtil restTemplateUtil = new RestTemplateUtil();
|
||||||
TokenResult tokenWithRestTemplate = tokenComponent.getTokenWithRestTemplate();
|
TokenResult tokenWithRestTemplate = tokenComponent.getTokenWithRestTemplate();
|
||||||
if (null == tokenWithRestTemplate) {
|
if (null == tokenWithRestTemplate) {
|
||||||
@@ -64,9 +66,11 @@ public class BusinessServiceImpl implements IBusinessService {
|
|||||||
}
|
}
|
||||||
JSONObject jsonObject;
|
JSONObject jsonObject;
|
||||||
JSONObject jsonObjectSub;
|
JSONObject jsonObjectSub;
|
||||||
|
//获取所有发电用户的id
|
||||||
|
List<String> userIds = pmsPowerGenerationUserService.queryAllUserId();
|
||||||
//将发电用户编号按500尺寸分片
|
//将发电用户编号按500尺寸分片
|
||||||
List<List<ExcelData>> partitionList = ListUtils.partition(excelDataList, 500);
|
List<List<String>> partitionList = ListUtils.partition(userIds, 500);
|
||||||
for (List<ExcelData> excelData : partitionList) {
|
for (List<String> userId : partitionList) {
|
||||||
Map</*表名*/String, List<Map</*属性名*/String,/*数值*/String>>> typeData = new HashMap<>();
|
Map</*表名*/String, List<Map</*属性名*/String,/*数值*/String>>> typeData = new HashMap<>();
|
||||||
jsonObject = JSONUtil.createObj();
|
jsonObject = JSONUtil.createObj();
|
||||||
jsonObjectSub = JSONUtil.createObj();
|
jsonObjectSub = JSONUtil.createObj();
|
||||||
@@ -75,7 +79,7 @@ public class BusinessServiceImpl implements IBusinessService {
|
|||||||
jsonObject.set("startTime", startTime);
|
jsonObject.set("startTime", startTime);
|
||||||
jsonObject.set("endTime", endTime);
|
jsonObject.set("endTime", endTime);
|
||||||
//按批次处理用户编号数据
|
//按批次处理用户编号数据
|
||||||
List<String> generationUserIDList = excelData.stream().map(t -> "160".concat(t.getGenerationUserID())).collect(Collectors.toList());
|
List<String> generationUserIDList = userId.stream().map("160"::concat).collect(Collectors.toList());
|
||||||
jsonObjectSub.set("consNos", generationUserIDList);
|
jsonObjectSub.set("consNos", generationUserIDList);
|
||||||
//1公专变2低压用户3光伏
|
//1公专变2低压用户3光伏
|
||||||
jsonObjectSub.set("consType", 3);
|
jsonObjectSub.set("consType", 3);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.jbsyncdata.service.impl;
|
package com.njcn.jbsyncdata.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.jbsyncdata.mapper.PmsPowerGenerationUserMapper;
|
import com.njcn.jbsyncdata.mapper.PmsPowerGenerationUserMapper;
|
||||||
import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
||||||
@@ -7,6 +8,8 @@ import com.njcn.jbsyncdata.service.IPmsPowerGenerationUserService;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 发电用户台账 服务实现类
|
* 发电用户台账 服务实现类
|
||||||
@@ -19,4 +22,8 @@ import org.springframework.stereotype.Service;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PmsPowerGenerationUserServiceImpl extends MppServiceImpl<PmsPowerGenerationUserMapper, PmsPowerGenerationUser> implements IPmsPowerGenerationUserService {
|
public class PmsPowerGenerationUserServiceImpl extends MppServiceImpl<PmsPowerGenerationUserMapper, PmsPowerGenerationUser> implements IPmsPowerGenerationUserService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> queryAllUserId() {
|
||||||
|
return this.baseMapper.queryAllUserId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user