示例#1
0
 @RequestMapping(params = "treegried")
 @ResponseBody
 public List<Map<String, Object>> loadItem(HttpServletRequest request) {
   CommonAdminSession common =
       (CommonAdminSession) request.getSession().getAttribute(Constant.COMMON_ADMIN_SESSION);
   return commonItemService.queryTreeGridTree(common.getDistrict().getDistrictCode());
 }
示例#2
0
 @RequestMapping(params = "articleSave")
 @ResponseBody
 public AjaxJson articleSave(
     ItemEntity item, String content, String contentTxt, HttpServletRequest req) {
   AjaxJson j = new AjaxJson();
   if (StringUtil.isNotEmpty(item.getId())) {
     message = "内容信息添加成功";
     ItemEntity t = commonItemService.get(ItemEntity.class, item.getId());
     ArticleEntity a = t.getArticle();
     a.setContent(content);
     a.setContentTxt(contentTxt);
     t.setArticle(a);
     if (item.getParentId().equals("0")) {
       item.setLevel(1); // 设置为目录级
     } else {
       item.setLevel(
           commonItemService.findParticalItemById(item.getParentId()).getLevel() + 1); // 设置为内容级别
     }
     try {
       MyBeanUtils.copyBeanNotNull2Bean(item, t);
       commonItemService.saveOrUpdate(t);
       systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
     } catch (Exception e) {
       e.printStackTrace();
       message = "类目基本信息更新失败";
     }
   } else {
     CommonAdminSession sessionAdmin =
         (CommonAdminSession) req.getSession().getAttribute(Constant.COMMON_ADMIN_SESSION);
     Date curDate = new Date(System.currentTimeMillis());
     message = "内容信息添加成功";
     item.setCreateTime(curDate);
     item.setUpdateTime(curDate);
     item.setBelongs(sessionAdmin.getDistrict().getDistrictCode());
     item.setCreator(sessionAdmin.getId());
     item.setType(Constant.Article);
     item.setStatus(DictionaryBean.keyDict.get("item_status_normal").getValue());
     if (item.getParentId().equals("0")) {
       item.setLevel(1); // 设置为目录级
     } else {
       item.setLevel(
           commonItemService.findParticalItemById(item.getParentId()).getLevel() + 1); // 设置为内容级别
     }
     ArticleEntity article = new ArticleEntity();
     article.setContent(content);
     article.setContentTxt(contentTxt);
     article.setParentId(item.getParentId());
     article.setBelongId(DictionaryBean.keyDict.get("item_belongs_private").getValue());
     commonItemService.save(article);
     item.setArticle(article);
     commonItemService.save(item);
   }
   j.setMsg(message);
   return j;
 }