Example #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);
    }
  }
Example #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);
      }
    }
  }
Example #3
0
  /** 查询组织结构 */
  public void synOrgstructure(Connection conn, SfUserDTO user) {
    int count = 0;
    long resumeTime = 0;
    int falsecount = 0;
    long start = System.currentTimeMillis();
    SynLogDTO logDTO = null;
    try {
      SynLogUtil logUtil = new SynLogUtil();
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_ORG_STRUCTURE);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS组织结构开始");
      logUtil.synLog(logDTO, conn);

      SBHRHRInquiryOrgStructureSrv service = new SBHRHRInquiryOrgStructureSrv();
      service.excute();
      SrvReturnMessage srm = service.getReturnMessage();
      SBHRHRInquiryOrgStructureDAO dao =
          new SBHRHRInquiryOrgStructureDAO(user, new SBHRHRInquiryOrgStructureDTO(), conn);
      if (srm.getErrorFlag().equalsIgnoreCase("Y")) {
        DTOSet ds = service.getDs();
        if (ds.getSize() > 0) {
          ds = filterDtoSet(ds);
          count = dao.synOrgStructure(ds);
        }
      }
      falsecount = dao.getErrorCount();
      if (falsecount == 0) { // 没有发生错误才记录同步类型的更新时间
        SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_ORG_STRUCTURE, conn);
        SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_ORG_STRUCTURE, conn);
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_ORG_STRUCTURE);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS组织结构结束。同步"
              + (count + falsecount)
              + "条记录,成功"
              + count
              + ",失败"
              + (falsecount)
              + ",耗时"
              + resumeTime
              + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (CalendarException e) {
      Logger.logError(e);
    } catch (DTOException e) {
      Logger.logError(e);
    } catch (DataHandleException e) {
      Logger.logError(e);
    }
  }
Example #4
0
  /** 查询资产类别 */
  public void synAssetCategory(Connection conn, SfUserDTO user) {
    int count = 0;
    long resumeTime = 0;
    int errorCount = 0;
    long start = System.currentTimeMillis();
    SynLogDTO logDTO = null;
    try {
      SynLogUtil logUtil = new SynLogUtil();
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_FA_CATEGORY);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS资产类别开始");
      logUtil.synLog(logDTO, conn);

      SBFIFAInquiryAssetCategorySrv service = new SBFIFAInquiryAssetCategorySrv();
      String lastUpdateDate = logUtil.getLastUpdateDate(SrvType.SRV_FA_CATEGORY, conn);
      SBFIFASrvAssetCategoryDAO srvAssetCategoryDAO =
          new SBFIFASrvAssetCategoryDAO(user, new SBFIFASrvAssetCategoryDTO(), conn);
      service.setLastUpdateDate(lastUpdateDate);
      service.execute();
      SrvReturnMessage srm = service.getReturnMessage();
      if (srm.getErrorFlag().equals("Y")) {
        SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_FA_CATEGORY, conn);
        DTOSet ds = service.getDs();
        if (ds.getSize() > 0) {
          count = srvAssetCategoryDAO.SavaAssetCategory(ds);
        }
        SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_FA_CATEGORY, conn);
      }
      errorCount = srvAssetCategoryDAO.getErrorCount();
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_FA_CATEGORY);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS资产类别结束,成功" + count + ",失败" + errorCount + ",耗时" + resumeTime + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (DatatypeConfigurationException e) {
      Logger.logError(e);
    } catch (PoolException e) {
      Logger.logError(e);
    } catch (QueryException e) {
      Logger.logError(e);
    } catch (ContainerException e) {
      Logger.logError(e);
    } catch (CalendarException e) {
      Logger.logError(e);
    } catch (DTOException e) {
      Logger.logError(e);
    } catch (DataHandleException e) {
      Logger.logError(e);
    }
  }
