Ejemplo n.º 1
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.º 2
0
  private RecordedCase ModelToBean(GWTRecordedCase gwtRecordedCase) {

    RecordedCase bean = new RecordedCase();
    bean.setRequestMsg(gwtRecordedCase.getRequestMsg());
    bean.setResponseMsg(gwtRecordedCase.getResponseMsg());
    bean.setResponseFlag(gwtRecordedCase.getResponseFlag());
    bean.setIsCased(gwtRecordedCase.getIsCased());
    bean.setMemo(gwtRecordedCase.getMemo());
    bean.setCreateTime(gwtRecordedCase.GetCreateTime());
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = new Date();
    try {
      String recordTime = gwtRecordedCase.GetRecordTime();
      date = sdf.parse(recordTime);
    } catch (ParseException e) {
      String recordTime = gwtRecordedCase.GetCreateTime();
      try {
        date = sdf.parse(recordTime);
      } catch (ParseException e1) {
        e1.printStackTrace();
      }
    }
    bean.setRecordTime(date);
    bean.setSystemId(Integer.parseInt(gwtRecordedCase.getSystemID()));
    if (gwtRecordedCase.GetRecordUserId() != null) {
      bean.setRecordUserId(Integer.parseInt(gwtRecordedCase.GetRecordUserId()));
    }
    if (!gwtRecordedCase.IsNew()) {
      bean.setId(Integer.parseInt(gwtRecordedCase.getID()));
    }
    // bean.setRecordTime(gwtRecordedCase.GetRecordTime());

    return bean;
  }
Ejemplo n.º 3
0
 private GWTRecordedCase BeanToModel(RecordedCase data) {
   String userName = "";
   if (data.getRecordUserId() >= 0) {
     userName = (new UserService()).GetUserNameByUserId(String.valueOf(data.getRecordUserId()));
   }
   return new GWTRecordedCase(
       data.getId(),
       data.getRequestMsg(),
       data.getResponseMsg(),
       String.valueOf(data.getSystemId()),
       data.getMemo(),
       data.getResponseFlag(),
       data.getIsCased(),
       data.getRecordUserId(),
       data.getRecordTime(),
       data.getCreateTime(),
       userName);
 }