Commit 73658edf authored by tangwei's avatar tangwei

解决冲突

parents 9e5d323c 1072ba5a
package com.yeejoin.amos.boot.module.jxiop.api.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum AlarmDesc {
ZXYGZ("运行","正常运行"),
FXYGZ("停机","正常停机"),
ZXWGZ("限额运行","限功率"),
FXWGZ("降额运行","限电停机"),
ZGXWG("告警运行","告警运行"),
ZZXYG("故障停机","故障停机"),
ZRXWG("待机","待机状态"),
ZFXYG("通讯故障","通讯中断");
private String name;
private String code;
public static String getCode(String name) {
for (AlarmDesc electricQuantity : AlarmDesc.values())
{
if (electricQuantity.getName().equals(name))
{
return electricQuantity.getCode();
}
}
return null;
}
}
package com.yeejoin.amos.boot.module.jxiop.api.feign;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
@FeignClient(name = "${amos.idx.name:AMOS-IDX}", path = "idx", configuration = {FeignConfiguration.class})
public interface IdxFeign {
/**
* 根据风险来源查询人员红黄绿吗信息
*/
@GetMapping("/jxIopAnalysis/healthIndexData")
FeignClientResult<Map<String, Object>> healthIndexData(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "stationType") String stationType);
}
......@@ -20,4 +20,10 @@ public interface McbWarningFeign {
FeignClientResult<Map<String, Object>> getQrCodeCount(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(value = "warningObjectType") String warningObjectType);
/**
* 根据风险来源查询人员红黄绿吗信息
*/
@GetMapping("/task/getWarningInfoCountByObjectId")
FeignClientResult<Integer> getWarningInfoCountByObjectId(@RequestParam(value = "code") String code);
}
......@@ -55,11 +55,15 @@ public interface PersonBasicMapper extends BaseMapper<PersonBasic> {
@Param("size") Integer size,
@Param("parentCode") String parentCode,
@Param("date") String date,
@Param("qrCodeColor") String qrCodeColor);
@Param("qrCodeColor") String qrCodeColor,
@Param("ne") String ne);
Integer getPersonYardByPageCount(@Param("parentCode") String parentCode,
@Param("date") String date,
@Param("qrCodeColor") String qrCodeColor);
@Param("qrCodeColor") String qrCodeColor,
@Param("ne") String ne);
List<StationQrCodeStatistics> getPersonStatistics();
Map<String, Object> getPersonDetailInfoByObjectId(String objectId);
}
......@@ -213,7 +213,8 @@
ifnull(b.name, '') as objectName ,
ifnull(a.qrcode_color, '') AS qrCodeColor,
ifnull(c.station_name, '') AS stationName,
ifnull(a.rec_date, '') as recDate
ifnull(a.rec_date, '') as recDate,
a.sequence_nbr as objectId
FROM
person_basic a
LEFT JOIN person_account b ON a.sequence_nbr = b.person_id
......@@ -226,7 +227,10 @@
AND a.rec_date like concat(#{date},'%')
</if>
<if test="qrCodeColor != null and qrCodeColor != ''">
AND a.qrcode_color like concat(#{qrCodeColor},'%')
AND a.qrcode_color = #{qrCodeColor}
</if>
<if test="ne != null and ne != ''">
AND a.qrcode_color != #{ne}
</if>
</where>
ORDER BY a.rec_date DESC
......@@ -248,7 +252,10 @@
AND a.rec_date like concat(#{date},'%')
</if>
<if test="qrCodeColor != null and qrCodeColor != ''">
AND a.qrcode_color like concat(#{qrCodeColor},'%')
AND a.qrcode_color = #{qrCodeColor}
</if>
<if test="ne != null and ne != ''">
AND a.qrcode_color != #{ne}
</if>
</where>
</select>
......@@ -266,4 +273,21 @@
GROUP BY
project_org_code
</select>
<select id="getPersonDetailInfoByObjectId" resultType="java.util.Map">
SELECT
IFNULL(b.`name`, '') as `name`,
IFNULL(a.phone, '') as phone,
IFNULL(a.post_name, '') as postName,
IFNULL(b.project_name, '') as stationName,
'' as unitName,
IFNULL(a.qrcode_color, 'green') as qrCodeColor,
IFNULL(a.rec_date, '') AS date
FROM
person_basic a
LEFT JOIN person_account b ON a.sequence_nbr = b.person_id
LEFT JOIN station_basic c ON a.project_org_code = c.project_org_code
where
a.sequence_nbr = #{objectId}
</select>
</mapper>
......@@ -174,7 +174,8 @@
update
`station_basic`
set
`qrcode_color` = #{item.qrcodeColor}
`qrcode_color` = #{item.qrcodeColor},
rec_date = now()
where
project_org_code = #{item.code}
</foreach>
......
......@@ -10,6 +10,8 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.Date;
import static org.springframework.data.elasticsearch.annotations.DateFormat.*;
/**
* @description:
* @author: tw
......@@ -33,14 +35,15 @@ public class ESEquipments {
private String gatewayId;
@Field(type = FieldType.Text)
private String isAlarm;
@Field(type = FieldType.Date, format = DateFormat.basic_date_time, index = false)
// @Field(type = FieldType.Date, format = custom,pattern = "yyyy-MM-dd HH:mm:ss",index = false)
@Field(type = FieldType.Date, format = basic_date_time,index = false)
private Date createdTime;
@Field(type = FieldType.Text , index = false)
private String unit;
@Field(type = FieldType.Text, index = false)
private String value;
@Field(type = FieldType.Double, index = false)
private Double valueDouble;
@Field(type = FieldType.Float, index = false)
private Float valueDouble;
@Field(type = FieldType.Text , index = false)
private String valueLabel;
@Field(type = FieldType.Text , index = false)
......@@ -59,7 +62,7 @@ public class ESEquipments {
private String displayName;
public ESEquipments(Double valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
public ESEquipments(Float valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
this.valueDouble = valueDouble;
this.id = id;
......
......@@ -286,6 +286,11 @@ public class MonitorFanIdxController extends BaseController {
public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false)String stationId,@RequestParam(value = "type", required = false)String type
,@RequestParam(value = "areaCode", required = false)String areaCode) {
String gatewayId = "";
if (null != areaCode){
List<StationCacheInfoDto> listStationCacheInfoDto = commonService.getListStationCacheInfoDto();
List<String> collect = listStationCacheInfoDto.stream().filter(e -> e.getAreaCode().equals(areaCode)).map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
gatewayId = String.join(",", collect);
}
if (null != stationId){
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
gatewayId = stationBasic.getBoosterGatewayId();
......@@ -736,7 +741,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "详情基础信息")
@GetMapping("/getStatisticsInfo")
public ResponseModel<Map<String,String>> getStatisticsInfo(@RequestParam(value = "equipmentIndexName", required = false) String equipmentIndexName,
public ResponseModel<Map<String,Object>> getStatisticsInfo(@RequestParam(value = "equipmentIndexName", required = false) String equipmentIndexName,
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "stationType", required = false) String stationType) {
String gatewayId = "";
......@@ -747,8 +752,15 @@ public class MonitorFanIdxController extends BaseController {
gatewayId = stationBasic.getBoosterGatewayId();
}
}
List<StationCacheInfoDto> list = commonService.getListStationCacheInfoDto();
double sum = 0.0;
sum =list.stream().filter(obj -> !ObjectUtils.isEmpty(obj.getInstalledCapacity())).mapToDouble(l->Double.parseDouble(l.getInstalledCapacity())).sum();
return ResponseHelper.buildResponse(monitorFanIndicator.getStatisticsInfo(gatewayId,equipmentIndexName ));
Map<String, Object> statisticsInfo = monitorFanIndicator.getStatisticsInfo(gatewayId, equipmentIndexName);
double v = Double.parseDouble( statisticsInfo.get("mean").toString());
String load = String.format("%.2f", v / sum);
statisticsInfo.put("load",load);
return ResponseHelper.buildResponse(statisticsInfo);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......@@ -853,7 +865,7 @@ public class MonitorFanIdxController extends BaseController {
}
@ApiOperation(value = "电站排名")
// @Scheduled(cron = "0/10 * * * * ? ")
@Scheduled(cron = "0/10 * * * * ? ")
@GetMapping("/stationRanking")
public ResponseModel stationRanking() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
......@@ -919,11 +931,13 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "运维数据 ")
@GetMapping("/operationData")
public ResponseModel<IPage<Map<String,Object>>> operationData() {
public ResponseModel<IPage<Map<String,Object>>> operationData(@RequestParam(value = "areaCode", required = false)String areaCode) {
List<StationCacheInfoDto> list = commonService.getListStationCacheInfoDto();
if (null != areaCode){
list = list.stream().filter(e->e.getAreaCode().equals(areaCode)).collect(Collectors.toList());
}
List<Map<String,Object>> mapList = new ArrayList<>();
Map<String, List<StationCacheInfoDto>> listMap = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getStationType, Collectors.toList()));
......@@ -941,8 +955,6 @@ public class MonitorFanIdxController extends BaseController {
result.setRecords(mapList);
result.setCurrent(1);
result.setTotal(mapList.size());
return ResponseHelper.buildResponse(result);
}
......@@ -957,14 +969,15 @@ public class MonitorFanIdxController extends BaseController {
map.put("equipmentIndexName.keyword",value);
if (null != areaCode){
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
List<String> collect = listStationCacheInfoDto.stream().filter(e -> e.getBelongArea().equals(areaCode)).map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
map.put("gateWayId",collect);
List<String> collect = listStationCacheInfoDto.stream().filter(e -> e.getAreaCode().equals(areaCode)).map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
map.put("gatewayId.keyword",collect);
}
List<? extends Terms.Bucket> lidate= commonService.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword", ESEquipments.class);
DecimalFormat format2 = new DecimalFormat("#.0000");
Double num = 0.00;
if (map.containsKey("gateWayId")&&map.get("gateWayId").size() > 0){
for (Terms.Bucket bucket : lidate) {
Aggregations aggregation= bucket.getAggregations();
List<Aggregation> listdata= Objects.nonNull(aggregation)?aggregation.asList():null;
......@@ -973,7 +986,7 @@ public class MonitorFanIdxController extends BaseController {
num = Double.valueOf(format2.format(parsedSum.getValue()));
}
}
}
return ResponseHelper.buildResponse(commonService.getSocialContributionDtoList(num));
}
......@@ -1105,5 +1118,57 @@ public class MonitorFanIdxController extends BaseController {
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@Scheduled(cron = "0 0/10 * * * ? ")
@ApiOperation(value = "接入情况 ")
@GetMapping("/accessSituation")
public ResponseModel<Map<String,Object>> accessSituation(){
Map<String, Object> map = new LinkedHashMap<>();
List<StationCacheInfoDto> list = commonService.getListStationCacheInfoDto();
double sum = list.stream().mapToDouble(l -> Double.parseDouble(l.getInstalledCapacity())).sum();
Map<String, List<StationCacheInfoDto>> listMap = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getStationType, Collectors.toList()));
for (StationType value : StationType.values()) {
List<StationCacheInfoDto> dtos = listMap.get(value.getCode());
map.put(value.getCode(),dtos == null ? 0 :dtos.size());
map.put(value.getCode()+"title",dtos == null ? 0 :dtos.stream().filter(obj -> !ObjectUtils.isEmpty(obj.getInstalledCapacity())).mapToDouble(l->Double.parseDouble(l.getInstalledCapacity())).sum());
}
map.put("total",list.size());
map.put("num",sum);
try {
emqKeeper.getMqttClient().publish("/accessSituation/topic",JSON.toJSONString(map).getBytes(),0,false);
} catch (MqttException e) {
}
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@Scheduled(cron = "0 0/10 * * * ? ")
@ApiOperation(value = "区域接入情况 ")
@GetMapping("/qyAccessSituation")
public ResponseModel<Map<String,Object>> qyAccessSituation(){
Map<String, Object> map = new LinkedHashMap<>();
List<StationCacheInfoDto> list = commonService.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getAreaCode));
for (String s : belongAreaList.keySet()) {
double sum = belongAreaList.get(s).stream().mapToDouble(l -> Double.parseDouble(l.getInstalledCapacity())).sum();
Map<String, List<StationCacheInfoDto>> listMap = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getStationType, Collectors.toList()));
for (StationType value : StationType.values()) {
List<StationCacheInfoDto> dtos = listMap.get(value.getCode());
map.put(value.getCode(),dtos == null ? 0 :dtos.size());
map.put(value.getCode()+"title",dtos == null ? 0 :dtos.stream().filter(obj -> !ObjectUtils.isEmpty(obj.getInstalledCapacity())).mapToDouble(l->Double.parseDouble(l.getInstalledCapacity())).sum());
}
map.put("total",list.size());
map.put("num",sum);
try {
emqKeeper.getMqttClient().publish("/accessSituation/topic/"+"s",JSON.toJSONString(map).getBytes(),0,false);
} catch (MqttException e) {
}
}
return ResponseHelper.buildResponse(map);
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.QrcodeColorEnum;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.feign.IdxFeign;
import com.yeejoin.amos.boot.module.jxiop.api.feign.McbWarningFeign;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationQrCodeStatisticsMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PersonBasicServiceImpl;
......@@ -46,6 +50,14 @@ public class PersonQrCodeController extends BaseController {
@Autowired
private SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
@Autowired
private IdxFeign idxFeign;
@Autowired
private StationBasicMapper stationBasicMapper;
/**
* 评估大屏 - 人员赋码环形图查询
*
......@@ -95,10 +107,10 @@ public class PersonQrCodeController extends BaseController {
Page<Map<String, Object>> resultList = new Page<>();
if ("person".equals(dataType)) {
resultList = personBasicServiceImpl.getPersonYardByPage(parentCode, current, size, date, qrCodeColor);
resultList = personBasicServiceImpl.getPersonYardByPage(parentCode, current, size, date, qrCodeColor, null, null);
} else if ("equip".equals(dataType)) {
List<Map<String, Object>> equipYardByPage = sjglZsjZsbtzMapper.getEquipYardByPage((current - 1) * size, size, parentCode, date, qrCodeColor);
Integer equipYardByPageCount = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, date, qrCodeColor);
List<Map<String, Object>> equipYardByPage = sjglZsjZsbtzMapper.getEquipYardByPage((current - 1) * size, size, parentCode, date, qrCodeColor, null);
Integer equipYardByPageCount = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, date, qrCodeColor, null);
equipYardByPage.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
......@@ -108,8 +120,8 @@ public class PersonQrCodeController extends BaseController {
resultList.setSize(size);
resultList.setTotal(equipYardByPageCount);
} else if ("job".equals(dataType)) {
List<Map<String, Object>> jobYardByPage = sjglZsjZsbtzMapper.getJobYardByPage((current - 1) * size, size, parentCode, date, qrCodeColor);
Integer jobYardByPageCount = sjglZsjZsbtzMapper.getJobYardByPageCount(parentCode, date, qrCodeColor);
List<Map<String, Object>> jobYardByPage = sjglZsjZsbtzMapper.getJobYardByPage((current - 1) * size, size, parentCode, date, qrCodeColor, null);
Integer jobYardByPageCount = sjglZsjZsbtzMapper.getJobYardByPageCount(parentCode, date, qrCodeColor, null);
jobYardByPage.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
......@@ -147,11 +159,11 @@ public class PersonQrCodeController extends BaseController {
String yellowToGreen = result.get("yellowToGreen").toString();
Integer countAll = 0;
if ("RYFM".equals(dataType) || "person".equals(dataType)) {
countAll = personBasicMapper.getPersonYardByPageCount(parentCode, null, null);
countAll = personBasicMapper.getPersonYardByPageCount(parentCode, null, null, null);
} else if ("equip".equals(dataType)) {
countAll = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, null, null);
countAll = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, null, null, null);
} else if ("job".equals(dataType)) {
countAll = sjglZsjZsbtzMapper.getJobYardByPageCount(parentCode, null, null);
countAll = sjglZsjZsbtzMapper.getJobYardByPageCount(parentCode, null, null, null);
}
result.put("redToGreenPercent", getPercent(new BigDecimal(red), new BigDecimal(countAll)));
result.put("redPercent", getPercent(new BigDecimal(redToGreen), new BigDecimal(countAll)));
......@@ -209,4 +221,112 @@ public class PersonQrCodeController extends BaseController {
return Math.abs(multiply.doubleValue());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getStationDetailInfo")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 场站信息查询", notes = "评估大屏 - 场站信息查询")
public ResponseModel<Map<String, Object>> getStationDetailInfo(@RequestParam(required = true, value = "parentCode") String parentCode) {
FeignClientResult<Map<String, Object>> sevenEntity = null;
try {
sevenEntity = idxFeign.healthIndexData(parentCode, null);
} catch (Exception e) {
e.printStackTrace();
}
FeignClientResult<Integer> sevenEntityMcb = null;
try {
sevenEntityMcb = mcbWarningFeign.getWarningInfoCountByObjectId(parentCode);
} catch (Exception e) {
e.printStackTrace();
}
String score = "100";
String gradeColor = "green";
Integer warningCount = 0;
if (sevenEntity != null && 200 == sevenEntity.getStatus()) {
Map<String, Object> result = sevenEntity.getResult();
score = result.get("score").toString();
gradeColor = result.get("gradeColor").toString();
}
if (sevenEntityMcb != null && 200 == sevenEntityMcb.getStatus()) {
warningCount = sevenEntityMcb.getResult();
}
HashMap<String, Object> map = new HashMap<>();
map.put("score", score);
map.put("gradeColor", gradeColor);
map.put("warningCount", warningCount);
LambdaQueryWrapper<StationBasic> stationBasicLambdaQueryWrapper = new LambdaQueryWrapper<>();
stationBasicLambdaQueryWrapper.eq(StationBasic::getProjectOrgCode, parentCode);
stationBasicLambdaQueryWrapper.last("limit 1");
StationBasic stationBasic = stationBasicMapper.selectOne(stationBasicLambdaQueryWrapper);
map.put("stationMasterName", stationBasic.getStationMasterName());
map.put("mobilePhone", stationBasic.getMobilePhone());
map.put("recDate", stationBasic.getRecDate());
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getStationEquipInfo")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 场站二级弹窗API", notes = "评估大屏 - 场站二级弹窗API")
public ResponseModel<Page<Map<String, Object>>> getStationEquipInfo(@RequestParam(value = "parentCode") String parentCode,
@RequestParam(required = false, value = "column") String column,
@RequestParam(required = false, value = "score") BigDecimal score,
@RequestParam(value = "current") Integer current,
@RequestParam(value = "size") Integer size,
@RequestParam(required = false, value = "date") String date) {
Page<Map<String, Object>> resultList = new Page<>();
if ("V1".equals(column)) {
resultList = personBasicServiceImpl.getPersonYardByPage(parentCode, current, size, date, null, "green", score);
} else if ("S1".equals(column)) {
List<Map<String, Object>> equipYardByPage = sjglZsjZsbtzMapper.getEquipYardByPage((current - 1) * size, size, parentCode, date, null, "green");
Integer equipYardByPageCount = sjglZsjZsbtzMapper.getEquipYardByPageCount(parentCode, date, null, "green");
equipYardByPage.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
item.put("faultInfo", "该存在缺陷或者告警");
item.put("faultLevel", "严重");
if (!Objects.isNull(score)) {
item.put("mark", new BigDecimal(100).subtract(score));
}
});
resultList.setRecords(equipYardByPage);
resultList.setCurrent(current);
resultList.setSize(size);
resultList.setTotal(equipYardByPageCount);
} else if ("P1".equals(column)) {
List<Map<String, Object>> jobYardByPage = sjglZsjZsbtzMapper.getJobYardByPage((current - 1) * size, size, parentCode, date, null, "green");
Integer jobYardByPageCount = sjglZsjZsbtzMapper.getJobYardByPageCount(parentCode, date, null, "green");
jobYardByPage.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
item.put("faultInfo", "该任务超时");
item.put("faultLevel", "严重");
if (!Objects.isNull(score)) {
item.put("mark", new BigDecimal(100).subtract(score));
}
});
resultList.setRecords(jobYardByPage);
resultList.setCurrent(current);
resultList.setSize(size);
resultList.setTotal(jobYardByPageCount);
}
return ResponseHelper.buildResponse(resultList);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getDetailInfoByObjectId")
@ApiOperation(httpMethod = "GET", value = "评估大屏 - 三级弹窗左侧信息API", notes = "评估大屏 - 三级弹窗左侧信息API")
public ResponseModel<Map<String, Object>> getDetailInfoByObjectId(@RequestParam(value = "objectId") String objectId,
@RequestParam(value = "column") String column,
@RequestParam(required = false, value = "jobId") String jobId) {
Map<String, Object> resultMap = new HashMap<>();
if ("V1".equals(column)) {
resultMap = personBasicServiceImpl.getPersonDetailInfoByObjectId(objectId);
} else if ("S1".equals(column)) {
resultMap = sjglZsjZsbtzMapper.getEquipDetailInfoByObjectId(objectId);
} else if ("P1".equals(column)) {
resultMap = sjglZsjZsbtzMapper.getJobDetailInfoByObjectId(jobId);
}
return ResponseHelper.buildResponse(resultMap);
}
}
......@@ -53,7 +53,7 @@ public class StationCacheDataInit implements CommandLineRunner {
stationCacheInfoDto.setStationType(stationBasic.getStationType());
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[","").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,2))||mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,2))||mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,2))||mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f",sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
List<QueryDto> queryDtoList = new ArrayList<>();
queryDtoList.add(new QueryDto("gatewayId",stationBasic.getFanGatewayId()));
......
......@@ -56,14 +56,16 @@ public interface SjglZsjZsbtzMapper extends BaseMapper<SjglZsjZsbtz> {
@Param("size") Integer size,
@Param("parentCode") String parentCode,
@Param("date") String date,
@Param("qrCodeColor") String qrCodeColor);
@Param("qrCodeColor") String qrCodeColor,
@Param("ne") String ne);
/**
* 设备赋码列表
*/
Integer getEquipYardByPageCount(@Param("parentCode") String parentCode,
@Param("date") String date,
@Param("qrCodeColor") String qrCodeColor);
@Param("qrCodeColor") String qrCodeColor,
@Param("ne") String ne);
......@@ -75,12 +77,18 @@ public interface SjglZsjZsbtzMapper extends BaseMapper<SjglZsjZsbtz> {
@Param("size") Integer size,
@Param("parentCode") String parentCode,
@Param("date") String date,
@Param("qrCodeColor") String qrCodeColor);
@Param("qrCodeColor") String qrCodeColor,
@Param("ne") String ne);
/**
* 任务赋码列表数量统计
*/
Integer getJobYardByPageCount(@Param("parentCode") String parentCode,
@Param("date") String date,
@Param("qrCodeColor") String qrCodeColor);
@Param("qrCodeColor") String qrCodeColor,
@Param("ne") String ne);
Map<String, Object> getEquipDetailInfoByObjectId(@Param("objectId") String objectId);
Map<String, Object> getJobDetailInfoByObjectId(@Param("objectId") String objectId);
}
......@@ -14,7 +14,7 @@ public interface TemporaryDataMapper extends BaseMapper<TemporaryData> {
List<Map<String, String>> timingTemporarysSorageData (@RequestParam(value ="gatewayId" ) String gatewayId);
Map<String, String> getStatisticsInfo (@RequestParam(value ="gatewayId" ) String gatewayId,
Map<String, Object> getStatisticsInfo (@RequestParam(value ="gatewayId" ) String gatewayId,
@RequestParam(value ="equipmentIndexName" ) String equipmentIndexName);
......
......@@ -157,7 +157,7 @@ public class LargeScreenImpl {
@Scheduled(cron = "0/10 * * * * ?")
private void sendQYYXZBMqtt(){
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getAreaCode));
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongArea));
for (String s : belongAreaList.keySet()) {
List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
getqy(ids,s);
......@@ -315,7 +315,7 @@ public class LargeScreenImpl {
@Scheduled(cron = "0/10 * * * * ?")
private void sendQYFDLMqtt(){
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getAreaCode));
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongArea));
for (String s : belongAreaList.keySet()) {
List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
getSeriesDataqy(new Date(),ids,s);
......@@ -377,7 +377,7 @@ public class LargeScreenImpl {
value1.add(monthy);
map.put("moon.keyword",value1);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"value" ,"day.keyword",ESEquipments.class);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueDouble" ,"day.keyword",ESEquipments.class);
Map<String,Double> mapdta=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.0000");
......@@ -426,7 +426,7 @@ public class LargeScreenImpl {
value1.add(monthy);
map.put("moon.keyword",value1);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"value" ,"day.keyword",ESEquipments.class);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueDouble" ,"day.keyword",ESEquipments.class);
Map<String,Double> mapdta=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.0000");
......
......@@ -1460,7 +1460,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return resultMap;
}
public Map<String, String> getStatisticsInfo(String gatewayId ,String equipmentIndexName){
public Map<String, Object> getStatisticsInfo(String gatewayId ,String equipmentIndexName){
return temporaryDataMapper.getStatisticsInfo(gatewayId,equipmentIndexName);
}
......@@ -1758,7 +1758,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public void sendMqttByRanking( List< Map<String,Object>> list,String code,String topic){
//先发送区域消息
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongArea));
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getAreaCode));
for (String s : belongAreaList.keySet()) {
List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
String idStrings = String.join(",", ids);
......@@ -1769,7 +1769,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
result.setCurrent(1);
result.setTotal(resultList.size());
try {
emqKeeper.getMqttClient().publish(s+"/"+topic+"/"+code,JSON.toJSONString(result).getBytes(),0,false);
emqKeeper.getMqttClient().publish(topic+"/"+code+"/"+s,JSON.toJSONString(result).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
......
......@@ -22,9 +22,11 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
......@@ -115,13 +117,20 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
Integer current,
Integer size,
String date,
String qrCodeColor) {
List<Map<String, Object>> resultList = personBasicMapper.getPersonYardByPage((current - 1) * size, size , parentCode, date, qrCodeColor);
Integer count = personBasicMapper.getPersonYardByPageCount(parentCode, date, qrCodeColor);
String qrCodeColor,
String ne,
BigDecimal score) {
List<Map<String, Object>> resultList = personBasicMapper.getPersonYardByPage((current - 1) * size, size , parentCode, date, qrCodeColor, ne);
Integer count = personBasicMapper.getPersonYardByPageCount(parentCode, date, qrCodeColor, ne);
resultList.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
item.put("faultInfo", "证书不全或临期");
item.put("faultLevel", "严重");
if (!Objects.isNull(score)) {
item.put("mark", new BigDecimal(100).subtract(score));
}
});
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setRecords(resultList);
......@@ -130,4 +139,9 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
mapPage.setTotal(count);
return mapPage;
}
public Map<String, Object> getPersonDetailInfoByObjectId(String objectId) {
Map<String, Object> resultMap = personBasicMapper.getPersonDetailInfoByObjectId(objectId);
return resultMap;
}
}
\ No newline at end of file
......@@ -74,7 +74,7 @@
LEFT JOIN privilege_company b on a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
b.COMPANY_CODE like concat(#{parentCode},'%')
b.ORG_CODE like concat(#{parentCode},'%')
</if>
</where>
GROUP BY
......@@ -90,7 +90,7 @@
LEFT JOIN privilege_company b on a.WERKS = b.COMPANY_CODE
<where>
<if test="parentCode != null and parentCode != ''">
b.COMPANY_CODE like concat(#{parentCode},'%')
b.ORG_CODE like concat(#{parentCode},'%')
</if>
</where>
GROUP BY
......@@ -102,7 +102,8 @@
ifnull(a.SBMC, '') as objectName ,
ifnull(a.QRCODE_COLOR, '') AS qrCodeColor,
ifnull(b.COMPANY_NAME, '') AS stationName,
ifnull(a.UPDATE_TIME, '') as recDate
ifnull(a.UPDATE_TIME, '') as recDate,
SBBM as objectId
FROM
sjgl_zsj_zsbtz a
LEFT JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE
......@@ -114,7 +115,10 @@
AND a.UPDATE_TIME like concat(#{date},'%')
</if>
<if test="qrCodeColor != null and qrCodeColor != ''">
AND a.QRCODE_COLOR like concat(#{qrCodeColor},'%')
AND a.QRCODE_COLOR = #{qrCodeColor}
</if>
<if test="ne != null and ne != ''">
AND a.QRCODE_COLOR != #{ne}
</if>
</where>
ORDER BY a.CREATE_TIME DESC
......@@ -135,7 +139,10 @@
AND a.UPDATE_TIME like concat(#{date},'%')
</if>
<if test="qrCodeColor != null and qrCodeColor != ''">
AND a.QRCODE_COLOR like concat(#{qrCodeColor},'%')
AND a.QRCODE_COLOR = #{qrCodeColor}
</if>
<if test="ne != null and ne != ''">
AND a.QRCODE_COLOR != #{ne}
</if>
</where>
</select>
......@@ -145,10 +152,13 @@
ifnull(a.JOB_DESCRIPTION, '') as objectName ,
ifnull(a.qrcode_color, '') AS qrCodeColor,
ifnull(b.COMPANY_NAME, '') AS stationName,
ifnull(a.CREATE_TIME, '') as recDate
ifnull(a.CREATE_TIME, '') as recDate,
a.DBID AS jobId,
c.SBBM as objectId
FROM
fdgl_job_main a
LEFT JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE
left join sjgl_zsj_zsbtz c on a.EQUIP_DBID = c.DBID
<where>
<if test="parentCode != null and parentCode != ''">
AND b.ORG_CODE like concat(#{parentCode},'%')
......@@ -157,7 +167,10 @@
AND a.CREATE_TIME like concat(#{date},'%')
</if>
<if test="qrCodeColor != null and qrCodeColor != ''">
AND a.QRCODE_COLOR like concat(#{qrCodeColor},'%')
AND a.QRCODE_COLOR = #{qrCodeColor}
</if>
<if test="ne != null and ne != ''">
AND a.QRCODE_COLOR != #{ne}
</if>
</where>
ORDER BY a.CREATE_TIME DESC
......@@ -178,8 +191,42 @@
AND a.CREATE_TIME like concat(#{date},'%')
</if>
<if test="qrCodeColor != null and qrCodeColor != ''">
AND a.QRCODE_COLOR like concat(#{qrCodeColor},'%')
AND a.QRCODE_COLOR = #{qrCodeColor}
</if>
<if test="ne != null and ne != ''">
AND a.QRCODE_COLOR != #{ne}
</if>
</where>
</select>
<select id="getEquipDetailInfoByObjectId" resultType="java.util.Map">
SELECT
IFNULL(`SBBM`, '') as `code`,
IFNULL(SBMC, '') as `name`,
IFNULL(GGXH, '') as typeCode,
IFNULL(SCCJ, '') as source,
'' as stationName,
IFNULL(QRCODE_COLOR, 'green') as qrCodeColor,
IFNULL(UPDATE_TIME, '') AS recDate
FROM
sjgl_zsj_zsbtz
where SBBM = #{objectId}
limit 1
</select>
<select id="getJobDetailInfoByObjectId" resultType="java.util.Map">
SELECT
IFNULL(`JOB_DESCRIPTION`, '') as `name`,
case
when QRCODE_COLOR = 'red' then '重大'
when QRCODE_COLOR = 'yellow' then '超时'
else '正常' end as `status`,
IFNULL(QRCODE_COLOR, 'green') as qrCodeColor,
IFNULL(ZFZR, '') as person,
'' as phone,
IFNULL(CREATE_TIME, '') as `recDate`
FROM
fdgl_job_main
where DBID = #{objectId}
</select>
</mapper>
......@@ -12,7 +12,7 @@
`temporary_data`
<where>
<if test="gatewayId != null and gatewayId != ''">
gatewayId = #{gatewayId}
gatewayId in( ${gatewayId})
</if>
<if test="gatewayId == null or gatewayId == ''">
equipmentNumber is not null and equipmentIndexName is not null
......
......@@ -715,23 +715,23 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
}
public Page<Map<String, Object>> getPersonYardByPage(String parentCode,
Integer current,
Integer size,
String date,
String qrCodeColor) {
List<Map<String, Object>> resultList = personBasicMapper.getPersonYardByPage((current - 1) * size, size , parentCode, date, qrCodeColor);
Integer count = personBasicMapper.getPersonYardByPageCount(parentCode, date, qrCodeColor);
resultList.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
});
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setRecords(resultList);
mapPage.setCurrent(current);
mapPage.setSize(size);
mapPage.setTotal(count);
return mapPage;
}
// public Page<Map<String, Object>> getPersonYardByPage(String parentCode,
// Integer current,
// Integer size,
// String date,
// String qrCodeColor) {
// List<Map<String, Object>> resultList = personBasicMapper.getPersonYardByPage((current - 1) * size, size , parentCode, date, qrCodeColor);
// Integer count = personBasicMapper.getPersonYardByPageCount(parentCode, date, qrCodeColor);
//
// resultList.forEach(item -> {
// String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
// item.put("name", name);
// });
// Page<Map<String, Object>> mapPage = new Page<>();
// mapPage.setRecords(resultList);
// mapPage.setCurrent(current);
// mapPage.setSize(size);
// mapPage.setTotal(count);
// return mapPage;
// }
}
\ No newline at end of file
......@@ -39,8 +39,8 @@ public class ESEquipments {
private String unit;
@Field(type = FieldType.Text, index = false)
private String value;
@Field(type = FieldType.Double, index = false)
private Double valueDouble;
@Field(type = FieldType.Float, index = false)
private Float valueDouble;
@Field(type = FieldType.Text , index = false)
private String valueLabel;
@Field(type = FieldType.Text , index = false)
......@@ -59,7 +59,7 @@ public class ESEquipments {
private String displayName;
public ESEquipments(Double valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
public ESEquipments(Float valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
this.valueDouble = valueDouble;
this.id = id;
......
......@@ -45,14 +45,13 @@ public class CommonConstans {
public static final HashMap<String, String> fanStatus = new HashMap<String, String>() {
{
put("发电状态", "正常运行");
put("报警状态", "警运行");
put("停机状态", "正常停机");
put("故障状态", "故障停机");
put("报警状态", "警运行");
put("停机状态", "停机状态");
put("故障状态", "故障状态");
put("待机状态", "待机状态");
put("维护状态", "维护状态");
put("限功率", "实时故障22");
put("限功率", "限功率");
put("通讯中断", "通讯中断");
}
};
// 正常运行 运行=1
......
......@@ -175,7 +175,7 @@ public class DemoController extends BaseController {
@GetMapping("/test4")
public ResponseModel<Integer> demoTest3() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801435891929089","1669524885619085313"};
String [] strings = {"1668801435891929089","1669524885619085313","1668801570352926721","1669525017559306241"};
// String [] strings = {"1669524885619085313"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
......@@ -195,7 +195,7 @@ public class DemoController extends BaseController {
for (MonitorFanIndicator monitorFanIndicator : list) {
ESEquipments eSEquipments=new ESEquipments(
3.55,
null,
monitorFanIndicator.getAddressGateway(),
monitorFanIndicator.getIndexAddress(),
monitorFanIndicator.getDataType(),
......@@ -212,7 +212,7 @@ public class DemoController extends BaseController {
monitorFanIndicator.getFrontModule(),
monitorFanIndicator.getSystemType(),
monitorFanIndicator.getPictureName(),
"" );
monitorFanIndicator.getEquipmentNumber());
listit.add(eSEquipments);
......@@ -289,7 +289,7 @@ public class DemoController extends BaseController {
ESEquipments eSEquipments=new ESEquipments(
3.55,
null,
monitorFanIndicator.getAddressGateway(),
monitorFanIndicator.getIndexAddress(),
monitorFanIndicator.getDataType(),
......@@ -395,7 +395,7 @@ public class DemoController extends BaseController {
@ApiOperation(value = "分组求和数")
@GetMapping("/test10")
public SearchHits demoTest10() {
QueryBuilder queryBuilder = QueryBuilders.matchQuery("equipmentIndexName", "有功功率");
QueryBuilder queryBuilder = QueryBuilders.matchQuery("equipmentIndexName", "年发电量");
......@@ -490,14 +490,13 @@ public class DemoController extends BaseController {
public Map demoTest14() {
List<String> value=new ArrayList<>();
value.add(ss);
value.add(zfs);
value.add(zfslj);
value.add("年发电量");
Map<String,List<String>> map=new HashMap<>();
map.put("equipmentIndexName.keyword",value);
// List<String> value1=new ArrayList<>();
// value1.add("1668801435891929089");
// map.put("gatewayId.keyword",value1);
List<String> value1=new ArrayList<>();
value1.add("1668801435891929089");
map.put("gatewayId.keyword",value1);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword",ESEquipments.class);
......@@ -553,12 +552,12 @@ public class DemoController extends BaseController {
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化升压站")
@ApiOperation(value = "初始化inlfuxdb-new")
@GetMapping("/test17")
public ResponseModel<Integer> demoTest17() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801435891929089","1669524885619085313"};
// String [] strings = {"1669525017559306241"};
String [] strings = {"1668801435891929089","1669524885619085313","1668801570352926721","1669525017559306241"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
......@@ -582,15 +581,15 @@ public class DemoController extends BaseController {
Map<String, String> tag = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>();
tag.put("address", monitorFanIndicator.getIndexAddress());
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
maps2.put("address", monitorFanIndicator.getIndexAddress());
maps2.put("dataType", monitorFanIndicator.getDataType());
maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
tag.put("gatewayId", monitorFanIndicator.getGateway());
maps2.put("gatewayId", monitorFanIndicator.getGateway());
maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
maps2.put("createdTime", "2023-07-05 18:30:26");
maps2.put("unit", monitorFanIndicator.getUnit());
maps2.put("value", "4");
maps2.put("value", "");
maps2.put("traceId", "");
maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
......@@ -599,9 +598,8 @@ public class DemoController extends BaseController {
maps2.put("pictureName", monitorFanIndicator.getPictureName());
//升压站的字段显示名称
maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
influxDbConnection.insert("test_" + monitorFanIndicator.getGateway(), tag, maps2);
influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2,1688558007051L, TimeUnit.MILLISECONDS);
}
}
return ResponseHelper.buildResponse(num);
}
......
......@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.DeaviationRateDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.EquipAlarmEventServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import io.swagger.annotations.Api;
......@@ -48,6 +49,9 @@ public class MonitorFanIdxController extends BaseController {
@Autowired
MonitorFanIndicatorImpl monitorFanIndicator;
@Autowired
EquipAlarmEventServiceImpl equipAlarmEventService;
@Autowired
StationBasicMapper stationBasicMapper;
......@@ -125,6 +129,8 @@ public class MonitorFanIdxController extends BaseController {
IndexDto indexDto = indexDtoList.get(i-1);
hashMap.put("url"+i,fanStatusImagePathPrefix+"/"+"风机-"+indexDto.getState()+".gif");
hashMap.put("name"+i,prefix+indexDto.getEquipmentNumber());
//用于参数传递
hashMap.put("name"+i+'d',indexDto.getEquipmentNumber());
}
page.setTotal(10);
page.setSize(10);
......@@ -259,7 +265,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "概览-全站功率曲线")
@GetMapping("/overviewWindSpeed")
public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false)String stationId,@RequestParam(value = "type", required = false)String type) {
public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false)String stationId,@RequestParam(value = "type", required = false)String type,@RequestParam(value = "areaCode", required = false)String areaCode) {
String gatewayId = "";
if (null != stationId){
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
......@@ -268,6 +274,7 @@ public class MonitorFanIdxController extends BaseController {
gatewayId = stationBasic.getFanGatewayId();
}
}
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeedAll(gatewayId);
return ResponseHelper.buildResponse(detailsWindSpeed);
......@@ -694,7 +701,7 @@ public class MonitorFanIdxController extends BaseController {
// if (null != stationType){
// gatewayId = stationBasic.getBoosterGatewayId();
// }
return ResponseHelper.buildResponse(monitorFanIndicator.getStatisticsInfo(stationId,equipmentIndexName));
return ResponseHelper.buildResponse(monitorFanIndicator.getStatisticsInfo(equipmentIndexName,stationId));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......@@ -789,8 +796,10 @@ public class MonitorFanIdxController extends BaseController {
for (StationBasic stationBasic : stationBasics) {
String gatewayId = stationBasic.getFanGatewayId();
String werks = stationBasic.getStationNumber();
if (!stationBasic.getStationType() .equals("FDZ")){
monitorFanIndicator.getListByNbq(gatewayId,werks,stationBasic.getSequenceNbr().toString());
}
}
return CommonResponseUtil.success();
......@@ -803,7 +812,14 @@ public class MonitorFanIdxController extends BaseController {
Map<String, Object> result = monitorFanIndicator.partofWaring3D(stationId,equipNum);
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "逆变器状态数量")
@GetMapping("/nbqStatus")
public ResponseModel<Page<Map<String, Object>>> nbqStatus(@RequestParam("stationId") String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Page<Map<String, Object>> result = monitorFanIndicator.nbqStatus(stationBasic.getFanGatewayId());
return ResponseHelper.buildResponse(result);
}
@ApiOperation(value = "电站排名")
@Scheduled(cron = "0/10 * * * * ? ")
......@@ -861,4 +877,18 @@ public class MonitorFanIdxController extends BaseController {
return CommonResponseUtil.success();
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "实时告警")
@GetMapping("/getEventByEquipIndex")
public ResponseModel<ResultsData> getEventByEquipIndex(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "stationId") String stationId,
@RequestParam(value = "equipIndex") String equipIndex) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
ResultsData resultsData = equipAlarmEventService.getEventByEquipIndex(gatewayId, current, size, equipIndex);
return ResponseHelper.buildResponse(resultsData);
}
}
......@@ -48,7 +48,7 @@ public class MonitoringMapController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取监盘全国-安全生产天数")
@GetMapping("/getSecDays")
public ResponseModel<String> getSecDays(@RequestParam (value = "provinceName", required = false)String provinceName,@RequestParam (value = "type", required = false)String type) {
public ResponseModel<HashMap<String,String>> getSecDays(@RequestParam (value = "provinceName", required = false)String provinceName,@RequestParam (value = "type", required = false)String type) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getSecDays(secStartDate));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
......
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@Data
@Accessors(chain = true)
public class EquipAlarmEventDto {
private Long sequenceNumber;
private Date createdTime;
private String gatewayId;
private String alarmDesc;
private String equipName;
private long sort;
}
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@Data
@Accessors(chain = true)
@TableName("equip_alarm_event")
public class EquipAlarmEvent {
@TableField("sequence_nbr")
private Long sequenceNumber;
@TableField("created_time")
private Date createdTime;
@TableField("equip_index")
private String equipIndex;
@TableField("alarm_desc")
private String alarmDesc;
@TableField("gateway_id")
private String gatewayId;
@TableField("equip_name")
private String equipName;
@TableField("sort")
private long sort;
}
......@@ -12,8 +12,10 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.QueryDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
......@@ -26,44 +28,49 @@ import java.util.stream.Collectors;
@Component
public class StationCacheDataInit implements CommandLineRunner {
Logger logger = LoggerFactory.getLogger(StationCacheDataInit.class);
@Resource
@Autowired
private StationBasicMapper stationBasicMapper;
@Resource
@Autowired
private RegionMapper regionMapper;
@Resource
@Autowired
private MapRegionMapper mapRegionMapper;
@Resource
@Autowired
private SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
@Resource
@Autowired
private CommonServiceImpl commonServiceImpl;
@Resource
@Autowired
private RedisTemplate redisTemplate;
Logger logger = LoggerFactory.getLogger(StationCacheDataInit.class);
public void run(String... args) throws Exception {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
redisTemplate.delete("station_info_cache");
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
List< MapRegion > mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
stationBasicList.forEach(stationBasic -> {
StationCacheInfoDto stationCacheInfoDto = new StationCacheInfoDto();
stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString());
stationCacheInfoDto.setStationName(stationBasic.getStationName());
stationCacheInfoDto.setStationType(stationBasic.getStationType());
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[","").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,2))||mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f",sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
try {
List<QueryDto> queryDtoList = new ArrayList<>();
queryDtoList.add(new QueryDto("gatewayId",stationBasic.getFanGatewayId()));
queryDtoList.add(new QueryDto("equipmentIndexName.keyword","有功功率"));
if(!stationBasic.getStationType().equals("FDZ")){
queryDtoList.add(new QueryDto("frontModule","逆变器"));
queryDtoList.add(new QueryDto("gatewayId", stationBasic.getFanGatewayId()));
queryDtoList.add(new QueryDto("equipmentIndexName.keyword", "有功功率"));
if (!stationBasic.getStationType().equals("FDZ")) {
queryDtoList.add(new QueryDto("frontModule", "逆变器"));
}
stationCacheInfoDto.setEquipmentNumbers(commonServiceImpl.getCount(queryDtoList, "equipmentNumber.Keyword", ESEquipments.class).toString());
} catch (Exception exception) {
logger.info("--------------------查询ES错误---------------------------");
}
stationCacheInfoDto.setEquipmentNumbers(commonServiceImpl.getCount(queryDtoList,"equipmentNumber.Keyword", ESEquipments.class).toString());
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
stationCacheInfoDtos.add(stationCacheInfoDto);
});
redisTemplate.opsForList().leftPushAll("station_info_cache",stationCacheInfoDtos);
redisTemplate.opsForList().leftPushAll("station_info_cache", stationCacheInfoDtos);
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipAlarmEvent;
import java.util.List;
public interface EquipAlarmEventMapper extends BaseMapper<EquipAlarmEvent> {
String getLastDataBySort(String gatewayId);
List<EquipAlarmEvent> getOldDataBySort(String sort,String gatewayId);
}
......@@ -341,7 +341,8 @@ public class CommonServiceImpl {
}
public StationCacheInfoDto getStationCacheInfoDtoByStationId(String stationId) {
return getListStationCacheInfoDto().stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationId().equals(stationId)).collect(Collectors.toList()).get(0);
StationCacheInfoDto stationCacheInfoDto = this.getListStationCacheInfoDto().stream().filter(stationCacheInfoDto1 -> stationCacheInfoDto1.getStationId().equals(stationId)).collect(Collectors.toList()).get(0);
return stationCacheInfoDto;
}
public String getFanDevicePrefix(String stationid) {
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.EquipAlarmEventDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipAlarmEvent;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.EquipAlarmEventMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Arrays;
import java.util.List;
@Service
public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto, EquipAlarmEvent, EquipAlarmEventMapper> {
@Autowired
EquipAlarmEventMapper equipAlarmEventMapper;
public ResultsData getEventByEquipIndex(String gatewayId, int current, int size, String equipIndex) {
LambdaQueryWrapper<EquipAlarmEvent> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(EquipAlarmEvent::getEquipIndex, equipIndex);
queryWrapper.eq(EquipAlarmEvent::getGatewayId, gatewayId);
queryWrapper.orderByDesc(EquipAlarmEvent::getCreatedTime);
List<EquipAlarmEvent> equipAlarmEvents = equipAlarmEventMapper.selectList(queryWrapper);
DataGridMock DataGridMock = new DataGridMock(current, equipAlarmEvents.size(), false, current, equipAlarmEvents);
ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名", "设备名", "dataGrid", "equipName");
ColModel colModelStationName = new ColModel("alarmDesc", "alarmDesc", "事件描述", "事件描述", "dataGrid", "alarmDesc");
ColModel colModelEventDesc = new ColModel("createdTime", "createdTime", "告警时间", "告警时间", "dataGrid", "createdTime");
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -9,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.AlarmDesc;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.ElectricQuantity;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.KGName;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
......@@ -22,15 +25,13 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.AlarmEventMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SwitchPictureMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SystemEnumMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.TemporaryDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IMonitorFanIndicator;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import com.yeejoin.amos.component.robot.BadRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -44,6 +45,8 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.Collator;
import java.text.ParseException;
import java.util.*;
......@@ -60,60 +63,51 @@ import java.util.stream.Collectors;
@Slf4j
public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private final static List<String> fanStatesList = Arrays.asList("报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "正常发电状态");
@Autowired
private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
@Autowired
private StationBasicMapper stationBasicMapper;
@Autowired
private RegionMapper regionMapper;
@Autowired
InfluxDButils influxDButils;
@Autowired
InfluxdbUtil influxdbUtil;
@Autowired
SystemEnumMapper systemEnumMapper;
@Autowired
SwitchPictureMapper switchPictureMapper;
@Autowired
SjglZsjZsbtzServiceImpl sjglZsjZsbtzServiceImpl;
@Autowired
TpriDmpDatabookServiceImpl tpriDmpDatabookServiceImpl;
@Autowired
TemporaryDataMapper temporaryDataMapper;
@Autowired
AlarmEventMapper alarmEventMapper;
@Autowired
AlarmEventServiceImpl alarmEventService;
@Autowired
TemporaryDataServiceImpl temporaryDataService;
@Autowired
CommonServiceImpl commonServiceImpl;
@Autowired
EquipAlarmEventMapper equipAlarmEventMapper;
@Autowired
EquipAlarmEventServiceImpl equipAlarmEventService;
@Autowired
EmqKeeper emqKeeper;
@Value("${pictureUrl}")
String pictureUrl;
@Autowired
private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
@Autowired
private StationBasicMapper stationBasicMapper;
@Autowired
private RegionMapper regionMapper;
//风机状态列表
@Value("${fan.statuts.stattuspath}")
private String fanStatusImagePathPrefix;
@Value("${pictureUrl}")
String pictureUrl;
@Value("classpath:/json/topic.json")
private Resource topic;
@Value("classpath:/json/fanlocation.json")
private Resource fanlocation;
private List<Map> list;
@Override
......@@ -198,9 +192,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Page<IndexDto> page = new Page<>(current, size);
String sql = "";
if (StringUtils.isNotEmpty(systemType)) {
sql = String.format("SELECT equipmentIndexName, value, frontModule, unit FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and frontModule =~/%s/ and systemType =~/%s/ ", stationBasic.getFanGatewayId(), equipNum, frontModule, systemType);
sql = String.format("SELECT equipmentIndexName, value, frontModule, unit,systemType FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and frontModule =~/%s/ and systemType =~/%s/ ", stationBasic.getFanGatewayId(), equipNum, frontModule, systemType);
} else {
sql = String.format("SELECT equipmentIndexName, value, frontModule, unit FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and frontModule =~/%s/", stationBasic.getFanGatewayId(), equipNum, frontModule);
sql = String.format("SELECT equipmentIndexName, value, frontModule, unit,systemType FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and frontModule =~/%s/", stationBasic.getFanGatewayId(), equipNum, frontModule);
}
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
influxDBList.stream().forEach(e -> {
......@@ -327,7 +321,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<IndexDto> equipNumList = influxDButils.getListData(sqlEquipNumList, IndexDto.class);
Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1));
equipNumList.forEach(item -> {
String status = ObjectUtils.isEmpty(CommonConstans.fanStatus.get(item.getState())) ? "通讯中断" : CommonConstans.fanStatus.get(item.getState());
String status = ObjectUtils.isEmpty(CommonConstans.fanStatus.get(collect.get(item.getEquipmentNumber()))) ? "通讯中断" : CommonConstans.fanStatus.get(collect.get(item.getEquipmentNumber()));
item.setState(status);
});
return equipNumList;
......@@ -435,7 +429,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public IndexDto getFanBasicInfoByEquipNum(String equipNum, String stationId) {
String json = null;
try {
json = IOUtils.toString(fanlocation.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
JSONArray jsonArray = JSONObject.parseArray(json);
JSONObject jsonObject = (JSONObject) jsonArray.get(Integer.valueOf(equipNum)-1);
IndexDto indexDto = new IndexDto();
indexDto.setLongitude(String.valueOf(jsonObject.get("longitude")));
indexDto.setLatitude(String.valueOf(jsonObject.get("latitude")));
StationBasic stationBasic = getOneByStationNumber(stationId);
String sql = String.format("SELECT equipmentNumber, equipmentSpecificName, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and equipmentIndexName =~/^报警状态|停机状态|故障状态|待机状态|维护状态|正常发电状态$/ and value = 'true' order by time desc limit 1", stationBasic.getFanGatewayId(), equipNum);
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
......@@ -796,6 +800,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryData.setGatewayId(indicatorsDto.getGatewayId());
temporaryData.setValue(Float.valueOf(indicatorsDto.getValue()));
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryData.setEquipmentIndexName(indicatorsDto.getEquipmentNumber());
temporaryDatas.add(temporaryData);
} catch (Exception e) {
e.printStackTrace();
......@@ -809,6 +814,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryData.setGatewayId(indicatorsDto.getGatewayId());
temporaryData.setValue(Float.valueOf(indicatorsDto.getValue()));
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryData.setEquipmentIndexName(indicatorsDto.getEquipmentNumber());
temporaryDatass.add(temporaryData);
} catch (Exception e) {
e.printStackTrace();
......@@ -843,16 +849,26 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public List<Map<String, Object>> getStatusGzp(String gatewayId, String systemType, String frontModule, String equipNum) {
String sql = " SELECT displayName , value as state,equipmentIndexName FROM indicators_" + gatewayId + " WHERE frontModule =~/" + frontModule + "/ and systemType = '" + systemType + "'";
String sql = " SELECT displayName ,equipmentNumber , value as state,equipmentIndexName FROM indicators_" + gatewayId + " WHERE frontModule =~/" + frontModule + "/ and systemType = '" + systemType + "'";
if (null != equipNum) {
sql = " SELECT displayName , value as state,equipmentIndexName FROM indicators_" + gatewayId + " WHERE frontModule =~/" + frontModule + "/ and systemType = '" + systemType + "' and equipmentNumber ='" + equipNum + "'";
sql = " SELECT displayName , equipmentNumber , value as state,equipmentIndexName FROM indicators_" + gatewayId + " WHERE frontModule =~/" + frontModule + "/ and systemType = '" + systemType + "' and equipmentNumber ='" + equipNum + "'";
}
List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class);
List<Map<String, Object>> statusMaps = new ArrayList<>();
for (IndicatorsDto listDatum : listData) {
Map<String, Object> statusMap = new HashMap<>();
statusMap.put("data", StringUtils.isEmpty(listDatum.getDisplayName()) ? listDatum.getEquipmentIndexName() : listDatum.getDisplayName());
String data = listDatum.getDisplayName();
if(StringUtils.isEmpty(data)){
data=listDatum.getEquipmentIndexName();
}else {
if(data.equals(listDatum.getEquipmentNumber())){
data=listDatum.getEquipmentIndexName();
}else {
data = listDatum.getDisplayName();
}
}
statusMap.put("data", data);
statusMap.put("state", listDatum.getState().equals("false") ? 1 : 0);
statusMap.put("status", listDatum.getState().equals("false") ? 1 : 0);
statusMap.put("title", listDatum.getState().equals("false") ? "断" : "通");
......@@ -950,10 +966,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
if (Integer.parseInt(num) == Integer.parseInt(listDatum.getEquipmentNumber())) {
Map<String, Object> map = new HashMap<>();
map.put("title", prefix + listDatum.getEquipmentNumber());
//用于参数传递
map.put("title1", listDatum.getEquipmentNumber());
map.put("windSpeed", listDatum.getValue());
map.put("power", listDatum.getValueLabel());
//获取风机状态如果获取到的状态为空-则默认为正常运行状态
String fantStatus = ObjectUtils.isEmpty(fanstatutsHashMap.get(num)) ? "正常运行" : fanstatutsHashMap.get(num);
String fantStatus = ObjectUtils.isEmpty(fanstatutsHashMap.get(num)) ? "通讯中断" : fanstatutsHashMap.get(num);
map.put("url", fanStatusImagePathPrefix + File.separator + "风机-" + fantStatus + ".gif");
statusMaps.add(map);
}
......@@ -1000,7 +1018,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
windSqlList.add(item);
}
if ("有功功率".equals(item.getEquipmentIndexName())) {
if (!ObjectUtils.isEmpty(item.getValue())) {
item.setValue(String.format("%.2f", Double.parseDouble(item.getValue()) / 1000));
}
powerSqlList.add(item);
}
if ("瞬时风速".equals(item.getEquipmentIndexName())) {
......@@ -1017,10 +1037,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
windSqlList.forEach(item -> {
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("equipmentNumber", item.getEquipmentNumber());
stringStringHashMap.put("wind", item.getValue());
stringStringHashMap.put("wind", ObjectUtils.isEmpty(item.getValue())?"0.0":item.getValue());
stringStringHashMap.put("power", powerSqlMap.get(item.getEquipmentNumber()));
stringStringHashMap.put("windSpeed", windSpeedSqlMap.get(item.getEquipmentNumber()));
stringStringHashMap.put("electricity", String.format("%.4f", Double.valueOf(electricitySqlMap.get(item.getEquipmentNumber()))));
stringStringHashMap.put("electricity", String.format("%.4f",ObjectUtils.isEmpty(item.getEquipmentNumber())?0.0000:Double.valueOf(electricitySqlMap.get(item.getEquipmentNumber() ))));
resultList.add(stringStringHashMap);
});
//构建平台数据
......@@ -1040,7 +1061,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<AlarmEventDto> alarmEventList = alarmEventMapper.getAlarmEventList(null, stationId, current, size);
List<AlarmEventDto> sorrtedAlarmEventList = alarmEventList.stream().sorted(Comparator.comparing(AlarmEventDto::getCreatedTime).reversed()).collect(Collectors.toList());
// List<AlarmEventDto> sorrtedAlarmEventList = alarmEventList.stream().sorted(Comparator.comparing(AlarmEventDto::getCreatedTime).reversed()).collect(Collectors.toList());
ArrayList<Map<String, String>> resultList = new ArrayList<>();
alarmEventList.forEach(item -> {
HashMap<String, String> stringStringHashMap = new HashMap<>();
......@@ -1177,7 +1198,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<IndicatorsDto> xyxSqlData = influxDButils.getListData(xyxSql, IndicatorsDto.class);
xyxSqlData.forEach(item -> resultMap.put("xyx" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValue())));
String dlbjSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '电量表计'", gatewayId);
String dlbjSql = String.format("SELECT value, displayName FROM \"indicators_%s\" WHERE systemType = '模拟量' and frontModule = '模拟量'", gatewayId);
List<IndicatorsDto> dlbjSqlData = influxDButils.getListData(dlbjSql, IndicatorsDto.class);
// 正向总有功正向总无功需要计算
dlbjSqlData.forEach(item -> {
......@@ -1476,17 +1497,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return resultMap;
}
public Map<String, String> getStatisticsInfo( String equipmentIndexName,String stationId) {
public Map<String, String> getStatisticsInfo(String equipmentIndexName, String stationId) {
StationCacheInfoDto stationCacheInfoDto = commonServiceImpl.getStationCacheInfoDtoByStationId(stationId);
String gatewayId = stationCacheInfoDto.getFanGatewayId();
if (!"FDZ".equals(stationCacheInfoDto.getStationType())){
if (!"FDZ".equals(stationCacheInfoDto.getStationType())) {
gatewayId = stationCacheInfoDto.getBoosterGatewayId();
}
String sql = "SELECT value FROM indicators_" + stationCacheInfoDto.getBoosterGatewayId() + " WHERE equipmentIndexName='220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值' or equipmentIndexName='南瑞光差保护_313P'";
List<Map<String,Object>> resultList =influxdbUtil.query(sql);
String load = String.format("%.2f",Double.parseDouble(String.valueOf(resultList.get(0).get("value")))/Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
Map<String,String> result = temporaryDataMapper.getStatisticsInfo(gatewayId, equipmentIndexName);
result.put("load",load);
List<Map<String, Object>> resultList = influxdbUtil.query(sql);
String load = String.format("%.2f", Double.parseDouble(String.valueOf(resultList.get(0).get("value"))) / Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
Map<String, String> result = temporaryDataMapper.getStatisticsInfo(gatewayId, equipmentIndexName);
result.put("load", load);
return result;
}
......@@ -1507,6 +1528,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
return statusMaps;
}
public String keepTwoDecimalPlaces(String value) {
String s = "0.00";
if (!ObjectUtils.isEmpty(value)) {
......@@ -1622,7 +1644,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public List<Map<String, Object>> solarPowerOperation(String gatewayId) {
String sql = "SELECT * FROM indicators_" + gatewayId + " WHERE equipmentIndexName = '有功功率' or equipmentIndexName = '逆变器效率' or equipmentIndexName ='总直流功率' or equipmentIndexName ='日发电量' or equipmentIndexName ='总发电量' ";
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
......@@ -1713,18 +1734,18 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
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());
map.put("value" + number,String.format("%.2f",Double.parseDouble(indicatorsDto.getValue())) );
map.put("valueLabel" + number, String.format("%.2f",Double.parseDouble(indicatorsDto.getValueLabel())) );
maps.add(map);
}
TpriDmpDatabook tpriDmpDatabook = tpriDmpDatabookServiceImpl.getTpriDmpDatabookByDataName("集电线");
List<Map<String, Object>> dataMaps = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper.getStationInfoMapByStationGFWerks(werks, tpriDmpDatabook.getDataid().toString());
List<Map<String, Object>> dataMaps = sjglZsjZsbtzServiceImpl.sjglZsjZsbtzMapper.getStationInfoMapByStationGFWerks(werks,"集电线");
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) {
int intNum = Integer.parseInt(num);
Map<String, String> map = new HashMap<>();
map.put("titie", "#" + num);
for (Map<String, String> stringMap : maps) {
......@@ -1732,9 +1753,14 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
map.putAll(stringMap);
}
}
if (equipNum.contains(num)) {
List<String> list = Arrays.asList(equipNum.split(","));
list.forEach(e->{
if ( Integer.parseInt(e) == intNum){
statusMaps.add(map);
}
});
}
IPage<Map<String, String>> result = new Page<>();
result.setRecords(statusMaps);
......@@ -1742,7 +1768,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
result.setTotal(statusMaps.size());
i += 1;
try {
emqKeeper.getMqttClient().publish(stationId + "/fj/group" + i, JSON.toJSONString(result).getBytes(), 0, false);
emqKeeper.getMqttClient().publish(stationId + "/gf/group/" + i, JSON.toJSONString(result).getBytes(), 0, false);
} catch (MqttException e) {
log.info("消息发送失败");
e.printStackTrace();
......@@ -1779,7 +1805,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public Map<String, Object> nbqStatus(String gatewayId) {
public Page<Map<String, Object>> nbqStatus(String gatewayId) {
// String sql = " SELECT * FROM indicators_" + gatewayId + " WHERE (equipmentIndexName ='待机' or equipmentIndexName ='故障停机' or equipmentIndexName ='告警运行' or equipmentIndexName ='限额运行' or equipmentIndexName ='停机') and value = 'true'";
// List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql, IndicatorsDto.class);
//
......@@ -1895,7 +1922,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
}
String querySql = " SELECT * FROM indicators_" + gatewayId + " equipmentIndexName ='运行' and value = 'true'";
String querySql = " SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName ='运行' and value = 'true'";
List<IndicatorsDto> queryList = influxDButils.getListData(querySql, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(queryList)) {
List<String> collect = queryList.stream().map(IndicatorsDto::getEquipmentNumber).collect(Collectors.toList());
......@@ -1903,7 +1930,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
zcNum = collect.size() - strings.size();
}
String querySql1 = " SELECT * FROM indicators_" + gatewayId + " equipmentIndexName ='通讯异常' and value = 'true'";
String querySql1 = " SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName ='通讯异常' and value = 'true'";
List<IndicatorsDto> queryList1 = influxDButils.getListData(querySql1, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(queryList1)) {
List<String> collect1 = queryList.stream().map(IndicatorsDto::getEquipmentNumber).collect(Collectors.toList());
......@@ -1911,16 +1938,53 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
txNum = collect1.size() - strings1.size();
}
numMap.put("djNum", djNum);
numMap.put("gzNum", gzNum);
numMap.put("gjNum", gjNum);
numMap.put("xeNum", xeNum);
numMap.put("xdNum", xdNum);
numMap.put("txNum", txNum);
numMap.put("tjNum", tjNum);
numMap.put("zcNum", zcNum);
return numMap;
Page<Map<String, Object>> mapPage = new Page<>();
ArrayList<Map<String, Object>> resultList = new ArrayList<>();
HashMap<String, Object> map = new HashMap<>();
map.put("count", zcNum);
map.put("equipmentIndexName", "正常运行");
map.put("color", "#00AA00");
resultList.add(map);
HashMap<String, Object> map2 = new HashMap<>();
map2.put("count", tjNum);
map2.put("equipmentIndexName", "正常停机");
map2.put("color", "#0055FF");
resultList.add(map2);
HashMap<String, Object> map3 = new HashMap<>();
map3.put("count", xeNum);
map3.put("equipmentIndexName", "限功率");
map3.put("color", "#A3F5AA");
resultList.add(map3);
HashMap<String, Object> map4 = new HashMap<>();
map4.put("count", xdNum);
map4.put("equipmentIndexName", "限电停机");
map4.put("color", "#FF00FF");
resultList.add(map4);
HashMap<String, Object> map5 = new HashMap<>();
map5.put("count", gjNum);
map5.put("equipmentIndexName", "告警运行");
map5.put("color", "#F9AD14");
resultList.add(map5);
HashMap<String, Object> map6 = new HashMap<>();
map6.put("count", gzNum);
map6.put("equipmentIndexName", "故障停机");
map6.put("color", "#00AAFF");
resultList.add(map6);
HashMap<String, Object> map7 = new HashMap<>();
map7.put("count", djNum);
map7.put("equipmentIndexName", "待机");
map7.put("color", "#F91414");
resultList.add(map7);
HashMap<String, Object> map8 = new HashMap<>();
map8.put("count", txNum);
map8.put("equipmentIndexName", "通讯中断");
map8.put("color", "#7D8E95");
resultList.add(map8);
mapPage.setTotal(8);
mapPage.setSize(8);
mapPage.setCurrent(1);
mapPage.setRecords(resultList);
return mapPage;
}
......@@ -1968,10 +2032,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public Page<DeaviationRateDto> getDeaviAtionRate(String stationId, String equipNumber) {
StationCacheInfoDto stationCacheInfoDto = commonServiceImpl.getStationCacheInfoDtoByStationId(stationId);
Page<DeaviationRateDto> deaviationRateDtoPage = new Page<>(1,100);
List<DeaviationRateDto> deaviationRateDtoList =new ArrayList<>();
String sql = "SELECT * FROM indicators_" + stationCacheInfoDto.getFanGatewayId() + " WHERE equipmentIndexName =~/路电流/ and and equipmentNumber ='+" + equipNumber+"'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql,IndicatorsDto.class);
Page<DeaviationRateDto> deaviationRateDtoPage = new Page<>(1, 100);
List<DeaviationRateDto> deaviationRateDtoList = new ArrayList<>();
String sql = "SELECT * FROM indicators_" + stationCacheInfoDto.getFanGatewayId() + " WHERE equipmentIndexName =~/路电流/ and and equipmentNumber ='+" + equipNumber + "'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql, IndicatorsDto.class);
Random random = new Random();
indicatorsDtoList.forEach(indicatorsDto -> {
DeaviationRateDto deaviationRateDto = new DeaviationRateDto();
......@@ -1984,5 +2048,37 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
deaviationRateDtoPage.setRecords(deaviationRateDtoList);
return deaviationRateDtoPage;
}
public void addNbqAlarmEvent(String gatewayId) {
String sql = " SELECT * FROM indicators_" + gatewayId + " WHERE (equipmentIndexName ='待机' or equipmentIndexName ='停机' or equipmentIndexName ='告警运行' or equipmentIndexName ='限额运行' or equipmentIndexName ='降额运行' or equipmentIndexName ='故障停机'or equipmentIndexName ='通讯故障'or equipmentIndexName ='运行') and value = 'true'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListData(sql, IndicatorsDto.class);
List<EquipAlarmEvent> newEquipAlarmEvents = new ArrayList<>();
List<EquipAlarmEvent> newEquipAlarmEvent = new ArrayList<>();
long time = new Date().getTime();
for (IndicatorsDto indicatorsDto : indicatorsDtoList) {
EquipAlarmEvent equipAlarmEvent = new EquipAlarmEvent();
equipAlarmEvent.setEquipIndex(indicatorsDto.getEquipmentNumber());
equipAlarmEvent.setAlarmDesc(AlarmDesc.getCode(indicatorsDto.getEquipmentIndexName()));
equipAlarmEvent.setCreatedTime(DateUtils.longStr2Date(indicatorsDto.getCreatedTime()));
equipAlarmEvent.setGatewayId(gatewayId);
equipAlarmEvent.setSort(time);
newEquipAlarmEvents.add(equipAlarmEvent);
newEquipAlarmEvent.add(equipAlarmEvent);
}
String lastSort = equipAlarmEventMapper.getLastDataBySort(gatewayId);
if (null != lastSort ) {
List<EquipAlarmEvent> oldEquipAlarmEvents = equipAlarmEventMapper.getOldDataBySort(lastSort,gatewayId);
for (EquipAlarmEvent oldEquipAlarmEvent : oldEquipAlarmEvents) {
for (EquipAlarmEvent equipAlarmEvent : newEquipAlarmEvents) {
if (oldEquipAlarmEvent.getEquipIndex().equals(equipAlarmEvent.getEquipIndex()) && oldEquipAlarmEvent.getAlarmDesc().equals(equipAlarmEvent.getAlarmDesc())){
newEquipAlarmEvent.remove(equipAlarmEvent);
}
}
}
}
equipAlarmEventService.saveBatch(newEquipAlarmEvent);
}
}
......@@ -190,65 +190,65 @@ public class MonitoringServiceIMQTTmpl {
/**
* 实时推送-风电站风场总概览
*/
@Scheduled(cron = fanstationOverviewCron)
public void getFanstationOverview() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
String gatewayId = stationBasic.getFanGatewayId();
String[] sumColumns = new String[]{"日发电量", "月发电量", "年发电量"};
String[] avgColumns = new String[]{"有功功率", "瞬时风速"};
List<String> columnList = Arrays.asList(sumColumns);
List<String> columnLists = Arrays.asList(avgColumns);
Map<String, Object> columnMap = new HashMap<>();
for (String column : columnList) {
Double result = commonService.getTotalByIndicatior(gatewayId, column);
columnMap.put(column, result);
}
for (String column : columnLists) {
Double result = commonService.getAvgvalueByIndicatior(gatewayId, column);
columnMap.put(column, result);
}
String num = monitorFanIndicator.getFJCount(gatewayId);
columnMap.put("风机台数", num);
Double capacityl = commonService.getStationCapactityByStationWerks(stationBasic.getStationNumber());
columnMap.put("装机容量", capacityl);
List<Map<String, Object>> objects = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
data.put("title", Float.valueOf(columnMap.get("装机容量").toString()));
objects.add(data);
Map<String, Object> data1 = new HashMap<>();
data1.put("title", Float.valueOf(columnMap.get("日发电量").toString()));
objects.add(data1);
Map<String, Object> data2 = new HashMap<>();
data2.put("title", columnMap.get("风机台数").toString().replace(".0", ""));
objects.add(data2);
Map<String, Object> data3 = new HashMap<>();
data3.put("title", Float.valueOf(columnMap.get("月发电量").toString()));
objects.add(data3);
Map<String, Object> data4 = new HashMap<>();
data4.put("title", Float.valueOf(columnMap.get("瞬时风速").toString()));
objects.add(data4);
Map<String, Object> data5 = new HashMap<>();
data5.put("title", Float.valueOf(columnMap.get("年发电量").toString()));
objects.add(data5);
Map<String, Object> data6 = new HashMap<>();
data6.put("title", Float.valueOf(columnMap.get("有功功率").toString()));
objects.add(data6);
Map<String, Object> data7 = new HashMap<>();
data7.put("title", 0.00);
objects.add(data7);
IPage<Map<String, Object>> result = new Page<>();
result.setRecords(objects);
result.setCurrent(1);
result.setTotal(objects.size());
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationOverview_topic", JSON.toJSON(result).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送风电站总概览数据消息=================== 成功!" + JSON.toJSONString(result));
} catch (Exception exception) {
logger.error("-----------------发送风电站总概览数据消息=================== 失败!");
}
});
}
// @Scheduled(cron = fanstationOverviewCron)
// public void getFanstationOverview() {
// List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
// stationBasicList.forEach(stationBasic -> {
// String gatewayId = stationBasic.getFanGatewayId();
// String[] sumColumns = new String[]{"日发电量", "月发电量", "年发电量"};
// String[] avgColumns = new String[]{"有功功率", "瞬时风速"};
// List<String> columnList = Arrays.asList(sumColumns);
// List<String> columnLists = Arrays.asList(avgColumns);
// Map<String, Object> columnMap = new HashMap<>();
// for (String column : columnList) {
// Double result = commonService.getTotalByIndicatior(gatewayId, column);
// columnMap.put(column, result);
// }
// for (String column : columnLists) {
// Double result = commonService.getAvgvalueByIndicatior(gatewayId, column);
// columnMap.put(column, result);
// }
// String num = monitorFanIndicator.getFJCount(gatewayId);
// columnMap.put("风机台数", num);
// Double capacityl = commonService.getStationCapactityByStationWerks(stationBasic.getStationNumber());
// columnMap.put("装机容量", capacityl);
// List<Map<String, Object>> objects = new ArrayList<>();
// Map<String, Object> data = new HashMap<>();
// data.put("title", Float.valueOf(columnMap.get("装机容量").toString()));
// objects.add(data);
// Map<String, Object> data1 = new HashMap<>();
// data1.put("title", Float.valueOf(columnMap.get("日发电量").toString()));
// objects.add(data1);
// Map<String, Object> data2 = new HashMap<>();
// data2.put("title", columnMap.get("风机台数").toString().replace(".0", ""));
// objects.add(data2);
// Map<String, Object> data3 = new HashMap<>();
// data3.put("title", Float.valueOf(columnMap.get("月发电量").toString()));
// objects.add(data3);
// Map<String, Object> data4 = new HashMap<>();
// data4.put("title", Float.valueOf(columnMap.get("瞬时风速").toString()));
// objects.add(data4);
// Map<String, Object> data5 = new HashMap<>();
// data5.put("title", Float.valueOf(columnMap.get("年发电量").toString()));
// objects.add(data5);
// Map<String, Object> data6 = new HashMap<>();
// data6.put("title", Float.valueOf(columnMap.get("有功功率").toString()));
// objects.add(data6);
// Map<String, Object> data7 = new HashMap<>();
// data7.put("title", 0.00);
// objects.add(data7);
// IPage<Map<String, Object>> result = new Page<>();
// result.setRecords(objects);
// result.setCurrent(1);
// result.setTotal(objects.size());
// try {
// emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationOverview_topic", JSON.toJSON(result).toString().getBytes("UTF-8"), 1, true);
// logger.info("-----------------发送风电站总概览数据消息=================== 成功!" + JSON.toJSONString(result));
// } catch (Exception exception) {
// logger.error("-----------------发送风电站总概览数据消息=================== 失败!");
// }
// });
// }
/**
* 实时推送-场站功率曲线总概览
......
......@@ -1083,7 +1083,9 @@ public class MonitoringServiceImpl {
return result;
}
public String getSecDays(String secStartDate) {
return String.valueOf(DateUtil.between(DateUtil.parse(secStartDate), DateUtil.date(), DateUnit.DAY));
public HashMap<String,String> getSecDays(String secStartDate) {
HashMap<String,String> result = new HashMap<>();
result.put("title",String.valueOf(DateUtil.between(DateUtil.parse(secStartDate), DateUtil.date(), DateUnit.DAY)));
return result;
}
}
......@@ -47,6 +47,7 @@ public class InfluxDButils {
if ("time".equals(k)) {
continue;
} else {
v = String.valueOf(v).equals("")?0.0:v;
bean.setPropertyValue(k, v);
}
}
......@@ -90,7 +91,7 @@ public class InfluxDButils {
for (int j = 0; j < columns.size(); ++j) {
String k = columns.get(j);
Object v = values.get(i).get(j);
v = String.valueOf(v).equals("")?0.0:v;
bean.setPropertyValue(k, v);
}
......
[
{
"euqipmentNumber": "01",
"latitude": "26°19'20.3968",
"longitude": "114°43'01.3487"
},
{
"euqipmentNumber": "02",
"latitude": "26°18'17.3192",
"longitude": "114°43'55.0756"
},
{
"euqipmentNumber": "03",
"latitude": "26°18'34.3219",
"longitude": "114°44'01.4686"
},
{
"euqipmentNumber": "04",
"latitude": "26°18'42.2673",
"longitude": "114°44'10.7522"
},
{
"euqipmentNumber": "05",
"latitude": "26°18'38.0098",
"longitude": "114°44'21.7018"
},
{
"euqipmentNumber": "06",
"latitude": "26°18'34.6466",
"longitude": "114°44'29.9556"
},
{
"euqipmentNumber": "07",
"latitude": "26°18'36.8995",
"longitude": "114°44'39.7470"
},
{
"euqipmentNumber": "08",
"latitude": "26°18'33.5051",
"longitude": "114°44'50.8102"
},
{
"euqipmentNumber": "09",
"longitude": "114°42'38.4597",
"latitude": "26°16'45.3175"
},
{
"euqipmentNumber": "10",
"longitude": "114°42'46.7892",
"latitude": "26°16'34.2193"
},
{
"euqipmentNumber": "11",
"longitude": "114°42'57.3524",
"latitude": "26°16'18.2295"
},
{
"euqipmentNumber": "12",
"longitude": "114°43'44.6453",
"latitude": "26°16'22.9530"
},
{
"euqipmentNumber": "13",
"latitude": "26°16'25.2473",
"longitude": "114°43'55.4240"
},
{
"euqipmentNumber": "14",
"latitude": "26°15'23.8288",
"longitude": "114°42'46.1713"
},
{
"euqipmentNumber": "15",
"latitude": "26°15'18.3501",
"longitude": "114°42'36.4494"
},
{
"euqipmentNumber": "16",
"latitude": "26°15'15.1157",
"longitude": "114°42'24.2207"
},
{
"euqipmentNumber": "17",
"latitude": "26°15'12.3541",
"longitude": "114°42'16.2315"
},
{
"euqipmentNumber": "18",
"latitude": "26°15'07.7590",
"longitude": "114°42'09.1002"
},
{
"euqipmentNumber": "19",
"latitude": "26°15'06.4482",
"longitude": "114°41'59.3730"
},
{
"euqipmentNumber": "20",
"latitude": "26°15'05.7242",
"longitude": "114°41'51.2436"
},
{
"euqipmentNumber": "21",
"latitude": "26°14'54.2353",
"longitude": "114°41'45.1572"
},
{
"euqipmentNumber": "22",
"latitude": "26°14'53.7742",
"longitude": "114°41'35.6931"
},
{
"euqipmentNumber": "23",
"latitude": "26°14'49.6670",
"longitude": "114°41'28.9852"
},
{
"euqipmentNumber": "24",
"latitude": "26°14'52.6637",
"longitude": "114°41'19.3269"
},
{
"euqipmentNumber": "25",
"latitude": "26°14'43.4608",
"longitude": "114°41'12.0974"
},
{
"euqipmentNumber": "26",
"latitude": "26°14'40.3649",
"longitude": "114°41'03.8101"
},
{
"euqipmentNumber": "27",
"latitude": "26°15'33.5730",
"longitude": "114°40'33.7931"
},
{
"euqipmentNumber": "28",
"latitude": "26°15'24.1330",
"longitude": "114°40'51.2196"
},
{
"euqipmentNumber": "29",
"latitude": "26°15'29.4603",
"longitude": "114°40'45.3326"
}
]
\ 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.jxiop.biz.mapper2.EquipAlarmEventMapper">
<select id="getLastDataBySort" resultType="java.lang.String">
select
sort
from
equip_alarm_event
<where>
<if test="gatewayId != null and gatewayId != ''">
gateway_id = #{gatewayId}
</if>
</where>
order by sort desc limit 1
</select>
<select id="getOldDataBySort" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipAlarmEvent">
select
*
from
equip_alarm_event
<where>
<if test="sort != null and sort != ''">
sort = #{sort}
</if>
AND gateway_id = #{gatewayId}
</where>
</select>
</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