示例#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);
      }
    }
  }
示例#2
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);
  }