1.灿能云接口移植,实时数据接口代码调整

This commit is contained in:
wr
2023-12-05 15:43:01 +08:00
parent e6a57d1436
commit d26cb9e1ce
18 changed files with 268 additions and 116 deletions

View File

@@ -3,6 +3,7 @@ package com.njcn.cloud.pojo.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.time.LocalDateTime;
@@ -39,6 +40,11 @@ public class AppEventMsg {
@TableField("EventDetail_Index")
private String eventdetailIndex;
@ApiModelProperty("触发时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("Time_Id")
private LocalDateTime timeID;
@ApiModelProperty("读取状态(0未读1已读2删除)")
@TableField("state")
private Integer state;

View File

@@ -22,7 +22,7 @@ import lombok.Setter;
@Setter
@TableName("app_info_set")
@ApiModel(value = "AppInfoSet对象", description = "推送消息设置")
public class AppInfoSet extends BaseEntity {
public class AppInfoSet {
private static final long serialVersionUID = 1L;

View File

@@ -1,6 +1,7 @@
package com.njcn.cloud.pojo.vo;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -9,7 +10,6 @@ import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -20,6 +20,15 @@ import java.util.stream.Collectors;
*/
@Data
public class DevMsgDetailInfo implements Serializable {
@ApiModelProperty("未读条数")
Integer unstate;
@ApiModelProperty("终端信息")
Page<DevMsgDetailInfo.Unstate> page;
@Data
public static class Unstate implements Serializable {
@ApiModelProperty("终端消息列表Guid")
private String devmsgIndex;
@ApiModelProperty("终端消息id")
private String topId;
@@ -63,6 +72,7 @@ public class DevMsgDetailInfo implements Serializable {
@ApiModelProperty("读取状态")
private Integer state;
public void setComoutDesc(String comoutDesc) {
List<String> collect = new ArrayList<>();
if (StrUtil.isNotBlank(comoutDesc)) {
@@ -81,3 +91,4 @@ public class DevMsgDetailInfo implements Serializable {
this.alarmDesc = collect;
}
}
}

View File

@@ -1,5 +1,6 @@
package com.njcn.cloud.pojo.vo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -16,7 +17,14 @@ import java.util.Date;
*/
@Data
public class EventMsgDetailVO implements Serializable {
@ApiModelProperty("未读条数")
private Integer udState;
@ApiModelProperty("消息返回体")
private Page<udState> page;
@Data
public static class udState implements Serializable {
@ApiModelProperty("监测点Id")
private String lineIndex;
@@ -39,14 +47,14 @@ public class EventMsgDetailVO implements Serializable {
@ApiModelProperty("特征幅值")
private Double eventValue;
@ApiModelProperty("终端信息")
@ApiModelProperty("监测点信息")
private String lineInfo;
@ApiModelProperty("暂态消息")
@ApiModelProperty("暂态消息Guid")
private String eventMsgIndex;
@ApiModelProperty("读取状态")
private Integer state;
}
}

View File

@@ -6,6 +6,8 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.DependsOn;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@Slf4j
@@ -13,6 +15,7 @@ import org.springframework.context.annotation.DependsOn;
@EnableFeignClients(basePackages = "com.njcn")
@SpringBootApplication(scanBasePackages = "com.njcn")
@DependsOn("proxyMapperRegister")
@EnableScheduling
public class AppCloudBootApplication {
public static void main(String[] args) {

View File

@@ -0,0 +1,45 @@
package com.njcn.cloud.controller.RealTimeInfo;
import cn.hutool.core.util.StrUtil;
import com.njcn.cloud.enums.app.UserCodeEnum;
import com.njcn.cloud.service.user.RealTimeInfoService;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.vo.LineDetailVO;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Description: 实时数据列表
* @Author: wr
* @Date: 2023/11/22 15:38
*/
@RestController
@RequestMapping("/realtimeinfo")
@Api(tags = "实时数据接口")
@RequiredArgsConstructor
public class RealTimeInfoController extends BaseController {
private final RealTimeInfoService realTimeInfoService;
@PostMapping("/getLineBaseInfo")
@ApiOperation(value = "监测点信息接口", notes = "监测点信息")
public HttpResult<List<LineDetailVO.Detail>> getLineBaseInfo(@RequestBody List<String> lineId) {
String methodDescribe = getMethodDescribe("getLineBaseInfo");
List<LineDetailVO.Detail> lineBaseInfo1 = realTimeInfoService.getLineBaseInfo(lineId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineBaseInfo1, methodDescribe);
}
}

View File

@@ -57,13 +57,13 @@ public class DevMsgController extends BaseController {
*/
@PostMapping("/deviceList")
@ApiOperation(value = "终端列表入口", notes = "终端列表")
public HttpResult<Page<DevMsgDetailInfo>> deviceList(@RequestBody BaseParam param) {
public HttpResult<DevMsgDetailInfo> deviceList(@RequestBody BaseParam param) {
String methodDescribe = getMethodDescribe("deviceList");
if (StrUtil.isBlank(param.getSearchValue())) {
throw new BusinessException(EventMsgCodeEnum.USERID_WRONG.getMsg());
}
Page<DevMsgDetailInfo> page = devMsgService.deviceList(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
DevMsgDetailInfo devMsgDetailInfo = devMsgService.deviceList(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devMsgDetailInfo, methodDescribe);
}
/**
@@ -80,7 +80,7 @@ public class DevMsgController extends BaseController {
/**
* 终端通讯状态统计
*/
@PostMapping("/getDevComTJ")
@PostMapping("/devComTJ")
@ApiOperation(value = "终端通讯状态统计", notes = "终端通讯状态统计")
public HttpResult<DevComTJ> getDevComTJ(String deptId) {
String methodDescribe = getMethodDescribe("getDevComTJ");
@@ -91,7 +91,7 @@ public class DevMsgController extends BaseController {
/**
* 终端通讯信息
*/
@PostMapping("/getDevComInfo")
@PostMapping("/devComInfo")
@ApiOperation(value = "终端通讯信息", notes = "终端通讯信息")
public HttpResult<List<DevDetail>> getDevComInfo(String deptId) {
String methodDescribe = getMethodDescribe("getDevComInfo");

View File

@@ -48,13 +48,13 @@ public class EventMsgController extends BaseController {
*/
@PostMapping("/eventDetailList")
@ApiOperation(value = "暂态消息获取入口", notes = "暂态消息")
public HttpResult<Page<EventMsgDetailVO>> eventDetailList(@RequestBody BaseParam param) {
public HttpResult<EventMsgDetailVO> eventDetailList(@RequestBody BaseParam param) {
String methodDescribe = getMethodDescribe("eventDetailList");
if (StrUtil.isBlank(param.getSearchValue())) {
throw new BusinessException(EventMsgCodeEnum.USERID_WRONG.getMsg());
}
Page<EventMsgDetailVO> page = eventMsgService.eventMsgPage(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
EventMsgDetailVO detailVO = eventMsgService.eventMsgPage(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, detailVO, methodDescribe);
}
/**

View File

@@ -49,7 +49,7 @@ public class SteadyMsgController extends BaseController {
@PostMapping("steadyState")
@ApiOperation(value = "稳态越限列表", notes = "稳态越限列表")
public HttpResult<AppSteadyMsgVO> steadyState(@RequestBody BaseParam param) {
String methodDescribe = getMethodDescribe("eventDetailList");
String methodDescribe = getMethodDescribe("steadyState");
if (StrUtil.isBlank(param.getSearchValue())) {
throw new BusinessException(EventMsgCodeEnum.USERID_WRONG.getMsg());
}
@@ -126,7 +126,7 @@ public class SteadyMsgController extends BaseController {
/**
* @description: 生成稳态越限指标图形
* @author gbl
* @author wr
* @param lineIndex 监测点ID
* @param timeID 统计时间
* @param typeCode

View File

@@ -42,7 +42,7 @@ public class EventMsgPushController extends BaseController {
@ApiOperation(value = "暂态消息推送", notes = "暂态消息推送")
public HttpResult<Boolean> sendEventMsg(String eventDetailIndex, String lineId) throws Exception {
String methodDescribe = getMethodDescribe("sendEventMsg");
if (StrUtil.isNotBlank(eventDetailIndex) || StrUtil.isNotBlank(lineId)) {
if (StrUtil.isBlank(eventDetailIndex) || StrUtil.isBlank(lineId)) {
throw new BusinessException(UserCodeEnum.INVALID_PARAMETER.getMsg());
}
msgService.sendEventMsg(eventDetailIndex, lineId);
@@ -61,7 +61,7 @@ public class EventMsgPushController extends BaseController {
@ApiOperation(value = "稳态消息推送", notes = "稳态消息推送")
public HttpResult<Boolean> sendSteadyMsg(String userIndex, String timeID, Integer lineNum) {
String methodDescribe = getMethodDescribe("sendSteadyMsg");
if (StrUtil.isNotBlank(userIndex) || StrUtil.isNotBlank(userIndex)) {
if (StrUtil.isBlank(userIndex) || StrUtil.isBlank(userIndex)) {
throw new BusinessException(UserCodeEnum.INVALID_PARAMETER.getMsg());
}
msgService.sendSteadyMsg(userIndex, timeID, lineNum);
@@ -76,13 +76,13 @@ public class EventMsgPushController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "userIndex", value = "用户索引", required = true, paramType = "query"),
@ApiImplicitParam(name = "timeID", value = "统计时间", required = true, paramType = "query"),
@ApiImplicitParam(name = "topID", value = "消息id", required = true, paramType = "query"),
@ApiImplicitParam(name = "topID", value = "消息id", required = true, paramType = "query"),
@ApiImplicitParam(name = "flag", value = "强制推送标志", required = true, paramType = "query"),
})
@ApiOperation(value = "终端消息推送", notes = "终端消息推送")
public HttpResult<Boolean> sendTargetMsg(String userIndex, String timeID, String topID, int flag) {
String methodDescribe = getMethodDescribe("sendTargetMsg");
if (StrUtil.isNotBlank(userIndex) || StrUtil.isNotBlank(userIndex)) {
if (StrUtil.isBlank(userIndex) || StrUtil.isBlank(userIndex)) {
throw new BusinessException(UserCodeEnum.INVALID_PARAMETER.getMsg());
}
msgService.sendTargetMsg(userIndex, timeID, topID, flag);

View File

@@ -37,8 +37,8 @@ public class SteadyMsgTask {
private final IAppSteadyAssService appSteadyAssService;
private final IAppDevMsgService appDevMsgService;
@Scheduled(cron = "* * 10 * * ?")
public void timer() throws Exception {
@Scheduled(cron = "0 0 10 * * ?")
public void timer() {
System.out.println("开始执行++++++++++++++++++++++++"+new Date());
Date date = DateUtil.offsetDay(new Date(), -1);
String time = DateUtil.format(date, DatePattern.NORM_DATE_PATTERN);
@@ -58,7 +58,8 @@ public class SteadyMsgTask {
* @Date: 2023/11/17 15:07
*/
public void steadyMsg(String time,String startTime,String endTime) {
List<User> users = userFeignClient.getUserByIdList(null).getData();
List<User> users = userFeignClient.getUserByIdList(new ArrayList<>()).getData();
// List<User> users = userFeignClient.getUserByIdList(Arrays.asList("5434cc08dc9d4b7cba5e856de52f0dda")).getData();
if(CollUtil.isNotEmpty(users)){
StatSubstationBizBaseParam param;
for (User user : users) {
@@ -96,7 +97,7 @@ public class SteadyMsgTask {
*/
public void devDegree(String time,String startTime,String endTime){
LocalDateTime date = LocalDateTimeUtil.parse(time,DatePattern.NORM_DATE_PATTERN);
List<User> users = userFeignClient.getUserByIdList(null).getData();
List<User> users = userFeignClient.getUserByIdList(new ArrayList<>()).getData();
if(CollUtil.isNotEmpty(users)){
for (User user : users) {
List<String> devIds = generalDeviceInfoClient.deptGetRunDev(user.getDeptId()).getData();

View File

@@ -51,14 +51,22 @@ public class AppDevMsgServiceImpl extends ServiceImpl<AppDevMsgMapper, AppDevMsg
}
@Override
public Page<DevMsgDetailInfo> deviceList(BaseParam param) {
public DevMsgDetailInfo deviceList(BaseParam param) {
DevMsgDetailInfo dev = new DevMsgDetailInfo();
int count = this.count(
new LambdaQueryWrapper<AppDevMsg>()
.eq(AppDevMsg::getUserIndex, param.getSearchValue())
.eq(AppDevMsg::getState, 0)
);
dev.setUnstate(count);
Page<AppDevMsg> page = this.page(new Page(param.getPageNum(), param.getPageSize()),
new LambdaQueryWrapper<AppDevMsg>()
.eq(AppDevMsg::getUserIndex, param.getSearchValue())
.orderByDesc(AppDevMsg::getTimeId)
);
List<AppDevMsg> records = page.getRecords();
List<DevMsgDetailInfo> info=new ArrayList<>();
List<DevMsgDetailInfo.Unstate> info = new ArrayList<>();
if (CollUtil.isNotEmpty(records)) {
List<String> topIds = records.stream().map(AppDevMsg::getTopId).collect(Collectors.toList());
OnlineRateParam top = new OnlineRateParam();
@@ -66,11 +74,12 @@ public class AppDevMsgServiceImpl extends ServiceImpl<AppDevMsgMapper, AppDevMsg
top.setType(0);
List<TopMsgPO> data = generalDeviceInfoClient.getTopMsgInfoByIds(top).getData();
Map<String, TopMsgPO> topMap = data.stream().collect(Collectors.toMap(TopMsgPO::getTopId, Function.identity()));
DevMsgDetailInfo msg;
DevMsgDetailInfo.Unstate msg;
for (AppDevMsg record : records) {
if (topMap.containsKey(record.getTopId())) {
TopMsgPO topMsgPO = topMap.get(record.getTopId());
msg=new DevMsgDetailInfo();
msg = new DevMsgDetailInfo.Unstate();
msg.setDevmsgIndex(record.getDevmsgIndex());
msg.setComoutDesc(topMsgPO.getComOutDesc());
msg.setAlarmDesc(topMsgPO.getAlarmDesc());
msg.setTopId(topMsgPO.getTopId());
@@ -90,16 +99,17 @@ public class AppDevMsgServiceImpl extends ServiceImpl<AppDevMsgMapper, AppDevMsg
}
}
}
Page<DevMsgDetailInfo> pageEvent = BeanUtil.copyProperties(page, Page.class);
Page<DevMsgDetailInfo.Unstate> pageEvent = BeanUtil.copyProperties(page, Page.class);
pageEvent.setRecords(info);
return pageEvent;
dev.setPage(pageEvent);
return dev;
}
@Override
public Boolean updateDevMsgState(List<String> ids) {
return this.update(new LambdaUpdateWrapper<AppDevMsg>()
.set(AppDevMsg::getState, 1)
.in(AppDevMsg::getTopId,ids)
.in(AppDevMsg::getDevmsgIndex, ids)
);
}

View File

@@ -46,15 +46,22 @@ public class AppEventMsgServiceImpl extends ServiceImpl<AppEventMsgMapper, AppEv
private final EventDetailFeignClient eventDetailFeignClient;
@Override
public Page<EventMsgDetailVO> eventMsgPage(BaseParam param) {
public EventMsgDetailVO eventMsgPage(BaseParam param) {
EventMsgDetailVO detailVO=new EventMsgDetailVO();
String searchValue = param.getSearchValue();
//获取暂态消息信息
Page<AppEventMsg> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), new LambdaQueryWrapper<AppEventMsg>()
.eq(AppEventMsg::getUserIndex, searchValue)
.eq(AppEventMsg::getUserIndex, searchValue)
.orderByDesc(AppEventMsg::getTimeID)
);
int count = this.count(new LambdaQueryWrapper<AppEventMsg>()
.eq(AppEventMsg::getUserIndex, searchValue)
.eq(AppEventMsg::getUserIndex, searchValue)
.eq(AppEventMsg::getState, 0)
);
detailVO.setUdState(count);
List<AppEventMsg> records = page.getRecords();
List<EventMsgDetailVO> info=new ArrayList<>();
List<EventMsgDetailVO.udState> info=new ArrayList<>();
if(CollUtil.isNotEmpty(records)){
Map<String, AppEventMsg> eventMsg = records.stream().collect(Collectors.toMap(AppEventMsg::getEventdetailIndex, Function.identity()));
//获取暂态事件id
@@ -64,16 +71,16 @@ public class AppEventMsgServiceImpl extends ServiceImpl<AppEventMsgMapper, AppEv
List<LineDetailVO.Detail> lineDetail = lineFeignClient.getLineDetailByIds(linedIds).getData();
//监测点map
Map<String, LineDetailVO.Detail> lineDetailMap = lineDetail.stream().collect(Collectors.toMap(LineDetailVO.Detail::getLineId, Function.identity()));
EventMsgDetailVO vo;
EventMsgDetailVO.udState vo;
AppEventMsg appEventMsg ;
for (RmpEventDetailPO detail : eventDetail) {
if(lineDetailMap.containsKey(detail.getLineId())){
LineDetailVO.Detail line = lineDetailMap.get(detail.getLineId());
vo=new EventMsgDetailVO();
vo=new EventMsgDetailVO.udState();
vo.setLineIndex(line.getLineId());
vo.setLineName(PubUtil.lineName(detail.getSagsource(),line.getLineName()));
vo.setEventDetailIndex(detail.getEventId());
vo.setTimeID(line.getTimeID());
vo.setTimeID(detail.getStartTime());
vo.setPersistTime(detail.getDuration());
vo.setMs(detail.getFirstMs());
vo.setEventValue(detail.getFeatureAmplitude());
@@ -87,12 +94,12 @@ public class AppEventMsgServiceImpl extends ServiceImpl<AppEventMsgMapper, AppEv
}
}
}
Page<EventMsgDetailVO> pageEvent = BeanUtil.copyProperties(page, Page.class);
Page<EventMsgDetailVO.udState> pageEvent = BeanUtil.copyProperties(page, Page.class);
pageEvent.setRecords(info);
return pageEvent;
detailVO.setPage(pageEvent);
return detailVO;
}
@Override

View File

@@ -2,6 +2,7 @@ package com.njcn.cloud.service.impl.user;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
@@ -38,6 +39,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@@ -69,6 +71,7 @@ public class MsgServiceImpl implements MsgService {
private final IAppSteadyMsgService appSteadyMsgService;
private final IAppDevMsgService appDevMsgService;
private final RedisUtil redisUtil;
private final SmsUtil smsUtil;
/**
@@ -82,6 +85,7 @@ public class MsgServiceImpl implements MsgService {
* 4执行推送保存功能
*/
@Override
@Transactional(rollbackFor = {Exception.class})
public void sendEventMsg(String eventDetailIndex, String lineId) throws Exception {
List<RmpEventDetailPO> eventDetails = eventDetailFeignClient.getEventDetailByIdsList(Arrays.asList(eventDetailIndex)).getData();
if (CollUtil.isEmpty(eventDetails)) {
@@ -93,7 +97,7 @@ public class MsgServiceImpl implements MsgService {
}
DeptLine deptLines = deptLineFeignClient.getLineByLineIds(lineId).getData();
//查询为空,则无人关注,不做推送处理,但是需要进行日志记录
if (ObjectUtil.isNotNull(deptLines)) {
if (ObjectUtil.isNull(deptLines)) {
noUserFocus(eventDetailIndex, lineId);
}
//存在则进行筛选用户操作
@@ -115,6 +119,7 @@ public class MsgServiceImpl implements MsgService {
List<WaveDataDetail> waveDataDetails = WaveUtil.filterWaveData(waveDataDTO);
String instantPath = wavePicComponent.generateImageShun(waveDataDTO, waveDataDetails);
String rmsPath = wavePicComponent.generateImageRms(waveDataDTO, waveDataDetails);
one=new AppEventInfo();
one.setEventdetailIndex(eventDetailIndex);
one.setInstantwavePath(instantPath);
one.setRmswavePath(rmsPath);
@@ -142,10 +147,11 @@ public class MsgServiceImpl implements MsgService {
* @param lineNum 监测点数
*/
@Override
@Transactional(rollbackFor = {Exception.class})
public String sendSteadyMsg(String userIndex, String timeID, Integer lineNum) {
List<User> users = userFeignClient.getUserByIdList(Arrays.asList(userIndex)).getData();
AppInfoSet appInfoSet = appInfoSetService.getById(userIndex);
if (CollUtil.isEmpty(users) || ObjectUtil.isNotNull(appInfoSet)) {
if (CollUtil.isEmpty(users) || ObjectUtil.isNull(appInfoSet)) {
throw new BusinessException(UserCodeEnum.NO_USER.getMsg());
}
LocalDateTime time = LocalDateTimeUtil.parse(timeID,DatePattern.NORM_DATE_PATTERN);
@@ -185,10 +191,11 @@ public class MsgServiceImpl implements MsgService {
* @param flag 是否强制推送
*/
@Override
@Transactional(rollbackFor = {Exception.class})
public String sendTargetMsg(String userIndex, String timeID, String topID, Integer flag) {
List<User> users = userFeignClient.getUserByIdList(Arrays.asList(userIndex)).getData();
AppInfoSet appInfoSet = appInfoSetService.getById(userIndex);
if (CollUtil.isEmpty(users) || ObjectUtil.isNotNull(appInfoSet)) {
if (CollUtil.isEmpty(users) || ObjectUtil.isNull(appInfoSet)) {
throw new BusinessException(UserCodeEnum.NO_USER.getMsg());
}
LocalDateTime time = LocalDateTimeUtil.parse(timeID,DatePattern.NORM_DATE_PATTERN);
@@ -223,6 +230,7 @@ public class MsgServiceImpl implements MsgService {
}
@Override
@Transactional(rollbackFor = {Exception.class})
public void sendTerminalMsg(String userIndex,String devCode, String timeID,Integer devNum,Integer alarmNum,Integer comOutNum) {
AppInfoSet appInfoSet = appInfoSetService.getById(userIndex);
if (ObjectUtil.isNotNull(appInfoSet)) {
@@ -250,7 +258,14 @@ public class MsgServiceImpl implements MsgService {
float flowNum = topMsgPO.getFlowValue();
if (alarmNum > 0 || comOutNum > 0 || flowNum > 94) {
//推送
String title = time + "终端异常共" + topMsgPO.getDeviceAbnormalNum() + "";
List<String> devIds = generalDeviceInfoClient.deptGetRunDev(user.getDeptId()).getData();
OnlineRateParam top=new OnlineRateParam();
top.setIds(devIds);
top.setType(1);
top.setStartTime(DateUtil.beginOfDay(DateUtil.parse(topMsgPO.getTime())).toString());
top.setEndTime(DateUtil.endOfDay(DateUtil.parse(topMsgPO.getTime())).toString());
List<TopMsgPO> data = generalDeviceInfoClient.getTopMsgInfoByIds(top).getData();
String title = time + "终端异常共" + data.size()+ "";
String content = "异常情况:" + (StringUtils.isEmpty(alarmNum) ? "" : "终端告警:" + alarmNum + "") + (StringUtils.isEmpty(comOutNum) ? "" : "通讯中断:" + Integer.valueOf(comOutNum) + "") + (StringUtils.isEmpty(flowNum) ? "" : "终端流量:" + Float.valueOf(flowNum) + "%");
sendMsg(user.getDevCode(), title, content, "3");
}
@@ -264,12 +279,13 @@ public class MsgServiceImpl implements MsgService {
* @param appUser 用户信息
* @param devCode 手机唯一标识
*/
private void pushEventInfo(RmpEventDetailPO eventDetail, User appUser, String devCode, int phonePushFlag) throws Exception {
private void pushEventInfo(RmpEventDetailPO eventDetail, User appUser, String devCode, int phonePushFlag) {
//先根据用户获取推送策略
AppInfoSet appInfoSet = appInfoSetService.getById(appUser.getId());
if (ObjectUtil.isNotNull(appInfoSet)) {
AppEventMsg eventMsg = new AppEventMsg();
eventMsg.setEventdetailIndex(eventDetail.getEventId());
eventMsg.setTimeID(eventDetail.getStartTime());
eventMsg.setUserIndex(appUser.getId());
eventMsg.setState(0);
//执行保存消息记录操作
@@ -295,7 +311,7 @@ public class MsgServiceImpl implements MsgService {
boolean isPush = judgeEventNeedPush(eventDetail, line);
if (isPush) {
String message = "{\"line\":\"" + line.getLineName() + "\",\"time\":\"" + time + "\",\"ms\":\"" + eventDetail.getFirstMs() + "\",\"eventvalue\":\"" + amplitude + "\",\"persisttime\":\"" + duration + "\"}";
smsUtil.sendSms(appUser.getPhone(), smsUtil.getMessageTemplate("8"), message);
// smsUtil.sendSms(appUser.getPhone(), smsUtil.getMessageTemplate("8"), message);
}
}
}

View File

@@ -0,0 +1,27 @@
package com.njcn.cloud.service.impl.user;
import com.njcn.cloud.service.user.RealTimeInfoService;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.vo.LineDetailVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author wr
* @description
* @date 2023/11/22 15:40
*/
@Service
@RequiredArgsConstructor
public class RealTimeInfoServiceImpl implements RealTimeInfoService {
private final LineFeignClient lineFeignClient;
@Override
public List<LineDetailVO.Detail> getLineBaseInfo(List<String> lineId) {
return lineFeignClient.getLineDetailByIds(lineId).getData();
}
}

View File

@@ -37,7 +37,7 @@ public interface IAppDevMsgService extends IService<AppDevMsg> {
* @Author: wr
* @Date: 2023/11/7 11:13
*/
Page<DevMsgDetailInfo> deviceList(BaseParam param);
DevMsgDetailInfo deviceList(BaseParam param);
/**
* @Description: 修改消息状态

View File

@@ -24,7 +24,7 @@ public interface IAppEventMsgService extends IService<AppEventMsg> {
* @Author: wr
* @Date: 2023/11/1 13:36
*/
Page<EventMsgDetailVO> eventMsgPage(BaseParam param);
EventMsgDetailVO eventMsgPage(BaseParam param);
/**
* @Description: 暂态事件基本信息

View File

@@ -0,0 +1,18 @@
package com.njcn.cloud.service.user;
import com.njcn.device.pq.pojo.vo.LineDetailVO;
import java.util.List;
public interface RealTimeInfoService {
/**
* @Description: 获取监测点信息
* @param lineId
* @return: java.util.List<com.njcn.device.pq.pojo.vo.LineDetailVO.Detail>
* @Author: wr
* @Date: 2023/11/22 15:44
*/
List<LineDetailVO.Detail> getLineBaseInfo(List<String> lineId);
}