コード例 #1
0
 @RequestMapping(
     value = "/list",
     method = {RequestMethod.GET, RequestMethod.POST})
 public String list(Page page, Map<String, Object> map, BizMember member) {
   BizMember admin = memberService.getAdminAccount();
   if (null == admin) {
     return LIST;
   }
   String type = HttpReceiver.getHttpServletReqeuest().getParameter("keywords");
   List<BizSiteMessage> list = null;
   if (StringUtils.isBlank(type)) {
     list = siteMessageService.findAll(page);
   } else {
     list = siteMessageService.findByMessageType(page, type);
   }
   List<Map<String, String>> mapList = new ArrayList<Map<String, String>>();
   if (CollectionUtils.isNotEmpty(list)) {
     for (BizSiteMessage message : list) {
       Map<String, String> tempMap = new HashMap<String, String>();
       tempMap.put("type", SiteMessageTypeEnum.getEnum(message.getMessageType()).getName());
       BizMember tempMem = memberService.get(message.getMemberId());
       tempMap.put("id", message.getId() + "");
       tempMap.put("name", (null == tempMem) ? "该用户已经被删除!" : tempMem.getName());
       tempMap.put("content", message.getMessageContent());
       tempMap.put("status", MsgStatusEnum.getMsgUseEnum(message.getStatus()).getName());
       tempMap.put(
           "time", DateUtil.date2String(message.getGmtCreate(), BizConstant.DATE_TIME_FORMAT));
       mapList.add(tempMap);
     }
   }
   List<Map<String, String>> tempList = new ArrayList<Map<String, String>>();
   for (SiteMessageTypeEnum enu : SiteMessageTypeEnum.values()) {
     Map<String, String> temp = new HashMap<String, String>();
     temp.put("name", enu.getName());
     temp.put("value", enu.getValue());
     tempList.add(temp);
   }
   map.put("types", tempList);
   map.put("page", page);
   map.put("data", mapList);
   return LIST;
 }
コード例 #2
0
 @RequestMapping(
     value = "/show/{id}",
     method = {RequestMethod.POST, RequestMethod.GET})
 public String approval(@PathVariable Long id, Map<String, Object> map) {
   BizSiteMessage siteMessage = siteMessageService.get(id);
   if (null == siteMessage) {
     return SHOW;
   }
   Map<String, String> dataMap = new HashMap<String, String>();
   dataMap.put("content", siteMessage.getMessageContent());
   dataMap.put("status", MsgStatusEnum.getMsgUseEnum(siteMessage.getStatus()).getName());
   dataMap.put("id", siteMessage.getId() + "");
   dataMap.put("type", SiteMessageTypeEnum.getEnum(siteMessage.getMessageType()).getName());
   dataMap.put(
       "createTime",
       DateUtil.date2String(siteMessage.getGmtCreate(), BizConstant.DATE_TIME_FORMAT));
   BizMember mem = memberService.get(siteMessage.getMemberId());
   if (null != mem) {
     dataMap.put("name", (null == mem) ? "该用户已经被删除!" : mem.getName());
   }
   map.put("data", dataMap);
   return SHOW;
 }