Пример #1
0
  /** 同步公司间调拨 */
  public void synTransBtwCompany(Connection conn, SfUserDTO user) {
    long resumeTime = 0;
    SynLogDTO logDTO = null;
    SynLogUtil logUtil = new SynLogUtil();
    long start = System.currentTimeMillis();
    try {
      logDTO = new SynLogDTO();
      logDTO.setSynType("BTWTRANSCOMPANY");
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS公司间调拨开始");
      logUtil.synLog(logDTO, conn);

      SBFIFAAssetsTransBtwCompanyDAO commitDAO =
          new SBFIFAAssetsTransBtwCompanyDAO(user, new SBFIFAAssetsTransBtwCompanyDTO(), conn);
      commitDAO.autoSyschronizeAssets();

      resumeTime = System.currentTimeMillis() - start;
      logDTO = new SynLogDTO();
      logDTO.setSynType("BTWTRANSCOMPANY");
      logDTO.setCreatedBy(user.getUserId());
      logDTO.setSynMsg("同步MIS公司间调拨结束。耗时" + resumeTime + "毫秒");
      logUtil.synLog(logDTO, conn);
    } catch (Exception e) {
      Logger.logError(e);
    }
  }
Пример #2
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);
    }
  }
Пример #3
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);
      }
    }
  }
Пример #4
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);
    }
  }
Пример #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);
    }
  }
Пример #6
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);
    }
  }
Пример #7
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);
     }
   }
 }
Пример #8
0
  public SQLModel getDataCreateModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    List sqlArgs = new ArrayList();
    AmsSpareCategoryDTO amsSpareCategory = (AmsSpareCategoryDTO) dtoParameter;
    String sqlStr =
        "INSERT INTO "
            + " AMS_SPARE_CATEGORY("
            + " BARCODE,"
            + " ITEM_NAME,"
            + " ITEM_SPEC,"
            + " ITEM_CATEGORY,"
            + " SPARE_USAGE,"
            + " VENDOR_ID,"
            + " ITEM_UNIT,"
            + " REMARK,"
            + " CREATION_DATE,"
            + " CREATED_BY"
            + ") VALUES ("
            + " ?, ?, ?, ?, ?, ?, ?, ?, GETDATE(), ?)";

    sqlArgs.add(amsSpareCategory.getBarcode());
    sqlArgs.add(amsSpareCategory.getItemName());
    sqlArgs.add(amsSpareCategory.getItemSpec());
    sqlArgs.add(amsSpareCategory.getItemCategory());
    sqlArgs.add(amsSpareCategory.getSpareUsage());
    sqlArgs.add(amsSpareCategory.getVendorId());
    sqlArgs.add(amsSpareCategory.getItemUnit());
    sqlArgs.add(amsSpareCategory.getRemark());
    sqlArgs.add(sfUser.getUserId());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);
    return sqlModel;
  }
Пример #9
0
  public SQLModel getDataUpdateModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    List sqlArgs = new ArrayList();
    AmsSpareCategoryDTO amsSpareCategory = (AmsSpareCategoryDTO) dtoParameter;
    String sqlStr =
        "UPDATE AMS_SPARE_CATEGORY"
            + " SET"
            + " ITEM_NAME = ?,"
            + " ITEM_SPEC = ?,"
            + " ITEM_CATEGORY = ?,"
            + " SPARE_USAGE = ?,"
            + " VENDOR_ID = ?,"
            + " ITEM_UNIT = ?,"
            + " REMARK = ?,"
            + " LAST_UPDATE_DATE = GETDATE(),"
            + " LAST_UPDATE_BY = ?"
            + " WHERE "
            + " BARCODE = ?";
    sqlArgs.add(amsSpareCategory.getItemName());
    sqlArgs.add(amsSpareCategory.getItemSpec());
    sqlArgs.add(amsSpareCategory.getItemCategory());
    sqlArgs.add(amsSpareCategory.getSpareUsage());
    sqlArgs.add(amsSpareCategory.getVendorId());
    sqlArgs.add(amsSpareCategory.getItemUnit());
    sqlArgs.add(amsSpareCategory.getRemark());
    sqlArgs.add(sfUser.getUserId());
    sqlArgs.add(amsSpareCategory.getBarcode());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);
    return sqlModel;
  }
