コード例 #1
0
 public String edit() {
   entity = keywordsTacticsImpl.findTaskById(id);
   String dtStartTime = entity.getDtStartTime();
   String dtEndTime = entity.getDtEndTime();
   entity.setDtStartTime(dtStartTime.substring(0, 10));
   entity.setDtEndTime(dtEndTime.substring(0, 10));
   List<FtbKeyValueGetterFilter> kList = keywordsTacticsImpl.findKeyById(id);
   if (kList != null && kList.size() > 0) {
     vcFilterKeyValue1 = "";
     vcFilterKeyValue2 = "";
     businessIds = "";
     business = "";
     for (FtbKeyValueGetterFilter key : kList) {
       if (key.isExactMark() && isRepeat(vcFilterKeyValue1, key.getVcFilterKeyValue())) {
         vcFilterKeyValue1 = vcFilterKeyValue1 + key.getVcFilterKeyValue() + ",";
       }
       if (!key.isExactMark() && isRepeat(vcFilterKeyValue2, key.getVcFilterKeyValue())) {
         vcFilterKeyValue2 = vcFilterKeyValue2 + key.getVcFilterKeyValue() + ",";
       }
       if (isRepeat(business, key.getVcSoName())) {
         businessIds = businessIds + "0:" + key.getNmSoTypeId() + ",";
         business = business + key.getVcSoName() + ",";
       }
     }
     businessIds = businessIds.substring(0, businessIds.length() - 1);
     business = business.substring(0, business.length() - 1);
     if (!vcFilterKeyValue1.equals("")) {
       vcFilterKeyValue1 = vcFilterKeyValue1.substring(0, vcFilterKeyValue1.length() - 1);
     }
     if (!vcFilterKeyValue2.equals("")) {
       vcFilterKeyValue2 = vcFilterKeyValue2.substring(0, vcFilterKeyValue2.length() - 1);
     }
   }
   return "edit";
 }
コード例 #2
0
 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";
   }
 }