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); }
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; }