Commit 5706a380 authored by chenzhao's avatar chenzhao

电站监控接口

parent e6900a0e
......@@ -1198,6 +1198,10 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
requestInfo.put("endTime", date);
requestInfo.put("stationId", jpStation.getThirdStationId());
if (jpStation.getThirdStationId().equals("517021808701218816")){
System.out.println("6666666666666666666666666");
}
String param = JSON.toJSONString(requestInfo);
List<SofarWarm> jsonObject2 = requestUtil.getResPonse(SoFarConstant.alert, SoFarConstant.requestPost, param,
SoFarConstant.stationAlertItems, SofarWarm.class);
......@@ -1248,6 +1252,12 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
hygfjpInverterWarn.setTimeLong(this.convertDate(hygfjpInverterWarn.getRecoverTime())
- this.convertDate(hygfjpInverterWarn.getStartTime()));
}
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} else {
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
}
}
}
......
......@@ -80,4 +80,7 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
@UserEmpower(field ={"hygf_jp_station.regional_companies_code"},dealerField ={"hygf_jp_station.amos_company_code","hygf_jp_station.regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
List<JpStationDto> queryAllPowerStation(String regionalCompaniesCode, String amosCompanyCode, String powerStationId);
@UserEmpower(field ={"hygf_jp_station.regional_companies_code"},dealerField ={"hygf_jp_station.amos_company_code","hygf_jp_station.regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
List<Map<String,Object>> selectStateCount(String regionalCompaniesCode, String amosCompanyCode, String type);
}
......@@ -80,6 +80,9 @@
<if test="dto.snCode != null and dto.snCode != ''">
AND hjc.sn_code like #{dto.snCode}
</if>
<if test="dto.state != null and dto.state != ''">
AND hjc.state = #{dto.state}
</if>
<if test="dto.minValue != null and dto.minValue !=''">
AND hjc.capacity >= #{dto.minValue}
</if>
......@@ -101,6 +104,9 @@
<if test="dto.snCode != null and dto.snCode != ''">
AND hjc.sn_code like #{dto.snCode}
</if>
<if test="dto.state != null and dto.state != ''">
AND hjc.state = #{dto.state}
</if>
<if test="dto.minValue != null and dto.minValue !=''">
AND hjc. capacity >= #{dto.minValue}
</if>
......@@ -127,8 +133,6 @@
</foreach>
)
GROUP BY all_statuses.status
ORDER BY all_statuses.status;
......
......@@ -612,6 +612,9 @@
<if test="dto.regionalCompaniesCode!=null">
and hygf_jp_station.regional_companies_code =#{dto.regionalCompaniesCode}
</if>
<if test="dto.state!=null">
and hygf_jp_station.state =#{dto.state}
</if>
<if test="dto.amosCompanyCode!=null">
and hygf_jp_station.amos_company_code =#{dto.amosCompanyCode}
</if>
......@@ -692,6 +695,37 @@
<select id="selectStateCount" resultType="map">
SELECT
all_statuses.status,
COALESCE(COUNT(hygf_jp_station.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_station ON all_statuses.status = hygf_jp_station.state
<where>
hygf_jp_station.regional_companies_code is not null
<if test="type!=null">
and hygf_jp_station.type =#{type}
</if>
<if test="regionalCompaniesCode!=null">
and hygf_jp_station.regional_companies_code like concat('%',#{regionalCompaniesCode},'%')
</if>
<if test="amosCompanyCode!=null">
and hygf_jp_station.amos_company_code =#{amosCompanyCode}
</if>
</where>
GROUP BY all_statuses.status
ORDER BY all_statuses.status;
</select>
</mapper>
......@@ -842,4 +842,26 @@ public class JpStationController extends BaseController {
return ResponseHelper.buildResponse(poserStatisticsData);
}
//查询经销商统计数据(根据区域公司orgCode)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询电站状态统计", notes = "查询电站状态统计")
@GetMapping(value = "/selectStateCount")
@UserLimits
public ResponseModel<Map<String,Object>> selectStateCount(@RequestParam(required = false) String regionalCompaniesCode,@RequestParam(required = false) String amosCompanyCode, @RequestParam(required = false)String type ) {
return ResponseHelper.buildResponse(jpStationServiceImpl.selectStateCount(regionalCompaniesCode, amosCompanyCode,type));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询电站下设备详情", notes = "查询电站下设备详情")
@GetMapping(value = "/queryEquipInfo")
public ResponseModel<Map<String,Object>> queryEquipInfo(String thirdStationId ) {
return ResponseHelper.buildResponse(jpStationServiceImpl.queryEquipInfo(thirdStationId));
}
}
......@@ -323,9 +323,9 @@ public class TdHygfJpInverterWarnController extends BaseController {
@UserLimits
public ResponseModel<Map<String, Object>> queryAlarmNumber(@RequestParam(required = false) String regionalCompaniesCode,
@RequestParam(required = false) String amosCompanyCode,
@RequestParam(required = false) String powerStationId
@RequestParam(required = false) String thirdStationId
) {
Map<String, Object> result = tdHygfJpInverterWarnServiceImpl.queryAlarmNumber(regionalCompaniesCode, amosCompanyCode, powerStationId);
Map<String, Object> result = tdHygfJpInverterWarnServiceImpl.queryAlarmNumber(regionalCompaniesCode, amosCompanyCode, thirdStationId);
return ResponseHelper.buildResponse(result);
}
......@@ -336,9 +336,9 @@ public class TdHygfJpInverterWarnController extends BaseController {
@UserLimits
public ResponseModel<Map<String, Object>> queryStateNumber(@RequestParam(required = false) String regionalCompaniesCode,
@RequestParam(required = false) String amosCompanyCode,
@RequestParam(required = false) String powerStationId
@RequestParam(required = false) String thirdStationId
) {
Map<String, Object> result = tdHygfJpInverterWarnServiceImpl.queryStateNumber(regionalCompaniesCode, amosCompanyCode, powerStationId);
Map<String, Object> result = tdHygfJpInverterWarnServiceImpl.queryStateNumber(regionalCompaniesCode, amosCompanyCode, thirdStationId);
return ResponseHelper.buildResponse(result);
}
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapBuilder;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -11,6 +12,7 @@ import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
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.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IJpStationService;
......@@ -18,6 +20,7 @@ import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.DayGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthPowerMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.YearGenerateMapper;
import org.apache.activemq.util.MapHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
......@@ -48,6 +51,8 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
@Autowired
JpInverterMapper jpInverterMapper;
@Autowired
JpCollectorMapper jpCollectorMapper;
@Autowired
MonthPowerMapper monthPowerMapper;
@Autowired
MonthPowerServiceImpl monthPowerServiceImpl;
......@@ -977,4 +982,36 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
List<JpStationDto> powerStationList = jpStationMapper.queryAllPowerStation(regionalCompaniesCode, amosCompanyCode, powerStationId);
return powerStationList;
}
public Map<String,Object> selectStateCount(String regionalCompaniesCode, String amosCompanyCode, String type){
Map<String, Object> resultNumMap = new HashMap<>();
List<Map<String, Object>> map = jpStationMapper.selectStateCount(regionalCompaniesCode, amosCompanyCode, type);
map.forEach(e->{
if (e.get("status").equals("在线")){
resultNumMap.put("online",(Integer.valueOf(e.get("count").toString())));
}else if (e.get("status").equals("报警")){
resultNumMap.put("warn",(Integer.valueOf(e.get("count").toString())));
}else {
resultNumMap.put("offline",(Integer.valueOf(e.get("count").toString())));
}
});
return resultNumMap;
}
public Map<String,Object> queryEquipInfo(String thirdStationId ){
LambdaQueryWrapper<JpInverter> inverQuery = new LambdaQueryWrapper<>();
inverQuery.eq(JpInverter::getThirdStationId,thirdStationId);
List<JpInverter> jpInverters = jpInverterMapper.selectList(inverQuery);
LambdaQueryWrapper<JpCollector> collectorQuery = new LambdaQueryWrapper<>();
collectorQuery.eq(JpCollector::getThirdStationId,thirdStationId);
List<JpCollector> jpCollectors = jpCollectorMapper.selectList(collectorQuery);
Map<String, Object> map = MapBuilder.<String, Object>create().put("inverter", jpInverters).put("collector", jpCollectors).put("ammeter",new ArrayList<>()).put("meteorograph",new ArrayList<>()).build();
return map;
}
}
\ 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