Browse Source

客户资料企业类型、税务信用字段取值调整

wuyx 5 năm trước cách đây
mục cha
commit
81da7c1580

+ 46 - 26
src/main/java/com/uas/erp/schedular/finance/task/B2BInformation.java

@@ -14,9 +14,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.uas.erp.schedular.entity.Master;
 import com.uas.erp.schedular.task.support.Method;
 import com.uas.erp.schedular.util.ContextHolder;
-import com.usoft.fin.external.open.api.entity.CapitalSideLoan;
-import com.usoft.fin.external.open.api.entity.FinanceOfferListOrBuilder;
-import com.usoft.fin.external.open.api.entity.OfferQuotaInfoRest;
+import com.usoft.fin.external.open.api.entity.*;
 import com.usoft.fin.external.open.api.protobuf.*;
 import com.usoft.sdk.fin.client.CapitalSideSdk;
 import com.usoft.sdk.fin.client.TradingHallSdk;
@@ -30,16 +28,6 @@ import com.uas.erp.schedular.task.support.Role;
 import com.uas.erp.schedular.task.support.TaskMapping;
 import com.uas.erp.schedular.util.CollectionUtil;
 import com.uas.erp.schedular.util.ContextHolder;
-import com.usoft.fin.external.open.api.entity.AcceptOfferDetail;
-import com.usoft.fin.external.open.api.entity.CompanyBasicInfosByErmRest;
-import com.usoft.fin.external.open.api.entity.CompanyEnterpriseCrawlerListFinRest;
-import com.usoft.fin.external.open.api.entity.CompanyIndustryAndCommerceInfoRest;
-import com.usoft.fin.external.open.api.entity.CompanyLawInfoFinRest;
-import com.usoft.fin.external.open.api.entity.FinanceOfferDetails;
-import com.usoft.fin.external.open.api.entity.OfferDetailAndFinanceAccept;
-import com.usoft.fin.external.open.api.entity.OpenCapitalSideLoanOther;
-import com.usoft.fin.external.open.api.entity.OpenCapitalSideRepaymentPlanOther;
-import com.usoft.fin.external.open.api.entity.RestBaseInfo;
 import com.usoft.fin.external.open.api.protobuf.GetCapitalSideLoanReq;
 import com.usoft.fin.external.open.api.protobuf.GetCapitalSideLoanResp;
 import com.usoft.fin.external.open.api.protobuf.GetFinanceOfferDetailsReq;
