Esempio n. 1
0
 public String checkExtractName() throws Exception {
   HttpServletRequest request = Struts2Utils.getRequest();
   HttpServletResponse response = Struts2Utils.getResponse();
   String taskName = getQueryParameter(request, "extractName");
   String act = this.getQueryParameter(request, "act");
   StringBuffer result = new StringBuffer();
   if (null == taskName) {
     result.append("{success:false,desc:'请输入任务名称!'}");
   } else {
     if (taskName.length() > 100) {
       result.append("{success:false,desc:'任务名称超过100个字符,请重新命名!'}");
     } else {
       if (HTMLFilter.isChineseEnglishNumber(taskName)) {
         // 新建、拷贝情况,只要分群名字存在,需要充命名
         if ("new".equalsIgnoreCase(act) || "copy".equalsIgnoreCase(act) || null == act) {
           if (extractTaskService.isTaskNameUnique(taskName)) {
             result.append("{success:true,desc:'任务名称可用!'}");
           } else {
             result.append("{success:false,desc:'任务名称已经存在,请重新命名!'}");
           }
         }
       } else {
         result.append("{success:false,desc:'只能输入汉字、数字、字母,字符之间不能空格,请重新输入!'}");
       }
     }
   }
   return writerMessageToClient(response, result.toString());
 }
Esempio n. 2
0
  public String showCustomMoldMain() throws Exception {
    HttpServletRequest request = Struts2Utils.getRequest();
    HttpServletResponse response = Struts2Utils.getResponse();

    String result =
        "{success: true,desc: '操作成功',currpage: 1, totalpages:1, totalrecords:7,rows: [{ id: '648c6cd6065d47c587b1378697513094', moldName: 'test sjj辽宁精选书香阅读包9月续订', createUser: '******', createDate: '2013-09-09 11:31:53', moldDesc: '提取辽宁精选书香阅读包续订用户清单', taskStatus: '待审核', taskType: 'A', func: '11' }, { id: '691eca35607b431993c8f5b546f6bca5', moldName: 'ebtest212', createUser: '******', createDate: '2013-08-14 22:43:26', moldDesc: 'ebtest', taskStatus: '待审核', taskType: 'A', func: '11' }, { id: 'c75752b0dd0c4e299b3f3e738b0ea8d4', moldName: '测试模板功能', createUser: '******', createDate: '2013-08-14 22:43:01', moldDesc: '测试', taskStatus: '待审核', taskType: 'A', func: '11' }, { id: 'be9c615d1be647b88235dadb2b96e2d0', moldName: 'test8390提取苏州地区6月份付费用户明细', createUser: '******', createDate: '2013-08-14 14:08:11', moldDesc: '提取分地市付费用户明细', taskStatus: '待审核', taskType: 'A', func: '11' }, { id: '57b80905ca08492f8608920f7b319c45', moldName: 'test8412提取6月份江苏地区高价值用户清单sjj', createUser: '******', createDate: '2013-08-14 14:04:58', moldDesc: '适用于提取地市高价值用户明细', taskStatus: '待审核', taskType: 'A', func: '11' }, { id: 'eef58b9a3a9d47bab90954b2352a08ac', moldName: 'test包月类指标体系sjj', createUser: '******', createDate: '2013-08-08 12:47:09', moldDesc: '应用范围:省份一线运营及精细化营销人员;   可以按照包月产品ID或者产品名称进行批量用户查询', taskStatus: '待审核', taskType: 'A', func: '11' }, { id: '46860f929bce4949b98aecc98c1c6084', moldName: 'test活动专区类sjj', createUser: '******', createDate: '2013-08-08 12:41:58', moldDesc: '应用范围:省份一线运营及精细化营销人员;  可以根据活动页面-节点ID来提取用户', taskStatus: '待审核', taskType: 'A', func: '11' }]}";

    return writerMessageToClient(response, result);
  }
Esempio n. 3
0
  public void modify() {
    HttpServletRequest request = Struts2Utils.getRequest();
    HttpServletResponse response = Struts2Utils.getResponse();
    HttpSession session = Struts2Utils.getSession();
    StringBuilder result = new StringBuilder();
    String taskId = getQueryParameter(request, "moldId");
    logger.info("Action 查看取数模板详细信息  taskId = " + taskId);
    ExtractMold obj = new ExtractMold();
    if (StringUtils.isBlank(taskId)) {
      result.append("{success : false , desc:'查看模板失败!moldId不能为空!'}");
    } else {
      obj = mouldService.getExtractTask(taskId);
      result.append("{success : true , desc:'模板信息获取成功'}");
    }
    List<LabelValue> operateList = operators();
    List<LabelValue> clusterOperateList = getClusterOperatorList();
    request.setAttribute("allOperators", operateList);
    request.setAttribute("allClusterOpt", clusterOperateList);

    System.out.println("!!!!!!result=" + result);

    session.setAttribute("moldData", obj);
  }
