@RequestNeedParam({"messageid"}) @RequestMapping( value = "/detailMessage", method = {RequestMethod.POST}) @ResponseBody public ResponseBean detailMessage(String request) { requestBean = gson.fromJson(request, RequestBean.class); // 进行校验 if (requestBean.checkMac()) { LOG.info("校验成功...."); // 真正的业务逻辑 try { content = requestBean.getContent(); Message message = gson.fromJson(content.toString(), Message.class); CommonUtils.decriptObject( message, requestBean.getHead().getImei(), requestBean.getHead().getImsi()); message = messageService.detailAndSetreadMessage(message); responseBean.setContent(message); } catch (Exception e) { LOG.error("业务执行异常...." + e.getMessage()); responseBean.getMsg().setCode("0001"); responseBean.getMsg().setDesc(Constant.CODE_0001); return responseBean; } LOG.info("业务执行成功,设置返回报文状态为成功..."); responseBean.getMsg().setCode("0000"); responseBean.getMsg().setDesc(Constant.CODE_0000); responseBean.setMac(requestBean.getHead().getSerial()); } return responseBean; }
@RequestNeedParam({"currentPage", "userid"}) @RequestMapping( value = "/listRoughMessage", method = {RequestMethod.POST}) @ResponseBody public ResponseBean listMessage(String request) { requestBean = gson.fromJson(request, RequestBean.class); // 进行校验 if (requestBean.checkMac()) { LOG.info("校验成功...."); // 真正的业务逻辑 try { content = requestBean.getContent(); Message message = gson.fromJson(content.toString(), Message.class); CommonUtils.decriptObject( message, requestBean.getHead().getImei(), requestBean.getHead().getImsi()); PageBase pageBase = CommonUtils.createNewPageBase(message); // 根据选择的类型,如果不填,则返回该用户的所有消息,如果有值,则返回该用户的未读消息 List<Message> messageList = messageService.listRoughMessage(message); responseBean.setContent(CommonUtils.createListPage(messageList, pageBase)); responseBean.setContent(pageBase); } catch (Exception e) { LOG.error("业务执行异常...." + e.getMessage()); responseBean.getMsg().setCode("0001"); responseBean.getMsg().setDesc(Constant.CODE_0001); return responseBean; } LOG.info("业务执行成功,设置返回报文状态为成功..."); responseBean.getMsg().setCode("0000"); responseBean.getMsg().setDesc(Constant.CODE_0000); responseBean.setMac(requestBean.getHead().getSerial()); } return responseBean; }