Пример #10
0
  /**
   * 增加信息到(ETS_FA_NEW_LOC)网络资产新地点表(AMS)
   *
   * @param objectCode
   * @param batchId
   * @param userAccount
   * @return
   */
  public SQLModel getInsertSynLogModel(
      String objectCode, String batchId, SfUserDTO userAccount, String priKey) {
    SQLModel sqlModel = new SQLModel();
    List sqlArgs = new ArrayList();
    String sqlStr =
        "INSERT INTO ETS_FA_NEW_LOC\n"
            + "  (LOCATION_ID,\n"
            + "   CODE,\n"
            + "   LOCATION,\n"
            + "   STATUS,\n"
            + "   ORGANIZATION_ID,\n"
            + "   MSG,\n"
            + "   BATCH_ID,\n"
            + "   CREATED_BY,\n"
            + "   CREATION_DATE)\n"
            + "  (SELECT '"
            + priKey
            + "',\n"
            + "          EOL.LOC2_CODE,\n"
            + "          EOL.LOC2_DESC,\n"
            +
            //        	"          2,\n" +//唐明胜注释
            "          0,\n"
            + // 唐明胜修改,1表示正在同步
            //        	"          EOCM.ORGANIZATION_ID,\n" +
            userAccount.getOrganizationId()
            + ",\n"
            + "          '',\n"
            + "          '"
            + batchId
            + "',\n"
            + "          "
            + userAccount.getUserId()
            + ",\n"
            + "          GETDATE()\n"
            + "     FROM ETS_OBJECT_LOC2 EOL"
            +
            //        	"	, ETS_OU_CITY_MAP EOCM\n" +
            //        	"    WHERE EOL.COMPANY_CODE = EOCM.COMPANY_CODE\n" +
            "     WHERE EOL.LOC2_CODE = ?)";

    sqlArgs.add(objectCode);
    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);
    return sqlModel;
  }
Пример #11
0
  /**
   * 功能:新增管理资产查询。
   *
   * @return SQLModel 返回页面翻页查询SQLModel
   * @throws com.sino.base.exception.SQLModelException 发生日历异常时转化为该异常抛出
   */
  public SQLModel getPageQueryModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    try {
      List sqlArgs = new ArrayList();
      AssetsAddDTO dto = (AssetsAddDTO) dtoParameter;
      //             AssetsAddLDTO dtoL = (AssetsAddLDTO) dtoParameter;
      String sqlStr =
          "SELECT EAAH.HEAD_ID,\n"
              + "       EAAH.BILL_NO,\n"
              + " CASE WHEN EAAH.STATUS=0 THEN '未完成' ELSE '已完成' END STATUS,"
              + "       EAAH.CREATE_USER,\n"
              + "       EAAH.CREATED_DATE,\n"
              + "       EAAH.SPEC_DEPT,\n"
              + "       EAAL.BARCODE,\n"
              + "       EAAL.ITEM_CODE,\n"
              + "       ESI.ITEM_NAME,\n"
              + "       ESI.ITEM_SPEC,\n"
              + "       SU.USERNAME\n"
              + "FROM   ETS_ASSETS_ADD_H EAAH,\n"
              + "       ETS_ASSETS_ADD_L EAAL,\n"
              + "       ETS_SYSTEM_ITEM  ESI,\n"
              + "       SF_USER          SU\n"
              + "WHERE  EAAH.HEAD_ID = EAAL.HEAD_ID\n"
              + "       AND EAAL.ITEM_CODE = ESI.ITEM_CODE\n"
              + "       AND EAAH.CREATE_USER = SU.USER_ID\n"
              + "       AND SU.ORGANIZATION_ID = ?\n"
              + "       AND SU.USERNAME LIKE dbo.NVL(?, SU.USERNAME)\n"
              + "       AND ESI.ITEM_SPEC LIKE dbo.NVL(?, ESI.ITEM_SPEC)\n"
              + "       AND ESI.ITEM_NAME LIKE dbo.NVL(?, ESI.ITEM_NAME)\n"
              + "       AND EAAH.STATUS = ISNULL(?, EAAH.STATUS)\n"
              + "       AND (? = '' OR EAAH.CREATED_DATE >= ISNULL(?, EAAH.CREATED_DATE))\n"
              + "       AND (? = '' OR EAAH.CREATED_DATE <= ISNULL(?, EAAH.CREATED_DATE))\n"
              + "       AND EAAL.BARCODE LIKE dbo.NVL(?, EAAL.BARCODE)\n"
              + "ORDER  BY EAAH.BILL_NO,\n"
              + "          EAAL.BARCODE";
      sqlArgs.add(sfDto.getOrganizationId());
      sqlArgs.add(dto.getCreateUser());
      sqlArgs.add(dto.getItemSpec());
      sqlArgs.add(dto.getItemName());
      if ("".equals(dto.getStatus()) || null == dto.getStatus()) {
        sqlArgs.add(null);
      } else {
        sqlArgs.add(StrUtil.strToInt(dto.getStatus()));
      }
      sqlArgs.add(dto.getFromDate());
      sqlArgs.add(dto.getFromDate());
      sqlArgs.add(dto.getToDate());
      sqlArgs.add(dto.getToDate());
      sqlArgs.add(dto.getBarcod());

      sqlModel.setSqlStr(sqlStr);
      sqlModel.setArgs(sqlArgs);
    } catch (CalendarException ex) {
      ex.printLog();
      throw new SQLModelException(ex);
    }
    return sqlModel;
  }
