Example #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);
      }
    }
  }
Example #2
0
  /**
   * 查看彩信详情
   *
   * @param appId 应用id
   * @param id 短信/彩信id
   * @param session
   * @param model
   * @return
   */
  @RequestMapping(value = "/view")
  public String viewContMms(@RequestParam(required = false) Long id, Model model) {
    ContMms contMms = contMmsService.getContMmsById(id);

    /** 将数据库时间转换成页面展示格式 yyyymmddhhmiss -> yyyy-mm-dd hh:mi:ss */
    contMms.setStartTime(
        TimeUtil.format(contMms.getStartTime(), TimeUtil.SOURCE_1, TimeUtil.TARGET_1));
    contMms.setEndTime(TimeUtil.format(contMms.getEndTime(), TimeUtil.SOURCE_1, TimeUtil.TARGET_1));

    model.addAttribute("contMms", contMms);
    return "/cont/mms/mms-view";
  }
Example #3
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("删除成功");
  }
Example #4
0
  /**
   * 获得应用下的彩信/短信
   *
   * @param pageNumber 分页总数
   * @param pageSize 页面条数
   * @param filter 查询条件 彩信/短信审核状态 0-待审核/1-审核通过/2-审核驳回
   * @param filterCt 查询条件 彩信/短信分类 0-短信/1-彩信
   * @param appId 应用id
   * @param startTime 查询条件开始时间
   * @param endTime 查询条件结束时间
   * @param session
   * @param model
   * @return
   * @throws SQLException
   */
  @RequestMapping(value = "/list")
  public String list(
      ContMms contMms,
      @RequestParam(value = "page", required = false, defaultValue = "1") int page,
      Model model)
      throws SQLException {
    /** 获得内容列表 */
    Page<ContMms> contentMmsList = contMmsService.listContMms(contMms, page, Page.DEFAULT_PAGESIZE);

    model.addAttribute("pageData", contentMmsList);
    model.addAttribute("statusMap", ContMms.ASTATUS_MAP);
    // /** 内容列表 */
    // model.addAttribute("content", content);

    return "/cont/mms/mms-list";
  }
Example #5
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);
  }
Example #6
0
  /**
   * 打开彩信编辑页面
   *
   * @param appId 应用id
   * @param id 短信/彩信id
   * @param model
   * @return
   * @throws SQLException
   */
  @RequestMapping(value = "preEdit")
  public String preEditMmsCont(@RequestParam(required = false) Long id, Model model)
      throws SQLException {

    ContMms contMms = contMmsService.getContMmsById(id);

    // /** 验证编辑权限 */
    // if (!checkContMmsPermission(contMms, session)) {
    // return "redirect:../info/no-permission";
    // }

    /** 将数据库时间转换成页面展示格式 yyyymmddhhmiss -> yyyy-mm-dd hh:mi:ss */
    contMms.setStartTime(
        TimeUtil.format(contMms.getStartTime(), TimeUtil.SOURCE_1, TimeUtil.TARGET_1));
    contMms.setEndTime(TimeUtil.format(contMms.getEndTime(), TimeUtil.SOURCE_1, TimeUtil.TARGET_1));

    List<ContentCode> contentCodeList = contentCodeService.getContentCodeList(1L);
    model.addAttribute("contentCodeList", contentCodeList);

    model.addAttribute("contMms", contMms);
    // AppInfo app = appInfoService.getAppInfo(appId);
    // model.addAttribute("app", app);
    return "cont/mms/mms-edit";
  }
Example #7
0
 /**
  * 加载已有彩信模块
  *
  * @param mmsId
  * @param model
  * @return
  */
 @RequestMapping(value = "loadMms/{mmsId}", method = RequestMethod.GET)
 @ResponseBody
 public Object loadMms(@PathVariable Long mmsId, Model model) {
   return contMmsService.getMmsContent(mmsId);
 }