Quellcode durchsuchen

额度申请下载-测试代码

wuyx vor 5 Jahren
Ursprung
Commit
c2297da675
1 geänderte Dateien mit 142 neuen und 4 gelöschten Zeilen
  1. 142 4
      src/test/java/com/uas/erp/test/ConnectToFinanceTest.java

+ 142 - 4
src/test/java/com/uas/erp/test/ConnectToFinanceTest.java

@@ -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.
  */
-/*@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = UasSchedulingApplication.class)*/
+//@RunWith(SpringJUnit4ClassRunner.class)
+//@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = UasSchedulingApplication.class)
 public class ConnectToFinanceTest extends AbstractTask {
-
-   /* @Test*/
+    @Autowired
+    private B2BInformation b2BInformation;
+    /**
+     * 测试地址
+     */
+    private CapitalSideSdk capitalSideSdk = new CapitalSideSdk("https://finrest.uuzcc.cn", "10042875", "c49f7be6a861461ab951e55030055a5c");
+   //@Test
+   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);
+       //com.usoft.fin.external.open.api.protobuf.SaveOfferQuotaInfoReq.Builder req
+       SaveOfferQuotaInfoResp resp = null;
+       try {
+           resp = capitalSideSdk.saveOfferQuotaInfo(req);
+           System.out.println(ProtoBufUtil.toJSON(resp));
+       } catch (Exception e) {
+           e.printStackTrace();
+       }
+   }
+    //@Test
+    //额度申请下载
+    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();
+    }
+   // @Test
+    //客户资料下载
+    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<>();
+//        jdbcTemplate.execute("UPDATE CUSTOMERQUOTA SET " +
+//                "CQ_CUSTCODE = (SELECT MAX(CU_CODE) FROM CUSTOMERINFOR WHERE CU_STATUSCODE <> 'DISABLE' AND CQ_FACTORUU = NVL(CU_ENUU,0) ) " +
+//                "where CQ_CUSTCODE is null and CQ_FACTORUU in (SELECT NVL(CU_ENUU,0) FROM CUSTOMERINFOR WHERE CU_STATUSCODE <> 'DISABLE') ");
+        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");
+//        if (cuUUList!=null &&cuUUList.length>0){
+//            for(Object cuUU : cuUUList){
+//                enMap = new HashMap<>();
+//                enMap.put("CQ_FACTORUU",10042875);//深圳市优软商城科技有限公司
+//                enMap.put("CQ_RECORDERUU",0);//用户UU
+//                enMap.put("CQ_CUSTUU",cuUU);//客户信息
+//                enUUList.add(enMap);
+//            }
+//        }
+        enMap = new HashMap<>();
+        enMap.put("CQ_FACTORUU",10042875);//深圳市优软商城科技有限公司
+        enMap.put("CQ_RECORDERUU",0);//用户UU
+        enMap.put("CQ_CUSTUU",10005285);//客户信息 深圳市吉利通电子有限公司
+        enMap.put("CQ_CUSTUU",10042875);//客户信息 深圳市优软商城科技有限公司
+        enUUList.add(enMap);
+        b2BInformation.getCustInfomation(enUUList);
+//        10042875	深圳市优软商城科技有限公司
+//        10000666	深圳市华商龙商务互联科技有限公司
+//        10041961	深圳市英唐智能控制股份有限公司
+//        10005285	深圳市吉利通电子有限公司
+//        10041166	深圳市优软科技有限公司
+//        10041559	深圳市胜芳电子有限公司
+//        10047861	深圳迈鼎电子有限公司
+    }
+   //@Test
+    //放款信息上传
+    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));
+    }
+    /* @Test*/
     public void testConnect() {
         Master master = new Master();
         master.setMa_user("YITOA_BL");