Commit ecef59d9 authored by 朱晨阳's avatar 朱晨阳

修改报警统计错误

parent d5ad231b
......@@ -33,10 +33,17 @@ public interface TdHygfJpInverterWarnMapper extends BaseMapper<TdHygfJpInverterW
@UserEmpower(field = {"regional_companies_code"}, dealerField = {"amos_company_code", "regional_companies_code"}, fieldConditions = {"eq", "in"}, relationship = "and")
List<TdHygfJpInverterWarnDto> selectWarnList(List<String> state, String level, String minvalue, String maxValue, String snCode, List<String> stationId, String startTime, String endTime, String content, Integer current, Integer size, String handlerStatus, String stationName);
List<TdHygfJpInverterWarnDto> selectWarnList(List<String> state, String regionalCompaniesCode, String amosCompanyCode, String thirdStationId, String type, String level, String minvalue, String maxValue, String snCode, List<String> stationId, String startTime, String endTime, String content, Integer current, Integer size, String handlerStatus, String stationName);
@UserEmpower(field = {"regional_companies_code"}, dealerField = {"amos_company_code", "regional_companies_code"}, fieldConditions = {"eq", "in"}, relationship = "and")
int selectWarnListTotal(List<String> state, String level, String minvalue, String maxValue, String snCode, List<String> stationId, String startTime, String endTime, String content, String handlerStatus, String stationName);
int selectWarnListTotal(List<String> state,String regionalCompaniesCode, String amosCompanyCode, String thirdStationId, String type, String level, String minvalue, String maxValue, String snCode, List<String> stationId, String startTime, String endTime, String content, String handlerStatus, String stationName);
@UserEmpower(field = {"regional_companies_code"}, dealerField = {"amos_company_code", "regional_companies_code"}, fieldConditions = {"eq", "in"}, relationship = "and")
int selectWarnTotal(List<String> state, String regionalCompaniesCode,
String amosCompanyCode,
String thirdStationId,
String type);
@Select("SELECT * from td_hygf_jp_inverter_warn WHERE (third_station_id = #{thirdStationId} AND sn_code = #{sncode} AND created_time = #{createdTime})")
TdHygfJpInverterWarn getInverTerWarnByparams(@Param("createdTime") long createdTime, @Param("sncode") String snCode, @Param("thirdStationId") String thirdStationId);
......
......@@ -80,6 +80,27 @@
<!-- <if test="handlerStatus != null and handlerStatus != ''">-->
<!-- AND handler_status = #{handlerStatus}-->
<!-- </if>-->
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="amosCompanyCode != null and amosCompanyCode != ''">
AND amos_company_code = #{amosCompanyCode}
</if>
<if test="thirdStationId != null and thirdStationId != ''">
AND third_station_id = #{thirdStationId}
</if>
<!-- <if test="type != null and type != ''">-->
<!-- AND type = #{type}-->
<!-- </if>-->
<if test="level != null and level != ''">
AND `level` = #{level}
</if>
<if test="level != null and level != ''">
AND `level` = #{level}
</if>
<if test="level != null and level != ''">
AND `level` = #{level}
</if>
<if test="level != null and level != ''">
AND `level` = #{level}
</if>
......@@ -127,6 +148,18 @@
#{item}
</foreach>
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="amosCompanyCode != null and amosCompanyCode != ''">
AND amos_company_code = #{amosCompanyCode}
</if>
<if test="thirdStationId != null and thirdStationId != ''">
AND third_station_id = #{thirdStationId}
</if>
<!-- <if test="type != null and type != ''">-->
<!-- AND type = #{type}-->
<!-- </if>-->
<!-- <if test="handlerStatus != null and handlerStatus != ''">-->
<!-- AND handler_status = #{handlerStatus}-->
<!-- </if>-->
......@@ -166,6 +199,37 @@
</select>
<select id="selectWarnTotal" resultType="int">
SELECT
count (1)
FROM house_pv_data.td_hygf_jp_inverter_warn
<where>
<if test="state != null and state.size>0">
`state` in
<foreach collection="state" item="item" open='(' close=')' separator=",">
#{item}
</foreach>
</if>
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
AND regional_companies_code = #{regionalCompaniesCode}
</if>
<if test="amosCompanyCode != null and amosCompanyCode != ''">
AND amos_company_code = #{amosCompanyCode}
</if>
<if test="thirdStationId != null and thirdStationId != ''">
AND third_station_id = #{thirdStationId}
</if>
<!-- <if test="type != null and type != ''">-->
<!-- AND type = #{type}-->
<!-- </if>-->
</where>
</select>
<select id="queryAlarmNumber" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto">
SELECT
`state`
......
......@@ -231,6 +231,10 @@ public class TdHygfJpInverterWarnController extends BaseController {
@UserLimits
public ResponseModel<Page<TdHygfJpInverterWarnDto>> selectWarnList(@RequestParam(required = false) List<String> state,
@RequestParam(required = false) String handlerStatus,
@RequestParam(required = false) String regionalCompaniesCode,
@RequestParam(required = false) String amosCompanyCode,
@RequestParam(required = false) String thirdStationId,
@RequestParam(required = false) String type,
@RequestParam(required = false) String level,
@RequestParam(required = false) String stationName,
@RequestParam(required = false) String minvalue,
......@@ -286,7 +290,7 @@ public class TdHygfJpInverterWarnController extends BaseController {
}
List<TdHygfJpInverterWarnDto> maps = tdHygfJpInverterWarnServiceImpl.selectWarnList(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content, current, size, handlerStatus, stationName);
List<TdHygfJpInverterWarnDto> maps = tdHygfJpInverterWarnServiceImpl.selectWarnList(state,regionalCompaniesCode,amosCompanyCode, thirdStationId, type, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content, current, size, handlerStatus, stationName);
for (TdHygfJpInverterWarnDto map : maps) {
// if (nameMaps.containsKey(map.getThirdStationId())) {
// map.setStationName(nameMaps.get(map.getThirdStationId()));
......@@ -295,7 +299,7 @@ public class TdHygfJpInverterWarnController extends BaseController {
map.setTimeLongFormat(te);
}
result.setTotal(tdHygfJpInverterWarnServiceImpl.selectWarnListTotal(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content, handlerStatus, stationName));
result.setTotal(tdHygfJpInverterWarnServiceImpl.selectWarnListTotal(state,regionalCompaniesCode,amosCompanyCode, thirdStationId, type, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content, handlerStatus, stationName));
List<Long> waringIds = maps.stream().map(tdHygfJpInverterWarnDto -> tdHygfJpInverterWarnDto.getCreatedTime()).collect(Collectors.toList());
if (waringIds.size() == 0) {
waringIds = Arrays.asList(0L);
......@@ -321,12 +325,20 @@ public class TdHygfJpInverterWarnController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "户用光伏逆变器报警表统计数据查询", notes = "户用光伏逆变器报警表统计数据查询")
@GetMapping(value = "/queryAlarmNumber")
@UserLimits
public ResponseModel<Map<String, Object>> queryAlarmNumber(@RequestParam(required = false) String regionalCompaniesCode,
@RequestParam(required = false) String amosCompanyCode,
@RequestParam(required = false) String thirdStationId,
@RequestParam(required = false) String type
public ResponseModel<Map<String, Object>> queryAlarmNumber(String regionalCompaniesCode,
String amosCompanyCode,
String thirdStationId,
String type
) {
Map<String, Object> result = tdHygfJpInverterWarnServiceImpl.queryAlarmNumber(regionalCompaniesCode, amosCompanyCode, thirdStationId, type);
// Map<String, Object> result = tdHygfJpInverterWarnServiceImpl.queryAlarmNumber(regionalCompaniesCode, amosCompanyCode, thirdStationId, type);
Map<String, Object> result = new HashMap<>();
int wcl = tdHygfJpInverterWarnServiceImpl.selectWarnTotal(Arrays.asList("未处理"), regionalCompaniesCode, amosCompanyCode, thirdStationId, type);
int ycl = tdHygfJpInverterWarnServiceImpl.selectWarnTotal(Arrays.asList("已处理", "已恢复"), regionalCompaniesCode, amosCompanyCode, thirdStationId, type);
result.put("wcl", wcl);
result.put("ycl", ycl);
return ResponseHelper.buildResponse(result);
}
......
......@@ -172,8 +172,8 @@ public class TdHygfJpInverterWarnServiceImpl
return tdHygfJpInverterWarnDto;
}
public List<TdHygfJpInverterWarnDto> selectWarnList(List<String> state, String level, String minvalue, String maxValue, String snCode, List<String> stationId, String startTime, String endTime, String content, Integer current, Integer size, String handlerStatus, String stationName) {
List<TdHygfJpInverterWarnDto> list = tdHygfJpInverterWarnMapper.selectWarnList(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content, (current - 1) * size, size, handlerStatus, stationName);
public List<TdHygfJpInverterWarnDto> selectWarnList(List<String> state,String regionalCompaniesCode,String amosCompanyCode,String thirdStationId,String type, String level, String minvalue, String maxValue, String snCode, List<String> stationId, String startTime, String endTime, String content, Integer current, Integer size, String handlerStatus, String stationName) {
List<TdHygfJpInverterWarnDto> list = tdHygfJpInverterWarnMapper.selectWarnList(state,regionalCompaniesCode,amosCompanyCode,thirdStationId,type, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content, (current - 1) * size, size, handlerStatus, stationName);
list.forEach(i -> {
JpStation jpStation = jpStationServiceImpl.getOne(new LambdaQueryWrapper<JpStation>()
.eq(JpStation::getThirdStationId, i.getThirdStationId()));
......@@ -186,8 +186,15 @@ public class TdHygfJpInverterWarnServiceImpl
return list;
}
public int selectWarnListTotal(List<String> state, String level, String minvalue, String maxValue, String snCode, List<String> stationId, String startTime, String endTime, String content, String handlerStatus, String stationName) {
return tdHygfJpInverterWarnMapper.selectWarnListTotal(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content, handlerStatus, stationName);
public int selectWarnListTotal(List<String> state,String regionalCompaniesCode, String amosCompanyCode, String thirdStationId, String type, String level, String minvalue, String maxValue, String snCode, List<String> stationId, String startTime, String endTime, String content, String handlerStatus, String stationName) {
return tdHygfJpInverterWarnMapper.selectWarnListTotal(state,regionalCompaniesCode,amosCompanyCode,thirdStationId,type, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content, handlerStatus, stationName);
}
public int selectWarnTotal(List<String> state, String regionalCompaniesCode,
String amosCompanyCode,
String thirdStationId,
String type) {
return tdHygfJpInverterWarnMapper.selectWarnTotal(state, regionalCompaniesCode, amosCompanyCode, thirdStationId, type);
}
public Map<String, Object> queryAlarmNumber(String regionalCompaniesCode, String amosCompanyCode, String thirdStationId, String type) {
......
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