private GWTExecuteSetExecutePlan BeanToModel(ExecuteSetExecutePlan bean) {
   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
   String beginRunTime = bean.getBeginRunTime() == null ? "" : sdf.format(bean.getBeginRunTime());
   String endRunTime = bean.getEndRunTime() == null ? "" : sdf.format(bean.getEndRunTime());
   String addTime = sdf.format(bean.getAddTime());
   GWTExecuteSetExecutePlan gwtExecuteSetExecutePlan =
       new GWTExecuteSetExecutePlan(
           bean.getId().toString(),
           bean.getExecuteSetDirId(),
           bean.getExecutePlanId().toString(),
           bean.getSystemId(),
           bean.getAddUserId(),
           String.valueOf(bean.getScheduledRunStatus()),
           beginRunTime,
           endRunTime,
           addTime);
   String execSetName =
       DALFactory.GetBeanDAL(ExecuteSetDirectory.class)
           .Get(Op.EQ(GWTExecuteSetDirectory.N_ID, Integer.parseInt(bean.getExecuteSetDirId())))
           .getName();
   String execPlanName =
       DALFactory.GetBeanDAL(ExecutePlan.class)
           .Get(Op.EQ(GWTExecutePlan.N_ID, bean.getExecutePlanId()))
           .getName();
   String userName =
       DALFactory.GetBeanDAL(User.class).Get(Op.EQ(GWTUser.N_id, bean.getAddUserId())).getName();
   gwtExecuteSetExecutePlan.SetExecPlanName(execPlanName);
   gwtExecuteSetExecutePlan.SetExecuteSetName(execSetName);
   gwtExecuteSetExecutePlan.SetUserName(userName);
   return gwtExecuteSetExecutePlan;
 }
 @Override
 public Boolean SaveOrUpdateExecuteSetExecutePlan(
     GWTExecuteSetExecutePlan gwtExecuteSetExecutePlan) {
   // TODO Auto-generated method stub
   ExecuteSetExecutePlan old = null;
   if (!gwtExecuteSetExecutePlan.isNew()) { // 如果不为新增
     old =
         esExecutePlanDAL.Get(
             Op.EQ(
                 GWTExecuteSetExecutePlan.N_ID,
                 Integer.parseInt(gwtExecuteSetExecutePlan.GetID())));
     if (gwtExecuteSetExecutePlan.GetExecutePlanID().equals("-1")) {
       // 计划任务ID为-1,表示删除原有计划任务
       esExecutePlanDAL.Del(old);
       return true;
     }
   }
   ExecuteSetExecutePlan data = ModelToBean(old, gwtExecuteSetExecutePlan);
   if (data.getAddUserId().equals("Administrator")) {
     data.setAddUserId("0");
   }
   if (gwtExecuteSetExecutePlan.isNew()) {
     data.setAddTime(new Date());
     esExecutePlanDAL.Add(data);
   } else {
     esExecutePlanDAL.Edit(data);
   }
   return true;
 }
 @Override
 public GWTExecuteSetExecutePlan GetExecSetExecPlan(String execSetId) {
   // TODO Auto-generated method stub
   ExecuteSetExecutePlan data =
       esExecutePlanDAL.Get(Op.EQ(GWTExecuteSetExecutePlan.N_ExecuteSetID, execSetId));
   if (data == null) {
     return null;
   } else {
     return BeanToModel(data);
   }
 }
 @Override
 public PagingLoadResult<GWTExecuteSetExecutePlan> GetExecuteSetExecutePlanList(
     String execPlanID, String systemID, String searchKey, PagingLoadConfig config) {
   // TODO Auto-generated method stub
   try {
     int count;
     List<ExecuteSetExecutePlan> lst;
     List<Op> ops = new ArrayList<Op>();
     ops.add(Op.EQ(GWTExecuteSetExecutePlan.N_SystemID, systemID));
     if (!execPlanID.isEmpty()) {
       ops.add(Op.EQ(GWTExecuteSetExecutePlan.N_ExecutePlanID, Integer.parseInt(execPlanID)));
     }
     Op[] condition = new Op[ops.size()];
     for (int i = 0; i < ops.size(); i++) { // 把集合类转成数组
       condition[i] = ops.get(i);
     }
     if (searchKey.isEmpty()) {
       count = esExecutePlanDAL.Count(condition);
       PageStartEnd pse = new PageStartEnd(config, count);
       lst =
           esExecutePlanDAL.List(
               GWTExecuteSetExecutePlan.N_ID, true, pse.getStart(), pse.getEnd(), condition);
     } else {
       String[] searchField = new String[] {};
       count = esExecutePlanDAL.MatchCount(searchKey, searchField, condition);
       PageStartEnd pse = new PageStartEnd(config, count);
       lst =
           esExecutePlanDAL.Match(searchKey, searchField, pse.getStart(), pse.getEnd(), condition);
     }
     List<GWTExecuteSetExecutePlan> result = new ArrayList<GWTExecuteSetExecutePlan>();
     for (ExecuteSetExecutePlan data : lst) {
       result.add(BeanToModel(data));
     }
     return new BasePagingLoadResult<GWTExecuteSetExecutePlan>(result, config.getOffset(), count);
   } catch (Exception e) {
     log.error(e, e);
     throw new RuntimeException(e);
   }
 }
