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);
}
}
......@@ -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;
}
}
......@@ -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