コード例 #1
0
  /**
   * 针对单个数据集操作 包括增删改
   *
   * @param details
   * @throws Exception
   */
  public void saveSupportevaluation(Collection<Supportevaluation> details) throws Exception {
    if (null != details && details.size() > 0) {
      for (Supportevaluation item : details) {
        EntityState state = EntityUtils.getState(item);
        IUser loginUser = ContextHolder.getLoginUser();
        String ucn = loginUser.getCname();
        String un = loginUser.getUsername();
        Date myDate = new Date();
        if (state.equals(EntityState.NEW)) {
          fileManager(item);
          supportevaluationDao.saveData(item);
          // 对用户新增操作进行记录,在用户操作日志表中新增一条记录。
          userOperationLogManager.recordUserOperationLog(0, myDate, un, ucn, "对保障评估表新增一条记录");
        } else if (state.equals(EntityState.MODIFIED)) {
          fileManager(item);
          supportevaluationDao.updateData(item);
          // 对用户修改操作进行记录,在用户操作日志表中新增一条记录。
          userOperationLogManager.recordUserOperationLog(1, myDate, un, ucn, "对保障评估表修改选定记录");
        } else if (state.equals(EntityState.DELETED)) {
          supportevaluationDao.deleteData(item);
          // 对用户删除操作进行记录,在用户操作日志表中新增一条记录。
          userOperationLogManager.recordUserOperationLog(2, myDate, un, ucn, "对保障评估表删除选定记录");
          // fileManager(item);
          FileHelper.deleteFile("/Out_Supportevaluation/" + item.getOid()); // 删除相关文件

        } else if (state.equals(EntityState.NONE)) {
        }
      }
    }
  }
コード例 #2
0
 /**
  * 学生档案中修改订单信息
  *
  * @param projectInfos
  * @throws Exception
  */
 @DataResolver
 public void updateStudentDangAn(Collection<OaOrder> oaOrderInfos) throws Exception {
   IUser user = ContextHolder.getLoginUser();
   if (user == null) {
     throw new NoneLoginException("Please login first");
   }
   Session session = this.getSessionFactory().openSession();
   try {
     for (OaOrder oaOrder : oaOrderInfos) {
       EntityState state = EntityUtils.getState(oaOrder);
       if (state.equals(EntityState.MODIFIED)) {
         session.update(oaOrder);
       }
     }
   } finally {
     session.flush();
     session.close();
   }
 }
コード例 #3
0
 /**
  * 针对单个数据集操作 包括增删改
  *
  * @param details
  * @throws Exception
  */
 public void saveFlightrestrict(Collection<Flightrestrict> details) throws Exception {
   if (null != details && details.size() > 0) {
     for (Flightrestrict item : details) {
       EntityState state = EntityUtils.getState(item);
       if (state.equals(EntityState.NEW)) {
         int tempId = item.getId();
         fileManager(item);
         flightrestrictDao.saveData(item);
         FileHelper.changeFolderById(
             "/Fly_Flightrestrict/" + tempId,
             "/Fly_Flightrestrict/" + item.getId()); // 替换以临时ID命名的文件夹
       } else if (state.equals(EntityState.MODIFIED)) {
         fileManager(item);
         flightrestrictDao.updateData(item);
       } else if (state.equals(EntityState.DELETED)) {
         flightrestrictDao.deleteData(item);
         FileHelper.deleteFile("/Fly_Flightrestrict/" + item.getId()); // 删除相关文件
       } else if (state.equals(EntityState.NONE)) {
       }
     }
   }
 }