配置文件调整
This commit is contained in:
@@ -13,13 +13,11 @@ import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
|||||||
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
||||||
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
import com.njcn.gather.event.devcie.service.PqsDeptslineService;
|
||||||
import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam;
|
import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam;
|
||||||
|
import com.njcn.gather.event.transientes.pojo.param.SimulationMsgParam;
|
||||||
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
|
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
|
||||||
import com.njcn.gather.event.transientes.pojo.po.PqsUser;
|
import com.njcn.gather.event.transientes.pojo.po.PqsUser;
|
||||||
import com.njcn.gather.event.transientes.pojo.po.PqsUserSet;
|
import com.njcn.gather.event.transientes.pojo.po.PqsUserSet;
|
||||||
import com.njcn.gather.event.transientes.service.EventGateService;
|
import com.njcn.gather.event.transientes.service.*;
|
||||||
import com.njcn.gather.event.transientes.service.PqsDeptsService;
|
|
||||||
import com.njcn.gather.event.transientes.service.PqsUserService;
|
|
||||||
import com.njcn.gather.event.transientes.service.PqsUsersetService;
|
|
||||||
import com.njcn.gather.event.transientes.websocket.WebSocketServer;
|
import com.njcn.gather.event.transientes.websocket.WebSocketServer;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
@@ -30,6 +28,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -65,8 +64,11 @@ public class EventGateController extends BaseController {
|
|||||||
private final PqsUsersetService pqsUsersetService;
|
private final PqsUsersetService pqsUsersetService;
|
||||||
|
|
||||||
private final PqLineMapper pqLineMapper;
|
private final PqLineMapper pqLineMapper;
|
||||||
|
|
||||||
private final EventGateService eventGateService;
|
private final EventGateService eventGateService;
|
||||||
|
|
||||||
|
private final MsgEventConfigService msgEventConfigService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@@ -79,10 +81,11 @@ public class EventGateController extends BaseController {
|
|||||||
JSONObject jsonObject;
|
JSONObject jsonObject;
|
||||||
try {
|
try {
|
||||||
jsonObject = new JSONObject(msg);
|
jsonObject = new JSONObject(msg);
|
||||||
webSocketServer.sendMessageToAll(msg);
|
if(msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString()) ){
|
||||||
|
webSocketServer.sendMessageToAll(msg);
|
||||||
|
}
|
||||||
//开始发送短信
|
//开始发送短信
|
||||||
sendMessage(jsonObject);
|
// sendMessage(jsonObject);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("暂降json格式异常!{}",e.getMessage());
|
log.error("暂降json格式异常!{}",e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -100,6 +103,15 @@ public class EventGateController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/simulationSend")
|
||||||
|
@ApiOperation("模拟发送短信")
|
||||||
|
public HttpResult<WaveDataDTO> simulationSend(@RequestBody @Validated SimulationMsgParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("simulationSend");
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void sendMessage(JSONObject jsonObject){
|
private void sendMessage(JSONObject jsonObject){
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.gather.event.transientes.controller;
|
package com.njcn.gather.event.transientes.controller;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
@@ -20,7 +21,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: cdf
|
* @Author: cdf
|
||||||
@@ -43,9 +47,7 @@ public class MsgEventConfigController extends BaseController {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public HttpResult<Object> eventConfig(@RequestBody @Validated MsgEventConfig msgEventConfig) {
|
public HttpResult<Object> eventConfig(@RequestBody @Validated MsgEventConfig msgEventConfig) {
|
||||||
String methodDescribe = getMethodDescribe("eventConfig");
|
String methodDescribe = getMethodDescribe("eventConfig");
|
||||||
msgEventConfigService.remove(new LambdaQueryWrapper<>());
|
msgEventConfigService.eventConfig(msgEventConfig);
|
||||||
msgEventConfig.setId(IdUtil.simpleUUID());
|
|
||||||
msgEventConfigService.save(msgEventConfig);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +56,7 @@ public class MsgEventConfigController extends BaseController {
|
|||||||
@ApiOperation("接收远程推送的暂态事件")
|
@ApiOperation("接收远程推送的暂态事件")
|
||||||
public HttpResult<MsgEventConfig> queryConfig() {
|
public HttpResult<MsgEventConfig> queryConfig() {
|
||||||
String methodDescribe = getMethodDescribe("queryConfig");
|
String methodDescribe = getMethodDescribe("queryConfig");
|
||||||
MsgEventConfig msgEventConfig = msgEventConfigService.getOne(new LambdaQueryWrapper<>());
|
MsgEventConfig msgEventConfig = msgEventConfigService.queryConfig();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, msgEventConfig, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, msgEventConfig, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.njcn.gather.event.transientes.pojo.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-07-01
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MsgEventConfigParam {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 严重通知标识
|
||||||
|
*/
|
||||||
|
@NotNull(message = "严重通知标识不可为空")
|
||||||
|
private Integer seriousNotice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通通知标识
|
||||||
|
*/
|
||||||
|
@NotNull(message = "普通通知标识不可为空")
|
||||||
|
private Integer normalNotic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语音类型
|
||||||
|
*/
|
||||||
|
@NotNull(message = "语音类型不可为空")
|
||||||
|
private Integer voiceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 屏幕通知标识
|
||||||
|
*/
|
||||||
|
@NotNull(message = "屏幕通知标识不可为空")
|
||||||
|
private Integer screenNotic;
|
||||||
|
|
||||||
|
@NotBlank(message = "事件类型不可为空")
|
||||||
|
private List<Integer> eventTypeList;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.gather.event.transientes.pojo.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-07-01
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SimulationMsgParam {
|
||||||
|
|
||||||
|
@NotBlank(message = "号码不可为空")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@NotBlank(message = "短信内容不可为空")
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,8 +9,12 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,4 +58,10 @@ public class MsgEventConfig implements Serializable {
|
|||||||
@TableField("SCREEN_NOTIC")
|
@TableField("SCREEN_NOTIC")
|
||||||
@NotNull(message = "屏幕通知标识不可为空")
|
@NotNull(message = "屏幕通知标识不可为空")
|
||||||
private Integer screenNotic;
|
private Integer screenNotic;
|
||||||
|
|
||||||
|
private String eventType;
|
||||||
|
|
||||||
|
@NotEmpty(message = "事件类型不可为空")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> eventTypeList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,14 @@ package com.njcn.gather.event.transientes.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.gather.event.transientes.pojo.po.MsgEventConfig;
|
import com.njcn.gather.event.transientes.pojo.po.MsgEventConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface MsgEventConfigService extends IService<MsgEventConfig> {
|
public interface MsgEventConfigService extends IService<MsgEventConfig> {
|
||||||
|
|
||||||
|
boolean eventConfig(MsgEventConfig msgEventConfig);
|
||||||
|
|
||||||
|
|
||||||
|
MsgEventConfig queryConfig();
|
||||||
|
|
||||||
|
List<String> getEventType();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
package com.njcn.gather.event.transientes.service.impl;
|
package com.njcn.gather.event.transientes.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.gather.event.transientes.mapper.MsgEventConfigMapper;
|
import com.njcn.gather.event.transientes.mapper.MsgEventConfigMapper;
|
||||||
import com.njcn.gather.event.transientes.pojo.po.MsgEventConfig;
|
import com.njcn.gather.event.transientes.pojo.po.MsgEventConfig;
|
||||||
import com.njcn.gather.event.transientes.service.MsgEventConfigService;
|
import com.njcn.gather.event.transientes.service.MsgEventConfigService;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: cdf
|
* @Author: cdf
|
||||||
@@ -12,6 +24,51 @@ import org.springframework.stereotype.Service;
|
|||||||
* @Description:
|
* @Description:
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Lazy(false) // 确保服务在启动时立即初始化
|
||||||
public class MsgEventConfigServiceImpl extends ServiceImpl<MsgEventConfigMapper, MsgEventConfig> implements MsgEventConfigService {
|
public class MsgEventConfigServiceImpl extends ServiceImpl<MsgEventConfigMapper, MsgEventConfig> implements MsgEventConfigService {
|
||||||
|
|
||||||
|
public List<String> eventType = Stream.of("1","3").collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public boolean eventConfig(MsgEventConfig msgEventConfig) {
|
||||||
|
this.remove(new LambdaQueryWrapper<>());
|
||||||
|
msgEventConfig.setId(IdUtil.simpleUUID());
|
||||||
|
String tem = String.join(", ", msgEventConfig.getEventTypeList());
|
||||||
|
msgEventConfig.setEventType(tem);
|
||||||
|
this.save(msgEventConfig);
|
||||||
|
eventType = msgEventConfig.getEventTypeList();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MsgEventConfig queryConfig() {
|
||||||
|
MsgEventConfig msgEventConfig = this.getOne(new LambdaQueryWrapper<>());
|
||||||
|
msgEventConfig.setEventTypeList(Arrays.asList(msgEventConfig.getEventType().split(StrUtil.COMMA)));
|
||||||
|
return msgEventConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
System.out.println("------------------------------------------------------------------------------");
|
||||||
|
MsgEventConfig config = this.getOne(new LambdaQueryWrapper<>());
|
||||||
|
if (config != null && StrUtil.isNotBlank(config.getEventType())) {
|
||||||
|
eventType = Arrays.asList(config.getEventType().split(StrUtil.COMMA));
|
||||||
|
} else {
|
||||||
|
eventType = Collections.emptyList();
|
||||||
|
}
|
||||||
|
System.out.println(eventType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 静态方法:全局访问点
|
||||||
|
@Override
|
||||||
|
public List<String> getEventType() {
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user