|
@@ -2,20 +2,34 @@ package com.uas.erp.test;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.api.crypto.util.FlexJsonUtils;
|
|
|
+import com.uas.api.crypto.util.SecretUtil;
|
|
|
import com.uas.erp.schedular.UasSchedulingApplication;
|
|
|
import com.uas.erp.schedular.entity.Master;
|
|
|
import com.uas.erp.schedular.finance.domain.*;
|
|
|
import com.uas.erp.schedular.finance.task.AbstractTask;
|
|
|
+import com.uas.erp.schedular.finance.task.B2BInformation;
|
|
|
import com.uas.erp.schedular.util.ContextHolder;
|
|
|
+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.protobuf.AddCapitalSideLoanReq;
|
|
|
+import com.usoft.fin.external.open.api.protobuf.AddCapitalSideLoanResp;
|
|
|
+import com.usoft.fin.external.open.api.protobuf.SaveOfferQuotaInfoReq;
|
|
|
+import com.usoft.fin.external.open.api.protobuf.SaveOfferQuotaInfoResp;
|
|
|
+import com.usoft.sdk.fin.client.CapitalSideSdk;
|
|
|
+import com.usoft.sdk.fin.utils.ProtoBufUtil;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
@@ -23,11 +37,135 @@ import java.util.List;
|
|
|
* <p>
|
|
|
* Created by hejq on 2017-12-22.
|
|
|
*/
|
|
|
-
|
|
|
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = UasSchedulingApplication.class)*/
|
|
|
+
|
|
|
+
|
|
|
public class ConnectToFinanceTest extends AbstractTask {
|
|
|
-
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private B2BInformation b2BInformation;
|
|
|
+
|
|
|
+ * 测试地址
|
|
|
+ */
|
|
|
+ private CapitalSideSdk capitalSideSdk = new CapitalSideSdk("https://finrest.uuzcc.cn", "10042875", "c49f7be6a861461ab951e55030055a5c");
|
|
|
+
|
|
|
+ public void testCap(){
|
|
|
+ SaveOfferQuotaInfoReq.Builder req = SaveOfferQuotaInfoReq.newBuilder();
|
|
|
+ req.setCsEnuu(10042875).setCsEnName("深圳市优软商城科技有限公司").setFsEnuu(10041559).setFsEnName("深圳市胜芳电子有限公司").setQuotaAmount(300)
|
|
|
+ .setCredDays(12).setFinanceRate(90).setOfferRate(15).setRepayment("到期一次性还本付息").setApplyUu(1000027739);
|
|
|
+
|
|
|
+ SaveOfferQuotaInfoResp resp = null;
|
|
|
+ try {
|
|
|
+ resp = capitalSideSdk.saveOfferQuotaInfo(req);
|
|
|
+ System.out.println(ProtoBufUtil.toJSON(resp));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void testGetOfferQuotaInfoList() throws Exception {
|
|
|
+ Master master = new Master();
|
|
|
+ master.setMa_user("YITOA_BL");
|
|
|
+ master.setMa_uu(10042875L);
|
|
|
+ master.setMa_accesssecret("600d3f07955ba67fe050007f01002db2");
|
|
|
+ master.setMa_env("prod");
|
|
|
+ master.setMa_name("YITOA_BL");
|
|
|
+ SecretUtil.set(Long.toString(master.getMa_uu()), master.getMa_accesssecret());
|
|
|
+ ContextHolder.setMaster(master);
|
|
|
+ b2BInformation.getOfferQuotaInfoList();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void testGetCustInfomation() throws Exception {
|
|
|
+ Master master = new Master();
|
|
|
+ master.setMa_user("YITOA_BL");
|
|
|
+ master.setMa_uu(10042875L);
|
|
|
+ master.setMa_accesssecret("600d3f07955ba67fe050007f01002db2");
|
|
|
+ master.setMa_env("prod");
|
|
|
+ master.setMa_name("YITOA_BL");
|
|
|
+ SecretUtil.set(Long.toString(master.getMa_uu()), master.getMa_accesssecret());
|
|
|
+ ContextHolder.setMaster(master);
|
|
|
+ List<Map<String, Object>> enUUList = new ArrayList<>();
|
|
|
+ Map<String, Object> enMap = new HashMap<>();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Object[] cuUUList = jdbcTemplate.queryForArray("SELECT CQ_CUSTUU FROM CUSTOMERQUOTA WHERE CQ_CUSTUU > 0 " +
|
|
|
+ "AND CQ_CUSTUU NOT IN (SELECT NVL(CU_ENUU,0) FROM CUSTOMERINFOR where CU_STATUSCODE <> 'DISABLE') group by CQ_CUSTUU");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ enMap = new HashMap<>();
|
|
|
+ enMap.put("CQ_FACTORUU",10042875);
|
|
|
+ enMap.put("CQ_RECORDERUU",0);
|
|
|
+ enMap.put("CQ_CUSTUU",10005285);
|
|
|
+ enMap.put("CQ_CUSTUU",10042875);
|
|
|
+ enUUList.add(enMap);
|
|
|
+ b2BInformation.getCustInfomation(enUUList);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void addCapitalSideLoan() throws Exception {
|
|
|
+ AddCapitalSideLoanReq.Builder req = AddCapitalSideLoanReq.newBuilder();
|
|
|
+ OpenCapitalSideLoanOther.Builder capitalSideLoanOther = OpenCapitalSideLoanOther.newBuilder();
|
|
|
+ capitalSideLoanOther.setFinanceDemandCode("73191217657460232300");
|
|
|
+ capitalSideLoanOther.setLoanCode("");
|
|
|
+ capitalSideLoanOther.setReceivablesArrivalDate("2020-1-25");
|
|
|
+ capitalSideLoanOther.setFinanceRate(8);
|
|
|
+ capitalSideLoanOther.setLoanAmount(19891.2);
|
|
|
+ capitalSideLoanOther.setLoanDate("2020-1-25");
|
|
|
+ capitalSideLoanOther.setRepaymentData("2020-3-25");
|
|
|
+ capitalSideLoanOther.setLoanRate(8);
|
|
|
+ capitalSideLoanOther.setRepaymentFrequency("按月付息,到期还本");
|
|
|
+ capitalSideLoanOther.setFsCollectionBank("招商银行");
|
|
|
+ capitalSideLoanOther.setFsCollectionAccount("1234567890");
|
|
|
+ capitalSideLoanOther.setFsCollectionName("英唐优软云");
|
|
|
+ capitalSideLoanOther.setReceiptForLoan(19891.2);
|
|
|
+ capitalSideLoanOther.setInterestPayable(5000);
|
|
|
+ capitalSideLoanOther.setBeOverdue(0);
|
|
|
+ capitalSideLoanOther.setSettle(0);
|
|
|
+ capitalSideLoanOther.setApplyDate("2020-1-2");
|
|
|
+ capitalSideLoanOther.setPersonInCharge("lzx");
|
|
|
+ capitalSideLoanOther.setStatus(1);
|
|
|
+ capitalSideLoanOther.setApprovalDate("2020-1-2");
|
|
|
+ capitalSideLoanOther.setApprovalMan("lzx");
|
|
|
+ req.setCapitalSideLoan(capitalSideLoanOther);
|
|
|
+
|
|
|
+ OpenCapitalSideRepaymentPlanOther.Builder capitalSideRepaymentPlanOther = OpenCapitalSideRepaymentPlanOther.newBuilder();
|
|
|
+ capitalSideRepaymentPlanOther.setRepaymentData("2020-2-25");
|
|
|
+ capitalSideRepaymentPlanOther.setCurrency("RMB");
|
|
|
+ capitalSideRepaymentPlanOther.setCapitalAmount(10000);
|
|
|
+ capitalSideRepaymentPlanOther.setInterest(1000);
|
|
|
+ capitalSideRepaymentPlanOther.setAmount(101000);
|
|
|
+ capitalSideRepaymentPlanOther.setPersonInCharge("lzx");
|
|
|
+ req.addCapitalSideRepaymentPlan(capitalSideRepaymentPlanOther);
|
|
|
+
|
|
|
+ OpenCapitalSideRepaymentPlanOther.Builder capitalSideRepaymentPlanOther1 = OpenCapitalSideRepaymentPlanOther.newBuilder();
|
|
|
+ capitalSideRepaymentPlanOther1.setRepaymentData("2020-3-25");
|
|
|
+ capitalSideRepaymentPlanOther1.setCurrency("RMB");
|
|
|
+ capitalSideRepaymentPlanOther1.setCapitalAmount(9891.2);
|
|
|
+ capitalSideRepaymentPlanOther1.setInterest(4000);
|
|
|
+ capitalSideRepaymentPlanOther1.setAmount(13891.2);
|
|
|
+ capitalSideRepaymentPlanOther1.setPersonInCharge("lzx");
|
|
|
+ req.addCapitalSideRepaymentPlan(capitalSideRepaymentPlanOther1);
|
|
|
+ req.setEnuu(10042875);
|
|
|
+
|
|
|
+ AddCapitalSideLoanResp resp = capitalSideSdk.addCapitalSideLoan(req);
|
|
|
+ System.out.println(ProtoBufUtil.toJSON(resp));
|
|
|
+ }
|
|
|
+
|
|
|
public void testConnect() {
|
|
|
Master master = new Master();
|
|
|
master.setMa_user("YITOA_BL");
|