示例#1
0
  /** 查询会计期间 */
  public void synPeriodStatus(Connection conn, SfUserDTO user) {
    int trueCount = 0;
    int totalCount = 0;
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    try {

      InquiryAssetPeriodStatusSrv service = new InquiryAssetPeriodStatusSrv();
      SrvAssetPeriodStatusDTO dtoParameter = new SrvAssetPeriodStatusDTO();
      SrvAssetPeriodDAO srvAssetPeriodDAO = new SrvAssetPeriodDAO(user, dtoParameter, conn);
      String bookType[] = logUtil.getBookTypeCodeModel(conn, MIS_CONSTANT.SOURCE_MIS);
      SrvReturnMessage srm = new SrvReturnMessage();

      for (int i = 0; i < bookType.length; i++) {
        logDTO = new SynLogDTO();
        logDTO.setSynType(SrvType.SRV_FA_PERIOD);
        logDTO.setCreatedBy(user.getUserId());
        logDTO.setSynMsg(bookType[i] + ":同步MIS资产会计期间开始");
        logUtil.synLog(logDTO, conn);
        service.setBookTypeCode(bookType[i]);
        service.execute();
        srm = service.getReturnMessage();

        if (srm.getErrorFlag().equals("Y")) {
          DTOSet ds = service.getDs();
          totalCount += ds.getSize();
          trueCount += srvAssetPeriodDAO.synAssetPeriod(ds);
        }
        resumeTime = System.currentTimeMillis() - start;
        logDTO = new SynLogDTO();
        logDTO.setSynType(SrvType.SRV_FA_PERIOD);
        logDTO.setCreatedBy(user.getUserId());
        logDTO.setSynMsg(
            bookType[i]
                + ":同步MIS资产会计期间结束。同步"
                + totalCount
                + "条记录,成功"
                + trueCount
                + ",失败"
                + (totalCount - trueCount)
                + ",耗时"
                + resumeTime
                + "毫秒");
        if (srm.getErrorFlag().equals("N")) {
          logDTO.setSynMsg(logDTO.getSynMsg() + ".错误信息:" + srm.getErrorMessage());
        }
        logUtil.synLog(logDTO, conn);
      }
      if (totalCount == trueCount) {
        SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_FA_PERIOD, conn);
        SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_FA_PERIOD, conn);
      }

    } catch (Exception e) {
      Logger.logError(e);
    }
  }
示例#2
0
  /** 查询资产财务信息服务(ODI) */
  public void synAssetInfo(Connection conn, SfUserDTO user, String periodName) {
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    boolean hasError = false;
    try {
      truncateData("ZTE_FA_ASSET_INFO", conn);
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_FA_TRANS_ASSET);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS资产财务信息(ODI)开始");
      logUtil.synLog(logDTO, conn);

      String bookTypeCodes[] =
          logUtil.getBookTypeCode(conn, MIS_CONSTANT.SOURCE_MIS); // 唐明胜修改,增加获取无形资产的账簿代码
      String envCode = SynUpdateDateUtils.getEnvCode("TransFaAssetInfoSrv", conn);
      //            String periodName =
      // SynUpdateDateUtils.getPeriodName(SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_FA_TRANS_ASSET, conn));
      // 唐明胜注释,会计期间需要获取关闭的最大会计期间

      TransFaAssetInfoSrv transAssetInfoSrv = new TransFaAssetInfoSrv();

      for (int i = 0; i < bookTypeCodes.length; i++) {
        transAssetInfoSrv.setEnvCode(envCode);
        transAssetInfoSrv.setPeriodName(periodName);
        transAssetInfoSrv.setBookTypeCode(bookTypeCodes[i]);
        transAssetInfoSrv.excute();
        SrvReturnMessage srvMessage = transAssetInfoSrv.getReturnMessage();
        if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
          resumeTime = System.currentTimeMillis() - start;
          logDTO = new SynLogDTO();
          logDTO.setSynType(SrvType.SRV_FA_TRANS_ASSET);
          logDTO.setCreatedBy(user.getUserId());
          logDTO.setSynMsg("同步MIS资产财务信息(ODI)成功。耗时" + resumeTime + "毫秒。");
          logUtil.synLog(logDTO, conn);
        } else {
          resumeTime = System.currentTimeMillis() - start;
          logDTO = new SynLogDTO();
          logDTO.setSynType(SrvType.SRV_FA_TRANS_ASSET);
          logDTO.setCreatedBy(user.getUserId());
          logDTO.setSynMsg(
              "同步MIS资产财务信息(ODI)失败。耗时" + resumeTime + "毫秒。错误信息:" + srvMessage.getErrorMessage());
          logUtil.synLog(logDTO, conn);
        }
      }
    } catch (Throwable e) {
      Logger.logError(e);
      hasError = true;
    } finally {
      if (!hasError) {
        SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_FA_TRANS_ASSET, conn);
        SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_FA_TRANS_ASSET, conn);
      }
    }
  }
