|
|
@ -9,6 +9,8 @@ import com.ruoyi.common.utils.poi.ExcelUtil; |
|
|
|
import com.zc.business.domain.DcEvent; |
|
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
|
import com.zc.business.service.IDcEventService; |
|
|
|
import com.zc.common.core.websocket.WebSocketService; |
|
|
|
import com.zc.common.core.websocket.constant.WebSocketEvent; |
|
|
|
import io.swagger.annotations.*; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
@ -17,9 +19,13 @@ import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import static com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty; |
|
|
|
|
|
|
|
/** |
|
|
|
* 事件信息Controller |
|
|
|
* |
|
|
@ -264,4 +270,24 @@ if (eventState==UniversalEnum.ZERO.getNumber()){ |
|
|
|
public Long getCountNum(){ |
|
|
|
return dcEventService.getCountNum(); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("光纤报警") |
|
|
|
@PostMapping("/opticalFiberAlarm") |
|
|
|
public AjaxResult receiveData(@RequestBody Map<String, Object> payload) { |
|
|
|
// 判断 payload 是否为空
|
|
|
|
if (payload == null || payload.isEmpty()) { |
|
|
|
return AjaxResult.error("请求体为空"); |
|
|
|
} |
|
|
|
String contentType = (String) payload.get("contentType"); |
|
|
|
String message = (String) payload.get("message"); |
|
|
|
String title = (String) payload.get("title"); |
|
|
|
Map<String, Object> contentMap = new HashMap<>(); |
|
|
|
contentMap.put("contentType", title); |
|
|
|
contentMap.put("message", message); |
|
|
|
contentMap.put("warningTime", new Date()); |
|
|
|
WebSocketService.broadcast("opticalFiberAlarm", contentMap); |
|
|
|
return AjaxResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|