/** 查询资产财务信息服务(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); } } }
/** 查询科目余额(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); } } }
/** 查询资产分配行信息(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); } }