示例#3
0
 /** 查询科目余额(ODI) */
 public void synAccountBlance(Connection conn, SfUserDTO user, String periodName) {
   long resumeTime = 0;
   SynLogDTO logDTO = null;
   SynLogUtil logUtil = new SynLogUtil();
   long start = System.currentTimeMillis();
   boolean hasError = false;
   try {
     truncateData("ZTE_GL_ACCOUNT_BALANCE", conn);
     logDTO = new SynLogDTO();
     logDTO.setSynType(SrvType.SRV_ACCOUNT_BALANCE);
     logDTO.setCreatedBy(user.getUserId());
     logDTO.setSynMsg("同步MIS科目余额(ODI)开始");
     logUtil.synLog(logDTO, conn);
     SBFIGLTransAccountBalanceSrv transAccountBalanceSrv = new SBFIGLTransAccountBalanceSrv();
     String envCode = SynUpdateDateUtils.getEnvCode("TransAccountBalanceSrv", conn);
     //            String periodName =
     // SynUpdateDateUtils.getPeriodName(SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_ACCOUNT_BALANCE, conn));
     // 唐明胜注释,会计期间需要获取最大已关闭会计期间
     transAccountBalanceSrv.setEnvCode(envCode);
     transAccountBalanceSrv.setPeriodName(periodName);
     transAccountBalanceSrv.excute();
     SrvReturnMessage srvMessage = transAccountBalanceSrv.getReturnMessage();
     if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
       resumeTime = System.currentTimeMillis() - start;
       logDTO = new SynLogDTO();
       logDTO.setSynType(SrvType.SRV_ACCOUNT_BALANCE);
       logDTO.setCreatedBy(user.getUserId());
       logDTO.setSynMsg("同步MIS科目余额(ODI)成功。耗时" + resumeTime + "毫秒。");
       logUtil.synLog(logDTO, conn);
     } else {
       resumeTime = System.currentTimeMillis() - start;
       logDTO = new SynLogDTO();
       logDTO.setSynType(SrvType.SRV_ACCOUNT_BALANCE);
       logDTO.setCreatedBy(user.getUserId());
       logDTO.setSynMsg(
           "同步MIS科目余额(ODI)失败。耗时" + resumeTime + "毫秒。错误信息:" + srvMessage.getErrorMessage());
       logUtil.synLog(logDTO, conn);
       hasError = true;
     }
   } catch (Throwable e) {
     Logger.logError(e);
     hasError = true;
   } finally {
     if (!hasError) {
       SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_ACCOUNT_BALANCE, conn);
       SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_ACCOUNT_BALANCE, conn);
     }
   }
 }