Пример #12
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);
   }
 }
 @SuppressWarnings("unchecked")
 public SQLModel getSyncErrorModel() {
   SQLModel sqlModel = new SQLModel();
   List sqlArgs = new ArrayList();
   String sqlStr =
       "SELECT COUNT(1) SYNC_ERROR_COUNT FROM ETS_AUTO_SYN_LOG EASL WHERE EASL.SYN_TYPE = 'SYN_CUST_DETAIL' AND EASL.CREATED_BY = ?";
   sqlArgs.add(sfUser.getUserId());
   sqlModel.setSqlStr(sqlStr);
   sqlModel.setArgs(sqlArgs);
   return sqlModel;
 }
  @SuppressWarnings("unchecked")
  public SQLModel getDataLogDeleteModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    List sqlArgs = new ArrayList();
    String sqlStr =
        "DELETE FROM ETS_AUTO_SYN_LOG WHERE SYN_TYPE = 'SYN_CUST_DETAIL' AND CREATED_BY = ?";
    sqlArgs.add(sfUser.getUserId());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);
    return sqlModel;
  }
Пример #15
0
  /**
   * 功能:导出Excel文件。
   *
   * @return File
   * @throws com.sino.base.exception.DataTransException
   */
  public File exportFile() throws DataTransException {
    File file = null;
    try {
      DataTransfer transfer = null;
      SQLModel sqlModel = sqlProducer.getPageQueryModel();
      TransRule rule = new TransRule();
      rule.setDataSource(sqlModel);
      rule.setCalPattern(CalendarConstant.LINE_PATTERN);
      rule.setSourceConn(conn);

      String fileName = "基站地点统计表.xls";
      String filePath = WorldConstant.USER_HOME;
      filePath += WorldConstant.FILE_SEPARATOR;
      filePath += fileName;
      rule.setTarFile(filePath);

      DataRange range = new DataRange();
      rule.setDataRange(range);

      Map fieldMap = new HashMap();
      fieldMap.put("WORKORDER_OBJECT_CODE", "地点编号");
      fieldMap.put("WORKORDER_OBJECT_NAME", "地点简称");
      fieldMap.put("WORKORDER_OBJECT_LOCATION", "所在地点");
      fieldMap.put("ORGANIZATION_ID", "组织ID");
      fieldMap.put("COUNTY_NAME", "所在区县");
      fieldMap.put("DISABLE_DATE", "失效日期");
      fieldMap.put("CATEGORY_NAME", "地点类别");
      //		fieldMap.put("IS_TEMP_ADDR", "是否临时地点");
      fieldMap.put("CREATION_DATE", "创建日期");
      fieldMap.put("CREATED_BY", "创建人");
      fieldMap.put("PROJECT_NAME", "所属工程");

      rule.setFieldMap(fieldMap);

      CustomTransData custData = new CustomTransData();
      custData.setReportTitle(fileName);
      custData.setReportPerson(sfUser.getUsername());
      custData.setNeedReportDate(true);
      rule.setCustData(custData);
      /*rule.setSheetSize(1000);*/
      // 设置分页显示
      TransferFactory factory = new TransferFactory();
      transfer = factory.getTransfer(rule);
      transfer.transData();
      file = (File) transfer.getTransResult();
    } catch (SQLModelException ex) {
      ex.printLog();
      throw new DataTransException(ex);
    }
    return file;
  }
  @SuppressWarnings("unchecked")
  public SQLModel getDataImpDeleteModel(String projectNum, String bookTypeCode)
      throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    List sqlArgs = new ArrayList();
    String sqlStr =
        "DELETE FROM ETS_TD_CUST_DETAIL_IMP2 WHERE BOOK_TYPE_CODE=? AND CREATE_USER_ID = ? AND PROJRCT_NUMBER= ? ";
    sqlArgs.add(bookTypeCode);
    sqlArgs.add(sfUser.getUserId());
    sqlArgs.add(projectNum);

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);
    return sqlModel;
  }
