Commit 3bed505b authored by chenzhao's avatar chenzhao

集电线路图 光伏逆变器接口

parent 630cafa4
...@@ -765,5 +765,23 @@ public class MonitorFanIdxController extends BaseController { ...@@ -765,5 +765,23 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "集电线路图右侧 光伏列表")
@GetMapping("/gfList")
@Scheduled(cron = "0/10 * * * * ? ")
public ResponseModel getListByNbq() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
String gatewayId = stationBasic.getFanGatewayId();
String werks = stationBasic.getStationNumber();
monitorFanIndicator.getListByNbq(gatewayId,werks,stationBasic.getSequenceNbr().toString());
}
return CommonResponseUtil.success();
}
} }
...@@ -24,5 +24,6 @@ public interface SjglZsjZsbtzMapper extends BaseMapper<SjglZsjZsbtz> { ...@@ -24,5 +24,6 @@ public interface SjglZsjZsbtzMapper extends BaseMapper<SjglZsjZsbtz> {
List<Map<String,Object>> getStationInfoMapByStationWerks(String WERKS, String DATAID); List<Map<String,Object>> getStationInfoMapByStationWerks(String WERKS, String DATAID);
List<Map<String,Object>> getStationInfoMapByStationGFWerks(String WERKS,String DATAID);
} }
...@@ -1649,5 +1649,70 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1649,5 +1649,70 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
map.put("axisData",timeMap.keySet()); map.put("axisData",timeMap.keySet());
return map; return map;
} }
public void getListByNbq(String gatewayId,String werks,String stationId){
String sql = " SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName ='总直流功率' and frontModule = '逆变器'";
String sql1 = " SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName ='有功功率' and frontModule = '逆变器'";
List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class);
List<IndicatorsDto> listData1 = influxDButils.getListData(sql1, IndicatorsDto.class);
// 将两组数据合并成一个集合中 将总直流功率数据 放入 另一个集合的valueLable中
for (IndicatorsDto listDatum : listData) {
for (IndicatorsDto indicatorsDto : listData1) {
if (indicatorsDto.getEquipmentNumber().equals(listDatum.getEquipmentNumber())){
indicatorsDto.setValueLabel(listDatum.getValue());
}
}
}
List< Map<String, String>> maps = new ArrayList<>();
Set<String> nums = new HashSet<>();
//此处组装数据 每一个Map代表一个逆变器
for (IndicatorsDto indicatorsDto : listData1) {
int num = Integer.parseInt(indicatorsDto.getEquipmentNumber().substring(0, 2));
nums.add(String.valueOf(num));
Map<String, String> map = new HashMap<>();
String equipNum = indicatorsDto.getEquipmentNumber();
String number = equipNum.substring(equipNum.length() - 1);
map.put("titie",String.valueOf(num));
map.put("titie"+number,equipNum);
map.put("value"+number,indicatorsDto.getValue());
map.put("valueLabel"+number,indicatorsDto.getValueLabel());
maps.add(map);
}
TpriDmpDatabook tpriDmpDatabook = tpriDmpDatabookServiceImpl.getTpriDmpDatabookByDataName("集电线");
List<Map<String,Object>> dataMaps = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper.getStationInfoMapByStationGFWerks(werks, tpriDmpDatabook.getDataid().toString());
int i = 0;
//逆变器需要根据所属集电线分类组装 下面循环是将同一子阵下的不同逆变器组装为消息数据
for (Map<String, Object> dataMap : dataMaps) {
List<Map<String,String>> statusMaps = new ArrayList<>();
String equipNum = dataMap.get("equipNum").toString();
for (String num : nums) {
Map<String, String> map = new HashMap<>();
map.put("titie","#"+num);
for (Map<String, String> stringMap : maps) {
if (stringMap.get("titie").equals(num)){
map.putAll(stringMap);
}
}
if (equipNum.contains(num)){
statusMaps.add(map);
}
}
IPage<Map<String,String>> result = new Page<>();
result.setRecords(statusMaps);
result.setCurrent(1);
result.setTotal(statusMaps.size());
i += 1;
try {
emqKeeper.getMqttClient().publish(stationId+"/fj/group"+i,JSON.toJSONString(result).getBytes(),0,false);
} catch (MqttException e) {
log.info("消息发送失败");
e.printStackTrace();
}
}
}
} }
...@@ -19,4 +19,22 @@ ...@@ -19,4 +19,22 @@
</select> </select>
<select id="getStationInfoMapByStationGFWerks" resultType="map">
SELECT LEFT
( b.SBMC, 4 ) AS NAME,
GROUP_CONCAT( REPLACE ( SUBSTRING_INDEX( b.SBMC, "#",- 1 ), '光伏阵区系统', '' ) ) AS equipNum
FROM
(
SELECT
*
FROM
sjgl_zsj_zsbtz
WHERE
FSB IN ( SELECT DBID FROM `sjgl_zsj_zsbtz` WHERE MACHGENRE = ( SELECT DATAID FROM `tpri_dmp_databook` WHERE DATANAME = #{DATAID} ) AND WERKS = #{WERKS} )
) B
GROUP BY
B.FSB
</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