Example #5
0
  /** 查询供应商信息 */
  public void synVendorInfo(Connection conn, SfUserDTO user) {
    int count = 0;
    int errorCount = 0;
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_VENDOR);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS供应商信息开始");
      logUtil.synLog(logDTO, conn);

      InquiryVendorInfoSrv service = new InquiryVendorInfoSrv();
      service.setLastUpdateDate(SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_VENDOR, conn));
      service.excute();
      SrvReturnMessage srvMessage = service.getReturnMessage();
      SrvVendorInfoDAO srvVendorInfoDAO = new SrvVendorInfoDAO(user, new SrvVendorInfoDTO(), conn);
      if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
        SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_VENDOR, conn);
        DTOSet ds = service.getDs();
        if (ds.getSize() > 0) {
          count = srvVendorInfoDAO.synVendorInfo(ds);
        }
        SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_VENDOR, conn);
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_VENDOR);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS供应商信息结束。同步"
              + (count + errorCount)
              + "条记录,成功"
              + count
              + ",失败"
              + errorCount
              + ",耗时"
              + resumeTime
              + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (DataHandleException e) {
      Logger.logError(e);
    } catch (QueryException e) {
      Logger.logError(e);
    } catch (ContainerException e) {
      Logger.logError(e);
    } catch (Exception e) {
      Logger.logError(e);
    }
  }
Example #6
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);
     }
   }
 }
Example #7
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);
   }
 }
Example #8
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);
    }
  }
Example #9
0
  /** 查询资产地点 */
  public void synFaLocation(Connection conn, SfUserDTO user) {
    int totalCount = 0;
    int count = 0;
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_FA_LOCATION);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS资产地点开始");
      logUtil.synLog(logDTO, conn);

      SrvAssetLocationSrv service = new SrvAssetLocationSrv();
      SrvAssetLocationDTO dtoParameter = new SrvAssetLocationDTO();
      SrvAssetLocationDAO srvAssetLocationDAO = new SrvAssetLocationDAO(user, dtoParameter, conn);
      service.setLastUpDate(SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_FA_LOCATION, conn));
      SrvProcessModel spm = new SrvProcessModel();
      SQLModel sqlModel =
          spm.getLocalCodeModel(MIS_CONSTANT.SOURCE_MIS, SinoConfig.getLoc1SetNameMis());
      SimpleQuery simp = new SimpleQuery(sqlModel, conn);
      simp.executeQuery();
      Row row = null;
      if (simp.hasResult()) {
        RowSet rs = simp.getSearchResult();
        for (int i = 0; i < rs.getSize(); i++) {
          row = rs.getRow(i);
          String cc = row.getStrValue("FLEX_VALUE");
          service.setSegment1(cc);
          service.excute();
          SrvReturnMessage srm = service.getReturnMessage();
          if (srm.getErrorFlag().equals("Y")) {
            DTOSet ds = service.getDs();
            totalCount += ds.getSize();
            if (ds.getSize() > 0) {
              count += srvAssetLocationDAO.synAssetLocation(ds, cc);
            }
          }
        }
        if (totalCount == count) { // 全部成功才更新同步类型日志,以免下次获取不到数据
          SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_FA_LOCATION, conn);
          SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_FA_LOCATION, conn);
        }
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_FA_LOCATION);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS资产地点结束。同步"
              + totalCount
              + "条记录,成功"
              + count
              + ",失败"
              + (totalCount - count)
              + ",耗时"
              + resumeTime
              + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (Exception e) {
      Logger.logError(e);
    }
  }
