package com.zhujizheng.IHome.msgnotify.net; import com.zhujizheng.IHome.msgnotify.dto.PYQueryMsgNotifyDTO; import com.zhujizheng.IHome.msgnotify.service.PYMsgNotifyServer; import com.zhujizheng.IHome.msgnotify.vo.PYMsgNotifyVO; import com.zhujizheng.IHome.websocket.Net.Base.NetProtocolBase; import lombok.extern.slf4j.Slf4j; import net.sf.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; @Slf4j @Component public class NetQueryMsgNotify extends NetProtocolBase { @Autowired private PYMsgNotifyServer msgNotifyServer; @Override public void dealWithJSONAndSid(JSONObject json, String sid) { super.dealWithJSONAndSid(json, sid); PYQueryMsgNotifyDTO dto = (PYQueryMsgNotifyDTO) JSONObject.toBean(json, PYQueryMsgNotifyDTO.class); int userId = Integer.parseInt(sid); List vos = msgNotifyServer.selectMsgNotifys(userId, dto.getTime()); if (vos == null) { this.sendServerError(sid); } else { this.sendObject(vos, sid); } } }