Exemplo n.º 1
0
  /**
   * 创建彩信提交
   *
   * @param appId 应用id
   * @param contMms 彩信对象
   * @param mmsFrameData 彩信内容字符串
   * @param result
   * @return
   */
  @RequestMapping(value = "/add")
  @ResponseBody
  public Object addContMms(
      @ModelAttribute("mmsFrameData") String mmsFrameData,
      ContMms contMms,
      HttpSession session,
      BindingResult result,
      HttpServletRequest request) {

    /** 验证彩信表单 */
    Collection<Frame> frames = contMmsService.getFrame(mmsFrameData); // 获得彩信对象
    contMmsPostValidator.validate(contMms, result, frames);
    Long contMmsId = contMms.getId();
    if (result.hasErrors()) {
      return JsonRespWrapper.success("彩信内容不合法!", "/cont/mms/list");
    } else {
      SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.SESSION_USER_KEY);

      contMms.setUpdateUserId(sessionUser.getId());
      contMms.setUnitId(String.valueOf(sessionUser.getUnitId()));
      contMms = contMmsService.addContMms(contMms);
      contMmsService.createMmsContent(contMms, mmsFrameData, false, frames);
      logUtils.logAdd(MODULE_NAME, "添加,id:" + contMms.getId());

      if (contMmsId == null) {
        return JsonRespWrapper.success("添加成功", "/cont/mms/list");
      } else {
        // 返回来源地址
        String backUrl = request.getParameter("backUrl");
        return JsonRespWrapper.success("修改成功", backUrl);
      }
    }
  }
Exemplo n.º 2
0
 @RequestMapping(value = "/add", method = RequestMethod.POST)
 @ResponseBody
 public Object addPost(
     @ModelAttribute("sysAnnouncement") SysAnnouncement sysAnnouncement,
     BindingResult result,
     MultipartFile uploadfileAdvise,
     MultipartFile uploadfileAdviseExtend)
     throws Exception {
   if (StringUtils.isBlank(sysAnnouncement.getDescription())
       && sysAnnouncement.getPubDest().equals("1")) {
     result.rejectValue("description", "server", "公告内容不能为空");
     return JsonRespWrapper.error(result.getFieldErrors());
   }
   if ("1".equals(sysAnnouncement.getPubDest())) {
     sysAnnouncement.setTitle(
         sysAnnouncement.getTitle().substring(0, sysAnnouncement.getTitle().length() - 2));
   }
   if ("3".equals(sysAnnouncement.getPubDest())) {
     sysAnnouncement.setTitle(sysAnnouncement.getTitle().substring(1));
   }
   logUtils.logAdd("添加公告内容", "添加成功");
   sysAnnouncement.setEndTime(
       sysAnnouncement.getEndTime().replaceAll("-", "").replaceAll(" ", "").replaceAll(":", ""));
   this.sysAnnouncementService.save(sysAnnouncement, uploadfileAdvise, uploadfileAdviseExtend);
   return JsonRespWrapper.success("操作成功", "/websys/announcement");
 }
Exemplo n.º 3
0
 @RequestMapping(value = "/edit", method = RequestMethod.POST)
 @ResponseBody
 public Object editPost(
     @ModelAttribute("sysAnnouncement") SysAnnouncement sysAnnouncement,
     BindingResult result,
     MultipartFile uploadfileAdvise,
     MultipartFile uploadfileAdviseExtend)
     throws Exception {
   if (null == sysAnnouncement.getPubDest()) {
     SysAnnouncement s = sysAnnouncementDao.findOne(sysAnnouncement.getId());
     sysAnnouncement.setPubDest(s.getPubDest());
   }
   if (StringUtils.isBlank(sysAnnouncement.getDescription())
       && sysAnnouncement.getPubDest().equals("1")) {
     result.rejectValue("description", "server", "公告内容不能为空");
     return JsonRespWrapper.error(result.getFieldErrors());
   }
   if ("1".equals(sysAnnouncement.getPubDest())) {
     sysAnnouncement.setTitle(sysAnnouncement.getTitle().split(",")[0]);
   }
   if ("3".equals(sysAnnouncement.getPubDest())) {
     sysAnnouncement.setTitle(sysAnnouncement.getTitle().split(",")[1]);
   }
   sysAnnouncement.setEndTime(
       sysAnnouncement.getEndTime().replaceAll("-", "").replaceAll(" ", "").replaceAll(":", ""));
   this.sysAnnouncementService.save(sysAnnouncement, uploadfileAdvise, uploadfileAdviseExtend);
   logUtils.logAdd("编辑公告内容,", "修改成功,公告编号:", +sysAnnouncement.getId());
   return JsonRespWrapper.success("操作成功", "/websys/announcement");
 }
Exemplo n.º 4
0
 @RequestMapping(value = "/del")
 @ResponseBody
 public Object del(@RequestParam(value = "id") Long id) {
   this.sysAnnouncementService.delete(id);
   logUtils.logAdd("删除公告内容,", "删除成功,公告编号:", +id);
   return JsonRespWrapper.success("操作成功", "/websys/announcement");
 }
Exemplo n.º 5
0
  @RequestMapping(value = "/delete/{id}")
  @ResponseBody
  public Object delete(@PathVariable Long id) {
    // 彩信
    // ContMms contMms = contMmsService.getContMmsById(id);
    // if (!checkContMmsPermission(contMms, session)) {
    // return JsonRespWrapper.error("no permission");
    // }

    contMmsService.deleteContMmsById(id);
    logUtils.logDelete(MODULE_NAME, "删除,id:" + id);
    return JsonRespWrapper.successReload("删除成功");
  }
Exemplo n.º 6
0
  /**
   * 审核
   *
   * @param id
   * @param status
   * @param model
   * @return
   * @throws SQLException
   */
  @RequestMapping(value = "/audit")
  @ResponseBody
  public Object auditMms(
      ContMms contMms, String status, HttpSession session, Model model, HttpServletRequest request)
      throws SQLException {

    SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.SESSION_USER_KEY);

    contMms.setAuditorId(sessionUser.getId());
    String mag = "审核驳回成功";
    if ("1".equals(status.trim())) {
      mag = "审核成功";
    }
    contMmsService.auditContMms(contMms);
    logUtils.logAudit(MODULE_NAME, "审核,id:" + contMms.getId());
    // 返回来源地址
    String backUrl = request.getParameter("backUrl");
    return JsonRespWrapper.success(mag, backUrl);
  }
Exemplo n.º 7
0
 @RequestMapping(value = "/audit", method = RequestMethod.POST)
 @ResponseBody
 public Object auditPost(Long id, int auditResult) {
   this.sysAnnouncementService.audit(id, auditResult == 1);
   return JsonRespWrapper.success("操作成功", "/websys/announcement");
 }