Пример #17
0
 /**
  * 功能:失效
  *
  * @return SQLModel 返回数据删除用SQLModel
  */
 public SQLModel getDataDeleteModel() {
   SQLModel sqlModel = new SQLModel();
   List sqlArgs = new ArrayList();
   AmsYjItemDTO amsYjItem = (AmsYjItemDTO) dtoParameter;
   String sqlStr =
       "UPDATE AMS_YJ_ITEM\n"
           + "SET DISABLE_DATE=GETDATE(),"
           + " LAST_UPDATE_DATE = GETDATE(),"
           + " LAST_UPDATE_USER = ?"
           + " WHERE"
           + " ITEM_CODE = CONVERT(FLOAT,?)";
   sqlArgs.add(sfUser.getUserId());
   sqlArgs.add(amsYjItem.getItemCode());
   sqlModel.setSqlStr(sqlStr);
   sqlModel.setArgs(sqlArgs);
   return sqlModel;
 }
 @SuppressWarnings("unchecked")
 public SQLModel getErrorRowModel() {
   SQLModel sqlModel = new SQLModel();
   List sqlArgs = new ArrayList();
   String sqlStr =
       "SELECT EASL.SYN_TYPE,\n"
           + " EASL.SYN_DATE,\n"
           + " EASL.SYN_MSG\n"
           + " FROM ETS_AUTO_SYN_LOG EASL\n"
           + " WHERE EASL.SYN_TYPE = 'SYN_CUST_DETAIL'\n"
           + " AND CONVERT(INT, CONVERT(CHAR, EASL.SYN_DATE, 112)) = CONVERT(INT, CONVERT(CHAR, GETDATE(), 112))\n"
           + " AND EASL.CREATED_BY = ?";
   sqlArgs.add(sfUser.getUserId());
   sqlModel.setSqlStr(sqlStr);
   sqlModel.setArgs(sqlArgs);
   return sqlModel;
 }
Пример #19
0
  public SQLModel getQueryDeptModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();

    List sqlArgs = new ArrayList();
    AssetsAddDTO dto = (AssetsAddDTO) dtoParameter;
    //             AssetsAddLDTO dtoL = (AssetsAddLDTO) dtoParameter;
    String sqlStr =
        "SELECT AMD.DEPT_NAME, AMD.DEPT_CODE\n"
            + "  FROM AMS_MIS_DEPT AMD, ETS_OU_CITY_MAP EOCM\n"
            + " WHERE EOCM.COMPANY_CODE = AMD.COMPANY_CODE\n"
            + "   AND EOCM.ORGANIZATION_ID = ?";
    sqlArgs.add(sfDto.getOrganizationId());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);

    return sqlModel;
  }
Пример #20
0
  public SQLModel getQueryAdressModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();

    List sqlArgs = new ArrayList();
    AssetsAddDTO dto = (AssetsAddDTO) dtoParameter;
    //             AssetsAddLDTO dtoL = (AssetsAddLDTO) dtoParameter;
    String sqlStr =
        "SELECT EO.WORKORDER_OBJECT_NAME, EO.WORKORDER_OBJECT_CODE\n"
            + "  FROM AMS_OBJECT_ADDRESS AOA, ETS_OBJECT EO\n"
            + " WHERE EO.WORKORDER_OBJECT_NO = AOA.OBJECT_NO\n"
            + "   AND EO.OBJECT_CATEGORY = '45'\n"
            + "   AND EO.ORGANIZATION_ID = ?";
    sqlArgs.add(sfDto.getOrganizationId());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);

    return sqlModel;
  }
