|
@@ -10,6 +10,7 @@ import com.ozs.service.entity.vo.MsgAlarmResp;
|
|
|
import com.ozs.service.service.BaseCameraManagementService;
|
|
|
import com.ozs.service.service.BaseRailwayManagementService;
|
|
|
import com.ozs.service.service.BaseUserService;
|
|
|
+import com.ozs.service.service.UserRegistrationidService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
@@ -17,6 +18,7 @@ import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -36,6 +38,8 @@ public class WebSocketConteoller extends BaseController {
|
|
|
private BaseRailwayManagementService baseRailwayManagementService;
|
|
|
@Autowired
|
|
|
private BaseCameraManagementService baseCameraManagementService;
|
|
|
+ @Autowired
|
|
|
+ private UserRegistrationidService userRegistrationidService;
|
|
|
|
|
|
@ResponseBody
|
|
|
@PostMapping("/publish")
|
|
@@ -64,9 +68,18 @@ public class WebSocketConteoller extends BaseController {
|
|
|
webSocketServer.sendMoreMessage(list, objStr(msgAlarmResp));
|
|
|
|
|
|
// app 消息推送
|
|
|
- List<String> alias = new ArrayList<String>();
|
|
|
- alias.add("sunhh");
|
|
|
- JPushUtil.sendToRegistrationId(alias, "中奖通知!!!!", "中奖通知!!!!!", "恭喜你中了100000000个亿!!!!", "https://www.baidu.com");
|
|
|
+ List<String> userIdList = new ArrayList<>(set);
|
|
|
+ List<String> alias = userRegistrationidService.selectRegistrationID(userIdList);
|
|
|
+ // List<String> alias = new ArrayList<String>();
|
|
|
+ // alias.add("sunhh");
|
|
|
+ Date alarmTime = msgAlarm.getAlarmTime();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String formatDate = sdf.format(alarmTime);
|
|
|
+ JPushUtil.sendToRegistrationId(
|
|
|
+ alias,
|
|
|
+ "报警通知!", cameraName,
|
|
|
+ formatDate + " " + ("1".equals(msgAlarmResp.getAlarmType()) ? "泥石流" : msgAlarmResp.getAlarmType()) + " " + mile + " " + endMile,
|
|
|
+ "");
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
map.put("code", 200);
|
|
|
return map;
|