@@ -152,22 +140,45 @@ public class B2BInformation  extends AbstractTask{
 			if(compBaseInfoByErmRest.getEnName()==null||compBaseInfoByErmRest.getEnName().equals("")){
 				break;
 			}
-			//System.out.println("客户基本信息: "+ProtoBufUtil.toJSON(compBaseInfoByErmRest));
-//			System.out.println("获取客户UU:"+compBaseInfoByErmRest.getEnuu());
+			//从表4 客户财务报表 利润表(元)  ErpProfitInfo
+			ErpDataInfoRest erpDataInfoRest = entExtInfoResp.getErpDataInfo();
+			List<ErpProfitInfo> erpProfitInfoList = erpDataInfoRest.getErpProfitList();
+			System.out.println("从表4 客户财务报表 利润表(元): "+ProtoBufUtil.toJSON(erpProfitInfoList));
+			//从表4 客户财务报表 资产负债表(元) ErpBalanceSheetInfo
+			List<ErpBalanceSheetInfo> erpBalanceSheetInfoList = erpDataInfoRest.getErpBalanceSheetList();
+			System.out.println("从表4 客户财务报表 资产负债表(元): "+ProtoBufUtil.toJSON(erpBalanceSheetInfoList));
+			//从表4 客户财务报表 现金流量表(元) ErpCashFlowInfo
+			List<ErpCashFlowInfo> erpCashFlowInfoList = erpDataInfoRest.getErpCashFlowList();
+			System.out.println("从表4 客户财务报表 现金流量表(元): "+ProtoBufUtil.toJSON(erpCashFlowInfoList));
+			//客户财务报表 盈利能力指标、资产质量指标、债务风险指标、经营增长指标 ErpCalculationOfEachIndex
+			//客户财务报表 盈利能力指标、资产质量指标、债务风险指标、经营增长指标 最近月份 TODO ???
+			List<ErpCalculationOfEachIndex> erpCalculationOfEachIndexYearList = erpDataInfoRest.getErpCalculationOfEachIndexYearList();
+			System.out.println("从表4 客户财务报表 盈利能力指标、资产质量指标、债务风险指标、经营增长指标-最近月份: "+ProtoBufUtil.toJSON(erpCalculationOfEachIndexYearList));
+			//客户财务报表 盈利能力指标、资产质量指标、债务风险指标、经营增长指标 前一年
+			List<ErpCalculationOfEachIndex> erpCalculationOfEachIndexLastYearList= erpDataInfoRest.getErpCalculationOfEachIndexLastYearList();
+			System.out.println("从表4 客户财务报表 盈利能力指标、资产质量指标、债务风险指标、经营增长指标-前一年: "+ProtoBufUtil.toJSON(erpCalculationOfEachIndexLastYearList));
+			//客户财务报表 盈利能力指标、资产质量指标、债务风险指标、经营增长指标 前两年
+			List<ErpCalculationOfEachIndex> erpCalculationOfEachIndexBeforeYearList= erpDataInfoRest.getErpCalculationOfEachIndexBeforeYearList();
+			System.out.println("从表4 客户财务报表 盈利能力指标、资产质量指标、债务风险指标、经营增长指标-前两年: "+ProtoBufUtil.toJSON(erpCalculationOfEachIndexBeforeYearList));
+			//客户财务报表 盈利能力指标、资产质量指标、债务风险指标、经营增长指标 前三年
+			List<ErpCalculationOfEachIndex> erpCalculationOfEachIndexBeforeLastYearList= erpDataInfoRest.getErpCalculationOfEachIndexBeforeLastYearList();
+			System.out.println("从表4 客户财务报表 盈利能力指标、资产质量指标、债务风险指标、经营增长指标-前三年: "+ProtoBufUtil.toJSON(erpCalculationOfEachIndexBeforeLastYearList));
+			//从表5 经营信息 ErpPurchaseInfo ErpSaleInfo
+			List<ErpPurchaseInfo>  erpPurchaseList = erpDataInfoRest.getErpPurchaseList();
+			List<ErpSaleInfo> erpSaleList = erpDataInfoRest.getErpSaleList() ;
+			//从表6 上下游信息 ErpTopFiveSuppliersInfo ErpTopFiveCustomersInfo
+			List<ErpTopFiveSuppliersInfo> topFiveSuppliersList = erpPurchaseList.get(0).getTopFiveSuppliersList();
+			List<ErpTopFiveCustomersInfo> topFiveCustomersList = erpSaleList.get(0).getTopFiveCustomersList();
 			//扩展信息 CompanyIndustryAndCommerceInfoRest
 			CompanyEnterpriseCrawlerListFinRest entCrawLFRest = entExtInfoResp.getCompanyEnterpriseCrawlerList();
 			CompanyIndustryAndCommerceInfoRest compIndusAndCommInforRest = entCrawLFRest.getCompanyIndustryAndCommerceInfo();
-			//System.out.println("扩展信息:"+ProtoBufUtil.toJSON(entCrawLFRest));
 			//企业简介 员工人数 CompanyIndustryAndCommerceInfoRest.CompanyLawInfoFinRest enIntro insuredNumberOfPeople
 			CompanyLawInfoFinRest compLawInfoRest = entCrawLFRest.getCompanyLawInfo();
 			//企业 融资方信息 RestBaseInfo
 			GetBaseInfoReq.Builder req = GetBaseInfoReq.newBuilder();
-			//资金方UU  为空或为0默认保理
-			req.setCsEnuu(facUU);
-			//融资方UU
-			req.setEnuu(custUU);
-			//操作人UU 为空就为0
-			req.setUu(userUU);
+			req.setCsEnuu(facUU);//资金方UU  为空或为0默认保理
+			req.setEnuu(custUU);//融资方UU
+			req.setUu(userUU);//操作人UU 为空就为0
 			GetBaseInfoResp restBaseInfoResp = tradingHallSdk.getBaseInfo(req);
 			RestBaseInfo restBaseInfo = restBaseInfoResp.getBaseInfo();
 //			System.out.println("融资方信息:"+ProtoBufUtil.toJSON(restBaseInfoResp));
@@ -187,14 +198,20 @@ public class B2BInformation  extends AbstractTask{
 				sqls.add("UPDATE CUSTOMERINFOR SET " +
 						" CU_STATUS='在录入',CU_STATUSCODE='ENTERING'," +
 						" CU_UPDATEDATE=SYSDATE,CU_NAME='"+compBaseInfoByErmRest.getEnName()+"',CU_LEGALPERSON='"+compBaseInfoByErmRest.getEnLegalRepName()+"'," +
-						" CU_TERM = "+cu_term+",CU_TYPE ='"+compBaseInfoByErmRest.getEnType()+"',CU_PLAFORMLEVEL='"+restBaseInfo.getGrade()+"'," +
+						" CU_TERM = "+cu_term+",CU_ENTERPTYPE ='"+compBaseInfoByErmRest.getEnType()+"',CU_PLAFORMLEVEL='"+restBaseInfo.getGrade()+"'," +
 						" CU_LICENSEDATE = "+cu_licensedate+",CU_PAPERSCODE='"+compBaseInfoByErmRest.getEnCodeCrawled()+"'," +
-						" CU_TAXCREDIT ='"+compIndusAndCommInforRest.getUnifiedSocialCreditCode()+"',CU_REGISTSTATUS='"+compBaseInfoByErmRest.getEnRegStatus()+"',CU_BUSINSSCOPE='"+compBaseInfoByErmRest.getEnOpRange()+"',CU_BUSINESSMAIN='"+restBaseInfo.getEnBusinessMain()+"'," +
+						" CU_TAXCREDIT ='"+entCrawLFRest.getConTheTaxCredit()+"',CU_REGISTSTATUS='"+compBaseInfoByErmRest.getEnRegStatus()+"',CU_BUSINSSCOPE='"+compBaseInfoByErmRest.getEnOpRange()+"',CU_BUSINESSMAIN='"+restBaseInfo.getEnBusinessMain()+"'," +
 						" CU_CONTACT='"+restBaseInfo.getFsContactsMan()+"',CU_CONTACTNUM='"+restBaseInfo.getFsContactsPhone()+"',CU_REGCAPITAL="+cu_regcapital+",CU_PAIDINCAPITAL="+cu_paidincapital+"," +
 						" CU_REGADD='"+compBaseInfoByErmRest.getEnRegLocation()+"',CU_OFFICEADD='"+restBaseInfo.getEnAddress()+"',CU_INTRODUCTION='"+compLawInfoRest.getEnIntro()+"',CU_ZJUU='"+10050877+"'," +
 						" CU_EMPLOYEESNUM=" +cu_employeesnum+
 						" WHERE CU_ENUU = "+custUU+" AND CU_STATUSCODE <> 'DISABLE'");
 				System.out.println(sqls);
+				//TODO 从表5 客户财务报表
+
+				//TODO 从表6 经营信息
+
+				//TODO 从表7 上下游信息
+
 				//从表1 高管信息 CUSTOMEREXCUTIVE
 				JSONArray enKeyPerList = JSONArray.parseArray(compBaseInfoByErmRest.getEnKeyPersonnel());
 				//System.out.println("更新高管信息:"+compBaseInfoByErmRest.getEnKeyPersonnel());
@@ -307,13 +324,13 @@ public class B2BInformation  extends AbstractTask{
 				detno = 1;
 				//System.out.println("enuu:"+compBaseInfoByErmRest.getEnuu()+",cuCode:"+cuCode);
 				sqls.add("INSERT INTO CUSTOMERINFOR(CU_ID,CU_CODE,CU_ENUU,CU_STATUS,CU_STATUSCODE,CU_UPDATEDATE,CU_NAME,CU_LEGALPERSON," +
-						"CU_TERM,CU_TYPE,CU_PLAFORMLEVEL,CU_LICENSEDATE,CU_PAPERSCODE," +
+						"CU_TERM,CU_ENTERPTYPE,CU_PLAFORMLEVEL,CU_LICENSEDATE,CU_PAPERSCODE," +
 						"CU_TAXCREDIT,CU_REGISTSTATUS,CU_BUSINSSCOPE,CU_BUSINESSMAIN," +
 						"CU_CONTACT,CU_CONTACTNUM,CU_REGCAPITAL,CU_PAIDINCAPITAL," +
 						"CU_REGADD,CU_OFFICEADD,CU_INTRODUCTION,CU_EMPLOYEESNUM,cu_zjuu" +
 						") VALUES ("+cuId+",'"+cuCode+"',"+compBaseInfoByErmRest.getEnuu()+",'在录入','ENTERING',SYSDATE,'"+compBaseInfoByErmRest.getEnName()+"','"+compBaseInfoByErmRest.getEnLegalRepName()+"',"
 						+cu_term+","+"'"+compBaseInfoByErmRest.getEnType()+"','"+restBaseInfo.getGrade()+"'," +cu_licensedate+",'"+compBaseInfoByErmRest.getEnCodeCrawled()+"',"+
-						"'"+compIndusAndCommInforRest.getUnifiedSocialCreditCode()+"','"+compBaseInfoByErmRest.getEnRegStatus()+"','"+compBaseInfoByErmRest.getEnOpRange()+"','"+restBaseInfo.getEnBusinessMain()+"',"+
+						"'"+entCrawLFRest.getConTheTaxCredit()+"','"+compBaseInfoByErmRest.getEnRegStatus()+"','"+compBaseInfoByErmRest.getEnOpRange()+"','"+restBaseInfo.getEnBusinessMain()+"',"+
 						"'"+restBaseInfo.getFsContactsMan()+"','"+restBaseInfo.getFsContactsPhone()+"',"+cu_regcapital+","+cu_paidincapital+",'"
 						+compBaseInfoByErmRest.getEnRegLocation()+"','"+restBaseInfo.getEnAddress()+"','"+compLawInfoRest.getEnIntro()+"',"+cu_employeesnum+",'10050877')");
 				sqls.add("UPDATE CUSTOMERQUOTA SET cq_custcode ='"+cuCode+"' where cq_custcode is null and CQ_CUSTUU = "+custUU);
@@ -412,6 +429,9 @@ public class B2BInformation  extends AbstractTask{
 						}
 					}
 				}
+				//TODO 从表5 客户财务报表
+				//TODO 从表6 经营信息
+				//TODO 从表7 上下游信息
 			}
 		}
 		//System.out.println("COMMONSQLS:"+sqls);