Пример #21
0
  public File exportFile() throws DataTransException {
    File file = null;
    try {
      SQLModel sqlModel = sqlProducer.getPageQueryModel();
      TransRule rule = new TransRule();
      rule.setDataSource(sqlModel);
      rule.setSourceConn(conn);

      String fileName = "备件业务单据统计表.xls";
      String filePath = WorldConstant.USER_HOME;
      filePath += WorldConstant.FILE_SEPARATOR;
      filePath += fileName;
      rule.setTarFile(filePath);

      DataRange range = new DataRange();
      rule.setDataRange(range);

      Map fieldMap = new HashMap();
      fieldMap.put("TRANS_NO", "单据号");
      fieldMap.put("CREATED_USER", "创建人");
      fieldMap.put("CREATION_DATE", "创建日期");
      fieldMap.put("TRANS_STATUS_NAME", "单据状态");
      fieldMap.put("TRANS_TYPE_NAME", "单据类型");
      rule.setFieldMap(fieldMap);

      CustomTransData custData = new CustomTransData();
      custData.setReportTitle(fileName);
      custData.setReportPerson(sfUser.getUsername());
      custData.setNeedReportDate(true);
      rule.setCustData(custData);
      /*rule.setSheetSize(1000);*/
      // 设置分页显示
      TransferFactory factory = new TransferFactory();
      DataTransfer transfer = factory.getTransfer(rule);
      transfer.transData();
      file = (File) transfer.getTransResult();
    } catch (SQLModelException ex) {
      ex.printLog();
      throw new DataTransException(ex);
    }
    return file;
  }
 /**
  * 统计同步数量
  *
  * @return
  */
 @SuppressWarnings("unchecked")
 public SQLModel getSyncTotalCountModel(String projectNum) {
   SQLModel sqlModel = new SQLModel();
   List sqlArgs = new ArrayList();
   String sqlStr =
       "SELECT COUNT(1) SYNC_TOTAL_COUNT \n"
           + "FROM ETS_TD_CUST_DETAIL_IMP2 EFCDI \n"
           + "WHERE EFCDI.CREATE_USER_ID = ? \n"
           + "AND PROJRCT_NUMBER= ? \n"
           + "AND EFCDI.TAG_NUMBER IS NOT NULL\n"
           + "AND NOT EXISTS \n"
           + "          (SELECT NULL\n"
           + "             FROM ETS_ITEM_INFO EII\n"
           + "            WHERE EFCDI.TAG_NUMBER = EII.BARCODE)";
   sqlArgs.add(sfUser.getUserId());
   sqlArgs.add(projectNum);
   sqlModel.setSqlStr(sqlStr);
   sqlModel.setArgs(sqlArgs);
   return sqlModel;
 }
Пример #23
0
  public SQLModel getQueryItemModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();

    List sqlArgs = new ArrayList();
    AssetsAddDTO dto = (AssetsAddDTO) dtoParameter;
    //             AssetsAddLDTO dtoL = (AssetsAddLDTO) dtoParameter;
    String sqlStr =
        "SELECT ESI.ITEM_NAME, ESI.ITEM_SPEC\n"
            + "  FROM ETS_SYSTEM_ITEM ESI, ETS_SYSITEM_DISTRIBUTE ESD\n"
            + " WHERE ESI.ITEM_CODE = ESD.ITEM_CODE\n"
            +
            //                    "   AND ESI.ITEM_CATEGORY IN ('HOUSE', 'LAND', 'OTHERS')\n" +
            "   AND ESD.ORGANIZATION_ID = ?\n"
            + " GROUP BY ESI.ITEM_NAME, ESI.ITEM_SPEC";
    sqlArgs.add(sfDto.getOrganizationId());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);

    return sqlModel;
  }
