Commit e6900a0e authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/dev0124' into developer

parents 6d11a1ea c863acac
......@@ -25,4 +25,6 @@ public interface JpCollectorMapper extends BaseMapper<JpCollector> {
@UserEmpower(field ={"sta.regional_companies_code"} ,dealerField = {"sta.amos_company_code","sta.regional_companies_code"},fieldConditions ={"in","in"} ,relationship="and")
int selectPageDataTota(@Param("dto") JpCollectorDto reviewDto);
List<Map<String, Object>> selectInverterState(@Param("thirdStationIds") List<String> thirdStationIds);
}
......@@ -28,4 +28,6 @@ public interface JpInverterMapper extends BaseMapper<JpInverter> {
@UserEmpower(field ={"sta.regional_companies_code"} ,dealerField={"sta.amos_company_code","sta.regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
int selectPageDataTotal(@Param("dto") JpInverterDto reviewDto);
List<Map<String,Object>> selectInverterState(@Param("thirdStationIds") List<String> thirdStationIds);
}
......@@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Select;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 户用光伏监盘逆变器报警表 Mapper 接口
......@@ -42,5 +43,7 @@ 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> queryAlarmNumber(@Param("thirdStationIds") List<String> thirdStationIds);
List<TdHygfJpInverterWarnDto> queryAlarmNumber(@Param("regionalCompaniesCode") Set<String> regionalCompaniesCodes);
List<TdHygfJpInverterWarnDto> queryAlarmNumberS(@Param("thirdStationIds") String thirdStationIds);
}
......@@ -90,4 +90,25 @@
</if>
</where>
</select>
<select id="selectInverterState" resultType="java.util.Map">
SELECT
all_statuses.status,
COALESCE(COUNT(hygf_jp_collector.state), 0) AS count
FROM (
SELECT '在线' AS status
UNION ALL
SELECT '离线' AS status
UNION ALL
SELECT '报警' AS status
) AS all_statuses
LEFT JOIN hygf_jp_collector ON all_statuses.status = hygf_jp_collector.state and hygf_jp_collector.third_station_id
in(
<foreach collection="thirdStationIds" item="item" separator=",">
(#{item})
</foreach>)
GROUP BY all_statuses.status
ORDER BY all_statuses.status;
</select>
</mapper>
......@@ -109,4 +109,28 @@
</if>
</where>
</select>
<select id="selectInverterState" resultType="java.util.Map">
SELECT
all_statuses.status,
COALESCE(COUNT(hygf_jp_inverter.state), 0) AS count
FROM (
SELECT '在线' AS status
UNION ALL
SELECT '离线' AS status
UNION ALL
SELECT '报警' AS status
) AS all_statuses
LEFT JOIN hygf_jp_inverter ON all_statuses.status = hygf_jp_inverter.state and hygf_jp_inverter.third_station_id
in(
<foreach collection="thirdStationIds" item="item" separator=",">
(#{item})
</foreach>
)
GROUP BY all_statuses.status
ORDER BY all_statuses.status;
</select>
</mapper>
......@@ -672,9 +672,11 @@
<select id="queryAllPowerStation" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto">
select
name,
third_station_id
third_station_id,
regional_companies_code
from hygf_jp_station
<where>
hygf_jp_station.regional_companies_code is not null
<if test="powerStationId!=null">
and hygf_jp_station.sequence_nbr =#{powerStationId}
</if>
......
......@@ -165,13 +165,12 @@
`state`
FROM house_pv_data.td_hygf_jp_inverter_warn
<where>
<if test="thirdStationIds != null and thirdStationIds.size > 0 ">
third_station_id in
<foreach collection="thirdStationIds" item="item" open='(' close=')' separator=",">
#{item}
<if test="regionalCompaniesCode != null and regionalCompaniesCode.size > 0 ">
`state` is not null and
<foreach collection="regionalCompaniesCode" item="item" open="(" close=")" separator="or">
regional_companies_code like #{item}
</foreach>
</if>
</where>
</select>
</mapper>
......@@ -842,28 +842,4 @@ public class JpStationController extends BaseController {
return ResponseHelper.buildResponse(poserStatisticsData);
}
//查询当前登录人权限区域公司统计数据
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司统计数据", notes = "查询当前登录人权限区域公司统计数据")
@GetMapping(value = "/getRegionStatistics")
// @UserLimits
public ResponseModel<Page<PowerStationStatistics>> getRegionStatistics(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, @RequestParam(required = false) String regionName) {
Page<PowerStationStatistics> poserStatisticsData = jpStationServiceImpl.getRegionStatistics(current, size, regionName);
return ResponseHelper.buildResponse(poserStatisticsData);
}
//查询经销商统计数据(根据区域公司orgCode)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询经销商统计数据", notes = "查询经销商统计数据")
@GetMapping(value = "/getDealerStatistics")
// @UserLimits
public ResponseModel<Page<PowerStationStatistics>> getDealerStatistics(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String regionCompanyOrgCode, @RequestParam(required = false) String dealerName) {
Page<PowerStationStatistics> poserStatisticsData = jpStationServiceImpl.getDealerStatistics(current, size, regionCompanyOrgCode, dealerName);
return ResponseHelper.buildResponse(poserStatisticsData);
}
}
......@@ -330,4 +330,17 @@ public class TdHygfJpInverterWarnController extends BaseController {
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "户用光伏统计数据查询", notes = "户用光伏统计数据查询")
@GetMapping(value = "/queryStateNumber")
@UserLimits
public ResponseModel<Map<String, Object>> queryStateNumber(@RequestParam(required = false) String regionalCompaniesCode,
@RequestParam(required = false) String amosCompanyCode,
@RequestParam(required = false) String powerStationId
) {
Map<String, Object> result = tdHygfJpInverterWarnServiceImpl.queryStateNumber(regionalCompaniesCode, amosCompanyCode, powerStationId);
return ResponseHelper.buildResponse(result);
}
}
......@@ -10,10 +10,10 @@ import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.dto.HYGFMaintenanceTicketsDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.HYGFMaintenanceTickets;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterWarn;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.HYGFMaintenanceTicketsMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpCollectorMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper;
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.util.TimeUtil;
......@@ -44,7 +44,10 @@ public class TdHygfJpInverterWarnServiceImpl
HYGFMaintenanceTicketsMapper hygfMaintenanceTicketsMapper;
@Autowired
TdHygfJpInverterWarnMapper tdHygfJpInverterWarnMapper;
@Autowired
JpInverterMapper jpInverterMapper;
@Autowired
JpCollectorMapper jpCollectorMapper;
/**
* 分页查询
*/
......@@ -196,10 +199,10 @@ public class TdHygfJpInverterWarnServiceImpl
if (!CollectionUtils.isEmpty(jpStationDtos)) {
// 获取thirdStationId集合
List<String> thirdStationIds = jpStationDtos.stream().map(JpStation -> JpStation.getThirdStationId()).collect(Collectors.toList());
Set<String> regionalCompaniesCodes = jpStationDtos.stream().map(JpStation -> JpStation.getRegionalCompaniesCode()).collect(Collectors.toSet());
List<TdHygfJpInverterWarnDto> tdHygfJpInverterWarnDtos = tdHygfJpInverterWarnMapper.queryAlarmNumber(thirdStationIds);
List<TdHygfJpInverterWarnDto> tdHygfJpInverterWarnDtos = tdHygfJpInverterWarnMapper.queryAlarmNumber(regionalCompaniesCodes);
ArrayList<String> yclArray = new ArrayList<>();
......@@ -225,4 +228,65 @@ public class TdHygfJpInverterWarnServiceImpl
return result;
}
public Map<String, Object> queryStateNumber(String regionalCompaniesCode, String amosCompanyCode, String powerStationId) {
// 查询所有场站
List<JpStationDto> jpStationDtos = jpStationServiceImpl.queryAllPowerStation(regionalCompaniesCode, amosCompanyCode, powerStationId);
Map<String, Object> result = new HashMap<>();
if (!CollectionUtils.isEmpty(jpStationDtos)) {
// 获取thirdStationId集合
List<String> thirdStationIds = jpStationDtos.stream().map(JpStation -> JpStation.getThirdStationId()).collect(Collectors.toList());
//在线
List<Integer> online = new ArrayList<>();
//报警
List<Integer> warn = new ArrayList<>();
//离线
List<Integer> offline = new ArrayList<>();
//逆变器
List<Map<String, Object>> map = jpInverterMapper.selectInverterState(thirdStationIds);
map.forEach(e->{
if (e.get("status").equals("在线")){
online.add(Integer.valueOf(e.get("count").toString()));
}else if (e.get("status").equals("报警")){
warn.add(Integer.valueOf(e.get("count").toString()));
}else {
offline.add(Integer.valueOf(e.get("count").toString()));
}
});
//采集器
List<Map<String, Object>> maps = jpCollectorMapper.selectInverterState(thirdStationIds);
maps.forEach(e->{
if (e.get("status").equals("在线")){
online.add(Integer.valueOf(e.get("count").toString()));
}else if (e.get("status").equals("报警")){
warn.add(Integer.valueOf(e.get("count").toString()));
}else {
offline.add(Integer.valueOf(e.get("count").toString()));
}
});
//目前系统无气象仪及电表
List<Integer> kong = new ArrayList<>(Arrays.asList(0,0));
online.addAll(kong);
warn.addAll(kong);
offline.addAll(kong);
Map<String, Object> resultNumMap = new HashMap<>();
resultNumMap.put("online",online);
resultNumMap.put("warn",warn);
resultNumMap.put("offline",offline);
result.put("xData",Arrays.asList("在线","报警","离线"));
result.put("yData",resultNumMap);
}
return result;
}
}
\ No newline at end of file
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