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; ...@@ -3,5 +3,12 @@ package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate;
import java.util.List;
import java.util.Map;
public interface TdHYGFInverterDayGenerateMapper extends BaseMapper<TdHYGFInverterDayGenerate> { 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; ...@@ -3,5 +3,11 @@ package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterMonthGenerate; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterMonthGenerate;
import java.util.List;
import java.util.Map;
public interface TdHYGFInverterMonthGenerateMapper extends BaseMapper<TdHYGFInverterMonthGenerate> { 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; package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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 com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterYearGenerate;
import java.util.List;
import java.util.Map;
public interface TdHYGFInverterYearGenerateMapper extends BaseMapper<TdHYGFInverterYearGenerate> { 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"?> <?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"> <!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"> <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> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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> </mapper>
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import java.util.*; 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.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
...@@ -10,10 +14,15 @@ import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits; ...@@ -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.TdHYGFInverterDayGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterMonthGenerate; 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.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.TdHYGFInverterDayGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterMonthGenerateMapper; 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.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.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
...@@ -92,10 +101,24 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -92,10 +101,24 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
return this.getBaseMapper().selectPageDataTotal(jpInverterDto); 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) { public Page<TdHYGFInverterDayGenerate> jpInverterDayReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
Page<TdHYGFInverterDayGenerate> tdHYGFInverterDayGeneratePage = new Page<>(); Page<TdHYGFInverterDayGenerate> tdHYGFInverterDayGeneratePage = new Page<>();
...@@ -196,4 +219,109 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -196,4 +219,109 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
} }
return result; 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": "直流电压", "name": "直流电压",
"key": "voltage", "key": "acv",
"children": [ "children": [
{"name":"直流电压PV1", {"name":"直流电压PV1",
"key": "acv1" "key": "acv_1",
"unit": "V"
}, },
{"name":"直流电压PV2", {"name":"直流电压PV2",
"key": "acv2" "key": "acv_2",
"unit": "V"
}, },
{"name":"直流电压PV3", {"name":"直流电压PV3",
"key": "acv3" "key": "acv_3",
"unit": "V"
}, },
{"name":"直流电压PV4", {"name":"直流电压PV4",
"key": "acv4" "key": "acv_4",
"unit": "V"
} }
] ]
}, },
{ {
"name": "直流电流", "name": "直流电流",
"key": "current", "key": "acc",
"children": [ "children": [
{"name":"直流电流PV1", {"name":"直流电流PV1",
"key": "acc1" "key": "acc_1",
"unit": "A"
}, },
{"name":"直流电流PV2", {"name":"直流电流PV2",
"key": "acc2" "key": "acc_2",
"unit": "A"
}, },
{"name":"直流电流PV3", {"name":"直流电流PV3",
"key": "acc3" "key": "acc_3",
"unit": "A"
}, },
{"name":"直流电流PV4", {"name":"直流电流PV4",
"key": "acc4" "key": "acc_4",
"unit": "A"
} }
] ]
}, },
...@@ -54,66 +62,73 @@ ...@@ -54,66 +62,73 @@
]}, ]},
{ {
"name": "U_交流电压", "name": "U_交流电压",
"key": "1", "key": "acv1",
"unit": "V",
"children": [ "children": [
] ]
}, },
{ {
"name": "V_交流电压", "name": "V_交流电压",
"key": "2", "key": "acv2",
"unit": "V",
"children": [ "children": [
] ]
}, { }, {
"name": "W_交流电压", "name": "W_交流电压",
"key": "3", "key": "acv3",
"unit": "V",
"children": [ "children": [
] ]
}, },
{ {
"name": "U_交流电流", "name": "U_交流电流",
"key": "4", "key": "acc1",
"unit": "A",
"children": [ "children": [
] ]
}, },
{ {
"name": "W_交流电流", "name": "W_交流电流",
"key": "5", "key": "acc3",
"unit": "A",
"children": [ "children": [
] ]
}, },
{ {
"name": "V_交流电流", "name": "V_交流电流",
"key": "6", "key": "acc2",
"unit": "A",
"children": [ "children": [
] ]
}, },
{ {
"name": "交流输出频率", "name": "交流输出频率",
"key": "7", "key": "frequency",
"unit": "Hz",
"children": [ "children": [
] ]
}, },
{ {
"name": "总功率", "name": "总功率",
"key": "totalPower", "key": "total_power",
"children": [ "children": [
] ]
}, },
{ {
"name": "当日电量", "name": "当日电量",
"key": "dayGen", "key": "day_gen",
"children": [ "children": [
] ]
}, },
{ {
"name": "累计电量", "name": "累计电量",
"key": "totalGen", "key": "total_gen",
"children": [ "children": [
] ]
}, },
{ {
"name": "IGBT温度", "name": "IGBT温度",
"key": "igbtTmep", "key": "igbt_temp",
"children": [ "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