/** 编辑策略 */ public void updateTactics() throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); PrintWriter out = ServletActionContext.getResponse().getWriter(); ServletActionContext.getResponse().setCharacterEncoding("UTF-8"); String vcTaskOrder = (String) ServletActionContext.getContext().getSession().get("baseUserId"); String dtOrderTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.s").format(new Date()); String dtStartTime = ReqUtils.getReqString(request, "dtStartTime"); String dtEndTime = ReqUtils.getReqString(request, "dtEndTime"); String intStartHour = ReqUtils.getReqString(request, "intStartHour"); String intEndHour = ReqUtils.getReqString(request, "intEndHour"); String vcContents = ReqUtils.getReqString(request, "vcContents"); // vcContents = new String(vcContents.getBytes("ISO-8859-1"),"UTF-8"); vcContents = new String(vcContents.getBytes("ISO-8859-1"), "GBK"); String nmDataGetterTaskId = ReqUtils.getReqString(request, "id"); String productArray = ReqUtils.getReqString(request, "product"); keywordsTacticsImpl.deleteKeyValueGetterFilter(nmDataGetterTaskId); keywordsTacticsImpl.updateTactics( nmDataGetterTaskId, vcTaskOrder, dtStartTime, dtEndTime, intStartHour, intEndHour, vcContents); String[] nmSoTypeIds = productArray.split(","); String isExactMarkValuearray = ReqUtils.getReqString(request, "iskey"); // isExactMarkValuearray = new // String(isExactMarkValuearray.getBytes("ISO-8859-1"),"UTF-8"); isExactMarkValuearray = new String(isExactMarkValuearray.getBytes("ISO-8859-1"), "GBK"); if (isExactMarkValuearray != "" || isExactMarkValuearray != null) { String[] isExactMarkValues = isExactMarkValuearray.split(","); for (int i = 0; i < nmSoTypeIds.length; i++) { String nmSoTypeId = nmSoTypeIds[i]; for (int j = 0; j < isExactMarkValues.length; j++) { String isExactMarkValue = isExactMarkValues[j]; // keywordsTacticsImpl.insertIsExactMark(nmDataGetterTaskId, nmSoTypeId, // isExactMarkValue); } } } String unExactMarkValuearray = ReqUtils.getReqString(request, "unkey"); // unExactMarkValuearray = new // String(unExactMarkValuearray.getBytes("ISO-8859-1"),"UTF-8"); unExactMarkValuearray = new String(unExactMarkValuearray.getBytes("ISO-8859-1"), "GBK"); if (unExactMarkValuearray != "" || unExactMarkValuearray != null) { String[] unExactMarkValues = unExactMarkValuearray.split(","); for (int i = 0; i < nmSoTypeIds.length; i++) { String nmSoTypeId = nmSoTypeIds[i]; for (int j = 0; j < unExactMarkValues.length; j++) { String unExactMarkValue = unExactMarkValues[j]; keywordsTacticsImpl.insertUnExactMark(nmDataGetterTaskId, nmSoTypeId, unExactMarkValue); } } } out.write("1"); }
public String update() throws ServletException, IOException { HttpServletRequest request = Struts2Utils.getRequest(); LoginListener loginListener = (LoginListener) request.getSession().getAttribute(VarConstants.LOGIN_LISTENER_KEY); TbBaseUserInfo userInfo = loginListener.getSessionContainer().getUserInfo(); String businessIds = request.getParameter("businessIds"); String business = request.getParameter("business"); String msg = null; String[] bussIds = null; String businessId = null; try { request.setAttribute(VarConstants.SUCC_CODE, MsgConstants.SUCC_CODE_00102); entity.setIntTaskStatus(0); // 新建时的状态 entity.setDtOrderTime( new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.s").format(new Date())); // 新建时的定制时间 entity.setVcTaskOrder(userInfo.getVcUserName()); keywordsTacticsImpl.update(entity); List dlist = keywordsTacticsImpl.findDataGetterFilterId(entity.getNmDataGetterTaskId() + ""); if (dlist != null && dlist.size() > 0) { String nmDataGetterFilterId = ""; for (int i = 0; i < dlist.size(); i++) { nmDataGetterFilterId = nmDataGetterFilterId + dlist.get(i).toString() + ","; } nmDataGetterFilterId = nmDataGetterFilterId.substring(0, nmDataGetterFilterId.length() - 1); keywordsTacticsImpl.deleteKeyValueSoTypeIdFilter(nmDataGetterFilterId); } keywordsTacticsImpl.deleteKeyValueGetterFilter(entity.getNmDataGetterTaskId()); if (businessIds != null && !"".equals(businessIds)) { String[] datas = businessIds.split(","); for (String ids : datas) { bussIds = ids.split(":"); businessId = bussIds[1].trim(); if (!vcFilterKeyValue1.equals("")) { vcFilterKeyValue1 = vcFilterKeyValue1.replace(",", ","); String[] vcFilterKeyValue = vcFilterKeyValue1.split(","); List keyList = new ArrayList<String>(); for (int i = 0; i < vcFilterKeyValue.length; i++) { if (!keyList.contains(vcFilterKeyValue[i]) && keyList.size() < 50) { long id = keywordsTacticsImpl.insertIsExactMark( entity.getNmDataGetterTaskId(), vcFilterKeyValue[i], 1); keywordsTacticsImpl.insertKeyValueSoTypeId(new Long(businessId), id); keyList.add(vcFilterKeyValue[i]); } } } if (!vcFilterKeyValue2.equals("")) { vcFilterKeyValue2 = vcFilterKeyValue2.replace(",", ","); String[] vcFilterKeyValue = vcFilterKeyValue2.split(","); List keyList2 = new ArrayList<String>(); for (int i = 0; i < vcFilterKeyValue.length; i++) { if (!keyList2.contains(vcFilterKeyValue[i]) && keyList2.size() < 50) { long id = keywordsTacticsImpl.insertIsExactMark( entity.getNmDataGetterTaskId(), vcFilterKeyValue[i], 0); keywordsTacticsImpl.insertKeyValueSoTypeId(new Long(businessId), id); keyList2.add(vcFilterKeyValue[i]); } } } } } msg = "编辑策略任务[名称:" + entity.getVcTaskName() + "]成功!"; // commonManagerImpl.log(request, msg); return "success"; } catch (Exception e) { logger.error(e.getMessage()); logger.error(e.toString()); logger.error(e.getMessage()); request.setAttribute(VarConstants.ERROR_CODE, MsgConstants.ERROR_CODE_00004); msg = "编辑策略任务[名称:" + entity.getVcTaskName() + "]失败!"; // commonManagerImpl.log(request, msg); return "success"; } }