Esempio n. 4
0
  public String saveAndSubmit() {
    HttpServletRequest request = Struts2Utils.getRequest();
    HttpSession session = Struts2Utils.getSession();
    // 1.新建  act=new  2.修改 act=modify 3.复制 act = copy
    String act = this.getQueryParameter(request, "act");
    // 获取groupId值
    String taskId = this.getQueryParameter(request, "taskId");
    String taskName = this.getQueryParameter(request, "extractName");
    String taskDesc = this.getQueryParameter(request, "extractDesc");
    String auditor = this.getQueryParameter(request, "auditor");
    String provinceId = this.getQueryParameter(request, "indArea");

    ExtractTask extractTask = null;
    if (StringUtils.isBlank(taskId)) {
      // 1.新建  act=new  //容器中没有就新建
      if (StringUtils.isBlank(act)) {
        //			if("new".equalsIgnoreCase(act)){
        extractTask = new ExtractTask();
        // 设置分群id
        taskId = UIDGenerator.generate().toString().substring(0, 19) + System.currentTimeMillis();
        extractTask.setId(taskId);
        // 设置客户分群状态    目前能用的状态共7个,分别是: 2 未提交  、4 等待执行、5 执行中、6 执行失败、7 执行完成、8 有数据、9无数据
        int taskStatus = 1; // 2 未提交
        extractTask.setTaskStatus(taskStatus);
        extractTask.setTaskName(taskName);
        extractTask.setTaskDesc(taskDesc);

        // 群创建人
        String createUser = securityManager.loginUser().getLoginName();
        //				securityManager.getAllRole().get(1).
        extractTask.setCreateUser(createUser);

      } else {
        throw new RuntimeException("无效操作!");
      }
    }

    System.out.println("taskId=" + taskId);
    // 分群条件关系   规则表达式
    String ruleRelationExp = this.getQueryParameter(request, "ruleRelationExp");
    String[] props = request.getParameterValues("attr");

    if (StringUtils.isBlank(ruleRelationExp)) {
      extractTask.setRuleRelationExp("");
    } else {
      extractTask.setRuleRelationExp(ruleRelationExp);
      ruleRelationExp = ruleRelationExp.replace("and", "+");
    }

    // 提取电话号码上限
    String upperLimit = this.getQueryParameter(request, "upperLimit");
    // 分群规则数据
    String[] ruleArrray = request.getParameterValues("rule");

    // 0415-2102

    if (HTMLFilter.isIntNumber(upperLimit)) {
      extractTask.setUpperLimit(Long.parseLong(upperLimit));
    } else {
      extractTask.setUpperLimit(0);
    }

    this.saveTaskRuleToContext(extractTask, ruleRelationExp, upperLimit, ruleArrray);

    /** 是否提取客户属性值 (1:表示是,0:表示否)默认为0 IS_EXTRACT_PROPS */
    //		if(StringUtils.isBlank(props.toString())){
    if (null == props) {
      /** 是否提取客户属性值 (1:表示是,0:表示否)默认为0 IS_EXTRACT_PROPS */
      extractTask.setIsExtractProps("0"); // 0:表示提取客户属性值
      extractTask.setExtractProps(null); // 将客户群提取的用户属性置空
    } else {
      extractTask.setIsExtractProps("1"); // 0:表示提取客户属性值
      this.saveTaskAttrToContext(extractTask, props);
    }

    if (StringUtils.isBlank(act) || "copy".equalsIgnoreCase(act)) {
      // 任务创建日期
      String createDate = DateUtil.getDateTime(Constants.DATE_PATTERN, new Date());
      extractTask.setCreateDate(createDate);
      // 修改日期
      String modifyDate = "-";
      extractTask.setModifyDate(modifyDate);
      extractTask.setTaskType("A");
      extractTask.setAuditUser(auditor);
      extractTask.setTaskSql(
          extractTaskService.getExtractTaskQueryString(extractTask).replace("'", "\""));
      extractTask.setProvinceId(provinceId);
      // 调用service.save方法,持久化数据
      try {
        extractTaskService.saveExtractTask(extractTask);
        session.setAttribute("status", "1");
      } catch (Exception e) {
        session.setAttribute("status", "0");
      }
    }
    // 跳转到客户分群列表界面
    return CrudActionSupport.RELOAD;
  }