Example #10
0
  /** 查询项目信息 */
  public void synProjectInfo(Connection conn, SfUserDTO user) {
    int totalCount = 0;
    int errorCount = 0;
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_PA_PROJECT);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS项目信息开始");
      logUtil.synLog(logDTO, conn);

      InquiryProjectInfoSrv projectInfoSrv = new InquiryProjectInfoSrv();
      projectInfoSrv.execute();
      SrvReturnMessage srvMessage = projectInfoSrv.getReturnMessage();
      if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
        DTOSet ds = projectInfoSrv.getDs();
        SrvProjectInfoDAO srvProjectInfoDAO = new SrvProjectInfoDAO(user, null, conn);
        for (int i = 0; i < ds.getSize(); i++) {
          SrvProjectInfoDTO dto = (SrvProjectInfoDTO) ds.getDTO(i);
          srvProjectInfoDAO.setDTOParameter(dto);
          try {
            if (SynUpdateDateUtils.getBetweenDays(
                    SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_PA_PROJECT, conn),
                    (dto.getLastUpdateDate().toString()))
                > 0) {
              if (srvProjectInfoDAO.isProjecdtExists(dto.getSegment1())) {
                srvProjectInfoDAO.updateData();
              } else {
                srvProjectInfoDAO.createData();
              }
              totalCount++;
            }
          } catch (Throwable e) {
            Logger.logError(e);
            logDTO = new SynLogDTO();
            logDTO.setSynType(SrvType.SRV_PA_PROJECT);
            logDTO.setCreatedBy(user.getUserId());
            logDTO.setSynMsg(e.toString());
            logUtil.synLog(logDTO, conn);
            errorCount++;
          }
        }
        if (errorCount == 0) { // 错误数为0时才能更新同步类型日志记录,否则可能造成数据遗漏
          SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_PA_PROJECT, conn);
          SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_PA_PROJECT, conn);
        }
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_PA_PROJECT);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS项目信息结束!成功" + totalCount + ",失败" + errorCount + ",耗时" + resumeTime + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (Throwable e) {
      Logger.logError(e);
    }
  }
Example #11
0
  /** 查询值集信息 */
  public void synSetValue(Connection conn, SfUserDTO user, String source) {
    int totalCount = 0;
    long resumeTime = 0;
    int errorCount = 0;
    long start = System.currentTimeMillis();
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_SET_VALUESET);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS值集值信息服务开始");
      logUtil.synLog(logDTO, conn);

      SBSYSYInquiryVSetValueInfoDAO mFndFlexValuesDAO =
          new SBSYSYInquiryVSetValueInfoDAO(user, null, conn);
      List valuesList = mFndFlexValuesDAO.getAllFlexValues(source);
      if (valuesList != null && valuesList.size() > 0) {
        SBSYSYInquiryVSetValueInfoSrv setValueInfoSrv = new SBSYSYInquiryVSetValueInfoSrv();
        setValueInfoSrv.setStartLastUpdateDate(
            SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_SET_VALUESET, conn));

        for (int i = 0; i < valuesList.size(); i++) {
          String flexValueName = (String) valuesList.get(i);
          setValueInfoSrv.setFlexValueName(flexValueName);
          setValueInfoSrv.execute();
          SrvReturnMessage srvMessage = setValueInfoSrv.getReturnMessage();
          if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
            DTOSet ds = setValueInfoSrv.getDs();
            for (int j = 0; j < ds.getSize(); j++) {
              SBSYSYInquiryVSetValueInfoDTO valueSetDTO =
                  (SBSYSYInquiryVSetValueInfoDTO) ds.getDTO(j);
              mFndFlexValuesDAO.setDTOParameter(valueSetDTO);
              try {
                if (mFndFlexValuesDAO.isexistsSetValueModel(
                    valueSetDTO.getFlexValue(), valueSetDTO.getFlexValueSetId())) {
                  mFndFlexValuesDAO.updateData();
                } else {
                  mFndFlexValuesDAO.createData();
                }
                totalCount++;
              } catch (Throwable e) {
                Logger.logError(e);
                logDTO = new SynLogDTO();
                logDTO.setSynType(SrvType.SRV_SET_VALUESET);
                logDTO.setCreatedBy(user.getUserId());
                logDTO.setSynMsg(e.toString());
                logUtil.synLog(logDTO, conn);
                errorCount++;
              }
            }
          }
        }
        if (errorCount == 0) {
          SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_SET_VALUESET, conn);
          SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_SET_VALUESET, conn);
        }
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_SET_VALUESET);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS值集值信息服务结束。成功" + totalCount + ",失败" + errorCount + ",耗时" + resumeTime + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (Throwable e) {
      Logger.logError(e);
    }
  }
