/** 编辑策略 */ 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 void stopTactics() throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); String msg = ""; ServletActionContext.getResponse().setCharacterEncoding("UTF-8"); ServletActionContext.getRequest().setCharacterEncoding("UTF-8"); int nmDataGetterTaskId = ReqUtils.getReqInt(request, "ids"); keywordsTacticsImpl.stopTatctics(nmDataGetterTaskId); msg = "停止策略成功!"; Struts2Utils.renderText(msg); }
/** * 获取策略名 * * @throws IOException */ @Transactional(propagation = Propagation.REQUIRED, readOnly = true) public void getTaskName() throws IOException { HttpServletRequest request = ServletActionContext.getRequest(); PrintWriter out = ServletActionContext.getResponse().getWriter(); ServletActionContext.getResponse().setCharacterEncoding("UTF-8"); String nmDataGetterTaskId = ReqUtils.getReqString(request, "id"); List<KeywordsTacticsDTO> lst = keywordsTacticsImpl.getShowMessage(nmDataGetterTaskId); JSONArray array = JSONArray.fromObject(lst.get(0)); out.write(array.toString()); }
/** 查询详细信息 */ public void showDialect() { HttpServletRequest request = ServletActionContext.getRequest(); GridServerHandler gridServerHandler = new GridServerHandler(Struts2Utils.getRequest(), Struts2Utils.getResponse()); String nmDataGetterTaskId = ReqUtils.getReqString(request, "id"); List<DialectKeywordsDTO> list = keywordsTacticsImpl.showDialect(nmDataGetterTaskId); List<JSONObject> jsonList = new ArrayList<JSONObject>(); for (DialectKeywordsDTO dto : list) { jsonList.add(JSONObject.fromObject(dto)); } gridServerHandler.setData(jsonList); Struts2Utils.renderJson(gridServerHandler.getLoadResponseJSON().toString()); }
/** 删除策略 */ public void deleteTactics() throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); String msg = ""; ServletActionContext.getResponse().setCharacterEncoding("UTF-8"); ServletActionContext.getRequest().setCharacterEncoding("UTF-8"); String nmDataGetterTaskId = ReqUtils.getReqString(request, "ids"); List dlist = keywordsTacticsImpl.findDataGetterFilterId(nmDataGetterTaskId); 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.deleteTactics(nmDataGetterTaskId); msg = "删除策略成功!"; Struts2Utils.renderText(msg); }