| | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.contant.Constant; |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.util.NumUtil; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.pipIrrRemote.largeScreen.WebSocketServer; |
| | | import io.swagger.v3.oas.annotations.Hidden; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | 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.Iterator; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @RestController |
| | | @RequestMapping(path="msCenter") |
| | | public class CenterMsReceiveCtrl{ |
| | | |
| | | @Autowired |
| | | private CenterMsReceiveSv sv ; |
| | | |
| | | /** |
| | | * 通信中间消息中心推送消息接收 |
| | |
| | | if(list != null && list.size() > 0){ |
| | | for (JSONObject jo : list) { |
| | | if(jo != null){ |
| | | log.info("----------------start " + token + " 消息数据--------------") ; |
| | | Iterator<String> it = jo.keySet().iterator() ; |
| | | String key ; |
| | | while (it.hasNext()){ |
| | | key = it.next() ; |
| | | log.info(key + ":" + jo.get(key)); |
| | | if(jo.containsKey("intakeId")){ |
| | | Object intakeIdObj = jo.get("intakeId") ; |
| | | Long intakeId = null ; |
| | | if(intakeIdObj != null && intakeIdObj instanceof Long){ |
| | | intakeId = (Long) intakeIdObj ; |
| | | }else if(intakeIdObj != null && intakeIdObj instanceof String){ |
| | | if(NumUtil.isPlusIntNumber(intakeIdObj.toString())){ |
| | | intakeId = Long.parseLong(intakeIdObj.toString()) ; |
| | | } |
| | | } |
| | | if(intakeId != null){ |
| | | String intakeNum = this.sv.selectIntakeName(intakeId) ; |
| | | jo.put("intakeNum", intakeNum) ; |
| | | } |
| | | } |
| | | log.info("----------------end " + token + " 消息数据--------------") ; |
| | | try { |
| | | WebSocketServer.sendAllMessage(jo.toJSONString()); |
| | | }catch (Exception e){ |
| | | log.error("推送消息失败", e) ; |
| | | } |
| | | } |
| | | } |
| | | } |