Example #12
0
  /** 查询员工信息 */
  public void synEmployeeInfo(Connection conn, SfUserDTO user) {
    long resumeTime = 0;
    int baseErrorCount = 0;
    int baseTotalCount = 0;
    int assignErrorCount = 0;
    int assignTotalCount = 0;
    long start = System.currentTimeMillis();
    SBHRHRInquiryEmpBaseInfoSrv employeeInfoSrv = new SBHRHRInquiryEmpBaseInfoSrv();
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_EMPLOYEE);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS员工信息开始");
      logUtil.synLog(logDTO, conn);

      employeeInfoSrv.setStartLastUpdateDate(
          SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_EMPLOYEE, conn));
      employeeInfoSrv.excute();
      SrvReturnMessage srvMessage = employeeInfoSrv.getReturnMessage();

      if (srvMessage.getErrorFlag().equalsIgnoreCase("Y")) {
        DTOSet ds = employeeInfoSrv.getDs();
        SBHRHRSrvEmpInfoDAO srvEmployeeInfoDAO = new SBHRHRSrvEmpInfoDAO(user, null, conn);
        for (int i = 0; i < ds.getSize(); i++) {
          SBHRHRSrvEmployeeInfoDTO dto = (SBHRHRSrvEmployeeInfoDTO) ds.getDTO(i);
          srvEmployeeInfoDAO.setDTOParameter(dto);
          try {
            if (srvEmployeeInfoDAO.isServiceTypeExists(dto.getEmployeeNumber())) {
              srvEmployeeInfoDAO.updateData();
            } else {
              srvEmployeeInfoDAO.createData();
            }
            baseTotalCount++;
          } catch (Throwable e) {
            Logger.logError(e);
            logDTO = new SynLogDTO();
            logDTO.setSynType(SrvType.SRV_EMPLOYEE);
            logDTO.setCreatedBy(user.getUserId());
            logDTO.setSynMsg(e.toString());
            logUtil.synLog(logDTO, conn);
            baseErrorCount++;
          }
        }
        SBHRHRInquiryEmpAssignInfoSrv empAssignInfoSrv = new SBHRHRInquiryEmpAssignInfoSrv();
        empAssignInfoSrv.setStartLastUpdateDate(
            SynUpdateDateUtils.getLastUpdateDate(SrvType.SRV_EMPLOYEE, conn));
        empAssignInfoSrv.execute();
        SrvReturnMessage empMessage = empAssignInfoSrv.getReturnMessage();
        if (empMessage.getErrorFlag().equalsIgnoreCase("Y")) {
          DTOSet dtos = empAssignInfoSrv.getDs();
          SBHRHRSrvEmpAssignDAO srvEmpAssignInfoDAO = new SBHRHRSrvEmpAssignDAO(user, null, conn);
          for (int i = 0; i < dtos.getSize(); i++) {
            SBHRHRSrvEmployeeInfoDTO dto = (SBHRHRSrvEmployeeInfoDTO) dtos.getDTO(i);
            srvEmpAssignInfoDAO.setDTOParameter(dto);
            try {
              if (srvEmpAssignInfoDAO.isEmployeeExists(dto.getEmployeeNumber())) {
                srvEmpAssignInfoDAO.updateData();
                assignTotalCount++;
              }
            } catch (Throwable e) {
              Logger.logError(e);
              logDTO = new SynLogDTO();
              logDTO.setSynType(SrvType.SRV_EMPLOYEE);
              logDTO.setCreatedBy(user.getUserId());
              logDTO.setSynMsg(e.toString());
              logUtil.synLog(logDTO, conn);
              assignErrorCount++;
            }
          }
        }
        if (baseErrorCount + assignErrorCount == 0) {
          SynUpdateDateUtils.createLastUpdateDate(SrvType.SRV_EMPLOYEE, conn);
          SynUpdateDateUtils.updateLastUpdateDate(SrvType.SRV_EMPLOYEE, conn);
        }
      }
      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType(SrvType.SRV_EMPLOYEE);
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg(
          "同步MIS员工信息结束。共同步"
              + (baseTotalCount + baseErrorCount + assignTotalCount + assignErrorCount)
              + "条记录,"
              + "员工基本信息同步成功"
              + baseTotalCount
              + ",失败"
              + baseErrorCount
              + ","
              + "员工分配信息同步成功"
              + assignTotalCount
              + ",失败"
              + assignErrorCount
              + ","
              + "耗时"
              + resumeTime
              + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (Throwable e) {
      Logger.logError(e);
    }
  }