Commit 519c1bae authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents a585c478 f3a598ab
...@@ -256,7 +256,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -256,7 +256,7 @@ public class BigScreenAnalyseController extends BaseController {
HashMap<String, Integer> wxMap = new HashMap<>(); HashMap<String, Integer> wxMap = new HashMap<>();
HashMap<String, Integer> zyMap = new HashMap<>(); HashMap<String, Integer> zyMap = new HashMap<>();
HashMap<String, Integer> jgMap = new HashMap<>(); HashMap<String, Integer> jgMap = new HashMap<>();
Set<String> list = new HashSet<>(); LinkedHashSet<String> list = new LinkedHashSet<>();
allEquipAlarmInfo.forEach(item -> { allEquipAlarmInfo.forEach(item -> {
if ("危险".equals(item.get("warningName"))) { if ("危险".equals(item.get("warningName"))) {
wxMap.put(item.get("station").toString(), Integer.parseInt(item.get("num").toString())); wxMap.put(item.get("station").toString(), Integer.parseInt(item.get("num").toString()));
...@@ -436,8 +436,8 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -436,8 +436,8 @@ public class BigScreenAnalyseController extends BaseController {
} else { } else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备"); query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName()); query.eq(IdxBizFanHealthLevel::getStatus, item.get("station"));
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore); query.lt(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore); query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query); IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel()); item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
...@@ -514,7 +514,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -514,7 +514,7 @@ public class BigScreenAnalyseController extends BaseController {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备"); query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, item.get("station")); query.eq(IdxBizFanHealthLevel::getStatus, item.get("station"));
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore); query.lt(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore); query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query); IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel()); item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
...@@ -549,13 +549,13 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -549,13 +549,13 @@ public class BigScreenAnalyseController extends BaseController {
if (100.0 == equipmentHealthScore) { if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全"); item.put("warningName", "安全");
} else { } else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备"); query.eq(IdxBizPvHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName()); query.eq(IdxBizPvHealthLevel::getStatus, item.get("station").toString());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore); query.lt(IdxBizPvHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore); query.ge(IdxBizPvHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query); IdxBizPvHealthLevel idxBizPvHealthLevel = idxBizPvHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel()); item.put("warningName", idxBizPvHealthLevel.getHealthLevel());
} }
item.put("healthIndex", equipmentHealthScore); item.put("healthIndex", equipmentHealthScore);
String subarray = CharSequenceUtil.replace(item.get("subarray").toString(), "#", ""); String subarray = CharSequenceUtil.replace(item.get("subarray").toString(), "#", "");
...@@ -616,13 +616,13 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -616,13 +616,13 @@ public class BigScreenAnalyseController extends BaseController {
if (100.0 == equipmentHealthScore) { if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全"); item.put("warningName", "安全");
} else { } else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备"); query.eq(IdxBizPvHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName()); query.eq(IdxBizPvHealthLevel::getStatus, item.get("station").toString());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore); query.lt(IdxBizPvHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore); query.ge(IdxBizPvHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query); IdxBizPvHealthLevel idxBizPvHealthLevel = idxBizPvHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel()); item.put("warningName", idxBizPvHealthLevel.getHealthLevel());
} }
item.put("healthIndex", equipmentHealthScore); item.put("healthIndex", equipmentHealthScore);
}); });
...@@ -708,7 +708,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -708,7 +708,7 @@ public class BigScreenAnalyseController extends BaseController {
String stationType = "风电站"; String stationType = "风电站";
List<IdxBizFanHealthLevel> collect = healthLevelInfoList.stream().filter(item -> item.getAnalysisObjType().contains(station)).collect(Collectors.toList()); List<IdxBizFanHealthLevel> collect = healthLevelInfoList.stream().filter(item -> item.getAnalysisObjType().contains(station)).collect(Collectors.toList());
for (IdxBizFanHealthLevel item : collect) { for (IdxBizFanHealthLevel item : collect) {
if (item.getAnalysisObjType().contains("子系统")) { if (!item.getAnalysisObjType().contains("子系统")) {
stationType = "光伏站"; stationType = "光伏站";
} }
} }
...@@ -784,7 +784,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -784,7 +784,7 @@ public class BigScreenAnalyseController extends BaseController {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.isNull(IdxBizFanHealthLevel::getStatus); query.isNull(IdxBizFanHealthLevel::getStatus);
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "全域"); query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "全域");
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, healthScoreInfo); query.lt(IdxBizFanHealthLevel::getGroupLowerLimit, healthScoreInfo);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, healthScoreInfo); query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, healthScoreInfo);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query); IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
...@@ -808,7 +808,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -808,7 +808,7 @@ public class BigScreenAnalyseController extends BaseController {
LambdaQueryWrapper<IdxBizFanHealthLevel> areaQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanHealthLevel> areaQuery = new LambdaQueryWrapper<>();
areaQuery.isNull(IdxBizFanHealthLevel::getStatus); areaQuery.isNull(IdxBizFanHealthLevel::getStatus);
areaQuery.eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区"); areaQuery.eq(IdxBizFanHealthLevel::getAnalysisObjType, "片区");
areaQuery.le(IdxBizFanHealthLevel::getGroupLowerLimit, areaHealthScoreInfo); areaQuery.lt(IdxBizFanHealthLevel::getGroupLowerLimit, areaHealthScoreInfo);
areaQuery.ge(IdxBizFanHealthLevel::getGroupUpperLimit, areaHealthScoreInfo); areaQuery.ge(IdxBizFanHealthLevel::getGroupUpperLimit, areaHealthScoreInfo);
IdxBizFanHealthLevel areaIdxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(areaQuery); IdxBizFanHealthLevel areaIdxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(areaQuery);
...@@ -848,7 +848,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -848,7 +848,7 @@ public class BigScreenAnalyseController extends BaseController {
LambdaQueryWrapper<IdxBizFanHealthLevel> stationQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanHealthLevel> stationQuery = new LambdaQueryWrapper<>();
stationQuery.like(IdxBizFanHealthLevel::getStatus, stationMap.getKey()); stationQuery.like(IdxBizFanHealthLevel::getStatus, stationMap.getKey());
stationQuery.eq(IdxBizFanHealthLevel::getAnalysisObjType, "场站"); stationQuery.eq(IdxBizFanHealthLevel::getAnalysisObjType, "场站");
stationQuery.le(IdxBizFanHealthLevel::getGroupLowerLimit, areaHealthScoreInfo); stationQuery.lt(IdxBizFanHealthLevel::getGroupLowerLimit, areaHealthScoreInfo);
stationQuery.ge(IdxBizFanHealthLevel::getGroupUpperLimit, areaHealthScoreInfo); stationQuery.ge(IdxBizFanHealthLevel::getGroupUpperLimit, areaHealthScoreInfo);
IdxBizFanHealthLevel stationLevel = idxBizFanHealthLevelMapper.selectOne(stationQuery); IdxBizFanHealthLevel stationLevel = idxBizFanHealthLevelMapper.selectOne(stationQuery);
stationDto.setStatus(ObjectUtils.isNotEmpty(stationLevel) ? stationLevel.getHealthLevel() : ""); stationDto.setStatus(ObjectUtils.isNotEmpty(stationLevel) ? stationLevel.getHealthLevel() : "");
...@@ -856,7 +856,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -856,7 +856,7 @@ public class BigScreenAnalyseController extends BaseController {
LambdaQueryWrapper<IdxBizPvHealthLevel> stationPvQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvHealthLevel> stationPvQuery = new LambdaQueryWrapper<>();
stationPvQuery.like(IdxBizPvHealthLevel::getStatus, stationMap.getKey()); stationPvQuery.like(IdxBizPvHealthLevel::getStatus, stationMap.getKey());
stationPvQuery.eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站"); stationPvQuery.eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站");
stationPvQuery.le(IdxBizPvHealthLevel::getGroupLowerLimit, areaHealthScoreInfo); stationPvQuery.lt(IdxBizPvHealthLevel::getGroupLowerLimit, areaHealthScoreInfo);
stationPvQuery.ge(IdxBizPvHealthLevel::getGroupUpperLimit, areaHealthScoreInfo); stationPvQuery.ge(IdxBizPvHealthLevel::getGroupUpperLimit, areaHealthScoreInfo);
IdxBizPvHealthLevel stationPvLevel = idxBizPvHealthLevelMapper.selectOne(stationPvQuery); IdxBizPvHealthLevel stationPvLevel = idxBizPvHealthLevelMapper.selectOne(stationPvQuery);
if (ObjectUtils.isNotEmpty(stationPvLevel)) { if (ObjectUtils.isNotEmpty(stationPvLevel)) {
...@@ -977,4 +977,17 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -977,4 +977,17 @@ public class BigScreenAnalyseController extends BaseController {
} }
return ResponseHelper.buildResponse(maps); return ResponseHelper.buildResponse(maps);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风电-场站风速")
@GetMapping("/getFanWindSpeedInfo")
public ResponseModel<Map<String, String>> getFanWindSpeedInfo(@RequestParam("stationId") String stationId) throws Exception {
if (StrUtil.isNotEmpty(stationId)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
stationId = stationBasic.getFanGatewayId();
}
return ResponseHelper.buildResponse(null);
}
} }
package com.yeejoin.amos.boot.module.jxiop.biz.emqx; package com.yeejoin.amos.boot.module.jxiop.biz.emqx;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HealthStatusIndicatorServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRecordServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRecordServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -16,9 +18,10 @@ import org.typroject.tyboot.component.emq.EmqKeeper; ...@@ -16,9 +18,10 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener; import org.typroject.tyboot.component.emq.EmqxListener;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.Date; import java.util.*;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
...@@ -26,11 +29,15 @@ public class WarningRecordStatusMessage extends EmqxListener { ...@@ -26,11 +29,15 @@ public class WarningRecordStatusMessage extends EmqxListener {
@Autowired @Autowired
protected EmqKeeper emqKeeper; protected EmqKeeper emqKeeper;
/**
* 预警状态修改消息 - 标准化
*/
public static final String WARNING_CHANGE_MESSAGE = "+/warning/change";
// 江西电建接收红黄绿码主题
private static final String QUESTION_STATUS_CHANGE = "question/status/change";
private static final BlockingQueue<JSONObject> blockingQueue = new LinkedBlockingQueue<JSONObject>(); private static final BlockingQueue<JSONArray> blockingQueueFan = new LinkedBlockingQueue<JSONArray>();
private static final BlockingQueue<JSONArray> blockingQueuePv = new LinkedBlockingQueue<JSONArray>();
@Autowired @Autowired
private IdxBizFanWarningRecordServiceImpl idxBizFanWarningRecordService; private IdxBizFanWarningRecordServiceImpl idxBizFanWarningRecordService;
...@@ -41,14 +48,21 @@ public class WarningRecordStatusMessage extends EmqxListener { ...@@ -41,14 +48,21 @@ public class WarningRecordStatusMessage extends EmqxListener {
@PostConstruct @PostConstruct
void init() throws Exception { void init() throws Exception {
new Thread(taskRunnable).start(); new Thread(taskRunnable).start();
emqKeeper.subscript(QUESTION_STATUS_CHANGE, 2, this); emqKeeper.subscript(WARNING_CHANGE_MESSAGE, 2, this);
} }
@Override @Override
public void processMessage(String topic, MqttMessage message) throws Exception { public void processMessage(String topic, MqttMessage message) throws Exception {
log.info("人员赋码消息{}", new String(message.getPayload())); if (topic.contains(HealthStatusIndicatorServiceImpl.SMART_ANALYSE_PV)) {
JSONObject ja = JSON.parseObject(new String(message.getPayload())); log.info("预警状态改变消息-光伏{}", new String(message.getPayload()));
blockingQueue.add(ja); JSONArray ja = JSON.parseArray(new String(message.getPayload()));
blockingQueuePv.add(ja);
} else if (topic.contains(HealthStatusIndicatorServiceImpl.SMART_ANALYSE_FAN)) {
log.info("预警状态改变消息-风电{}", new String(message.getPayload()));
JSONArray ja = JSON.parseArray(new String(message.getPayload()));
blockingQueueFan.add(ja);
}
} }
Runnable taskRunnable = new Runnable() { Runnable taskRunnable = new Runnable() {
...@@ -60,8 +74,10 @@ public class WarningRecordStatusMessage extends EmqxListener { ...@@ -60,8 +74,10 @@ public class WarningRecordStatusMessage extends EmqxListener {
k++; k++;
isRun = k < Integer.MAX_VALUE; isRun = k < Integer.MAX_VALUE;
try { try {
JSONObject analysisResult = blockingQueue.take(); JSONArray analysisResultFan = blockingQueueFan.take();
jxIopUpdate(analysisResult); jxIopUpdateFan(analysisResultFan);
JSONArray analysisResultPv = blockingQueuePv.take();
jxIopUpdatePv(analysisResultPv);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -69,22 +85,28 @@ public class WarningRecordStatusMessage extends EmqxListener { ...@@ -69,22 +85,28 @@ public class WarningRecordStatusMessage extends EmqxListener {
} }
}; };
public void jxIopUpdate(JSONObject analysisResult) { public void jxIopUpdateFan(JSONArray analysisResult) {
log.info("修改预警状态信息:{}", analysisResult); log.info("修改预警状态信息:{}", analysisResult);
if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("pv")) { List<JSONObject> taskList = JSONObject.parseArray(analysisResult.toJSONString(), JSONObject.class);
List<String> traceIds = taskList.stream().map(t -> t.get("traceId").toString()).collect(Collectors.toList());
LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已处置"); lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已处置");
lambda.set(IdxBizFanWarningRecord::getStatus, "1"); lambda.set(IdxBizFanWarningRecord::getStatus, "1");
lambda.set(IdxBizFanWarningRecord::getDisposotionDate, new Date()); lambda.set(IdxBizFanWarningRecord::getDisposotionDate, new Date());
lambda.eq(IdxBizFanWarningRecord::getSequenceNbr, analysisResult.get("objectId")); lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds);
idxBizFanWarningRecordService.update(lambda); idxBizFanWarningRecordService.update(lambda);
} else if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("fan")) {
}
public void jxIopUpdatePv(JSONArray analysisResult) {
log.info("修改预警状态信息:{}", analysisResult);
List<JSONObject> taskList = JSONObject.parseArray(analysisResult.toJSONString(), JSONObject.class);
List<String> traceIds = taskList.stream().map(t -> t.get("traceId").toString()).collect(Collectors.toList());
LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置"); lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
lambda.set(IdxBizPvWarningRecord::getStatus, "1"); lambda.set(IdxBizPvWarningRecord::getStatus, "1");
lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date()); lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date());
lambda.eq(IdxBizPvWarningRecord::getSequenceNbr, analysisResult.get("objectId")); lambda.in(IdxBizPvWarningRecord::getSequenceNbr, traceIds);
idxBizPvWarningRecordService.update(lambda); idxBizPvWarningRecordService.update(lambda);
} }
}
} }
package com.yeejoin.amos.boot.module.jxiop.biz.emqx; //package com.yeejoin.amos.boot.module.jxiop.biz.emqx;
//
import com.alibaba.fastjson.JSON; //import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; //import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; //import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; //import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; //import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord; //import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl; //import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRecordServiceImpl; //import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRecordServiceImpl;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttMessage; //import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper; //import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener; //import org.typroject.tyboot.component.emq.EmqxListener;
//
import javax.annotation.PostConstruct; //import javax.annotation.PostConstruct;
import java.util.Date; //import java.util.Date;
import java.util.List; //import java.util.List;
import java.util.concurrent.BlockingQueue; //import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue; //import java.util.concurrent.LinkedBlockingQueue;
//
/** ///**
* 处理无需处置情况 // * 处理无需处置情况
*/ // */
@Component //@Component
@Slf4j //@Slf4j
public class WarningRecordStatusMessage2 extends EmqxListener { //public class WarningRecordStatusMessage2 extends EmqxListener {
//
@Autowired // @Autowired
protected EmqKeeper emqKeeper; // protected EmqKeeper emqKeeper;
//
/** // /**
* 无需处置 // * 无需处置
*/ // */
public static final String NOT_DISPOSE_AMOS = "not/dispose/amos"; // public static final String NOT_DISPOSE_AMOS = "not/dispose/amos";
//
private static final BlockingQueue<JSONObject> blockingQueue = new LinkedBlockingQueue<JSONObject>(); // private static final BlockingQueue<JSONObject> blockingQueue = new LinkedBlockingQueue<JSONObject>();
//
@Autowired // @Autowired
private IdxBizFanWarningRecordServiceImpl idxBizFanWarningRecordService; // private IdxBizFanWarningRecordServiceImpl idxBizFanWarningRecordService;
//
@Autowired // @Autowired
private IdxBizPvWarningRecordServiceImpl idxBizPvWarningRecordService; // private IdxBizPvWarningRecordServiceImpl idxBizPvWarningRecordService;
//
@PostConstruct // @PostConstruct
void init() throws Exception { // void init() throws Exception {
new Thread(taskRunnable).start(); // new Thread(taskRunnable).start();
emqKeeper.subscript(NOT_DISPOSE_AMOS, 2, this); // emqKeeper.subscript(NOT_DISPOSE_AMOS, 2, this);
} // }
//
@Override // @Override
public void processMessage(String topic, MqttMessage message) throws Exception { // public void processMessage(String topic, MqttMessage message) throws Exception {
log.info("修改预警状态消息{}", new String(message.getPayload())); // log.info("修改预警状态消息{}", new String(message.getPayload()));
JSONObject ja = JSON.parseObject(new String(message.getPayload())); // JSONObject ja = JSON.parseObject(new String(message.getPayload()));
blockingQueue.add(ja); // blockingQueue.add(ja);
} // }
//
Runnable taskRunnable = new Runnable() { // Runnable taskRunnable = new Runnable() {
@Override // @Override
public void run() { // public void run() {
boolean isRun = true; // boolean isRun = true;
int k = 0; // int k = 0;
while (isRun) { // while (isRun) {
k++; // k++;
isRun = k < Integer.MAX_VALUE; // isRun = k < Integer.MAX_VALUE;
try { // try {
JSONObject analysisResult = blockingQueue.take(); // JSONObject analysisResult = blockingQueue.take();
jxIopUpdate(analysisResult); // jxIopUpdate(analysisResult);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
} // }
}; // };
//
public void jxIopUpdate(JSONObject analysisResult) { // public void jxIopUpdate(JSONObject analysisResult) {
log.info("修改预警状态信息:{}", analysisResult); // log.info("修改预警状态信息:{}", analysisResult);
if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("pv")) { // if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("fan")) {
LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>(); // LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已处置"); // lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已处置");
lambda.set(IdxBizFanWarningRecord::getStatus, "1"); // lambda.set(IdxBizFanWarningRecord::getStatus, "1");
lambda.set(IdxBizFanWarningRecord::getDisposotionDate, new Date()); // lambda.set(IdxBizFanWarningRecord::getDisposotionDate, new Date());
List<String> traceIds = (List<String>) analysisResult.get("traceIds"); // List<String> traceIds = (List<String>) analysisResult.get("traceIds");
lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds); // lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds);
idxBizFanWarningRecordService.update(lambda); // idxBizFanWarningRecordService.update(lambda);
} else if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("fan")) { // } else if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("pv")) {
LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>(); // LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置"); // lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
lambda.set(IdxBizPvWarningRecord::getStatus, "1"); // lambda.set(IdxBizPvWarningRecord::getStatus, "1");
lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date()); // lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date());
List<String> traceIds = (List<String>) analysisResult.get("traceIds"); // List<String> traceIds = (List<String>) analysisResult.get("traceIds");
lambda.eq(IdxBizPvWarningRecord::getSequenceNbr, traceIds); // lambda.in(IdxBizPvWarningRecord::getSequenceNbr, traceIds);
idxBizPvWarningRecordService.update(lambda); // idxBizPvWarningRecordService.update(lambda);
} // }
} // }
} //}
...@@ -162,4 +162,9 @@ public class IdxBizFanHealthIndex { ...@@ -162,4 +162,9 @@ public class IdxBizFanHealthIndex {
@TableField("ANALYSIS_TIME") @TableField("ANALYSIS_TIME")
private String ANALYSISTIME; private String ANALYSISTIME;
/**
* KKS码
*/
@TableField("KKS")
private String kks;
} }
...@@ -145,4 +145,10 @@ public class IdxBizFanWarningRecord{ ...@@ -145,4 +145,10 @@ public class IdxBizFanWarningRecord{
@TableField("DISPOSOTION_DATE") @TableField("DISPOSOTION_DATE")
private Date disposotionDate; private Date disposotionDate;
/**
* KKS码
*/
@TableField("KKS")
private String kks;
} }
...@@ -172,4 +172,10 @@ public class IdxBizPvHealthIndex{ ...@@ -172,4 +172,10 @@ public class IdxBizPvHealthIndex{
@TableField("ANALYSIS_TIME") @TableField("ANALYSIS_TIME")
private String ANALYSISTIME; private String ANALYSISTIME;
/**
* KKS码
*/
@TableField("KKS")
private String kks;
} }
...@@ -146,4 +146,10 @@ public class IdxBizPvWarningRecord{ ...@@ -146,4 +146,10 @@ public class IdxBizPvWarningRecord{
@TableField("DISPOSOTION_DATE") @TableField("DISPOSOTION_DATE")
private Date disposotionDate; private Date disposotionDate;
/**
* KKS码
*/
@TableField("KKS")
private String kks;
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<select id="getHealthScoreInfo" resultType="java.math.BigDecimal"> <select id="getHealthScoreInfo" resultType="java.math.BigDecimal">
SELECT SELECT
avg( a.avgHealthIndex ) AS healthIndex round(avg( a.avgHealthIndex ), 2) AS healthIndex
FROM FROM
( (
SELECT SELECT
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal"> <select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal">
SELECT SELECT
IFNULL( HEALTH_INDEX , 100 ) AS healthIndex round(IFNULL( HEALTH_INDEX , 100 ), 2) AS healthIndex
FROM FROM
${tableName} ${tableName}
<where> <where>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
WARNING_NAME WARNING_NAME
) a ) a
ORDER BY ORDER BY
a.allNum DESC a.allNum ASC
</select> </select>
...@@ -291,10 +291,18 @@ ...@@ -291,10 +291,18 @@
<select id="getAllEquipAlarmInfoAnalysisByStationType" resultType="java.util.Map"> <select id="getAllEquipAlarmInfoAnalysisByStationType" resultType="java.util.Map">
SELECT SELECT
<!-- ( SELECT POINT_NAME FROM ${tableName2} WHERE GATEWAY_ID = a.GATEWAY_ID AND INDEX_ADDRESS = a.INDEX_ADDRESS ) AS pointName,-->
concat(#{stationType}, '-', a.POINT_NAME) as pointName, concat(#{stationType}, '-', a.POINT_NAME) as pointName,
a.WARNING_NAME as warningName, a.WARNING_NAME as warningName,
count(1) as num count(1) as num,
(select count(1) from ${tableName} as tb
<where>
tb.DISPOSOTION_STATE = '未处置'
and tb.POINT_NAME = a.POINT_NAME
<if test="areaCode != null and areaCode != ''">
and tb.ARAE like concat('%', #{areaCode}, '%')
</if>
</where>
) AS totalNum
FROM FROM
${tableName} a ${tableName} a
<where> <where>
...@@ -307,7 +315,7 @@ ...@@ -307,7 +315,7 @@
warningName warningName
having pointName IS NOT NULL having pointName IS NOT NULL
AND pointName != '' AND pointName != ''
order by num desc order by totalNum asc
</select> </select>
<select id="getAllEquipAlarmInfoAnalysisByArea" resultType="java.util.Map"> <select id="getAllEquipAlarmInfoAnalysisByArea" resultType="java.util.Map">
...@@ -318,7 +326,16 @@ ...@@ -318,7 +326,16 @@
SELECT SELECT
wr.WARNING_NAME AS warningName, wr.WARNING_NAME AS warningName,
concat('光伏-', wr.POINT_NAME) AS pointName, concat('光伏-', wr.POINT_NAME) AS pointName,
count( 1 ) AS num count( 1 ) AS num,
( SELECT count( 1 ) FROM idx_biz_pv_warning_record
<where>
DISPOSOTION_STATE = '未处置' AND wr.POINT_NAME = POINT_NAME
<if test="areaCode != null and areaCode != ''">
and ARAE like concat('%', #{areaCode}, '%')
</if>
</where>
) AS allNum
FROM FROM
idx_biz_pv_warning_record wr idx_biz_pv_warning_record wr
<where> <where>
...@@ -333,7 +350,16 @@ ...@@ -333,7 +350,16 @@
SELECT SELECT
wr.WARNING_NAME AS warningName, wr.WARNING_NAME AS warningName,
concat('风电-', wr.POINT_NAME) AS pointName, concat('风电-', wr.POINT_NAME) AS pointName,
count( 1 ) AS num count( 1 ) AS num,
( SELECT count( 1 ) FROM idx_biz_fan_warning_record
<where>
DISPOSOTION_STATE = '未处置' AND wr.POINT_NAME = POINT_NAME
<if test="areaCode != null and areaCode != ''">
and ARAE like concat('%', #{areaCode}, '%')
</if>
</where>
) AS allNum
FROM FROM
idx_biz_fan_warning_record wr idx_biz_fan_warning_record wr
<where> <where>
...@@ -349,7 +375,7 @@ ...@@ -349,7 +375,7 @@
WHERE WHERE
a.pointName IS NOT NULL a.pointName IS NOT NULL
AND a.pointName != '' AND a.pointName != ''
order by a.num desc order by a.allNum ASC
</select> </select>
<select id="getSubSystemInfo" resultType="java.util.Map"> <select id="getSubSystemInfo" resultType="java.util.Map">
...@@ -489,7 +515,8 @@ ...@@ -489,7 +515,8 @@
<select id="getPvInfoByPage" resultType="java.util.Map"> <select id="getPvInfoByPage" resultType="java.util.Map">
SELECT SELECT
SUBARRAY as subarray SUBARRAY as subarray,
STATION AS station
FROM FROM
idx_biz_pv_point_process_variable_classification idx_biz_pv_point_process_variable_classification
<where> <where>
...@@ -594,7 +621,8 @@ ...@@ -594,7 +621,8 @@
<select id="getPvPointNameListBySumSystem" resultType="java.util.Map"> <select id="getPvPointNameListBySumSystem" resultType="java.util.Map">
SELECT SELECT
POINT_NAME as pointName, POINT_NAME as pointName,
INDEX_ADDRESS as indexAddress INDEX_ADDRESS as indexAddress,
STATION AS station
FROM FROM
idx_biz_pv_point_process_variable_classification idx_biz_pv_point_process_variable_classification
<where> <where>
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
AND a.recDate >= concat(#{startDate}, ' 00:00:00') AND a.recDate >= concat(#{startDate}, ' 00:00:00')
</if> </if>
<if test="endDate != '' and endDate != null"> <if test="endDate != '' and endDate != null">
AND concat(#{startDate}, ' 23:59:59') >= a.recDate AND concat(#{endDate}, ' 23:59:59') >= a.recDate
</if> </if>
</where> </where>
order by warningName DESC, recDate DESC order by warningName DESC, recDate DESC
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
AND a.recDate >= concat(#{startDate}, ' 00:00:00') AND a.recDate >= concat(#{startDate}, ' 00:00:00')
</if> </if>
<if test="endDate != '' and endDate != null"> <if test="endDate != '' and endDate != null">
AND concat(#{startDate}, ' 23:59:59') >= a.recDate AND concat(#{endDate}, ' 23:59:59') >= a.recDate
</if> </if>
</where>) b </where>) b
</select> </select>
......
package com.yeejoin.amos.boot.module.jxiop.api.mapper; package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mysql.cj.x.protobuf.MysqlxCrud;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto; import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.RunRecord;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator; import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -17,22 +14,7 @@ import java.util.Map; ...@@ -17,22 +14,7 @@ import java.util.Map;
* @createDate: 2023/7/3 * @createDate: 2023/7/3
*/ */
public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicator> { public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicator> {
//批量修改
void UpdateMonitorFanIndicator(@Param(value = "list") List<IndexDto> list);
Integer queryByPageTotal(@Param("equipmentNumber") String equipmentNumber,
@Param("gateway") String gateway,
@Param("frontModule") String frontModule);
List<MonitorFanIndicator> queryByPage(@Param("size") long size,
@Param("equipmentNumber") String equipmentNumber,
@Param("gateway") String gateway,
@Param("frontModule") String frontModule,
@Param("offset") int offset);
Object getIndicatoralueAvage(String gateway,String indicator);
Object getIndicatoralueTotal(String gateway,String indicator);
List<Map<String, String>> getFanConfigPower(@Param("gatewayId") String gatewayId, List<Map<String, String>> getFanConfigPower(@Param("gatewayId") String gatewayId,
@Param("equipmentNum") String equipmentNum); @Param("equipmentNum") String equipmentNum);
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.api.mapper.MonitorFanIndicatorMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper">
<update id="UpdateMonitorFanIndicator">
update monitor_fan_indicator
<trim prefix="set" suffixOverrides=",">
<trim prefix="indicator_value=case" suffix="end,">
<foreach collection="list" item="item" index="index">
when address_gateway=#{item.equipmentsIdx} then #{item.valueLabel}
</foreach>
</trim>
<trim prefix="indicator_time=case" suffix="end,">
<foreach collection="list" item="item" index="index">
when address_gateway=#{item.equipmentsIdx} then #{item.createdTime}
</foreach>
</trim>
</trim>
where address_gateway in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item.equipmentsIdx}
</foreach>
</update>
<select id="queryByPage" resultType="com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator">
select * from monitor_fan_indicator
<where>
<if test="equipmentNumber != null and equipmentNumber !=''">
equipment_number = #{equipmentNumber}
</if>
<if test="gateway != null and gateway !=''">
AND gateway = #{gateway}
</if>
<if test="frontModule != null and frontModule !=''">
AND front_module = #{frontModule}
</if>
</where>
limit #{offset}, #{size}
</select>
<select id="queryByPageTotal" resultType="java.lang.Integer">
select count(1) from monitor_fan_indicator
<where>
<if test="equipmentNumber != null and equipmentNumber !=''">
equipment_number = #{equipmentNumber}
</if>
<if test="gateway != null and gateway !=''">
AND gateway = #{gateway}
</if>
<if test="frontModule != null and frontModule !=''">
AND front_module = #{frontModule}
</if>
</where>
</select>
<select id="getIndicatoralueAvage" resultType="Object">
SELECT AVG(indicator_value) wind_speed
FROM monitor_fan_indicator
WHERE gateway=#{gateway} and
indicator like concat('%',#{indicator},'%')
</select>
<select id="getIndicatoralueTotal" resultType="Object">
SELECT SUM(indicator_value) wind_speed
FROM monitor_fan_indicator
WHERE gateway=#{gateway} and
indicator like concat('%',#{indicator},'%')
</select>
<select id="getFanConfigPower" resultType="java.util.Map"> <select id="getFanConfigPower" resultType="java.util.Map">
select select
sequence_nbr as id, sequence_nbr as id,
......
...@@ -1019,6 +1019,117 @@ public class MonitorFanIdxController extends BaseController { ...@@ -1019,6 +1019,117 @@ public class MonitorFanIdxController extends BaseController {
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "电站排名")
@GetMapping("/stationRankingtype")
public ResponseModel stationRanking(String day,String type,String areaCode ) {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(areaCode!=null,StationBasic::getAreaCode,areaCode);
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
List<Map<String, Object>> datDataFJ = new ArrayList<>();
List<Map<String, Object>> monthDataFJ = new ArrayList<>();
List<Map<String, Object>> yearDataFJ = new ArrayList<>();
List<Map<String, Object>> datDataGF = new ArrayList<>();
List<Map<String, Object>> monthDataGF = new ArrayList<>();
List<Map<String, Object>> yearDataGF = new ArrayList<>();
for (StationBasic stationBasic : stationBasics) {
String gatewayId = stationBasic.getFanGatewayId();
String boosterGatewayId = stationBasic.getBoosterGatewayId();
String querySql = null;
String name = stationBasic.getStationName();
if (stationBasic.getStationType().equals("FDZ")) {
Map<String, Object> map = monitorFanIndicator.generatingCapacity(gatewayId, querySql);
Map<String, Object> dayMap = new HashMap<>();
Map<String, Object> monthMap = new HashMap<>();
Map<String, Object> yearMap = new HashMap<>();
dayMap.put("name", name);
dayMap.put("value", map.get("日发电量") == null ? 0 : String.format("%.4f", map.get("日发电量")));
dayMap.put("gateWayId", stationBasic.getFanGatewayId());
monthMap.put("name", name);
monthMap.put("value", map.get("月发电量") == null ? 0 : String.format("%.4f", map.get("月发电量")));
monthMap.put("gateWayId", stationBasic.getFanGatewayId());
yearMap.put("name", name);
yearMap.put("gateWayId", stationBasic.getFanGatewayId());
yearMap.put("value", map.get("年发电量") == null ? 0 : String.format("%.4f", map.get("年发电量")));
datDataFJ.add(dayMap);
monthDataFJ.add(monthMap);
yearDataFJ.add(yearMap);
} else {
querySql = "逆变器";
Map<String, Object> map = monitorFanIndicator.generatingCapacity(boosterGatewayId, querySql);
Map<String, Object> dayMap = new HashMap<>();
Map<String, Object> monthMap = new HashMap<>();
Map<String, Object> yearMap = new HashMap<>();
dayMap.put("name", name);
dayMap.put("gateWayId", stationBasic.getFanGatewayId());
dayMap.put("value", map.get("日发电量") == null ? 0 : String.format("%.4f", Double.parseDouble(map.get("日发电量").toString())));
monthMap.put("name", name);
monthMap.put("gateWayId", stationBasic.getFanGatewayId());
monthMap.put("value", map.get("月发电量") == null ? 0 : String.format("%.4f", Double.parseDouble(map.get("月发电量").toString())));
yearMap.put("name", name);
yearMap.put("gateWayId", stationBasic.getFanGatewayId());
yearMap.put("value", map.get("年发电量") == null ? 0 : String.format("%.4f", Double.parseDouble(map.get("年发电量").toString())));
datDataGF.add(dayMap);
monthDataGF.add(monthMap);
yearDataGF.add(yearMap);
}
}
// monitorFanIndicator.sendMqttByRanking(datDataFJ, GeneratingCapacity.DAY.getCode(), "fjpm");
// monitorFanIndicator.sendMqttByRanking(monthDataFJ, GeneratingCapacity.MONTH.getCode(), "fjpm");
// monitorFanIndicator.sendMqttByRanking(yearDataFJ, GeneratingCapacity.YEAR.getCode(), "fjpm");
// monitorFanIndicator.sendMqttByRanking(datDataGF, GeneratingCapacity.DAY.getCode(), "gfpm");
// monitorFanIndicator.sendMqttByRanking(monthDataGF, GeneratingCapacity.MONTH.getCode(), "gfpm");
// monitorFanIndicator.sendMqttByRanking(yearDataGF, GeneratingCapacity.YEAR.getCode(), "gfpm");
Page<Map<String, Object>> socialContributionDtoPage = new Page<Map<String, Object>>();
socialContributionDtoPage.setCurrent(1);
socialContributionDtoPage.setTotal(100);
if("gf".equals(type)){
if("0".equals(day)){
socialContributionDtoPage.setRecords(datDataGF);
}else if("1".equals(day)){
socialContributionDtoPage.setRecords(monthDataGF);
} else if("2".equals(day)){
socialContributionDtoPage.setRecords(yearDataGF);
}
}else{
if("0".equals(day)){
socialContributionDtoPage.setRecords(datDataFJ);
}else if("1".equals(day)){
socialContributionDtoPage.setRecords(monthDataFJ);
} else if("2".equals(day)){
socialContributionDtoPage.setRecords(yearDataFJ);
}
}
return CommonResponseUtil.success(socialContributionDtoPage);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "运维数据 ") @ApiOperation(value = "运维数据 ")
@GetMapping("/operationData") @GetMapping("/operationData")
......
...@@ -165,10 +165,10 @@ public class PersonQrCodeController extends BaseController { ...@@ -165,10 +165,10 @@ public class PersonQrCodeController extends BaseController {
} else if ("job".equals(dataType)) { } else if ("job".equals(dataType)) {
countAll = sjglZsjZsbtzMapper.getJobYardByPageCount(parentCode, null, 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(red), new BigDecimal(countAll)));
result.put("redPercent", getPercent(new BigDecimal(redToGreen), new BigDecimal(countAll))); result.put("redToGreenPercent", getPercent(new BigDecimal(redToGreen), new BigDecimal(countAll)));
result.put("yellowToGreenPercent", getPercent(new BigDecimal(yellow), new BigDecimal(countAll))); result.put("yellowPercent", getPercent(new BigDecimal(yellow), new BigDecimal(countAll)));
result.put("yellowPercent", getPercent(new BigDecimal(yellowToGreen), new BigDecimal(countAll))); result.put("yellowToGreenPercent", getPercent(new BigDecimal(yellowToGreen), new BigDecimal(countAll)));
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
...@@ -217,7 +217,7 @@ public class PersonQrCodeController extends BaseController { ...@@ -217,7 +217,7 @@ public class PersonQrCodeController extends BaseController {
* @return 百分比 * @return 百分比
*/ */
private double getPercent(BigDecimal numerator, BigDecimal denominator) { private double getPercent(BigDecimal numerator, BigDecimal denominator) {
BigDecimal multiply = numerator.divide(denominator.compareTo(BigDecimal.ZERO) != 0 ? denominator : new BigDecimal(1), 4, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)); BigDecimal multiply = numerator.divide(denominator.compareTo(BigDecimal.ZERO) != 0 ? denominator : new BigDecimal(1), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
return Math.abs(multiply.doubleValue()); return Math.abs(multiply.doubleValue());
} }
......
...@@ -14,7 +14,7 @@ import java.util.Map; ...@@ -14,7 +14,7 @@ import java.util.Map;
*/ */
public interface IMonitorFanIndicator { public interface IMonitorFanIndicator {
//批量修改指标值 //批量修改指标值
void UpdateMonitorFanIndicator(List<IndexDto> list); // void UpdateMonitorFanIndicator(List<IndexDto> list);
// ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber); // ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
// ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber); // ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
......
...@@ -115,13 +115,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -115,13 +115,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private List<Map> list; private List<Map> list;
@Override
public void UpdateMonitorFanIndicator(List<IndexDto> list) {
monitorFanIndicatorregionMapper.UpdateMonitorFanIndicator(list);
}
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) { public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
...@@ -287,9 +280,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -287,9 +280,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
* @param indicator * @param indicator
* @return * @return
*/ */
public Object getIndicatoralueAvage(String gateway, String indicator) { // public Object getIndicatoralueAvage(String gateway, String indicator) {
return monitorFanIndicatorregionMapper.getIndicatoralueAvage(gateway, indicator); // return monitorFanIndicatorregionMapper.getIndicatoralueAvage(gateway, indicator);
} // }
/** /**
...@@ -299,9 +292,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -299,9 +292,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
* @param indicator * @param indicator
* @return * @return
*/ */
public Object getIndicatoralueTotal(String gateway, String indicator) { // public Object getIndicatoralueTotal(String gateway, String indicator) {
return monitorFanIndicatorregionMapper.getIndicatoralueTotal(gateway, indicator); // return monitorFanIndicatorregionMapper.getIndicatoralueTotal(gateway, indicator);
} // }
public StationBasic getOneByStationNumber(String stationId) { public StationBasic getOneByStationNumber(String stationId) {
......
...@@ -101,8 +101,8 @@ ...@@ -101,8 +101,8 @@
ifnull(a.SBMC, '') as objectName , ifnull(a.SBMC, '') as objectName ,
ifnull(a.QRCODE_COLOR, '') AS qrCodeColor, ifnull(a.QRCODE_COLOR, '') AS qrCodeColor,
ifnull(b.COMPANY_NAME, '') AS stationName, ifnull(b.COMPANY_NAME, '') AS stationName,
ifnull(a.UPDATE_TIME, '') as recDate, ifnull(a.UPDATE_STAMP, '') as recDate,
SBBM as objectId a.SBBM as objectId
FROM FROM
sjgl_zsj_zsbtz a sjgl_zsj_zsbtz a
INNER JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE and b.IS_DELETED = false AND b.`LEVEL` = 'station' INNER JOIN privilege_company b ON a.WERKS = b.COMPANY_CODE and b.IS_DELETED = false AND b.`LEVEL` = 'station'
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
AND b.ORG_CODE like concat(#{parentCode},'%') AND b.ORG_CODE like concat(#{parentCode},'%')
</if> </if>
<if test="date != null and date != ''"> <if test="date != null and date != ''">
AND a.UPDATE_TIME like concat(#{date},'%') AND a.UPDATE_STAMP like concat(#{date},'%')
</if> </if>
<if test="qrCodeColor != null and qrCodeColor != ''"> <if test="qrCodeColor != null and qrCodeColor != ''">
AND a.QRCODE_COLOR = #{qrCodeColor} AND a.QRCODE_COLOR = #{qrCodeColor}
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
AND a.QRCODE_COLOR != #{ne} AND a.QRCODE_COLOR != #{ne}
</if> </if>
</where> </where>
ORDER BY a.CREATE_TIME DESC ORDER BY a.UPDATE_STAMP DESC
limit #{current},#{size} limit #{current},#{size}
</select> </select>
......
package com.yeejoin.amos.boot.module.jxiop.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.github.classgraph.json.Id;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* CREATE TABLE `equipments_jxiop_doc_mysql` (
* `id` varchar(50) NOT NULL,
* `address` varchar(50) DEFAULT NULL,
* `equipment_specific_name` varchar(255) DEFAULT NULL,
* `gateway_id` varchar(50) DEFAULT NULL,
* `is_alarm` varchar(20) DEFAULT NULL,
* `created_time` date DEFAULT NULL,
* `unit` varchar(50) DEFAULT NULL,
* `value` varchar(50) DEFAULT NULL,
* `value_F` float DEFAULT NULL,
* `value_label` varchar(255) DEFAULT NULL,
* `trace_id` varchar(50) DEFAULT NULL,
* `equipment_index_name` varchar(255) DEFAULT NULL,
* `equipment_number` varchar(50) DEFAULT NULL,
* `front_module` varchar(200) DEFAULT NULL,
* `system_type` varchar(200) DEFAULT NULL,
* `picture_name` varchar(255) DEFAULT NULL,
* `display_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
* `data_type` varchar(50) DEFAULT NULL,
* PRIMARY KEY (`id`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
*/
@Data
@Accessors(chain = true)
@TableName("equipments_jxiop_doc_mysql")
public class EquipmentsJxiopDocMysql {
@Id
private String id;
@TableField("address")
private String address;
@TableField("data_type")
private String dataType;
@TableField("equipment_specific_name")
private String equipmentSpecificName;
@TableField("gateway_id")
private String gatewayId;
@TableField("is_alarm")
private String isAlarm;
@TableField("created_time")
private Date createdTime;
@TableField("unit")
private String unit;
@TableField("value")
private String value;
@TableField("value_F")
private Float valueF ;
@TableField("value_label")
private String valueLabel;
@TableField("trace_id")
private String traceId;
@TableField("equipment_index_name")
private String equipmentIndexName;
@TableField("equipment_number")
private String equipmentNumber;
@TableField("front_module")
private String frontModule;
@TableField("system_type")
private String systemType;
@TableField("picture_name")
private String pictureName;
@TableField("display_name")
private String displayName;
}
package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipmentsJxiopDocMysql;
public interface EquipmentsJxiopDocMysqlMapper extends BaseMapper<EquipmentsJxiopDocMysql> {
}
...@@ -39,6 +39,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -39,6 +39,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.Collator;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -351,6 +352,34 @@ public class MonitorFanIdxController extends BaseController { ...@@ -351,6 +352,34 @@ public class MonitorFanIdxController extends BaseController {
result.setTotal(statusMonitoring.size()); result.setTotal(statusMonitoring.size());
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "升压站光字牌/开关-通用")
@GetMapping("/getStatusGzpnew")
public ResponseModel<IPage<Map<String, Object>>> getStatusGzpnew(@RequestParam(required = false) String name,@RequestParam(value = "stationId") String stationId, String frontModule, String systemType, String equipNum, @RequestParam(required = false) String stationType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
if (null != stationType) {
gatewayId = stationBasic.getFanGatewayId();
}
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusGzp(gatewayId, systemType, frontModule, equipNum,stationBasic.getStationType());
if(name!=null){
statusMonitoring= statusMonitoring.stream().filter(s-> s.get("data").toString().contains(name)).collect(Collectors.toList());
}
IPage<Map<String, Object>> result = new Page<>();
result.setRecords(statusMonitoring);
result.setCurrent(1);
result.setTotal(statusMonitoring.size());
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class PointImportDto {
@ExcelProperty("网关")
private String gatewayId ;
@ExcelProperty("模块")
private String frontModule;
@ExcelProperty("类型")
private String systemType;
@ExcelProperty("排序号")
private String traceId;
@ExcelProperty("测点名称")
private String equipmentIndexName;
@ExcelProperty("显示名称")
private String displayName;
@ExcelProperty("单位")
private String unit;
}
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.github.classgraph.json.Id;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* CREATE TABLE `equipments_jxiop_doc_mysql` (
* `id` varchar(50) NOT NULL,
* `address` varchar(50) DEFAULT NULL,
* `equipment_specific_name` varchar(255) DEFAULT NULL,
* `gateway_id` varchar(50) DEFAULT NULL,
* `is_alarm` varchar(20) DEFAULT NULL,
* `created_time` date DEFAULT NULL,
* `unit` varchar(50) DEFAULT NULL,
* `value` varchar(50) DEFAULT NULL,
* `value_F` float DEFAULT NULL,
* `value_label` varchar(255) DEFAULT NULL,
* `trace_id` varchar(50) DEFAULT NULL,
* `equipment_index_name` varchar(255) DEFAULT NULL,
* `equipment_number` varchar(50) DEFAULT NULL,
* `front_module` varchar(200) DEFAULT NULL,
* `system_type` varchar(200) DEFAULT NULL,
* `picture_name` varchar(255) DEFAULT NULL,
* `display_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
* `data_type` varchar(50) DEFAULT NULL,
* PRIMARY KEY (`id`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
*/
@Data
@Accessors(chain = true)
@TableName("equipments_jxiop_doc_mysql")
public class EquipmentsJxiopDocMysql {
@Id
private String id;
@TableField("address")
private String address;
@TableField("data_type")
private String dataType;
@TableField("equipment_specific_name")
private String equipmentSpecificName;
@TableField("gateway_id")
private String gatewayId;
@TableField("is_alarm")
private String isAlarm;
@TableField("created_time")
private Date createdTime;
@TableField("unit")
private String unit;
@TableField("value")
private String value;
@TableField("value_F")
private Float valueF ;
@TableField("value_label")
private String valueLabel;
@TableField("trace_id")
private String traceId;
@TableField("equipment_index_name")
private String equipmentIndexName;
@TableField("equipment_number")
private String equipmentNumber;
@TableField("front_module")
private String frontModule;
@TableField("system_type")
private String systemType;
@TableField("picture_name")
private String pictureName;
@TableField("display_name")
private String displayName;
}
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import lombok.Getter;
/**
*
* @author LiuLin
* @date 2023年10月11日 09:31
*/
@Getter
public final class EsEntity<T> {
private String id;
private T data;
public EsEntity() {
}
public EsEntity(String id, T data) {
this.data = data;
this.id = id;
}
public void setId(String id) {
this.id = id;
}
public void setData(T data) {
this.data = data;
}
}
...@@ -13,8 +13,6 @@ import java.util.Map; ...@@ -13,8 +13,6 @@ import java.util.Map;
* @createDate: 2023/7/3 * @createDate: 2023/7/3
*/ */
public interface IMonitorFanIndicator { public interface IMonitorFanIndicator {
//批量修改指标值
void UpdateMonitorFanIndicator(List<IndexDto> list);
ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber); ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber); ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
......
...@@ -599,7 +599,7 @@ public class CommonServiceImpl { ...@@ -599,7 +599,7 @@ public class CommonServiceImpl {
List<T> list = searchHitList.stream().map(hit -> hit.getContent()).collect(Collectors.toList()); List<T> list = searchHitList.stream().map(hit -> hit.getContent()).collect(Collectors.toList());
return list; return list;
} }
return null; return new ArrayList<>();
} }
......
...@@ -46,6 +46,7 @@ import org.springframework.util.ObjectUtils; ...@@ -46,6 +46,7 @@ import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.ws.rs.HEAD;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
...@@ -116,10 +117,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -116,10 +117,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private List<Map> list; private List<Map> list;
@Override
public void UpdateMonitorFanIndicator(List<IndexDto> list) {
monitorFanIndicatorregionMapper.UpdateMonitorFanIndicator(list);
}
@Override @Override
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) { public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
...@@ -293,28 +291,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -293,28 +291,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return treeDto; return treeDto;
} }
/**
* 根据网关与指标获取指标的平均值
*
* @param gateway
* @param indicator
* @return
*/
public Object getIndicatoralueAvage(String gateway, String indicator) {
return monitorFanIndicatorregionMapper.getIndicatoralueAvage(gateway, indicator);
}
/**
* 根据网关与指标获取指标的总值
*
* @param gateway
* @param indicator
* @return
*/
public Object getIndicatoralueTotal(String gateway, String indicator) {
return monitorFanIndicatorregionMapper.getIndicatoralueTotal(gateway, indicator);
}
public StationBasic getOneByStationNumber(String stationId) { public StationBasic getOneByStationNumber(String stationId) {
...@@ -840,21 +820,28 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -840,21 +820,28 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String, String> likeMap = new HashMap<>(); Map<String, String> likeMap = new HashMap<>();
likeMap.put(CommonConstans.QueryStringFrontMoudle, frontModule); likeMap.put(CommonConstans.QueryStringFrontMoudle, frontModule);
if (stationType.equals("FDZ")) { if (stationType.equals("FDZ")) {
queryCondtion.put(CommonConstans.QueryStringSystemTypeKeyword, Arrays.asList(systemType)); queryCondtion.put(CommonConstans.QueryStringSystemTypeKeyword, Arrays.asList(systemType));
} else { } else {
likeMap.put(CommonConstans.QueryStringSystemTypeKeyword, systemType); likeMap.put(CommonConstans.QueryStringSystemTypeKeyword, systemType);
} }
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, likeMap); List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, likeMap);
Integer traceIdCount = indicatorsDtoList.stream().filter(esEquipments -> !StringUtils.isEmpty(esEquipments.getTraceId())).collect(Collectors.toList()).size();
List<Map<String, Object>> statusMaps = new ArrayList<>(); List<Map<String, Object>> statusMaps = new ArrayList<>();
for (ESEquipments listDatum : indicatorsDtoList) { for (ESEquipments listDatum : indicatorsDtoList) {
Map<String, Object> statusMap = new HashMap<>(); Map<String, Object> statusMap = new HashMap<>();
statusMap.put("traceId",listDatum.getTraceId());
String data = listDatum.getDisplayName(); String data = listDatum.getDisplayName();
if (StringUtils.isEmpty(data) || (!ObjectUtils.isEmpty(listDatum.getEquipmentNumber()) && data.equals(listDatum.getEquipmentNumber()))) { if (StringUtils.isEmpty(data) || (!ObjectUtils.isEmpty(listDatum.getEquipmentNumber()) && data.equals(listDatum.getEquipmentNumber()))) {
data = listDatum.getEquipmentIndexName(); data = listDatum.getEquipmentIndexName();
} }
statusMap.put("displayName",listDatum.getDisplayName());
statusMap.put("equipmentIndexName",listDatum.getEquipmentIndexName());
statusMap.put("unit",listDatum.getUnit());
statusMap.put("value",listDatum.getValue());
statusMap.put("addres", listDatum.getAddress()); statusMap.put("addres", listDatum.getAddress());
statusMap.put("id", listDatum.getId());
statusMap.put("data", data); statusMap.put("data", data);
statusMap.put("state", listDatum.getValue().equals("false") ? 0 : 1); statusMap.put("state", listDatum.getValue().equals("false") ? 0 : 1);
statusMap.put("status", listDatum.getValue().equals("false") ? 0 : 1); statusMap.put("status", listDatum.getValue().equals("false") ? 0 : 1);
...@@ -864,7 +851,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -864,7 +851,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} }
statusMaps.add(statusMap); statusMaps.add(statusMap);
} }
statusMaps.sort(Comparator.comparingLong(o -> Long.parseLong(o.get("addres").toString()))); // Collator instance = Collator.getInstance(Local);
String sortField;
if(traceIdCount == statusMaps.size()){
sortField = "traceId";
} else {
sortField = "addres";
}
// Collections.sort(statusMaps, (e1, e2) -> {
// return instance.compare(Integer.valueOf(e1.get(sortField).toString()), Integer.valueOf(e2.get(sortField).toString()));
// });
statusMaps.sort(Comparator.comparingInt(o -> Integer.parseInt(o.get(sortField).toString())));
return statusMaps; return statusMaps;
} }
...@@ -878,8 +875,16 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -878,8 +875,16 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap); List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap);
List<ESEquipments> listData = esEquipmentsList.stream().filter(esEquipments -> !esEquipments.getDisplayName().equals("")).collect(Collectors.toList()); List<ESEquipments> listData = esEquipmentsList.stream().filter(esEquipments -> !esEquipments.getDisplayName().equals("")).collect(Collectors.toList());
List<Map<String, Object>> statusMaps = new ArrayList<>(); List<Map<String, Object>> statusMaps = new ArrayList<>();
Integer traceIdCount = listData.stream().filter(esEquipments -> !StringUtils.isEmpty(esEquipments.getTraceId())).collect(Collectors.toList()).size();
for (ESEquipments listDatum : listData) { for (ESEquipments listDatum : listData) {
Map<String, Object> statusMap = new HashMap<>(); Map<String, Object> statusMap = new HashMap<>();
statusMap.put("traceId",listDatum.getTraceId());
statusMap.put("displayName",listDatum.getDisplayName());
statusMap.put("equipmentIndexName",listDatum.getEquipmentIndexName());
statusMap.put("equipmentIndexName",listDatum.getEquipmentIndexName());
statusMap.put("unit",listDatum.getUnit());
statusMap.put("value",listDatum.getValue());
statusMap.put("id", listDatum.getId());
if (StringUtils.isEmpty(listDatum.getValue())) { if (StringUtils.isEmpty(listDatum.getValue())) {
statusMap.put("title", 0.00 + (StringUtils.isNotEmpty(listDatum.getUnit()) ? listDatum.getUnit() : "")); statusMap.put("title", 0.00 + (StringUtils.isNotEmpty(listDatum.getUnit()) ? listDatum.getUnit() : ""));
} else { } else {
...@@ -888,13 +893,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -888,13 +893,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
statusMap.put("title1", listDatum.getDisplayName()); statusMap.put("title1", listDatum.getDisplayName());
statusMaps.add(statusMap); statusMaps.add(statusMap);
} }
Collator instance = Collator.getInstance(Locale.CHINA); Collator instance = Collator.getInstance(Locale.CHINA);
String sortField;
if(traceIdCount == statusMaps.size()){
sortField = "traceId";
statusMaps.sort(Comparator.comparingInt(o -> Integer.parseInt(o.get(sortField).toString())));
} else {
sortField = "title1";
Collections.sort(statusMaps, (e1, e2) -> { Collections.sort(statusMaps, (e1, e2) -> {
return instance.compare(e1.get("title1"), e2.get("title1")); return instance.compare(e1.get(sortField), e2.get(sortField));
}); });
}
return statusMaps; return statusMaps;
} }
...@@ -2211,8 +2220,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -2211,8 +2220,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
c = -c; c = -c;
} }
double pcv = c / avageValue; double pcv = c / avageValue;
pcv = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, pcv)); pcv=pcv*100;
resultMap.put("pcv", pcv); pcv=Math.round(pcv);
//pcv = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, pcv));
resultMap.put("pcv", (int)pcv+"%");
resultList.add(resultMap); resultList.add(resultMap);
} }
} }
......
package com.yeejoin.amos.boot.module.jxiop.biz.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EsEntity;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.DocWriteResponse;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.ClearScrollRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequest;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.search.Scroll;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
* @author LiuLin
* @date 2023年08月08日 16:30
*/
@Slf4j
@Component
public class ElasticSearchUtil {
private static final long SCROLL_TIMEOUT = 180000;
private static final int SIZE = 1000;
@Autowired
private RestHighLevelClient restHighLevelClient;
/**
* ES修改数据
*
* @param indexName 索引名称
* @param id 主键
* @param paramJson 参数JSON
* @return
*/
public boolean updateData(String indexName, String id, String paramJson) {
log.info("更新ES数据,value:{}", id);
UpdateRequest updateRequest = new UpdateRequest(indexName, id);
//如果修改索引中不存在则进行新增
updateRequest.docAsUpsert(true);
//立即刷新数据
updateRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
updateRequest.doc(paramJson, XContentType.JSON);
try {
UpdateResponse updateResponse = restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT);
//log.info("索引[{}],主键:【{}】操作结果:[{}]", indexName, id, updateResponse.getResult());
if (DocWriteResponse.Result.CREATED.equals(updateResponse.getResult())) {
log.info("索引:【{}】,主键:【{}】新增成功", indexName, id);
return true;
} else if (DocWriteResponse.Result.UPDATED.equals(updateResponse.getResult())) {
log.info("索引:【{}】,主键:【{}】修改成功", indexName, id);
return true;
} else if (DocWriteResponse.Result.NOOP.equals(updateResponse.getResult())) {
log.info("索引:[{}],主键:[{}]无变化", indexName, id);
return true;
}
} catch (IOException e) {
log.error("索引:[{}],主键:【{}】", indexName, id, e);
return false;
}
return false;
}
/**
* 单条更新
*
* @param indexName
* @param id
* @param data
* @return
* @throws IOException
*/
public boolean updateData(String indexName, String id, Object data) throws IOException {
UpdateRequest updateRequest = new UpdateRequest(indexName, id);
//准备文档
String jsonString = JSONObject.toJSONString(data);
Map jsonMap = JSONObject.parseObject(jsonString, Map.class);
updateRequest.doc(jsonMap);
updateRequest.timeout(TimeValue.timeValueSeconds(1));
updateRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL);
//数据为存储而不是更新
UpdateResponse update = restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT);
return update.getGetResult().equals(DocWriteResponse.Result.UPDATED);
}
/**
* 必须传递ids集合
*
* @param indexName
* @param idList
* @param map
* @return
*/
public boolean update(String indexName, List<String> idList, Map map) {
// 创建批量请求
BulkRequest bulkRequest = new BulkRequest();
for (String id : idList) {
UpdateRequest updateRequest = new UpdateRequest(indexName, id).doc(map);
bulkRequest.add(updateRequest);
}
try {
bulkRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
BulkResponse bulk = restHighLevelClient.bulk(bulkRequest, RequestOptions.DEFAULT);
return bulk.hasFailures();
} catch (IOException e) {
return false;
}
}
/**
* Description: 批量修改数据
*
* @param index index
* @param list 更新列表
* @author LiuLin
*/
public <T> void updateBatch(String index, List<EsEntity<T>> list) {
BulkRequest request = new BulkRequest();
list.forEach(item -> request.add(new UpdateRequest(index, item.getId())
.doc(JSON.toJSONString(item.getData()), XContentType.JSON)));
try {
restHighLevelClient.bulk(request, RequestOptions.DEFAULT);
list.forEach(s -> log.info("===========索引:【{}】,主键:【{}】修改成功", index, s.getId()));
} catch (Exception e) {
log.error("索引:[{}]", index, e);
}
}
/**
* Description: 批量插入数据
*
* @param index index
* @param list 插入列表
* @author LiuLin
*/
public <T> void insertBatch(String index, List<EsEntity<T>> list) {
BulkRequest request = new BulkRequest();
list.forEach(item -> request.add(new IndexRequest(index).id(item.getId())
.source(JSON.toJSONString(item.getData()), XContentType.JSON)));
try {
restHighLevelClient.bulk(request, RequestOptions.DEFAULT);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* ES异步修改数据
*
* @param indexName 索引名称
* @param id 主键
* @param paramJson 参数JSON
*/
public void updateDataAsync(String indexName, String id, String paramJson) throws IOException {
UpdateRequest updateRequest = new UpdateRequest(indexName, id);
updateRequest.docAsUpsert(true);
updateRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
updateRequest.doc(paramJson, XContentType.JSON);
restHighLevelClient.updateAsync(updateRequest, RequestOptions.DEFAULT, new ActionListener<UpdateResponse>() {
@Override
public void onResponse(UpdateResponse updateResponse) {
if (DocWriteResponse.Result.UPDATED.equals(updateResponse.getResult())) {
log.info("索引:【{}】,主键:【{}】修改成功", indexName, id);
}
}
@Override
public void onFailure(Exception e) {
log.error("索引:[{}],主键:【{}】", indexName, id, e);
}
});
}
/**
* 构建SearchResponse
*
* @param indices 索引
* @param query queryBuilder
* @param fun 返回函数
* @param <T> 返回类型
* @return List, 可以使用fun转换为T结果
* @throws Exception e
*/
public <T> List<T> searchResponse(String indices, QueryBuilder query, Function<SearchHit, T> fun) throws Exception {
SearchRequest request = new SearchRequest(indices);
Scroll scroll = new Scroll(TimeValue.timeValueMillis(SCROLL_TIMEOUT));
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(query);
sourceBuilder.size(SIZE);
request.scroll(scroll);
request.source(sourceBuilder);
List<String> scrollIdList = new ArrayList<>();
List<T> result = new ArrayList<>();
SearchResponse searchResponse = restHighLevelClient.search(request, RequestOptions.DEFAULT);
String scrollId = searchResponse.getScrollId();
SearchHit[] hits = searchResponse.getHits().getHits();
scrollIdList.add(scrollId);
try {
while (ArrayUtils.isNotEmpty(hits)) {
for (SearchHit hit : hits) {
result.add(fun.apply(hit));
}
if (hits.length < SIZE) {
break;
}
SearchScrollRequest searchScrollRequest = new SearchScrollRequest(scrollId);
searchScrollRequest.scroll(scroll);
SearchResponse searchScrollResponse = restHighLevelClient.scroll(searchScrollRequest, RequestOptions.DEFAULT);
scrollId = searchScrollResponse.getScrollId();
hits = searchScrollResponse.getHits().getHits();
scrollIdList.add(scrollId);
}
} finally {
ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
clearScrollRequest.setScrollIds(scrollIdList);
restHighLevelClient.clearScroll(clearScrollRequest, RequestOptions.DEFAULT);
}
return result;
}
}
...@@ -69,4 +69,12 @@ public class EventController { ...@@ -69,4 +69,12 @@ public class EventController {
resultsData = equipAlarmEventServiceImpl.getEquipEvent(current, size, fanGatewayId, equipIndex, frontModule); resultsData = equipAlarmEventServiceImpl.getEquipEvent(current, size, fanGatewayId, equipIndex, frontModule);
return ResponseHelper.buildResponse(resultsData); return ResponseHelper.buildResponse(resultsData);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "刷新字典API")
@GetMapping("/dic/refresh")
public ResponseModel<String> refresh() {
alarmEventServiceImpl.init();
return ResponseHelper.buildResponse("success");
}
} }
...@@ -47,4 +47,7 @@ public class EquipAlarmEvent { ...@@ -47,4 +47,7 @@ public class EquipAlarmEvent {
@TableField(exist = false) @TableField(exist = false)
private String time; private String time;
@TableField("alarm_group_name")
private String alarmGroupName;
} }
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("wl_equipment_specific_index_alarm_dic")
public class EquipmentSpecificIndexAlarmDic {
@TableField("value")
private int value;
@TableField("name")
private String name;
}
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.EquipmentSpecificIndexAlarmDic;
public interface EquipmentSpecificIndexAlarmDicMapper extends BaseMapper<EquipmentSpecificIndexAlarmDic> {
}
...@@ -19,7 +19,6 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -19,7 +19,6 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; 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.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -31,6 +30,8 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData; ...@@ -31,6 +30,8 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.AlarmEvent; import com.yeejoin.amos.boot.module.jxiop.biz.entity.AlarmEvent;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipAlarmEvent; import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipAlarmEvent;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipmentSpecificIndex; import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipmentSpecificIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipmentSpecificIndexAlarmDic;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.EquipmentSpecificIndexAlarmDicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.EquipmentSpecificIndexMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.EquipmentSpecificIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.AlarmEventMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.AlarmEventMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.EquipAlarmEventMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.EquipAlarmEventMapper;
...@@ -45,11 +46,17 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -45,11 +46,17 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired @Autowired
private EquipmentSpecificIndexAlarmDicMapper equipmentSpecificIndexAlarmDicMapper;
@Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired @Autowired
private static Map<String, EquipmentSpecificIndex> map; private static Map<String, EquipmentSpecificIndex> map;
@Autowired
private static Map<Integer, String> typeMap;
@PostConstruct @PostConstruct
public void init() { public void init() {
QueryWrapper<EquipmentSpecificIndex> wrapper = new QueryWrapper<>(); QueryWrapper<EquipmentSpecificIndex> wrapper = new QueryWrapper<>();
...@@ -57,12 +64,16 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -57,12 +64,16 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
List<EquipmentSpecificIndex> list = equipmentSpecificIndexMapper.selectList(wrapper); List<EquipmentSpecificIndex> list = equipmentSpecificIndexMapper.selectList(wrapper);
map = list.stream().collect(Collectors.toMap(EquipmentSpecificIndex::getEquipmentSpecificName, map = list.stream().collect(Collectors.toMap(EquipmentSpecificIndex::getEquipmentSpecificName,
Function.identity(), (key1, key2) -> key2)); Function.identity(), (key1, key2) -> key2));
List<EquipmentSpecificIndexAlarmDic> typelist = equipmentSpecificIndexAlarmDicMapper.selectList(null);
typeMap = typelist.stream().collect(
Collectors.toMap(EquipmentSpecificIndexAlarmDic::getValue, EquipmentSpecificIndexAlarmDic::getName));
} }
@Async("jxiopAsyncExecutor") @Async("jxiopAsyncExecutor")
public void handleMessage(List<ConsumerRecord<String, String>> record) { public void handleMessage(List<ConsumerRecord<String, String>> record) {
List<AlarmEvent> alarmEvents = new ArrayList<>(); List<AlarmEvent> alarmEvents = new ArrayList<>();
List<EquipAlarmEvent> equipAlarmEvents = new ArrayList<>(); List<EquipAlarmEvent> equipAlarmEvents = new ArrayList<>();
String group = null;
for (ConsumerRecord<String, String> one : record) { for (ConsumerRecord<String, String> one : record) {
JSONObject obj = JSONObject.parseObject(one.value()); JSONObject obj = JSONObject.parseObject(one.value());
String objName = obj.getString("equipmentSpecificName"); String objName = obj.getString("equipmentSpecificName");
...@@ -70,13 +81,19 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -70,13 +81,19 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
String gatewayId = obj.getString("gatewayId"); String gatewayId = obj.getString("gatewayId");
String value = obj.getString("value"); String value = obj.getString("value");
String valueLabel = obj.getString("valueLabel"); String valueLabel = obj.getString("valueLabel");
Integer isAlarm = Integer.valueOf(obj.getString("isAlarm"));
if (!typeMap.containsKey(isAlarm)) {
continue;
} else {
group=typeMap.get(isAlarm);
}
if ("升压站".equals(objName)) { if ("升压站".equals(objName)) {
AlarmEvent alarmEvent = new AlarmEvent(); AlarmEvent alarmEvent = new AlarmEvent();
alarmEvent.setEventDesc(indexName); alarmEvent.setEventDesc(indexName);
// alarmEvent.setStationId(""); // alarmEvent.setStationId("");
// alarmEvent.setStationName(""); // alarmEvent.setStationName("");
alarmEvent.setGatewayId(gatewayId); alarmEvent.setGatewayId(gatewayId);
alarmEvent.setAlarmGroupName("运行告警"); alarmEvent.setAlarmGroupName(group);
alarmEvent.setValue(value); alarmEvent.setValue(value);
alarmEvents.add(alarmEvent); alarmEvents.add(alarmEvent);
} else { } else {
...@@ -102,6 +119,7 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -102,6 +119,7 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
equipAlarmEvent.setEventDesc(indexName); equipAlarmEvent.setEventDesc(indexName);
equipAlarmEvent.setGatewayId(gatewayId); equipAlarmEvent.setGatewayId(gatewayId);
equipAlarmEvent.setValue(warn); equipAlarmEvent.setValue(warn);
equipAlarmEvent.setAlarmGroupName(group);
equipAlarmEvents.add(equipAlarmEvent); equipAlarmEvents.add(equipAlarmEvent);
} }
} }
...@@ -113,6 +131,7 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -113,6 +131,7 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
// equipAlarmEvent.setFrontModule(value); // equipAlarmEvent.setFrontModule(value);
equipAlarmEvent.setGatewayId(gatewayId); equipAlarmEvent.setGatewayId(gatewayId);
equipAlarmEvent.setValue(value); equipAlarmEvent.setValue(value);
equipAlarmEvent.setAlarmGroupName(group);
equipAlarmEvents.add(equipAlarmEvent); equipAlarmEvents.add(equipAlarmEvent);
} }
} }
...@@ -154,7 +173,7 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -154,7 +173,7 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
ColModel colModelStationName = new ColModel("stationName", "stationName", "名称", "名称", "dataGrid", ColModel colModelStationName = new ColModel("stationName", "stationName", "名称", "名称", "dataGrid",
"stationName"); "stationName");
ColModel colModelEventDesc = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc"); ColModel colModelEventDesc = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc");
ColModel colModelAlarmGroupName = new ColModel("alarmGroupName", "alarmGroupName", "事件告警组", "事件告警组", "dataGrid", ColModel colModelAlarmGroupName = new ColModel("alarmGroupName", "alarmGroupName", "事件类型", "事件类型", "dataGrid",
"alarmGroupName"); "alarmGroupName");
ColModel colModelEventTime = new ColModel("time", "time", "事件发生时间", "事件发生时间", "dataGrid", "time"); ColModel colModelEventTime = new ColModel("time", "time", "事件发生时间", "事件发生时间", "dataGrid", "time");
ColModel colModelEventMovement = new ColModel("value", "value", "事件值", "事件值", "dataGrid", "value"); ColModel colModelEventMovement = new ColModel("value", "value", "事件值", "事件值", "dataGrid", "value");
......
...@@ -43,7 +43,7 @@ public class EquipAlarmEventServiceImpl ...@@ -43,7 +43,7 @@ public class EquipAlarmEventServiceImpl
equipName = s[0] + "子阵/逆变器" + s[1]; equipName = s[0] + "子阵/逆变器" + s[1];
} else if ("汇流箱".equals(frontModule)) { } else if ("汇流箱".equals(frontModule)) {
String[] s = equipIndex.split("-"); String[] s = equipIndex.split("-");
if (s[2].indexOf("0")==0) { if (s[2].indexOf("0") == 0) {
s[2] = s[2].substring(1); s[2] = s[2].substring(1);
} }
equipName = s[0] + "子阵/逆变器" + s[1] + "/#" + s[2] + "汇流箱"; equipName = s[0] + "子阵/逆变器" + s[1] + "/#" + s[2] + "汇流箱";
...@@ -64,12 +64,12 @@ public class EquipAlarmEventServiceImpl ...@@ -64,12 +64,12 @@ public class EquipAlarmEventServiceImpl
} else if ("false".equals(i.getValue())) { } else if ("false".equals(i.getValue())) {
i.setValue("分"); i.setValue("分");
} }
long mills = i.getCreatedTime()/1000000; long mills = i.getCreatedTime() / 1000000;
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
//System.out.println(sdf.format(car.getTime())); // System.out.println(sdf.format(car.getTime()));
i.setTime(sdf.format(car.getTime())); i.setTime(sdf.format(car.getTime()));
//car.add(Calendar.HOUR, 12); // car.add(Calendar.HOUR, 12);
//System.out.println(sdf.format(car.getTime())); // System.out.println(sdf.format(car.getTime()));
}); });
PageInfo<EquipAlarmEvent> page = new PageInfo(alarmEventList); PageInfo<EquipAlarmEvent> page = new PageInfo(alarmEventList);
...@@ -79,11 +79,12 @@ public class EquipAlarmEventServiceImpl ...@@ -79,11 +79,12 @@ public class EquipAlarmEventServiceImpl
ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名称", "设备名称", "dataGrid", ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名称", "设备名称", "dataGrid",
"equipName"); "equipName");
ColModel colModelStationName = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc"); ColModel colModelStationName = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc");
ColModel colModelEventDesc = new ColModel("time", "time", "事件发生时间", "事件发生时间", "dataGrid", ColModel colModelAlarmGroupName = new ColModel("alarmGroupName", "alarmGroupName", "事件类型", "事件类型", "dataGrid",
"time"); "alarmGroupName");
ColModel colModelEventDesc = new ColModel("time", "time", "事件发生时间", "事件发生时间", "dataGrid", "time");
ColModel colModelValueDesc = new ColModel("value", "value", "事件值", "事件值", "dataGrid", "value"); ColModel colModelValueDesc = new ColModel("value", "value", "事件值", "事件值", "dataGrid", "value");
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc, List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelAlarmGroupName,
colModelValueDesc); colModelEventDesc, colModelValueDesc);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel); ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData; return resultsData;
} }
......
<?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.EquipmentSpecificIndexAlarmDicMapper">
</mapper>
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
</select> </select>
<insert id="save"> <insert id="save">
INSERT INTO INSERT INTO
equip_alarm_event(created_time,staion_name,staion_id,gateway_id,equip_index,event_desc,equip_name,front_module,value) equip_alarm_event(created_time,staion_name,staion_id,gateway_id,equip_index,event_desc,equip_name,front_module,value,alarm_group_name)
VALUES VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(NOW(),#{item.stationName},#{item.stationId},#{item.gatewayId},#{item.equipIndex},'#{item.eventDesc}','#{item.equipName}',#{item.frontModule},'#{item.value}') (NOW(),#{item.stationName},#{item.stationId},#{item.gatewayId},#{item.equipIndex},'#{item.eventDesc}','#{item.equipName}',#{item.frontModule},'#{item.value}','#{item.alarmGroupName}')
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment