Commit 6784e9a8 authored by chenzhao's avatar chenzhao

增加逆变器接口

parent 27ee5e69
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
@TableName(value = "td_hygf_inverter_total_generate" ,autoResultMap = true)
public class TdHYGFInverterTotalGenerate implements Serializable {
/**
* 创建时间
*/
private Long createdTime;
/**
* 第三方场站id
*/
private String thirdStationId;
/**
* sncode
*/
private String snCode;
/**
*日 yyyy-MM
*/
private String yearTime;
/**
*月 yyyy
*/
private String year;
/**
* 发电量
*/
private Double generate;
/**
* 满发小时数
*/
private Double fullhour;
private Double income;
}
......@@ -3,5 +3,12 @@ package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate;
import java.util.List;
import java.util.Map;
public interface TdHYGFInverterDayGenerateMapper extends BaseMapper<TdHYGFInverterDayGenerate> {
List<Map<String,Object>> selectDayTrend(List<String> treeParams, String time, String snCode, String thirdStationId);
}
......@@ -3,5 +3,11 @@ package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterMonthGenerate;
import java.util.List;
import java.util.Map;
public interface TdHYGFInverterMonthGenerateMapper extends BaseMapper<TdHYGFInverterMonthGenerate> {
List<Map<String,Object>> selectMonthTrend(String time, String snCode, String thirdStationId);
Map<String,Object> selectMonthTotal(String time, String snCode, String thirdStationId);
}
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterTotalGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterYearGenerate;
import java.util.List;
import java.util.Map;
public interface TdHYGFInverterYearGenerateMapper extends BaseMapper<TdHYGFInverterYearGenerate> {
List<Map<String, Object>> selectYearTrend(String time, String snCode, String thirdStationId);
List<Map<String, Object>> selectTotalTrend(String time, String snCode, String thirdStationId);
Map<String, Object> selectYearTotal(String time, String snCode, String thirdStationId);
List<TdHYGFInverterTotalGenerate> selectTotalSum(String time, String snCode, String thirdStationId);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterDayGenerateMapper">
<select id="selectDayTrend" resultType="map">
SELECT
<foreach collection="treeParams" item="item" separator=",">
#{item}
</foreach>,
created_time as `time`
from
house_pv_data.td_hygf_inverter_day_generate
<where>
created_time >= (#{time} - 8h )
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterMonthGenerateMapper">
<select id="selectMonthTrend" resultType="map">
SELECT
day_time as dayTime,
generate,
fullhour
from
house_pv_data.td_hygf_inverter_month_generate
<where>
year_month = #{time}
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
<select id="selectMonthTotal" resultType="map">
SELECT
generate,
fullhour,
income
from
house_pv_data.td_hygf_inverter_month_generate
<where>
day_time = #{time}
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterYearGenerateMapper">
<select id="selectYearTrend" resultType="map">
SELECT
day_time as dayTime,
generate,
fullhour
from
house_pv_data.td_hygf_inverter_year_generate
<where>
year_month = #{time}
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
<select id="selectTotalTrend" resultType="map">
SELECT
day_time as dayTime,
generate,
fullhour
from
house_pv_data.td_hygf_inverter_year_generate
<where>
year_time = #{time}
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
<select id="selectYearTotal" resultType="map">
SELECT
income ,
generate,
fullhour
from
house_pv_data.td_hygf_inverter_year_generate
<where>
month_time = #{time}
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
<select id="selectTotalSum" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterTotalGenerate">
SELECT
income ,
generate,
fullhour
from
house_pv_data.td_hygf_inverter_year_generate
<where>
<if test="time != null and time !=''">
year_time = #{time}
</if>
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto;
......@@ -65,94 +66,94 @@ public class JpInverterController extends BaseController {
@Autowired
JpPersonStationMapper pPersonStationMapper;
@Value("classpath:/json/paramsTree.json")
private Resource paramsTree;
/**
* 新增户用光伏监盘逆变器表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增户用光伏监盘逆变器表", notes = "新增户用光伏监盘逆变器表")
public ResponseModel<JpInverterDto> save(@RequestBody JpInverterDto model) {
model = jpInverterServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏监盘逆变器表", notes = "根据sequenceNbr更新户用光伏监盘逆变器表")
public ResponseModel<JpInverterDto> updateBySequenceNbrJpInverter(@RequestBody JpInverterDto model,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jpInverterServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除户用光伏监盘逆变器表", notes = "根据sequenceNbr删除户用光伏监盘逆变器表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jpInverterServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个户用光伏监盘逆变器表", notes = "根据sequenceNbr查询单个户用光伏监盘逆变器表")
public ResponseModel<JpInverterDto> selectOne(@PathVariable Long sequenceNbr) {
JpInverterDto jpInverter = jpInverterServiceImpl.queryBySeq(sequenceNbr);
jpInverter.setDayPowerGeneration(jpInverter.getDayPowerGeneration() != null ? jpInverter.getDayPowerGeneration() / 1000 : 0);
jpInverter.setMonthPowerGeneration(jpInverter.getMonthPowerGeneration() != null ? jpInverter.getMonthPowerGeneration() / 1000 : 0);
jpInverter.setYearPowerGeneration(jpInverter.getYearPowerGeneration() != null ? jpInverter.getYearPowerGeneration() / 1000 : 0);
jpInverter.setTotalPowerGeneration(jpInverter.getTotalPowerGeneration() != null ? jpInverter.getTotalPowerGeneration() / 1000 : 0);
@Value("classpath:/json/paramsTree.json")
private Resource paramsTree;
/**
* 新增户用光伏监盘逆变器表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增户用光伏监盘逆变器表", notes = "新增户用光伏监盘逆变器表")
public ResponseModel<JpInverterDto> save(@RequestBody JpInverterDto model) {
model = jpInverterServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏监盘逆变器表", notes = "根据sequenceNbr更新户用光伏监盘逆变器表")
public ResponseModel<JpInverterDto> updateBySequenceNbrJpInverter(@RequestBody JpInverterDto model,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jpInverterServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除户用光伏监盘逆变器表", notes = "根据sequenceNbr删除户用光伏监盘逆变器表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jpInverterServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个户用光伏监盘逆变器表", notes = "根据sequenceNbr查询单个户用光伏监盘逆变器表")
public ResponseModel<JpInverterDto> selectOne(@PathVariable Long sequenceNbr) {
JpInverterDto jpInverter= jpInverterServiceImpl.queryBySeq(sequenceNbr);
jpInverter.setDayPowerGeneration(jpInverter.getDayPowerGeneration()!=null?jpInverter.getDayPowerGeneration()/1000:0);
jpInverter.setMonthPowerGeneration(jpInverter.getMonthPowerGeneration()!=null?jpInverter.getMonthPowerGeneration()/1000:0);
jpInverter.setYearPowerGeneration(jpInverter.getYearPowerGeneration()!=null?jpInverter.getYearPowerGeneration()/1000:0);
jpInverter.setTotalPowerGeneration(jpInverter.getTotalPowerGeneration()!=null?jpInverter.getTotalPowerGeneration()/1000:0);
return ResponseHelper.buildResponse(jpInverter);
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器表分页查询", notes = "户用光伏监盘逆变器表分页查询")
public ResponseModel<Page<JpInverterDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, JpInverterDto jpInverterDto) {
List<JpPersonStation> pPersonStation = null;
if (jpInverterDto.getName() != null && !"".equals(jpInverterDto.getName())) {
LambdaQueryWrapper<JpPersonStation> qug1 = new LambdaQueryWrapper<>();
qug1.like(JpPersonStation::getStationName, jpInverterDto.getName());
pPersonStation = pPersonStationMapper.selectList(qug1);
} else {
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器表分页查询", notes = "户用光伏监盘逆变器表分页查询")
public ResponseModel<Page<JpInverterDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, JpInverterDto jpInverterDto) {
List<JpPersonStation> pPersonStation =null;
if(jpInverterDto.getName()!=null&&!"".equals(jpInverterDto.getName())){
LambdaQueryWrapper<JpPersonStation> qug1=new LambdaQueryWrapper<>();
qug1.like(JpPersonStation::getStationName,jpInverterDto.getName());
pPersonStation=pPersonStationMapper.selectList(qug1);
}else{
LambdaQueryWrapper<JpPersonStation> qug = new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId, getUserInfo().getUserId());
pPersonStation = pPersonStationMapper.selectList(qug);
pPersonStation = pPersonStationMapper.selectList(qug);
}
if (!pPersonStation.isEmpty()) {
......@@ -209,19 +210,24 @@ public class JpInverterController extends BaseController {
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/jpInverterTrend")
@ApiOperation(httpMethod = "GET", value = "逆变器图标 折线图", notes = "逆变器图标 折线图")
public void jpInverterTrend(List<String> treeParams, String type, String time, String snCode, String thirdStationId) {
if (CollectionUtils.isNotEmpty(treeParams)) {
jpInverterServiceImpl.selectDayTrend(treeParams, time, snCode, thirdStationId);
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/jpInverterTrend")
@ApiOperation(httpMethod = "POST", value = "逆变器图标 折线图", notes = "逆变器图标 折线图")
public ResponseModel<Map<String,Object>> jpInverterTrend (@RequestBody Map<String,Object> treeParams) {
String time = treeParams.get("time").toString();
String snCode = treeParams.get("snCode").toString();
String thirdStationId = treeParams.get("thirdStationId").toString();
if (treeParams.get("date").equals("day")){
time = time+ " 00:00:00";
List<JSONObject> treeParams1 = parseArray(JSONObject.toJSONString(treeParams.get("treeParams")), JSONObject.class);
return ResponseHelper.buildResponse(jpInverterServiceImpl.selectDayTrend(treeParams1, time, snCode, thirdStationId));
}else if (treeParams.get("date").equals("month")){
return ResponseHelper.buildResponse(jpInverterServiceImpl.selectMonthTrend(time, snCode, thirdStationId));
}else {
return ResponseHelper.buildResponse(jpInverterServiceImpl.selectYearTrend(time, snCode, thirdStationId));
}
}
}
// jpInverterServiceImpl.
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getInverterSncodes")
@ApiOperation(httpMethod = "GET", value = "获取逆变器snCode", notes = "获取逆变器snCode")
......@@ -319,4 +325,13 @@ public class JpInverterController extends BaseController {
e.printStackTrace();
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/jpInverterTotal")
@ApiOperation(httpMethod = "GET", value = "逆变器详折线图上方统计", notes = "逆变器详折线图上方统计")
public ResponseModel<Map<String,Object>> jpInverterTotal( String time,String snCode,String thirdStationId,String date) {
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterTotal(snCode,thirdStationId,time,date));
}
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import java.util.*;
import java.util.stream.Collectors;
import java.util.*;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
......@@ -10,10 +14,15 @@ import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterMonthGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterYearGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterTotalGenerate;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterDayGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterMonthGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterYearGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterMonthGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterYearGenerateMapper;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean;
......@@ -92,10 +101,24 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
return this.getBaseMapper().selectPageDataTotal(jpInverterDto);
}
public void selectDayTrend(List<String> treeParams, String time, String snCode, String thirdStationId) {
}
public Map<String,Object> selectDayTrend(List<JSONObject>treeParams, String time, String snCode, String thirdStationId) {
List<String> key = treeParams.stream().map(e -> e.get("key").toString().replace("_","")).collect(Collectors.toList());
List<Map<String,Object>> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectDayTrend(key, time, snCode, thirdStationId);
Set<String> xData = new TreeSet<>();
for (JSONObject treeParam : treeParams) {
List<String> value = new ArrayList<>();
for (Map<String, Object> obj : tdHYGFInverterDayGenerates) {
xData.add(obj.get("time").toString().substring(0,obj.get("time").toString().length()-4));
String key1 = treeParam.get("key").toString().replace("_","");
value.add(obj.get(key1).toString());
}
treeParam.put("data",value);
}
Map<String,Object> map = new HashMap<>();
map.put("xData",xData);
map.put("yData",treeParams);
return map;
}
public Page<TdHYGFInverterDayGenerate> jpInverterDayReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
Page<TdHYGFInverterDayGenerate> tdHYGFInverterDayGeneratePage = new Page<>();
......@@ -196,4 +219,109 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
}
return result;
}
public Map<String,Object> selectMonthTrend(String time, String snCode, String thirdStationId) {
Set<String> xData = new TreeSet<>();
List<String> value1 = new ArrayList<>();
List<String> value2 = new ArrayList<>();
List<Map<String, Object>> maps = tdHYGFInverterMonthGenerateMapper.selectMonthTrend(time, snCode, thirdStationId);
for (Map<String, Object> map : maps) {
xData.add(map.get("daytime").toString());
value1.add(map.get("generate").toString());
value2.add(map.get("fullhour").toString());
}
List<Map<String, Object>> yData = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
Map<String,Object> map1 = new HashMap<>();
map1.put("name","发电量");
map1.put("unit","Kw");
map1.put("data",value1);
yData.add(map1);
Map<String,Object> map2 = new HashMap<>();
map2.put("name","满发小时数");
map2.put("unit","h");
map2.put("data",value2);
yData.add(map2);
map.put("xData",xData);
map.put("yData",yData);
return map;
}
public Map<String,Object> selectYearTrend(String time, String snCode, String thirdStationId) {
Set<String> xData = new TreeSet<>();
List<String> value1 = new ArrayList<>();
List<String> value2 = new ArrayList<>();
List<Map<String, Object>> maps = tdHYGFInverterYearGenerateMapper.selectYearTrend(time, snCode, thirdStationId);
for (Map<String, Object> map : maps) {
xData.add(map.get("daytime").toString());
value1.add(map.get("generate").toString());
value2.add(map.get("fullhour").toString());
}
List<Map<String, Object>> yData = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
Map<String,Object> map1 = new HashMap<>();
map1.put("name","发电量");
map1.put("unit","Kw");
map1.put("data",value1);
yData.add(map1);
Map<String,Object> map2 = new HashMap<>();
map2.put("name","满发小时数");
map2.put("unit","h");
map2.put("data",value2);
yData.add(map2);
map.put("xData",xData);
map.put("yData",yData);
return map;
}
public Map<String,Object> selectTotalTrend(String time, String snCode, String thirdStationId) {
Set<String> xData = new TreeSet<>();
List<String> value1 = new ArrayList<>();
List<String> value2 = new ArrayList<>();
List<Map<String, Object>> maps = tdHYGFInverterYearGenerateMapper.selectTotalTrend(time, snCode, thirdStationId);
for (Map<String, Object> map : maps) {
xData.add(map.get("daytime").toString());
value1.add(map.get("generate").toString());
value2.add(map.get("fullhour").toString());
}
List<Map<String, Object>> yData = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
Map<String,Object> map1 = new HashMap<>();
map1.put("name","发电量");
map1.put("unit","Kw");
map1.put("data",value1);
yData.add(map1);
Map<String,Object> map2 = new HashMap<>();
map2.put("name","满发小时数");
map2.put("unit","h");
map2.put("data",value2);
yData.add(map2);
map.put("xData",xData);
map.put("yData",yData);
return map;
}
public Map<String,Object> jpInverterTotal(String snCode, String thirdStationId, String time, String date) {
if (date.equals("day")){
return tdHYGFInverterMonthGenerateMapper.selectMonthTotal(time, snCode, thirdStationId);
}else if (date.equals("month")){
return tdHYGFInverterYearGenerateMapper.selectYearTotal(time, snCode, thirdStationId);
}else if (date.equals("year")){
TdHYGFInverterTotalGenerate tdHYGFInverterTotalGenerate = tdHYGFInverterYearGenerateMapper.selectTotalSum(time, snCode, thirdStationId).get(0);
return Bean.BeantoMap(tdHYGFInverterTotalGenerate) ;
}else {
List<TdHYGFInverterTotalGenerate> maps = tdHYGFInverterYearGenerateMapper.selectTotalSum(null, snCode, thirdStationId);
double fullhour = maps.stream().mapToDouble(TdHYGFInverterTotalGenerate::getFullhour).sum();
double income = maps.stream().mapToDouble(TdHYGFInverterTotalGenerate::getIncome).sum();
double generate = maps.stream().mapToDouble(TdHYGFInverterTotalGenerate::getGenerate).sum();
Map<String,Object> map = new HashMap<>();
map.put("fullhour",fullhour);
map.put("income",income);
map.put("generate",generate);
return map;
}
}
}
\ No newline at end of file
[
{
"name": "直流电压",
"key": "voltage",
"key": "acv",
"children": [
{"name":"直流电压PV1",
"key": "acv1"
"key": "acv_1",
"unit": "V"
},
{"name":"直流电压PV2",
"key": "acv2"
"key": "acv_2",
"unit": "V"
},
{"name":"直流电压PV3",
"key": "acv3"
"key": "acv_3",
"unit": "V"
},
{"name":"直流电压PV4",
"key": "acv4"
"key": "acv_4",
"unit": "V"
}
]
},
{
"name": "直流电流",
"key": "current",
"key": "acc",
"children": [
{"name":"直流电流PV1",
"key": "acc1"
"key": "acc_1",
"unit": "A"
},
{"name":"直流电流PV2",
"key": "acc2"
"key": "acc_2",
"unit": "A"
},
{"name":"直流电流PV3",
"key": "acc3"
"key": "acc_3",
"unit": "A"
},
{"name":"直流电流PV4",
"key": "acc4"
"key": "acc_4",
"unit": "A"
}
]
},
......@@ -54,66 +62,73 @@
]},
{
"name": "U_交流电压",
"key": "1",
"key": "acv1",
"unit": "V",
"children": [
]
},
{
"name": "V_交流电压",
"key": "2",
"key": "acv2",
"unit": "V",
"children": [
]
}, {
"name": "W_交流电压",
"key": "3",
"key": "acv3",
"unit": "V",
"children": [
]
},
{
"name": "U_交流电流",
"key": "4",
"key": "acc1",
"unit": "A",
"children": [
]
},
{
"name": "W_交流电流",
"key": "5",
"key": "acc3",
"unit": "A",
"children": [
]
},
{
"name": "V_交流电流",
"key": "6",
"key": "acc2",
"unit": "A",
"children": [
]
},
{
"name": "交流输出频率",
"key": "7",
"key": "frequency",
"unit": "Hz",
"children": [
]
},
{
"name": "总功率",
"key": "totalPower",
"key": "total_power",
"children": [
]
},
{
"name": "当日电量",
"key": "dayGen",
"key": "day_gen",
"children": [
]
},
{
"name": "累计电量",
"key": "totalGen",
"key": "total_gen",
"children": [
]
},
{
"name": "IGBT温度",
"key": "igbtTmep",
"key": "igbt_temp",
"children": [
]
}
......
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