测试事件bug修改
This commit is contained in:
@@ -187,8 +187,12 @@ public class EventGateController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
//下面一行代码正式环境需要放开
|
//下面一行代码正式环境需要放开
|
||||||
jsonObject = test();
|
jsonObject = test();
|
||||||
|
List<PqsDepts> deptsList = (List<PqsDepts>) redisUtil.getObjectByKey(REDIS_DEPT_INDEX + StrUtil.DASHED + "AllDept");
|
||||||
|
List<String> deptIds = deptsList.stream().map(PqsDepts::getDeptsIndex).distinct().collect(Collectors.toList());
|
||||||
|
jsonObject.putOpt("dept", String.join(StrUtil.COMMA,deptIds));
|
||||||
|
|
||||||
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString()) && Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()) {
|
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString()) && Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()) {
|
||||||
|
log.info("122345678788999999----------测试发送数据成功: {}",jsonObject);
|
||||||
webSocketServer.sendMessageToAll(jsonObject.toString());
|
webSocketServer.sendMessageToAll(jsonObject.toString());
|
||||||
|
|
||||||
//开始发送短信
|
//开始发送短信
|
||||||
@@ -232,8 +236,19 @@ public class EventGateController extends BaseController {
|
|||||||
//以下部分为测试数据后续删除
|
//以下部分为测试数据后续删除
|
||||||
List<PqLine> pqLineList = pqLineMapper.selectList(new LambdaQueryWrapper<>());
|
List<PqLine> pqLineList = pqLineMapper.selectList(new LambdaQueryWrapper<>());
|
||||||
List<Integer> lineList = pqLineList.stream().map(PqLine::getLineIndex).collect(Collectors.toList());
|
List<Integer> lineList = pqLineList.stream().map(PqLine::getLineIndex).collect(Collectors.toList());
|
||||||
List<LedgerBaseInfoDTO> baseInfoDTOList = pqLineMapper.getBaseLineInfo(lineList);
|
|
||||||
Map<Integer, LedgerBaseInfoDTO> map = baseInfoDTOList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = new ArrayList<>();
|
||||||
|
if(lineList.size()>1000){
|
||||||
|
List<List<Integer>> listIds = CollUtil.split(lineList,1000);
|
||||||
|
for(List<Integer> itemIds : listIds){
|
||||||
|
List<LedgerBaseInfoDTO> temp =pqLineMapper.getBaseLineInfo(itemIds);
|
||||||
|
ledgerBaseInfoDTOS.addAll(temp);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
List<LedgerBaseInfoDTO> temp =pqLineMapper.getBaseLineInfo(lineList);
|
||||||
|
ledgerBaseInfoDTOS.addAll(temp);
|
||||||
|
}
|
||||||
|
Map<Integer, LedgerBaseInfoDTO> map = ledgerBaseInfoDTOS.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
||||||
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
Integer lineId = lineList.get(random.nextInt(lineList.size()));
|
Integer lineId = lineList.get(random.nextInt(lineList.size()));
|
||||||
@@ -355,15 +370,12 @@ public class EventGateController extends BaseController {
|
|||||||
|
|
||||||
if (CollUtil.isNotEmpty(poList)) {
|
if (CollUtil.isNotEmpty(poList)) {
|
||||||
StringBuilder stringBuilder = new StringBuilder(jsonObject.get("timeid").toString());
|
StringBuilder stringBuilder = new StringBuilder(jsonObject.get("timeid").toString());
|
||||||
|
String busName = jsonObject.containsKey("busname")? "_"+jsonObject.get("busname").toString():"";
|
||||||
BigDecimal bigDecimal = new BigDecimal(jsonObject.get("eventvalue").toString()).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP);
|
BigDecimal bigDecimal = new BigDecimal(jsonObject.get("eventvalue").toString()).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP);
|
||||||
stringBuilder.append(".").append(jsonObject.get("ms").toString()).append(",").append(jsonObject.get("bdname").toString()).append("_").append(jsonObject.get("busname").toString()).append("_").append(jsonObject.get("pointname").toString())
|
stringBuilder.append(".").append(jsonObject.get("ms").toString()).append(",").append(jsonObject.get("bdname").toString()).append(busName).append("_").append(jsonObject.get("pointname").toString())
|
||||||
.append("发生电压暂降事件,事件残余电压").append(bigDecimal).append("%,持续时间:").append(jsonObject.get("persisttime").toString()).append("S;影响用户:");
|
.append("发生电压暂降事件,事件残余电压").append(bigDecimal).append("%,持续时间:").append(jsonObject.get("persisttime").toString()).append("S;影响用户:");
|
||||||
stringBuilder.append(objStr);
|
stringBuilder.append(objStr);
|
||||||
|
|
||||||
//TODO 临时处理,后面需要用上
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String message;
|
String message;
|
||||||
if (stringBuilder.length() > 500) {
|
if (stringBuilder.length() > 500) {
|
||||||
message = stringBuilder.substring(0, 490).concat(";详情请登录电压暂降监测平台查看。");
|
message = stringBuilder.substring(0, 490).concat(";详情请登录电压暂降监测平台查看。");
|
||||||
|
|||||||
Reference in New Issue
Block a user