Commit b10d392c authored by tangwei's avatar tangwei

解决冲突

parents c94da7cc 3e289e90
...@@ -99,4 +99,10 @@ public class JpInverterDto extends BaseDto { ...@@ -99,4 +99,10 @@ public class JpInverterDto extends BaseDto {
@ApiModelProperty(value = "所属电站名称") @ApiModelProperty(value = "所属电站名称")
private String name; private String name;
@ApiModelProperty(value = "筛选用 最小值")
private Double minValue;
@ApiModelProperty(value = "筛选用 最大值")
private Double maxValue;
} }
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@Data
@TableName(value = "td_hygf_inverter_day_generate" ,autoResultMap = true)
public class TdHYGFInverterDayGenerate implements Serializable {
/**
* 创建时间
*/
@ExcelIgnore
private Long createdTime;
/**
* 创建时间
*/
@ExcelProperty("时间")
private String createdTimeStr;
/**
* 第三方场站id
*/
@ExcelIgnore
private String thirdStationId;
/**
* sncode
*/
@ExcelProperty("SN")
private String snCode;
/**
* 工作状态
*/
@ExcelProperty("工作状态")
private String workStatus;
/**
* 直流电压1
*/
@ExcelProperty("直流电压1(V)")
private Double acv1;
/**
* 直流电压2
*/
@ExcelProperty("直流电压2(V)")
private Double acv2;
/**
* 直流电压3
*/
@ExcelProperty("直流电压3(V)")
private Double acv3;
/**
* 直流电压4
*/
@ExcelProperty("直流电压4(V)")
private Double acv4;
/**
* 直流电流1
*/
@ExcelProperty("直流电流1(A)")
private Double acc1;
/**
* 直流电流2
*/
@ExcelProperty("直流电流2(A)")
private Double acc2;
/**
* 直流电流3
*/
@ExcelProperty("直流电流3(A)")
private Double acc3;
/**
* 直流电流4
*/
@ExcelProperty("直流电流4(A)")
private Double acc4;
/**
* 交流电压1
*/
@ExcelProperty("交流电压1(V)")
private Double dcv1;
/**
* 交流电压2
*/
@ExcelProperty("交流电压2(V)")
private Double dcv2;
/**
* 交流电压3
*/
@ExcelProperty("交流电压3(V)")
private Double dcv3;
/**
* 交流电压4
*/
@ExcelProperty("交流电压4(V)")
private Double dcv4;
/**
* 交流电流1
*/
@ExcelProperty("交流电流1(A)")
private Double dcc1;
/**
* 交流电流2
*/
@ExcelProperty("交流电流2(A)")
private Double dcc2;
/**
* 交流电流3
*/
@ExcelProperty("交流电流3(A)")
private Double dcc3;
/**
* 交流电流4
*/
@ExcelProperty("交流电流4(A)")
private Double dcc4;
/**
* 总功率
*/
@ExcelProperty("总功率(kWh)")
private Double totalPower;
/**
* 频率
*/
@ExcelProperty("交流频率(Hz)")
private String frequency;
/**
* 功率因数
*/
@ExcelProperty("功率因数")
private Double powerFactor;
/**
* 日发电量
*/
@ExcelProperty("日发电量(kWh)")
private Double dayGen;
/**
* 月发电量
*/
@ExcelProperty("月发电量(kWh)")
private Double monthGen;
/**
* 年发电量
*/
@ExcelProperty("年发电量(kWh)")
private Double yearGen;
/**
* 累计发电量
*/
@ExcelProperty("总发电量(kWh)")
private Double totalGen;
/**
* IGBT温度
*/
@ExcelProperty("IGBT温度(℃)")
private Double igbtTemp;
/**
* 直流电流1
*/
@ExcelIgnore
private Double pv1;
/**
* 直流电流2
*/
@ExcelIgnore
private Double pv2;
/**
* 直流电流3
*/
@ExcelIgnore
private Double pv3;
/**
* 直流电流4
*/
@ExcelIgnore
private Double pv4;
@ExcelIgnore
private Double income;
@ExcelIgnore
private Double fullhour;
}
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_month_generate" ,autoResultMap = true)
public class TdHYGFInverterMonthGenerate implements Serializable {
/**
* 创建时间
*/
private Long createdTime;
/**
* 第三方场站id
*/
private String thirdStationId;
/**
* sncode
*/
private String snCode;
/**
*日 yyyy-MM
*/
private String monthTime;
/**
*月 yyyy
*/
private String year;
/**
* 发电量
*/
private Double generate;
/**
* 满发小时数
*/
private Double fullhour;
}
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_year_generate" ,autoResultMap = true)
public class TdHYGFInverterYearGenerate 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;
}
package com.yeejoin.amos.boot.module.hygf.api.mapper; package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector; import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -16,4 +18,11 @@ import java.util.Map; ...@@ -16,4 +18,11 @@ import java.util.Map;
*/ */
public interface JpCollectorMapper extends BaseMapper<JpCollector> { public interface JpCollectorMapper extends BaseMapper<JpCollector> {
List<Map<String,Object>> queryCollectorCountStatus(@Param("dto") JpStationDto reviewDto); List<Map<String,Object>> queryCollectorCountStatus(@Param("dto") JpStationDto reviewDto);
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
List<JpCollectorDto> selectPageData(@Param("dto") JpCollectorDto reviewDto, Integer current, Integer size);
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
int selectPageDataTota(@Param("dto") JpCollectorDto reviewDto);
} }
package com.yeejoin.amos.boot.module.hygf.api.mapper; package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter; import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -17,4 +19,10 @@ import java.util.Map; ...@@ -17,4 +19,10 @@ import java.util.Map;
public interface JpInverterMapper extends BaseMapper<JpInverter> { public interface JpInverterMapper extends BaseMapper<JpInverter> {
List<Map<String,Object>> queryInverterCountStatus(@Param("dto") JpStationDto reviewDto); List<Map<String,Object>> queryInverterCountStatus(@Param("dto") JpStationDto reviewDto);
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
List<JpInverterDto> selectPageData(@Param("dto") JpInverterDto reviewDto, int current, int size);
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
int selectPageDataTotal(@Param("dto") JpInverterDto reviewDto);
} }
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;
public interface TdHYGFInverterDayGenerateMapper extends BaseMapper<TdHYGFInverterDayGenerate> {
}
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;
public interface TdHYGFInverterMonthGenerateMapper extends BaseMapper<TdHYGFInverterMonthGenerate> {
}
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.TdHYGFInverterYearGenerate;
public interface TdHYGFInverterYearGenerateMapper extends BaseMapper<TdHYGFInverterYearGenerate> {
}
...@@ -25,4 +25,6 @@ public interface TdHygfJpInverterWarnMapper extends BaseMapper<TdHygfJpInverterW ...@@ -25,4 +25,6 @@ public interface TdHygfJpInverterWarnMapper extends BaseMapper<TdHygfJpInverterW
List<TdHygfJpInverterWarnDto> list(@Param("param") TdHygfJpInverterWarnDto tdHygfJpInverterWarnDto); List<TdHygfJpInverterWarnDto> list(@Param("param") TdHygfJpInverterWarnDto tdHygfJpInverterWarnDto);
TdHygfJpInverterWarnDto getByTime(@Param("createdTime") long createdTime); TdHygfJpInverterWarnDto getByTime(@Param("createdTime") long createdTime);
}
List<TdHygfJpInverterWarnDto> selectWarnList(String state, String level, String minValue, String maxValue, String snCode, List<String> stationId, String startTime, String endTime, String content, Integer current, Integer size);
}
...@@ -39,4 +39,51 @@ ...@@ -39,4 +39,51 @@
GROUP BY hygf_jp_collector.`state` GROUP BY hygf_jp_collector.`state`
</select> </select>
<select id="selectPageData" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto">
select
state,
sn_code,
station_name,
update_time,
type
from
hygf_jp_collector hjc
left join hygf_jp_station sta on sta.third_station_id = hjc.third_station_id
<where>
<if test="dto.snCode != null and dto.snCode != ''">
sn_code = #{dto.snCode}
</if>
<if test="dto.type != null and dto.type !=''">
type = #{dto.type}
</if>
<if test="dto.state != null and dto.state !=''">
state = #{dto.state}
</if>
</where>
limit #{current},#{size}
</select>
<select id="selectPageDataTota" resultType="int">
select
state,
sn_code,
station_name,
update_time,
type
from
hygf_jp_collector hjc
left join hygf_jp_station sta on sta.third_station_id = hjc.third_station_id
<where>
<if test="dto.snCode != null and dto.snCode != ''">
sn_code = #{dto.snCode}
</if>
<if test="dto.type != null and dto.type !=''">
type = #{dto.type}
</if>
<if test="dto.state != null and dto.state !=''">
state = #{dto.state}
</if>
</where>
</select>
</mapper> </mapper>
...@@ -35,4 +35,44 @@ ...@@ -35,4 +35,44 @@
</where> </where>
GROUP BY hygf_jp_inverter.`state` GROUP BY hygf_jp_inverter.`state`
</select> </select>
<select id="selectPageData" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto">
select
hjc. *
from
hygf_jp_inverter hjc
left join hygf_jp_station sta on sta.third_station_id = hjc.third_station_id
<where>
<if test="dto.snCode != null and dto.snCode != ''">
sn_code = #{dto.snCode}
</if>
<if test="dto.minValue != null and dto.minValue !=''">
capacity >= #{dto.type}
</if>
<if test="dto.maxValue != null and dto.maxValue !=''">
capacity <![CDATA[<=]]> #{dto.maxValue}
</if>
</where>
limit #{current},#{size}
</select>
<select id="selectPageDataTotal" resultType="int">
select
count(1)
from
hygf_jp_inverter hjc
left join hygf_jp_station sta on sta.third_station_id = hjc.third_station_id
<where>
<if test="dto.snCode != null and dto.snCode != ''">
sn_code = #{dto.snCode}
</if>
<if test="dto.minValue != null and dto.minValue !=''">
capacity >= #{dto.type}
</if>
<if test="dto.maxValue != null and dto.maxValue !=''">
capacity <![CDATA[<=]]> #{dto.maxValue}
</if>
</where>
</select>
</mapper> </mapper>
<?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">
</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">
</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">
</mapper>
\ No newline at end of file
...@@ -46,4 +46,48 @@ ...@@ -46,4 +46,48 @@
</if> </if>
</where> </where>
</select> </select>
<select id="selectWarnList" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto">
SELECT
`level` ,
`state` ,
third_station_id,
sn_code,
content,
start_time
FROM house_pv_data.td_hygf_jp_inverter_warn
<where>
<if test="state != null and state != ''">
AND state = #{state}
</if>
<if test="level != null and level != ''">
AND level = #{level}
</if>
<if test="minValue != null and minValue != ''">
time_long >= #{minvalue}
</if>
<if test="maxValue != null and maxValue != ''">
AND time_long [<![CDATA[<=]]>]#{maxValue}
</if>
<if test="snCode != null and snCode != ''">
AND sn_code = #{snCode}
</if>
<if test="stationId.size >0 ">
AND third_station_id in
<foreach collection="stationId" item="item" open='(' close=')' separator=",">
#{item}
</foreach>
</if>
<if test="startTime != null and startTime != ''">
AND start_time >= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND start_time [<![CDATA[<=]]>] #{endTime}
</if>
<if test="content">
AND content like #{content}
</if>
</where>
limit #{current},#{size}
</select>
</mapper> </mapper>
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter; import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpInverterServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpInverterServiceImpl;
...@@ -174,4 +175,20 @@ public class JpCollectorController extends BaseController { ...@@ -174,4 +175,20 @@ public class JpCollectorController extends BaseController {
public ResponseModel<List<JpCollectorDto>> selectForList() { public ResponseModel<List<JpCollectorDto>> selectForList() {
return ResponseHelper.buildResponse(jpCollectorServiceImpl.queryForJpCollectorList()); return ResponseHelper.buildResponse(jpCollectorServiceImpl.queryForJpCollectorList());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryForDataPage")
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘采集器表分页查询", notes = "户用光伏监盘采集器表分页查询")
public ResponseModel<Page<JpCollectorDto>> queryForDataPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, JpCollectorDto jpCollectorDto) {
Page<JpCollectorDto> page = new Page<JpCollectorDto>();
page.setCurrent(current);
page.setSize(size);
page.setTotal(jpCollectorServiceImpl.selectPageDataTota(jpCollectorDto));
page.setRecords(jpCollectorServiceImpl.selectPageData(jpCollectorDto,(current-1)*size,size));
return ResponseHelper.buildResponse(page);
}
} }
package com.yeejoin.amos.boot.module.hygf.biz.controller; 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.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import org.springframework.core.io.Resource;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpInverterServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpInverterServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -25,6 +43,8 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper; ...@@ -25,6 +43,8 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import static com.alibaba.fastjson.JSON.parseArray;
/** /**
* 户用光伏监盘逆变器表 * 户用光伏监盘逆变器表
* *
...@@ -38,10 +58,15 @@ public class JpInverterController extends BaseController { ...@@ -38,10 +58,15 @@ public class JpInverterController extends BaseController {
@Autowired @Autowired
JpInverterServiceImpl jpInverterServiceImpl; JpInverterServiceImpl jpInverterServiceImpl;
@Autowired
JpStationServiceImpl jpStationServiceImpl;
@Autowired @Autowired
JpPersonStationMapper pPersonStationMapper; JpPersonStationMapper pPersonStationMapper;
@Value("classpath:/json/paramsTree.json")
private Resource paramsTree;
/** /**
* 新增户用光伏监盘逆变器表 * 新增户用光伏监盘逆变器表
...@@ -95,11 +120,11 @@ public class JpInverterController extends BaseController { ...@@ -95,11 +120,11 @@ public class JpInverterController extends BaseController {
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个户用光伏监盘逆变器表", notes = "根据sequenceNbr查询单个户用光伏监盘逆变器表") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个户用光伏监盘逆变器表", notes = "根据sequenceNbr查询单个户用光伏监盘逆变器表")
public ResponseModel<JpInverterDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<JpInverterDto> selectOne(@PathVariable Long sequenceNbr) {
JpInverterDto jpInverter= jpInverterServiceImpl.queryBySeq(sequenceNbr); JpInverterDto jpInverter = jpInverterServiceImpl.queryBySeq(sequenceNbr);
jpInverter.setDayPowerGeneration(jpInverter.getDayPowerGeneration()!=null?jpInverter.getDayPowerGeneration()/1000:0); jpInverter.setDayPowerGeneration(jpInverter.getDayPowerGeneration() != null ? jpInverter.getDayPowerGeneration() / 1000 : 0);
jpInverter.setMonthPowerGeneration(jpInverter.getMonthPowerGeneration()!=null?jpInverter.getMonthPowerGeneration()/1000:0); jpInverter.setMonthPowerGeneration(jpInverter.getMonthPowerGeneration() != null ? jpInverter.getMonthPowerGeneration() / 1000 : 0);
jpInverter.setYearPowerGeneration(jpInverter.getYearPowerGeneration()!=null?jpInverter.getYearPowerGeneration()/1000:0); jpInverter.setYearPowerGeneration(jpInverter.getYearPowerGeneration() != null ? jpInverter.getYearPowerGeneration() / 1000 : 0);
jpInverter.setTotalPowerGeneration(jpInverter.getTotalPowerGeneration()!=null?jpInverter.getTotalPowerGeneration()/1000:0); jpInverter.setTotalPowerGeneration(jpInverter.getTotalPowerGeneration() != null ? jpInverter.getTotalPowerGeneration() / 1000 : 0);
return ResponseHelper.buildResponse(jpInverter); return ResponseHelper.buildResponse(jpInverter);
} }
...@@ -116,13 +141,13 @@ public class JpInverterController extends BaseController { ...@@ -116,13 +141,13 @@ public class JpInverterController extends BaseController {
public ResponseModel<Page<JpInverterDto>> queryForPage(@RequestParam(value = "current") int current, public ResponseModel<Page<JpInverterDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, JpInverterDto jpInverterDto) { @RequestParam(value = "size") int size, JpInverterDto jpInverterDto) {
List<JpPersonStation> pPersonStation =null; List<JpPersonStation> pPersonStation = null;
if(jpInverterDto.getName()!=null&&!"".equals(jpInverterDto.getName())){ if (jpInverterDto.getName() != null && !"".equals(jpInverterDto.getName())) {
LambdaQueryWrapper<JpPersonStation> qug1=new LambdaQueryWrapper<>(); LambdaQueryWrapper<JpPersonStation> qug1 = new LambdaQueryWrapper<>();
qug1.like(JpPersonStation::getStationName,jpInverterDto.getName()); qug1.like(JpPersonStation::getStationName, jpInverterDto.getName());
pPersonStation=pPersonStationMapper.selectList(qug1); pPersonStation = pPersonStationMapper.selectList(qug1);
}else{ } else {
LambdaQueryWrapper<JpPersonStation> qug = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JpPersonStation> qug = new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId, getUserInfo().getUserId()); qug.eq(JpPersonStation::getPersonId, getUserInfo().getUserId());
pPersonStation = pPersonStationMapper.selectList(qug); pPersonStation = pPersonStationMapper.selectList(qug);
...@@ -151,4 +176,91 @@ public class JpInverterController extends BaseController { ...@@ -151,4 +176,91 @@ public class JpInverterController extends BaseController {
public ResponseModel<List<JpInverterDto>> selectForList() { public ResponseModel<List<JpInverterDto>> selectForList() {
return ResponseHelper.buildResponse(jpInverterServiceImpl.queryForJpInverterList()); return ResponseHelper.buildResponse(jpInverterServiceImpl.queryForJpInverterList());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryForDataPage")
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘采集器表分页查询", notes = "户用光伏监盘采集器表分页查询")
public ResponseModel<Page<JpInverterDto>> queryForDataPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, JpInverterDto jpInverterDto) {
Page<JpInverterDto> page = new Page<JpInverterDto>();
page.setCurrent(current);
page.setSize(size);
page.setTotal(jpInverterServiceImpl.selectPageDataTota(jpInverterDto));
page.setRecords(jpInverterServiceImpl.selectPageData(jpInverterDto, (current - 1) * size, size));
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/selectParamTree")
@ApiOperation(httpMethod = "GET", value = "逆变器图标 选择参数树", notes = "逆变器图标 选择参数树")
public ResponseModel<List<Map>> selectParamTree() {
String json = null;
try {
json = IOUtils.toString(paramsTree.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
List<Map> list = parseArray(json, Map.class);
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);
}
// jpInverterServiceImpl.
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/jpInverterDayReport")
@ApiOperation(httpMethod = "GET", value = "逆变器日报表", notes = "逆变器日报表")
public ResponseModel<Page<TdHYGFInverterDayGenerate>> jpInverterDayReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, String time, @RequestParam(required = false) List<String> snCodes) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(null);
List<String> stationids = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterDayReport(current,size,time,snCodes,stationids));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/jpInverterDayReportExport", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "逆变器日报表导出", notes = "逆变器日报表导出")
public void jpInverterDayReportExport( String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(null);
List<String> stationids = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(time,snCodes,stationids);
try {
setResponseHeadForDowload(response,"逆变器日报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* 设置响应头
*
* @param response 响应体
* @param dowloadFileName 下载文件名称
*/
public void setResponseHeadForDowload(HttpServletResponse response, String dowloadFileName) {
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(dowloadFileName, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
} }
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation; import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation; import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
...@@ -230,4 +231,39 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -230,4 +231,39 @@ public class TdHygfJpInverterWarnController extends BaseController {
} }
return ResponseHelper.buildResponse(collector); return ResponseHelper.buildResponse(collector);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器报警表列表全部数据查询", notes = "户用光伏监盘逆变器报警表列表全部数据查询")
@GetMapping(value = "/selectWarnList")
@UserLimits
public ResponseModel<List<TdHygfJpInverterWarnDto>> selectWarnList(@RequestParam(required = false) String state,
@RequestParam(required = false) String level,
@RequestParam(required = false) String minvalue,
@RequestParam(required = false) String maxValue,
@RequestParam(required = false) String snCode,
@RequestParam(required = false) List<String> stationId,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) Integer current,
@RequestParam(required = false) Integer size,
@RequestParam(required = false) String content) {
JpStationDto reviewDto = new JpStationDto();
Map<String, String> nameMaps = new HashMap<>();
List<JpStation> jpStation = jpStationMapper.getJpStation(reviewDto);
nameMaps = jpStation.stream().collect(Collectors.toMap(JpStation::getThirdStationId, JpStation::getName));
if (null == stationId ){
stationId = jpStation.stream().map(JpStation::getThirdStationId).collect(Collectors.toList());
}
List<TdHygfJpInverterWarnDto> maps = tdHygfJpInverterWarnServiceImpl.selectWarnList(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content,(current-1)*size,size);
for (TdHygfJpInverterWarnDto map : maps) {
if (nameMaps.containsKey(map.getThirdStationId())){
map.setStationName(nameMaps.get(map.getThirdStationId()));
}
}
return ResponseHelper.buildResponse(maps);
}
} }
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector; import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpCollectorMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpCollectorMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IJpCollectorService; import com.yeejoin.amos.boot.module.hygf.api.service.IJpCollectorService;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import org.apache.ibatis.annotations.Param;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -66,4 +68,15 @@ public class JpCollectorServiceImpl extends BaseService<JpCollectorDto, JpCollec ...@@ -66,4 +68,15 @@ public class JpCollectorServiceImpl extends BaseService<JpCollectorDto, JpCollec
public List<JpCollectorDto> queryForJpCollectorList() { public List<JpCollectorDto> queryForJpCollectorList() {
return this.queryForList("", false); return this.queryForList("", false);
} }
@UserLimits
public List<JpCollectorDto> selectPageData(JpCollectorDto jpCollectorDto, int current, int size) {
return this.getBaseMapper().selectPageData(jpCollectorDto,current,size);
}
@UserLimits
public int selectPageDataTota(@Param("dto") JpCollectorDto reviewDto) {
return this.getBaseMapper().selectPageDataTota(reviewDto);
}
} }
\ 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.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.tdenginemapper.TdHYGFInverterDayGenerateMapper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
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;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -11,7 +21,6 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -11,7 +21,6 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter; import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IJpInverterService; import com.yeejoin.amos.boot.module.hygf.api.service.IJpInverterService;
...@@ -25,6 +34,10 @@ import com.yeejoin.amos.boot.module.hygf.api.service.IJpInverterService; ...@@ -25,6 +34,10 @@ import com.yeejoin.amos.boot.module.hygf.api.service.IJpInverterService;
@Service @Service
public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter, JpInverterMapper> public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter, JpInverterMapper>
implements IJpInverterService { implements IJpInverterService {
@Autowired
TdHYGFInverterDayGenerateMapper tdHYGFInverterDayGenerateMapper;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -34,7 +47,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -34,7 +47,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
if (jpInverterDto.getState() != null) { if (jpInverterDto.getState() != null) {
wrapper.eq(JpInverter::getState, jpInverterDto.getState()); wrapper.eq(JpInverter::getState, jpInverterDto.getState());
} }
if(StringUtils.isNotEmpty(jpInverterDto.getSnCode())) { if (StringUtils.isNotEmpty(jpInverterDto.getSnCode())) {
wrapper.like(JpInverter::getSnCode, jpInverterDto.getSnCode()); wrapper.like(JpInverter::getSnCode, jpInverterDto.getSnCode());
} }
if (!jpInverterDto.getStationIds().isEmpty()) { if (!jpInverterDto.getStationIds().isEmpty()) {
...@@ -60,4 +73,65 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -60,4 +73,65 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
public List<JpInverterDto> queryForJpInverterList() { public List<JpInverterDto> queryForJpInverterList() {
return this.queryForList("", false); return this.queryForList("", false);
} }
@UserLimits
public List<JpInverterDto> selectPageData(JpInverterDto jpInverterDto, int current, int size) {
return this.getBaseMapper().selectPageData(jpInverterDto, current, size);
}
@UserLimits
public long selectPageDataTota(JpInverterDto jpInverterDto) {
return this.getBaseMapper().selectPageDataTotal(jpInverterDto);
}
public void selectDayTrend(List<String> treeParams, String time, String snCode, String thirdStationId) {
}
public Page<TdHYGFInverterDayGenerate> jpInverterDayReport(int current, int size, String time, List<String> sncodes,List<String> stationIds) {
Page<TdHYGFInverterDayGenerate> tdHYGFInverterDayGeneratePage = new Page<>();
Date date = DateUtil.parse(time, "yyyy-MM-dd");
String startTime = DateUtil.format(date, "yyyy-MM-dd") + "00:00:00";
String endTime = DateUtil.format(date, "yyyy-MM-dd") + "23:59:59";
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>()
.ge("created_time", startTime)
.le("created_time", endTime)
.in("third_station_id",stationIds);;
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
queryWrapper.orderByDesc("created_time");
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper);
tdHYGFInverterDayGeneratePage.setTotal(tdHYGFInverterDayGenerates.size());
tdHYGFInverterDayGeneratePage.setSize(size);
tdHYGFInverterDayGeneratePage.setCurrent(current);
tdHYGFInverterDayGenerates=tdHYGFInverterDayGenerates.subList((current-1)*size,current*size>tdHYGFInverterDayGenerates.size()?tdHYGFInverterDayGenerates.size():current*size);
tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> {
Date date1=new Date(tdHYGFInverterDayGenerate.getCreatedTime());
tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN));
});
tdHYGFInverterDayGeneratePage.setRecords(tdHYGFInverterDayGenerates);
return tdHYGFInverterDayGeneratePage;
}
public List<TdHYGFInverterDayGenerate> jpInverterDayReportExport(String time, List<String> sncodes,List<String> stationIds) {
Date date = DateUtil.parse(time, "yyyy-MM-dd");
String startTime = DateUtil.format(date, "yyyy-MM-dd") + "00:00:00";
String endTime = DateUtil.format(date, "yyyy-MM-dd") + "23:59:59";
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>()
.ge("created_time", startTime)
.le("created_time", endTime)
.in("third_station_id",stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
queryWrapper.orderByDesc("created_time");
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper);
tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> {
Date date1=new Date(tdHYGFInverterDayGenerate.getCreatedTime());
tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN));
});
return tdHYGFInverterDayGenerates;
}
} }
\ No newline at end of file
...@@ -11,6 +11,7 @@ import java.util.stream.Collectors; ...@@ -11,6 +11,7 @@ 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;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -27,6 +28,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterWarn; ...@@ -27,6 +28,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterWarn;
import com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpInverterWarnService; import com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpInverterWarnService;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterWarnMapper; import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterWarnMapper;
import com.yeejoin.amos.boot.module.hygf.api.util.TimeUtil; import com.yeejoin.amos.boot.module.hygf.api.util.TimeUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/** /**
* 户用光伏监盘逆变器报警表服务实现类 * 户用光伏监盘逆变器报警表服务实现类
...@@ -127,4 +129,8 @@ public class TdHygfJpInverterWarnServiceImpl ...@@ -127,4 +129,8 @@ public class TdHygfJpInverterWarnServiceImpl
return tdHygfJpInverterWarnDto; return tdHygfJpInverterWarnDto;
} }
public List<TdHygfJpInverterWarnDto> selectWarnList(String state, String level, String minvalue, String maxValue, String snCode, List<String> stationId, String startTime, String endTime, String content, Integer current, Integer size){
return this.getBaseMapper().selectWarnList(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content,(current-1)*size,size);
}
} }
\ No newline at end of file
[
{
"name": "直流电压",
"key": "voltage",
"children": [
{"name":"直流电压PV1",
"key": "acv1"
},
{"name":"直流电压PV2",
"key": "acv2"
},
{"name":"直流电压PV3",
"key": "acv3"
},
{"name":"直流电压PV4",
"key": "acv4"
}
]
},
{
"name": "直流电流",
"key": "current",
"children": [
{"name":"直流电流PV1",
"key": "acc1"
},
{"name":"直流电流PV2",
"key": "acc2"
},
{"name":"直流电流PV3",
"key": "acc3"
},
{"name":"直流电流PV4",
"key": "acc4"
}
]
},
{
"name": "直流功率",
"key": "power",
"children": [
{"name":"直流功率PV1",
"key": "power_PV1"
},
{"name":"直流功率PV2",
"key": "power_PV2"
},
{"name":"直流功率PV3",
"key": "power_PV3"
},
{"name":"直流功率PV4",
"key": "power_PV4"
}
]},
{
"name": "U_交流电压",
"key": "1",
"children": [
]
},
{
"name": "V_交流电压",
"key": "2",
"children": [
]
}, {
"name": "W_交流电压",
"key": "3",
"children": [
]
},
{
"name": "U_交流电流",
"key": "4",
"children": [
]
},
{
"name": "W_交流电流",
"key": "5",
"children": [
]
},
{
"name": "V_交流电流",
"key": "6",
"children": [
]
},
{
"name": "交流输出频率",
"key": "7",
"children": [
]
},
{
"name": "总功率",
"key": "totalPower",
"children": [
]
},
{
"name": "当日电量",
"key": "dayGen",
"children": [
]
},
{
"name": "累计电量",
"key": "totalGen",
"children": [
]
},
{
"name": "IGBT温度",
"key": "igbtTmep",
"children": [
]
}
]
\ No newline at end of file
...@@ -1304,10 +1304,10 @@ public class CommonServiceImpl { ...@@ -1304,10 +1304,10 @@ public class CommonServiceImpl {
public Map<String, String> getUnitByIndexAddress(String stationType, String pointId) { public Map<String, String> getUnitByIndexAddress(String stationType, String pointId) {
IndicatorData indicatorData = new IndicatorData(); IndicatorData indicatorData = new IndicatorData();
if ("FD".equals(stationType)) { if ("FD".equals(stationType)) {
IdxBizFanPointProcessVariableClassification indexAddress = idxBizFanPointProcessVariableClassificationMapper.selectOne(new QueryWrapper<IdxBizFanPointProcessVariableClassification>().eq("INDEX_ADDRESS", pointId)); IdxBizFanPointProcessVariableClassification indexAddress = idxBizFanPointProcessVariableClassificationMapper.selectOne(new QueryWrapper<IdxBizFanPointProcessVariableClassification>().eq("INDEX_ADDRESS", pointId).last("limit 1"));
indicatorData = indicatorDataMapper.selectUnitByAddressAndGatewayId(indexAddress.getIndexAddress(), indexAddress.getGatewayId()); indicatorData = indicatorDataMapper.selectUnitByAddressAndGatewayId(indexAddress.getIndexAddress(), indexAddress.getGatewayId());
} else { } else {
IdxBizPvPointProcessVariableClassification indexAddress = idxBizPvPointProcessVariableClassificationMapper.selectOne(new QueryWrapper<IdxBizPvPointProcessVariableClassification>().eq("INDEX_ADDRESS", pointId)); IdxBizPvPointProcessVariableClassification indexAddress = idxBizPvPointProcessVariableClassificationMapper.selectOne(new QueryWrapper<IdxBizPvPointProcessVariableClassification>().eq("INDEX_ADDRESS", pointId).last("limit 1"));
indicatorData = indicatorDataMapper.selectUnitByAddressAndGatewayId(indexAddress.getIndexAddress(), indexAddress.getGatewayId()); indicatorData = indicatorDataMapper.selectUnitByAddressAndGatewayId(indexAddress.getIndexAddress(), indexAddress.getGatewayId());
} }
HashMap<String, String> resultMap = new HashMap<>(); HashMap<String, String> resultMap = new HashMap<>();
......
...@@ -72,6 +72,11 @@ public class TdengineTimeServiceImpl { ...@@ -72,6 +72,11 @@ public class TdengineTimeServiceImpl {
List<IdxBizFanHealthLevel> levelListQy = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区").last("limit 4")); List<IdxBizFanHealthLevel> levelListQy = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区").last("limit 4"));
List<FanHealthIndex> fanHealthIndicesQy = fanHealthIndexMapper.getInfoListByGroupByQyFan(startTime, "fan_health_index_moment", "场站"); List<FanHealthIndex> fanHealthIndicesQy = fanHealthIndexMapper.getInfoListByGroupByQyFan(startTime, "fan_health_index_moment", "场站");
saveBatchFan(fanHealthIndicesQy, "fan_health_index_moment", recDate, "按时刻", levelListQy); saveBatchFan(fanHealthIndicesQy, "fan_health_index_moment", recDate, "按时刻", levelListQy);
// 全域【所有 / 全国】
List<IdxBizFanHealthLevel> levelListQg = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<FanHealthIndex> fanHealthIndicesQg = fanHealthIndexMapper.getInfoListByGroupByQgFan(startTime, "fan_health_index_moment", "片区");
saveBatchFan(fanHealthIndicesQg, "fan_health_index_moment", recDate, "按时刻", levelListQg);
} }
...@@ -107,6 +112,11 @@ public class TdengineTimeServiceImpl { ...@@ -107,6 +112,11 @@ public class TdengineTimeServiceImpl {
List<IdxBizFanHealthLevel> levelListQy = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区").last("limit 4")); List<IdxBizFanHealthLevel> levelListQy = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区").last("limit 4"));
List<FanHealthIndex> fanHealthIndicesQy = fanHealthIndexMapper.getInfoListByGroupByQyFan(startTime, "fan_health_index_moment", "场站"); List<FanHealthIndex> fanHealthIndicesQy = fanHealthIndexMapper.getInfoListByGroupByQyFan(startTime, "fan_health_index_moment", "场站");
saveBatchFan(fanHealthIndicesQy, "fan_health_index_hour", recDate, "按小时", levelListQy); saveBatchFan(fanHealthIndicesQy, "fan_health_index_hour", recDate, "按小时", levelListQy);
// 全域【所有 / 全国】
List<IdxBizFanHealthLevel> levelListQg = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<FanHealthIndex> fanHealthIndicesQg = fanHealthIndexMapper.getInfoListByGroupByQgFan(startTime, "fan_health_index_moment", "片区");
saveBatchFan(fanHealthIndicesQg, "fan_health_index_hour", recDate, "按小时", levelListQg);
} }
/** /**
...@@ -140,6 +150,10 @@ public class TdengineTimeServiceImpl { ...@@ -140,6 +150,10 @@ public class TdengineTimeServiceImpl {
List<IdxBizFanHealthLevel> levelListQy = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区").last("limit 4")); List<IdxBizFanHealthLevel> levelListQy = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区").last("limit 4"));
List<FanHealthIndex> fanHealthIndicesQy = fanHealthIndexMapper.getInfoListByGroupByQyFan(startTime, "fan_health_index_hour", "场站"); List<FanHealthIndex> fanHealthIndicesQy = fanHealthIndexMapper.getInfoListByGroupByQyFan(startTime, "fan_health_index_hour", "场站");
saveBatchFan(fanHealthIndicesQy, "fan_health_index_day", recDate, "按天", levelListQy); saveBatchFan(fanHealthIndicesQy, "fan_health_index_day", recDate, "按天", levelListQy);
// 全域【所有 / 全国】
List<IdxBizFanHealthLevel> levelListQg = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<FanHealthIndex> fanHealthIndicesQg = fanHealthIndexMapper.getInfoListByGroupByQgFan(startTime, "fan_health_index_hour", "片区");
saveBatchFan(fanHealthIndicesQg, "fan_health_index_day", recDate, "按天", levelListQg);
} }
...@@ -198,6 +212,10 @@ public class TdengineTimeServiceImpl { ...@@ -198,6 +212,10 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> levelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4")); List<IdxBizPvHealthLevel> levelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesQy = pvHealthIndexMapper.getInfoListByGroupByQyPv(startTime, "pv_health_index_moment", "场站"); List<PvHealthIndex> fanHealthIndicesQy = pvHealthIndexMapper.getInfoListByGroupByQyPv(startTime, "pv_health_index_moment", "场站");
saveBatchPv(fanHealthIndicesQy, "pv_health_index_moment", recDate, "按时刻", levelListQy); saveBatchPv(fanHealthIndicesQy, "pv_health_index_moment", recDate, "按时刻", levelListQy);
// 全域【所有 / 全国】
List<IdxBizPvHealthLevel> levelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesQg = pvHealthIndexMapper.getInfoListByGroupByQgPv(startTime, "pv_health_index_moment", "片区");
saveBatchPv(fanHealthIndicesQg, "pv_health_index_moment", recDate, "按时刻", levelListQg);
} }
/** /**
...@@ -232,6 +250,10 @@ public class TdengineTimeServiceImpl { ...@@ -232,6 +250,10 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> levelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4")); List<IdxBizPvHealthLevel> levelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesQy = pvHealthIndexMapper.getInfoListByGroupByQyPv(startTime, "pv_health_index_moment", "场站"); List<PvHealthIndex> fanHealthIndicesQy = pvHealthIndexMapper.getInfoListByGroupByQyPv(startTime, "pv_health_index_moment", "场站");
saveBatchPv(fanHealthIndicesQy, "pv_health_index_hour", recDate, "按小时", levelListQy); saveBatchPv(fanHealthIndicesQy, "pv_health_index_hour", recDate, "按小时", levelListQy);
// 全域【所有 / 全国】
List<IdxBizPvHealthLevel> levelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesQg = pvHealthIndexMapper.getInfoListByGroupByQgPv(startTime, "pv_health_index_moment", "片区");
saveBatchPv(fanHealthIndicesQg, "pv_health_index_hour", recDate, "按小时", levelListQg);
} }
/** /**
...@@ -264,6 +286,10 @@ public class TdengineTimeServiceImpl { ...@@ -264,6 +286,10 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> levelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4")); List<IdxBizPvHealthLevel> levelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesQy = pvHealthIndexMapper.getInfoListByGroupByQyPv(startTime, "pv_health_index_hour", "场站"); List<PvHealthIndex> fanHealthIndicesQy = pvHealthIndexMapper.getInfoListByGroupByQyPv(startTime, "pv_health_index_hour", "场站");
saveBatchPv(fanHealthIndicesQy, "pv_health_index_day", recDate, "按天", levelListQy); saveBatchPv(fanHealthIndicesQy, "pv_health_index_day", recDate, "按天", levelListQy);
// 全域【所有 / 全国】
List<IdxBizPvHealthLevel> levelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesQg = pvHealthIndexMapper.getInfoListByGroupByQgPv(startTime, "pv_health_index_hour", "片区");
saveBatchPv(fanHealthIndicesQg, "pv_health_index_day", recDate, "按天", levelListQg);
} }
......
...@@ -69,6 +69,14 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> { ...@@ -69,6 +69,14 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
@Param("tableName") String tableName, @Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType); @Param("analysisObjectType") String analysisObjectType);
/**
* 全域【全国/所有】
*/
List<FanHealthIndex> getInfoListByGroupByQgFan(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
List<FanHealthIndex> getInfoByPage(@Param("dto") FanHealthIndexDto dto); List<FanHealthIndex> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
Integer getInfoByPageTotal(@Param("dto") FanHealthIndexDto dto); Integer getInfoByPageTotal(@Param("dto") FanHealthIndexDto dto);
......
...@@ -11,7 +11,7 @@ import java.util.Map; ...@@ -11,7 +11,7 @@ import java.util.Map;
public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Select("<script>"+ @Select("<script>"+
"SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, point_name as pointName, index_address as indexAddress, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" + "SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, anomaly, analysis_time,station,equipment_name AS equipmentName, point_name as pointName, index_address as indexAddress, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
" FROM analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType}" + " FROM analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> { public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
@Select("<script>"+ @Select("<script>"+
"SELECT `health_index` AS healthIndex, `health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" + "SELECT `health_index` AS healthIndex, `health_index` AS `value`, rec_date AS recDate, anomaly, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
" FROM analysis_data.pv_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" + " FROM analysis_data.pv_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
......
...@@ -53,6 +53,11 @@ public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> { ...@@ -53,6 +53,11 @@ public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
@Param("tableName") String tableName, @Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType); @Param("analysisObjectType") String analysisObjectType);
// 全国/全域
List<PvHealthIndex> getInfoListByGroupByQgPv(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
List<PvHealthIndex> getInfoByPage(@Param("dto") PvHealthIndexDto dto); List<PvHealthIndex> getInfoByPage(@Param("dto") PvHealthIndexDto dto);
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMoment> { public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMoment> {
@Select("<script>"+ @Select("<script>"+
"SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" + "SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, anomaly, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
" FROM analysis_data.pv_health_index_moment WHERE analysis_obj_type = #{analysisObjType}" + " FROM analysis_data.pv_health_index_moment WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
......
...@@ -34,4 +34,6 @@ public class PvHealthIndexDay { ...@@ -34,4 +34,6 @@ public class PvHealthIndexDay {
private String pointName; private String pointName;
private String analysisTime; private String analysisTime;
private String kks; private String kks;
private String value;
private String status;
} }
...@@ -34,5 +34,7 @@ public class PvHealthIndexHour { ...@@ -34,5 +34,7 @@ public class PvHealthIndexHour {
private String pointName; private String pointName;
private String analysisTime; private String analysisTime;
private String kks; private String kks;
private String value;
private String status;
} }
...@@ -34,5 +34,7 @@ public class PvHealthIndexMoment { ...@@ -34,5 +34,7 @@ public class PvHealthIndexMoment {
private String pointName; private String pointName;
private String analysisTime; private String analysisTime;
private String kks; private String kks;
private String value;
private String status;
} }
...@@ -380,4 +380,18 @@ ...@@ -380,4 +380,18 @@
</select> </select>
<select id="getInfoListByGroupByQgFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
select
'全域' as analysis_obj_type,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
analysis_obj_type
</select>
</mapper> </mapper>
...@@ -254,4 +254,18 @@ ...@@ -254,4 +254,18 @@
) )
</foreach> </foreach>
</select> </select>
<select id="getInfoListByGroupByQgPv" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex">
select
'全域' as analysis_obj_type,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
analysis_obj_type
</select>
</mapper> </mapper>
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