Ejemplo n.º 5
0
  @Override
  public Boolean SaveRecordedCase(GWTRecordedCase recordedCase, Integer loginLogId) {

    RecordedCase data = ModelToBean(recordedCase);
    String userId = OperationLogService.getLoginLogById(loginLogId).getUserId();
    if (recordedCase.IsNew()) {
      data.setRecordTime(new Date());
      data.setRecordUserId(Integer.parseInt(userId));
      dataDao.Add(data);
      OperationLogService.writeOperationLog(
          OpType.RecordedCase,
          IDUType.Insert,
          data.getId(),
          data.getRequestMsg(),
          "memo",
          null,
          data.getRequestMsg(),
          loginLogId);
    } else {
      RecordedCase oldBean = dataDao.Get(Op.EQ("id", Integer.parseInt(recordedCase.getID())));
      data.setLastModifiedTime(new Date());
      data.setLastModifiedUserId(userId);
      try {
        OperationLogService.writeUpdateOperationLog(
            OpType.RecordedCase,
            RecordedCase.class,
            oldBean.getId(),
            "ID=" + recordedCase.getID(),
            oldBean,
            data,
            loginLogId);
      } catch (Exception e) {
        log.error(e, e);
      }
      dataDao.Edit(data);
    }
    return true;
  }
Ejemplo n.º 6
0
  @Override
  public PagingLoadResult<GWTRecordedCase> GetGWTRecordedCasePageList(
      String sysId, String searchKey, PagingLoadConfig config) {

    try {
      List<GWTRecordedCase> returnList = new ArrayList<GWTRecordedCase>();
      Op[] conditions;
      int count;
      List<RecordedCase> lst;

      List<Op> conList = new ArrayList<Op>();
      conList.add(Op.EQ("systemId", Integer.parseInt(sysId)));
      if (config.get("date") != null) {
        String date = config.get("date");
        conList.add(Op.LIKE("createTime", date));
      }
      if (config.get("reponseFlag") != null) {
        if (!config.get("reponseFlag").equals("-1")) {
          conList.add(
              Op.EQ(
                  GWTRecordedCase.N_ResponseFlag,
                  Integer.parseInt(config.get("reponseFlag").toString())));
        }
      }
      if (config.get("isCased") != null) {
        if (!config.get("isCased").equals("-1")) {
          conList.add(
              Op.EQ(GWTRecordedCase.N_IsCased, Integer.parseInt(config.get("isCased").toString())));
        }
      }
      if (config.get("user") != null) {
        if (!config.get("user").equals("-1")) {
          conList.add(Op.EQ("recordUserId", Integer.parseInt(config.get("user").toString())));
        }
      }

      conditions = new Op[conList.size()];
      for (int i = 0; i < conList.size(); i++) {
        conditions[i] = conList.get(i);
      }

      if (searchKey.isEmpty()) {
        count = dataDao.Count(conditions);
        PageStartEnd pse = new PageStartEnd(config, count);
        lst = dataDao.List(pse.getStart(), pse.getEnd(), conditions);
      } else {
        String[] properties = {"requestMsg", "responseMsg", GWTRecordedCase.N_Memo};
        count = dataDao.MatchCount(searchKey, properties, conditions);
        PageStartEnd pse = new PageStartEnd(config, count);
        lst = dataDao.Match(searchKey, properties, pse.getStart(), pse.getEnd(), conditions);
      }

      for (RecordedCase recrdCase : lst) {
        if (recrdCase != null) returnList.add(BeanToModel(recrdCase));
      }

      return new BasePagingLoadResult<GWTRecordedCase>(returnList, config.getOffset(), count);
    } catch (Exception ex) {
      log.error(ex, ex);
      throw new RuntimeException(ex);
    }
  }