示例#4
0
 /** 查询项目任务信息(ODI) */
 public void synTransTaskInfo(Connection conn, SfUserDTO user) {
   long resumeTime = 0;
   SynLogDTO logDTO = null;
   SynLogUtil logUtil = new SynLogUtil();
   long start = System.currentTimeMillis();
   try {
     logDTO = new SynLogDTO();
     logDTO.setSynType(SrvType.SRV_PA_TASK);
     logDTO.setCreatedBy(user.getUserId());
     logDTO.setSynMsg("同步MIS项目任务信息(ODI)开始");
     logUtil.synLog(logDTO, conn);
     TransTaskInfoSrv transTaskInfoSrv = new TransTaskInfoSrv();
     String envCode = SynUpdateDateUtils.getEnvCode("TransTaskInfoSrv", conn);
     String lastUpdateDate = SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_PA_TASK, conn);
     transTaskInfoSrv.setEnvCode(envCode);
     transTaskInfoSrv.setStratLastUpdateDate(lastUpdateDate);
     transTaskInfoSrv.excute();
     SrvReturnMessage srvMessage = transTaskInfoSrv.getReturnMessage();
     if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
       SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_PA_TASK, conn);
       resumeTime = System.currentTimeMillis() - start;
       logDTO = new SynLogDTO();
       logDTO.setSynType(SrvType.SRV_PA_TASK);
       logDTO.setCreatedBy(user.getUserId());
       logDTO.setSynMsg("同步MIS项目任务信息(ODI)成功。耗时" + resumeTime + "毫秒");
       logUtil.synLog(logDTO, conn);
       SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_PA_TASK, conn);
     } else {
       resumeTime = System.currentTimeMillis() - start;
       logDTO = new SynLogDTO();
       logDTO.setSynType(SrvType.SRV_PA_TASK);
       logDTO.setCreatedBy(user.getUserId());
       logDTO.setSynMsg(
           "同步MIS项目任务信息(ODI)失败。耗时" + resumeTime + "毫秒。错误信息:" + srvMessage.getErrorMessage());
       logUtil.synLog(logDTO, conn);
     }
   } catch (QueryException e) {
     Logger.logError(e);
   } catch (ContainerException e) {
     Logger.logError(e);
   } catch (Exception e) {
     Logger.logError(e);
   }
 }
示例#5
0
  /** 查询资产分配行信息(ODI) */
  public void synAssetDistribute(Connection conn, SfUserDTO user) {
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    try {
      truncateData("ZTE_FA_ASSET_DISTRIBUTION", conn);
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_FA_DISTRIBUTION);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS资产分配行信息(ODI)开始");
      logUtil.synLog(logDTO, conn);

      TransAssetDistributionSrv transAssetDistributionSrv = new TransAssetDistributionSrv();
      String envCode = SynUpdateDateUtils.getEnvCode("TransAssetDistributionSrv", conn);
      //            String bookTypeCodes[] = logUtil.getBookTypeCodeModel(conn,
      // MIS_CONSTANT.SOURCE_MIS);
      String bookTypeCodes[] =
          logUtil.getBookTypeCode(conn, MIS_CONSTANT.SOURCE_MIS); // 唐明胜修改,增加获取无形资产的账簿代码
      String lastUpdateDate =
          SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_FA_DISTRIBUTION, conn);
      boolean hasError = false;
      if (bookTypeCodes != null && bookTypeCodes.length > 0) {
        for (int i = 0; i < bookTypeCodes.length; i++) {
          transAssetDistributionSrv.setEnvCode(envCode);
          transAssetDistributionSrv.setBookTypeCode(bookTypeCodes[i]);
          transAssetDistributionSrv.setStratLastUpdateDate(lastUpdateDate);
          try {
            transAssetDistributionSrv.excute();
            SrvReturnMessage srvMessage = transAssetDistributionSrv.getReturnMessage();
            if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
              resumeTime = System.currentTimeMillis() - start;
              logDTO = new SynLogDTO();
              logDTO.setSynType(SrvType.SRV_FA_DISTRIBUTION);
              logDTO.setCreatedBy(user.getUserId());
              logDTO.setSynMsg(
                  "同步MIS资产分配行信息(ODI)成功。耗时" + resumeTime + "毫秒,资产账簿:" + bookTypeCodes[i]);
              logUtil.synLog(logDTO, conn);
            } else {
              resumeTime = System.currentTimeMillis() - start;
              logDTO = new SynLogDTO();
              logDTO.setSynType(SrvType.SRV_FA_DISTRIBUTION);
              logDTO.setCreatedBy(user.getUserId());
              logDTO.setSynMsg(
                  "同步MIS资产分配行信息(ODI)失败。耗时"
                      + resumeTime
                      + "毫秒,资产账簿:"
                      + bookTypeCodes[i]
                      + "。错误信息:"
                      + srvMessage.getErrorMessage());
              logUtil.synLog(logDTO, conn);
              hasError = true;
            }
          } catch (Throwable ex) {
            hasError = true;
          }
        }
        if (!hasError) { // 记录日志位于最后,以免遗漏数据读取不过来
          SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_FA_DISTRIBUTION, conn);
          SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_FA_DISTRIBUTION, conn);
        }
      }
    } catch (Throwable e) {
      Logger.logError(e);
    }
  }