Пример #24
0
  /**
   * 功能:框架自动生成应急保障设备名称字典表 AMS_YJ_ITEM数据插入SQLModel,请根据实际需要修改。
   *
   * @return SQLModel 返回数据插入用SQLModel
   * @throws SQLModelException 发生日历异常时转化为该异常抛出
   */
  public SQLModel getDataCreateModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    List sqlArgs = new ArrayList();
    AmsYjItemDTO amsYjItem = (AmsYjItemDTO) dtoParameter;
    String sqlStr =
        "INSERT INTO "
            + " AMS_YJ_ITEM("
            + " ITEM_CODE,"
            + " ITEM_NAME,"
            + " ITEM_CATEGORY,"
            + " CREATION_DATE,"
            + " CREATE_USER"
            + ") VALUES ("
            + " CONVERT(FLOAT,?), ?, '装备', GETDATE(), ?)";

    sqlArgs.add(amsYjItem.getItemCode());
    sqlArgs.add(amsYjItem.getItemName());
    sqlArgs.add(sfUser.getUserId());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);
    return sqlModel;
  }
Пример #25
0
  public File exportFile() throws DataTransException {
    File file = null;
    try {
      ItemInfoDTO itemInfoDto = (ItemInfoDTO) dtoParameter;
      if (itemInfoDto.getQryType().equals(WebAttrConstant.BY_DAIWEI)) {
        SQLModel sqlModel = sqlProducer.getPageQueryModel();
        TransRule rule = new TransRule();
        rule.setDataSource(sqlModel);
        rule.setCalPattern(CalendarConstant.LINE_PATTERN);
        rule.setSourceConn(conn);
        String fileName = "设备信息.xls";
        String filePath = WorldConstant.USER_HOME;
        filePath += WorldConstant.FILE_SEPARATOR;
        filePath += fileName;
        rule.setTarFile(filePath);
        DataRange range = new DataRange();
        rule.setDataRange(range);

        Map fieldMap = new HashMap();
        //            fieldMap.put("ORG_NAME", "公司");
        fieldMap.put("BARCODE", "条码");
        fieldMap.put("ITEM_NAME", "设备名称");
        fieldMap.put("ITEM_SPEC", "规格型号");
        fieldMap.put("WORKORDER_OBJECT_CODE", "地点编号");
        fieldMap.put("WORKORDER_OBJECT_LOCATION", "所在地点");
        fieldMap.put("NAME", "代维公司");

        rule.setFieldMap(fieldMap);

        CustomTransData custData = new CustomTransData();
        custData.setReportTitle("设备信息");
        custData.setReportPerson(sfUser.getUsername());
        custData.setNeedReportDate(true);
        rule.setCustData(custData);
        TransferFactory factory = new TransferFactory();
        DataTransfer transfer = factory.getTransfer(rule);
        transfer.transData();
        file = (File) transfer.getTransResult();
      } else {
        SQLModel sqlModel = sqlProducer.getPageQueryModel();
        TransRule rule = new TransRule();
        rule.setDataSource(sqlModel);
        rule.setCalPattern(CalendarConstant.LINE_PATTERN);
        rule.setSourceConn(conn);
        String fileName = "设备信息.xls";
        String filePath = WorldConstant.USER_HOME;
        filePath += WorldConstant.FILE_SEPARATOR;
        filePath += fileName;
        rule.setTarFile(filePath);
        DataRange range = new DataRange();
        rule.setDataRange(range);

        Map fieldMap = new HashMap();
        //            fieldMap.put("ORG_NAME", "公司");
        fieldMap.put("BARCODE", "条码");
        fieldMap.put("ITEM_NAME", "设备名称");
        fieldMap.put("ITEM_SPEC", "规格型号");
        fieldMap.put("ITEM_CATEGORY", "设备分类");
        fieldMap.put("START_DATE", "启用日期");
        fieldMap.put("PROJECT_NAME", "所属工程");
        fieldMap.put("WORKORDER_OBJECT_NAME", "所属地点");
        fieldMap.put("COUNTY_NAME", "所属区县");

        rule.setFieldMap(fieldMap);

        CustomTransData custData = new CustomTransData();
        custData.setReportTitle("设备信息");
        custData.setReportPerson(sfUser.getUsername());
        custData.setNeedReportDate(true);
        rule.setCustData(custData);
        TransferFactory factory = new TransferFactory();
        DataTransfer transfer = factory.getTransfer(rule);
        transfer.transData();
        file = (File) transfer.getTransResult();
      }
    } catch (SQLModelException ex) {
      ex.printLog();
      throw new DataTransException(ex);
    }
    return file;
  }
Пример #26
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);
    }
  }
Пример #27
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);
    }
  }
Пример #28
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);
    }
  }
Пример #29
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);
    }
  }
Пример #30
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);
    }
  }