Beispiel #1
0
 /**
  * 审核前
  *
  * @param id
  * @param model
  * @return
  */
 @RequestMapping(value = "/preAudit")
 public String preAuditMms(@RequestParam(required = false) Long id, Model model) {
   ContMms contMms = new ContMms();
   contMms.setId(id);
   model.addAttribute("contMms", contMms);
   return "/cont/mms/mms-audit";
 }
Beispiel #2
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);
      }
    }
  }
Beispiel #3
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";
  }
Beispiel #4
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);
  }
Beispiel #5
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";
  }
Beispiel #6
0
  /**
   * 保存SMS群发任务
   *
   * @param task
   * @param uploadfile
   * @param uploadblackfile
   * @param uploadwhitefile
   * @throws Exception
   */
  @Transactional
  public void saveMsmTask(
      BatchTask task,
      MultipartFile uploadfile,
      MultipartFile uploadblackfile,
      MultipartFile uploadwhitefile,
      Long mmsvalue)
      throws Exception {
    String IsNewTerminalId = task.getIsNewTerminalId();
    String srcFrom = task.getSrcFrom();
    String smsorwapservice[] = task.getService().split("\\|");
    task.setFeeType(Long.valueOf(smsorwapservice[1]));
    task.setServiceId(smsorwapservice[0]);
    task.setFee(Long.valueOf(smsorwapservice[2]));
    task.setStatus(0L);

    task.setSpeed(50L);
    task.setTaskType(2l);
    task.setCreateTime(TimeStamp.getTime(14));
    task.setPriority(10L);
    task.setTraceRespond(1L);
    task.setStartTime(
        task.getStartTime().replaceAll("-", "").replaceAll(" ", "").replaceAll(":", ""));
    task.setStopTime(
        task.getStopTime().replaceAll("-", "").replaceAll(" ", "").replaceAll(":", ""));
    task.setCustomTag(0l);
    if (null != mmsvalue && !"".equals(mmsvalue)) {
      ContMms mmsInfo = mmsDao.findOne(mmsvalue);
      String mmstitle = mmsInfo.getTitle();
      String mmscontent = mmsInfo.getContentPath();
      String mmssmil = mmsInfo.getSmilName();
      task.setTitle(mmstitle);
      task.setContent(mmscontent);
      task.setSmil(mmssmil);
    }
    task = batchTaskDao.save(task);
    if (IsNewTerminalId.equals("1")) {
      PathInfo filepath =
          bsFileService.dealModuleFile(
              uploadfile, BsFileService.MODULE_TASK_BATCH, task.getId()); // 群发号码文件路径
      PathInfo whiteFilepath =
          bsFileService.dealModuleFile(
              uploadwhitefile, BsFileService.MODULE_TASK_BATCH_WHITE, task.getId()); // 白名单号码文件路径
      PathInfo blackFilepath =
          bsFileService.dealModuleFile(
              uploadblackfile, BsFileService.MODULE_TASK_BATCH_BLACK, task.getId()); // 黑名单号码文件路径

      // 号码文件来源文本文件
      if (srcFrom.equals("1")) {
        if (uploadfile != null && !uploadfile.isEmpty()) {
          List list = FileTools.readLines(filepath.getRealPath());
          task.setSubmitCnt(Long.valueOf(list.size()));
          // task.setMobileListFile(filepath.getRealWebPath(""));
          task.setMobileListFile(filepath.getRealPath()); // 存放号码文件绝对路径
        }
        if (uploadwhitefile != null && !uploadwhitefile.isEmpty()) {
          // task.setWhiteListFile(whiteFilepath.getRealPath());
          task.setWhiteListFile(whiteFilepath.getRealPath()); // 存放号码文件绝对路径
        }
        if (uploadblackfile != null && !uploadblackfile.isEmpty()) {
          // task.setBlackListFile(blackFilepath.getRealWebPath(""));
          task.setBlackListFile(blackFilepath.getRealPath()); // 存放号码文件绝对路径
        }
      } else {
        task.setSubmitCnt(saveTaskSendFile(task.getTerminalid(), filepath.getRealPath()));
        // saveTaskSendFile(task.getTerminalid(),
        // filepath.getRealPath());
        task.setMobileListFile(filepath.getRealPath()); // 存放号码文件绝对路径
        if (null != task.getBlackid() && !"".equals(task.getBlackid())) {
          // 黑名单文件
          saveTaskSendFile(task.getBlackid(), blackFilepath.getRealPath());
          // task.setBlackListFile(blackFilepath.getRealWebPath(""));
          task.setBlackListFile(blackFilepath.getRealPath()); // 存放号码文件绝对路径
        }
        if (null != task.getWhiteid() && !"".equals(task.getWhiteid())) {
          // 白名单文件
          saveTaskSendFile(task.getWhiteid(), whiteFilepath.getRealPath());
          // task.setWhiteListFile(whiteFilepath.getRealWebPath(""));
          task.setWhiteListFile(whiteFilepath.getRealPath()); // 存放号码文件绝对路径
        }
      }

      batchTaskDao.save(task);
    }
  }