scr пре 8 година
родитељ
комит
837364a56c
19 измењених фајлова са 491 додато и 96 уклоњено
  1. 5 2
      src/main/java/com/uas/erp/schedular/financeservice/domain/AccountInfo.java
  2. 33 1
      src/main/java/com/uas/erp/schedular/financeservice/domain/Apply.java
  3. 193 0
      src/main/java/com/uas/erp/schedular/financeservice/domain/ApplyInfo.java
  4. 1 0
      src/main/java/com/uas/erp/schedular/financeservice/domain/AssociateCompanyInfo.java
  5. 91 0
      src/main/java/com/uas/erp/schedular/financeservice/domain/Attach.java
  6. 6 2
      src/main/java/com/uas/erp/schedular/financeservice/domain/BusinessConditionInfo.java
  7. 3 1
      src/main/java/com/uas/erp/schedular/financeservice/domain/ChangesInstructionInfo.java
  8. 10 11
      src/main/java/com/uas/erp/schedular/financeservice/domain/CustInfo.java
  9. 5 1
      src/main/java/com/uas/erp/schedular/financeservice/domain/CustomerExcutiveInfo.java
  10. 37 30
      src/main/java/com/uas/erp/schedular/financeservice/domain/CustomerInfo.java
  11. 6 2
      src/main/java/com/uas/erp/schedular/financeservice/domain/FinanceConditionInfo.java
  12. 5 2
      src/main/java/com/uas/erp/schedular/financeservice/domain/ProductMixInfo.java
  13. 5 4
      src/main/java/com/uas/erp/schedular/financeservice/domain/PurcCustInfo.java
  14. 5 2
      src/main/java/com/uas/erp/schedular/financeservice/domain/ShareholdersInfo.java
  15. 4 1
      src/main/java/com/uas/erp/schedular/financeservice/domain/UpdowncastInfo.java
  16. 5 3
      src/main/java/com/uas/erp/schedular/financeservice/task/AbstractTask.java
  17. 19 6
      src/main/java/com/uas/erp/schedular/financeservice/task/CustomerInfoTask.java
  18. 2 2
      src/main/resources/init/setting.json
  19. 56 26
      src/test/java/com/uas/erp/test/ConnectToFinanceTest.java

+ 5 - 2
src/main/java/com/uas/erp/schedular/financeservice/domain/AccountInfo.java

@@ -1,8 +1,9 @@
 package com.uas.erp.schedular.financeservice.domain;
 
 /**
+ * created by shicr on 2017/12/20
  * 财务数据表
- */
+ **/
 public class AccountInfo {
 
     /**
@@ -21,7 +22,6 @@ public class AccountInfo {
      */
     private String ai_kind;
 
-
     /**
      * 买方名称
      */
@@ -98,4 +98,7 @@ public class AccountInfo {
         this.ai_paydays = ai_paydays;
     }
 
+    public AccountInfo() {
+
+    }
 }

+ 33 - 1
src/main/java/com/uas/erp/schedular/financeservice/domain/FinancingApply.java → src/main/java/com/uas/erp/schedular/financeservice/domain/Apply.java

@@ -1,12 +1,17 @@
 package com.uas.erp.schedular.financeservice.domain;
 
+import java.io.Serializable;
+import java.util.List;
+
 /**
  * 金融服务申请数据
  * 
  * @author hejq
  * @time 创建时间:2017年11月24日
  */
-public class FinancingApply {
+public class Apply implements Serializable {
+
+	private static final long serialVersionUID = 1L;
 
 	/**
 	 * ID
@@ -69,6 +74,17 @@ public class FinancingApply {
 	 */
 	private String fa_facorpcode;
 
+	/**
+     * 客户信息表
+	 */
+	private CustInfo customerInfo;
+
+	/**
+	 * 附件表
+	 * @return
+	 */
+	private List<Attach> attachList;
+
 	public Long getId() {
 		return id;
 	}
@@ -164,4 +180,20 @@ public class FinancingApply {
 	public void setFa_facorpcode(String fa_facorpcode) {
 		this.fa_facorpcode = fa_facorpcode;
 	}
+
+	public CustInfo getCustomerInfo() {
+		return customerInfo;
+	}
+
+	public void setCustomerInfo(CustInfo customerInfo) {
+		this.customerInfo = customerInfo;
+	}
+
+	public List<Attach> getAttachList() {
+		return attachList;
+	}
+
+	public void setAttachList(List<Attach> attachList) {
+		this.attachList = attachList;
+	}
 }

+ 193 - 0
src/main/java/com/uas/erp/schedular/financeservice/domain/ApplyInfo.java

@@ -0,0 +1,193 @@
+package com.uas.erp.schedular.financeservice.domain;
+
+import java.io.Serializable;
+
+/**
+ * created by shicr on 2017/12/26
+ **/
+public class ApplyInfo implements Serializable{
+
+    private static final long serialVersionUID = 1L;
+    /**
+     * ID
+     */
+    private Long id;
+
+    /**
+     * 企业uu
+     * @return
+     */
+    private Long enuu;
+
+    /**
+     * 联系人
+     */
+    private String fa_contact;
+
+    /**
+     * 联系方式1
+     */
+    private String fa_telphone;
+
+    /**
+     * 联系方式2
+     */
+    private String fa_phone;
+
+    /**
+     * 申请金额
+     */
+    private Long fa_appamount;
+
+    /**
+     * 申请人
+     */
+    private String fa_applyman;
+
+    /**
+     * 申请日期
+     */
+    private String fa_applydate;
+
+    /**
+     * 申请得分
+     */
+    private Double fa_score;
+
+    /**
+     * 融资申请单号
+     */
+    private String fa_busincode;
+
+    /**
+     * 保理公司名称
+     */
+    private String fa_facorpname;
+
+    /**
+     * 保理公司
+     */
+    private String fa_facorpcode;
+
+    /**
+     * 客户信息表
+     */
+    private CustInfo customerInfo;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getEnuu() {
+        return enuu;
+    }
+
+    public void setEnuu(Long enuu) {
+        this.enuu = enuu;
+    }
+
+    public String getFa_contact() {
+        return fa_contact;
+    }
+
+    public void setFa_contact(String fa_contact) {
+        this.fa_contact = fa_contact;
+    }
+
+    public String getFa_telphone() {
+        return fa_telphone;
+    }
+
+    public void setFa_telphone(String fa_telphone) {
+        this.fa_telphone = fa_telphone;
+    }
+
+    public String getFa_phone() {
+        return fa_phone;
+    }
+
+    public void setFa_phone(String fa_phone) {
+        this.fa_phone = fa_phone;
+    }
+
+    public Long getFa_appamount() {
+        return fa_appamount;
+    }
+
+    public void setFa_appamount(Long fa_appamount) {
+        this.fa_appamount = fa_appamount;
+    }
+
+    public String getFa_applyman() {
+        return fa_applyman;
+    }
+
+    public void setFa_applyman(String fa_applyman) {
+        this.fa_applyman = fa_applyman;
+    }
+
+    public String getFa_applydate() {
+        return fa_applydate;
+    }
+
+    public void setFa_applydate(String fa_applydate) {
+        this.fa_applydate = fa_applydate;
+    }
+
+    public Double getFa_score() {
+        return fa_score;
+    }
+
+    public void setFa_score(Double fa_score) {
+        this.fa_score = fa_score;
+    }
+
+    public String getFa_busincode() {
+        return fa_busincode;
+    }
+
+    public void setFa_busincode(String fa_busincode) {
+        this.fa_busincode = fa_busincode;
+    }
+
+    public String getFa_facorpname() {
+        return fa_facorpname;
+    }
+
+    public void setFa_facorpname(String fa_facorpname) {
+        this.fa_facorpname = fa_facorpname;
+    }
+
+    public String getFa_facorpcode() {
+        return fa_facorpcode;
+    }
+
+    public void setFa_facorpcode(String fa_facorpcode) {
+        this.fa_facorpcode = fa_facorpcode;
+    }
+
+    public ApplyInfo(Apply apply) {
+        if (apply != null) {
+            this.id = apply.getId();
+            this.enuu = apply.getEnuu();
+            this.fa_contact = apply.getFa_contact();
+            this.fa_telphone = apply.getFa_telphone();
+            this.fa_phone = apply.getFa_phone();
+            this.fa_appamount = apply.getFa_appamount();
+            this.fa_applyman = apply.getFa_applyman();
+            this.fa_applydate = apply.getFa_applydate();
+            this.fa_score = apply.getFa_score();
+            this.fa_busincode = apply.getFa_busincode();
+            this.fa_facorpname = apply.getFa_facorpname();
+            this.fa_facorpcode = apply.getFa_facorpcode();
+        }
+    }
+
+    public ApplyInfo () {
+
+    }
+}

+ 1 - 0
src/main/java/com/uas/erp/schedular/financeservice/domain/AssociateCompanyInfo.java

@@ -1,5 +1,6 @@
 package com.uas.erp.schedular.financeservice.domain;
 
+
 /**
  * 关联企业
  * created by shicr on 2017/12/18

+ 91 - 0
src/main/java/com/uas/erp/schedular/financeservice/domain/Attach.java

@@ -0,0 +1,91 @@
+package com.uas.erp.schedular.financeservice.domain;
+
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * created by shicr on 2017/12/25
+ **/
+public class Attach implements Serializable{
+
+    private static final long serialVersionUID = 1L;
+
+    private Long id;
+
+    /**
+     * 附件名
+     */
+    private String name;
+
+    /**
+     * 附件路径
+     */
+    @Column(name="path")
+    private String path;
+
+    /**
+     * 文件大小
+     */
+    private Long size;
+
+    /**
+     *文件所属类别
+     */
+    private String type;
+
+    /**
+     * 附件所属的金融单据
+     */
+    private Long applyId;
+
+
+    public Long getApplyId() {
+        return applyId;
+    }
+
+    public void setApplyId(Long applyId) {
+        this.applyId = applyId;
+    }
+
+    public Long getSize() {
+        return size;
+    }
+
+    public void setSize(Long size) {
+        this.size = size;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+}

+ 6 - 2
src/main/java/com/uas/erp/schedular/financeservice/domain/BusinessConditionInfo.java

@@ -1,9 +1,9 @@
 package com.uas.erp.schedular.financeservice.domain;
 
-
 /**
+ * created by shicr on 2017/12/20
  * 情况描述
- */
+ **/
 public class BusinessConditionInfo {
 
     /**
@@ -59,4 +59,8 @@ public class BusinessConditionInfo {
     public void setBc_sweaterprocess(String bc_sweaterprocess) {
         this.bc_sweaterprocess = bc_sweaterprocess;
     }
+
+    public BusinessConditionInfo() {
+
+    }
 }

+ 3 - 1
src/main/java/com/uas/erp/schedular/financeservice/domain/ChangesInstructionInfo.java

@@ -1,6 +1,5 @@
 package com.uas.erp.schedular.financeservice.domain;
 
-
 /**
  * 变更内容
  */
@@ -84,4 +83,7 @@ public class ChangesInstructionInfo {
         this.cs_after = cs_after;
     }
 
+    public ChangesInstructionInfo() {
+
+    }
 }

+ 10 - 11
src/main/java/com/uas/erp/schedular/financeservice/domain/CustInfo.java

@@ -114,7 +114,7 @@ public class CustInfo {
      *
      * @return
      */
-    private Long cu_employeesum;
+    private Long cu_employeesnum;
 
     /**
      * 部门设置概况
@@ -156,7 +156,7 @@ public class CustInfo {
     /**
      * 金融服务申请数据
      */
-    private List<FinancingApply> financingApplies;
+    private Apply financingApply;
 
     /**
      * 买方客户资料
@@ -338,12 +338,12 @@ public class CustInfo {
         this.cu_highestauthority = cu_highestauthority;
     }
 
-    public Long getCu_employeesum() {
-        return cu_employeesum;
+    public Long getCu_employeesnum() {
+        return cu_employeesnum;
     }
 
-    public void setCu_employeesum(Long cu_employeesum) {
-        this.cu_employeesum = cu_employeesum;
+    public void setCu_employeesnum(Long cu_employeesnum) {
+        this.cu_employeesnum = cu_employeesnum;
     }
 
     public String getCu_departsituation() {
@@ -402,12 +402,12 @@ public class CustInfo {
         this.financeConditions = financeConditions;
     }
 
-    public List<FinancingApply> getFinancingApplies() {
-        return financingApplies;
+    public Apply getFinancingApply() {
+        return financingApply;
     }
 
-    public void setFinancingApplies(List<FinancingApply> financingApplies) {
-        this.financingApplies = financingApplies;
+    public void setFinancingApply(Apply financingApply) {
+        this.financingApply = financingApply;
     }
 
     public List<PurcCustInfo> getMfCustInfos() {
@@ -441,5 +441,4 @@ public class CustInfo {
     public void setUpdowncasts(List<UpdowncastInfo> updowncasts) {
         this.updowncasts = updowncasts;
     }
-
 }

+ 5 - 1
src/main/java/com/uas/erp/schedular/financeservice/domain/CustomerExcutiveInfo.java

@@ -1,8 +1,9 @@
 package com.uas.erp.schedular.financeservice.domain;
 
 /**
+ * created by shicr on 2017/12/20
  * 管理层信息
- */
+ **/
 public class CustomerExcutiveInfo {
 
     /**
@@ -163,6 +164,9 @@ public class CustomerExcutiveInfo {
         this.ce_woekexper = ce_woekexper;
     }
 
+    public CustomerExcutiveInfo() {
+
+    }
 }
 
 

+ 37 - 30
src/main/java/com/uas/erp/schedular/financeservice/domain/CustomerInfo.java

@@ -1,12 +1,12 @@
 package com.uas.erp.schedular.financeservice.domain;
 
 /**
- * Created by hejq on 2017-12-22.
- */
+ * created by shicr on 2017/12/26
+ **/
 public class CustomerInfo {
 
     /**
-     * ID
+     * id
      */
     private Long id;
 
@@ -112,7 +112,7 @@ public class CustomerInfo {
      *
      * @return
      */
-    private Long cu_employeesum;
+    private Long cu_employeesnum;
 
     /**
      * 部门设置概况
@@ -281,12 +281,12 @@ public class CustomerInfo {
         this.cu_highestauthority = cu_highestauthority;
     }
 
-    public Long getCu_employeesum() {
-        return cu_employeesum;
+    public Long getCu_employeesnum() {
+        return cu_employeesnum;
     }
 
-    public void setCu_employeesum(Long cu_employeesum) {
-        this.cu_employeesum = cu_employeesum;
+    public void setCu_employeesnum(Long cu_employeesnum) {
+        this.cu_employeesnum = cu_employeesnum;
     }
 
     public String getCu_departsituation() {
@@ -297,27 +297,34 @@ public class CustomerInfo {
         this.cu_departsituation = cu_departsituation;
     }
 
-    public CustomerInfo(CustInfo info) {
-        this.cu_businesscode = info.getCu_businesscode();
-        this.cu_businsscope = info.getCu_businsscope();
-        this.cu_capcurrency = info.getCu_capcurrency();
-        this.cu_ctfduedate = info.getCu_ctfduedate();
-        this.cu_departsituation = info.getCu_departsituation();
-        this.cu_employeesum = info.getCu_employeesum();
-        this.cu_engname = info.getCu_engname();
-        this.cu_enterptype = info.getCu_enterptype();
-        this.cu_highestauthority = info.getCu_highestauthority();
-        this.cu_institutype = info.getCu_institutype();
-        this.cu_licensedate = info.getCu_licensedate();
-        this.cu_name = info.getCu_name();
-        this.cu_nastdinducls = info.getCu_nastdinducls();
-        this.cu_officeaddcode = info.getCu_officeaddcode();
-        this.cu_others = info.getCu_others();
-        this.cu_paidincapital = info.getCu_paidincapital();
-        this.cu_enuu = info.getCu_enuu();
-        this.id = info.getId();
-    }
-
-    public CustomerInfo() {
+    public CustomerInfo () {
+
+    }
+
+    public CustomerInfo (CustInfo info) {
+        if(info!=null) {
+            this.id = info.getId();
+            this.cu_name = info.getCu_name();
+            this.cu_engname = info.getCu_engname();
+            this.cu_enterptype = info.getCu_enterptype();
+            this.cu_licensedate = info.getCu_licensedate();
+            this.cu_paperstype = info.getCu_paperstype();
+            this.cu_institutype = info.getCu_institutype();
+            this.cu_paperscode = info.getCu_paperscode();
+            this.cu_ctfduedate = info.getCu_ctfduedate();
+            this.cu_businesscode = info.getCu_businesscode();
+            this.cu_nastdinducls = info.getCu_nastdinducls();
+            this.cu_capcurrency = info.getCu_capcurrency();
+            this.cu_regcapital = info.getCu_regcapital();
+            this.cu_paidincapital = info.getCu_paidincapital();
+            this.cu_redaddcode = info.getCu_redaddcode();
+            this.cu_officeaddcode = info.getCu_officeaddcode();
+            this.cu_businsscope = info.getCu_businsscope();
+            this.cu_others = info.getCu_others();
+            this.cu_enuu = info.getCu_enuu();
+            this.cu_highestauthority = info.getCu_highestauthority();
+            this.cu_employeesnum = info.getCu_employeesnum();
+            this.cu_departsituation = info.getCu_departsituation();
+        }
     }
 }

+ 6 - 2
src/main/java/com/uas/erp/schedular/financeservice/domain/FinanceConditionInfo.java

@@ -1,8 +1,9 @@
 package com.uas.erp.schedular.financeservice.domain;
 
 /**
+ * created by shicr on 2017/12/20
  * 财务情况说明
- */
+ **/
 public class FinanceConditionInfo {
 
     /**
@@ -97,4 +98,7 @@ public class FinanceConditionInfo {
         this.fc_otharremark = fc_otharremark;
     }
 
-}
+    public FinanceConditionInfo() {
+
+    }
+}

+ 5 - 2
src/main/java/com/uas/erp/schedular/financeservice/domain/ProductMixInfo.java

@@ -1,9 +1,9 @@
 package com.uas.erp.schedular.financeservice.domain;
 
-
 /**
+ * created by shicr on 2017/12/20
  * 经营情况表
- */
+ **/
 public class ProductMixInfo {
 
     /**
@@ -98,4 +98,7 @@ public class ProductMixInfo {
         this.pm_ratio = pm_ratio;
     }
 
+    public ProductMixInfo() {
+
+    }
 }

+ 5 - 4
src/main/java/com/uas/erp/schedular/financeservice/domain/PurcCustInfo.java

@@ -1,9 +1,9 @@
 package com.uas.erp.schedular.financeservice.domain;
 
-
 /**
+ * created by shicr on 2017/12/20
  * 买方客户资料
- */
+ **/
 public class PurcCustInfo {
 
     /**
@@ -32,7 +32,6 @@ public class PurcCustInfo {
      */
     private String mf_legrep;
 
-
     /**
      * 注册资本(万元)
      */
@@ -63,7 +62,6 @@ public class PurcCustInfo {
      */
     private String mf_fax;
 
-
     /**
      * 电子邮箱
      */
@@ -243,4 +241,7 @@ public class PurcCustInfo {
         this.mf_businsscope = mf_businsscope;
     }
 
+    public PurcCustInfo() {
+
+    }
 }

+ 5 - 2
src/main/java/com/uas/erp/schedular/financeservice/domain/ShareholdersInfo.java

@@ -1,9 +1,9 @@
 package com.uas.erp.schedular.financeservice.domain;
 
-
 /**
  * 股东信息表
- */
+ * created by shicr on 2017/12/18
+ **/
 public class ShareholdersInfo {
 
     /**
@@ -98,4 +98,7 @@ public class ShareholdersInfo {
         this.enuu = enuu;
     }
 
+    public ShareholdersInfo() {
+
+    }
 }

+ 4 - 1
src/main/java/com/uas/erp/schedular/financeservice/domain/UpdowncastInfo.java

@@ -2,7 +2,7 @@ package com.uas.erp.schedular.financeservice.domain;
 
 /**
  * 供应商客户
- *
+ * created by shicr on 2017/12/20
  **/
 public class UpdowncastInfo {
 
@@ -111,4 +111,7 @@ public class UpdowncastInfo {
         this.udc_cooperationyears = udc_cooperationyears;
     }
 
+    public UpdowncastInfo() {
+
+    }
 }

+ 5 - 3
src/main/java/com/uas/erp/schedular/financeservice/task/AbstractTask.java

@@ -77,10 +77,12 @@ public class AbstractTask extends AbstractAgent {
     private String getURI(String url, Object... vars) {
         Master master = ContextHolder.getMaster();
         master = new Master();
-        master.setMa_user("UAS");
-        master.setMa_uu(10041166L);
-        master.setMa_accesssecret("2c1ea0898633796fe050007f01002ea6");
+        master.setMa_user("UAS_TEST");
+        master.setMa_uu(10046597L);
+        master.setMa_accesssecret("60ed5581d63aa728e050007f0100453f");
         master.setMa_env("test");
+        master.setMa_name("UAS_TEST");
+        ContextHolder.setMaster(master);
         if (null == master.getMa_uu() || StringUtils.isEmpty(master.getMa_accesssecret())) {
             throw new RuntimeException("未设置企业UU和私钥");
         }

+ 19 - 6
src/main/java/com/uas/erp/schedular/financeservice/task/CustomerInfoTask.java

@@ -1,5 +1,4 @@
 package com.uas.erp.schedular.financeservice.task;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.uas.api.crypto.util.FlexJsonUtils;
 import com.uas.erp.schedular.financeservice.domain.AccountInfo;
@@ -22,7 +21,7 @@ import java.util.List;
 @TaskMapping(title = "金融服务", role = Role.SELLER)
 public class CustomerInfoTask extends AbstractTask {
 
-    @TaskMapping(title = "申请企业从金融平台下载客户的申请数据", fixedDelay = 60000, method = Method.DOWNLOAD)
+   /* @TaskMapping(title = "申请企业从金融平台下载客户的申请数据", fixedDelay = 60000, method = Method.DOWNLOAD)
     public void downloadFinance() {
        String jsonStr = getForObject("/erp/customerInfo", String.class);
         if (!StringUtils.isEmpty(jsonStr)) {
@@ -34,6 +33,20 @@ public class CustomerInfoTask extends AbstractTask {
             // 回执
             onSaleDownSuccess(jsonObject.getString("idStr"));
         }
+    }*/
+
+    @TaskMapping(title = "申请企业从金融平台下载客户的申请数据", fixedDelay = 60000, method = Method.DOWNLOAD)
+    public void downloadFinance() {
+        String jsonStr = getForObject("/erp/finance", String.class);
+        if (!StringUtils.isEmpty(jsonStr)) {
+            JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+            String size = jsonObject.getString("size");
+            ContextHolder.setDataSize(null != size ? Integer.valueOf(size) : 0);
+            saveCustInfo(jsonObject.getString("custInfos"));
+            // TODO notice++
+            // 回执
+            onSaleDownSuccess(jsonObject.getString("idStr"));
+        }
     }
 
     /**
@@ -56,20 +69,20 @@ public class CustomerInfoTask extends AbstractTask {
             List<CustInfo> infos = FlexJsonUtils.fromJsonArray(custInfos, CustInfo.class);
             if(!CollectionUtils.isEmpty(infos)) {
                 for(CustInfo info : infos) {
-                    CustomerInfo customer = new CustomerInfo(info);
+                    CustomerInfo customer = new CustomerInfo();
                     String url = "/openapi/applicant/financingApply.action";
-                    postForEntity(url, new ModelMap("customer", JSON.toJSONString(customer))
+/*                    postForEntity(url, new ModelMap("customer", JSON.toJSONString(customer))
                             .addAttribute("accountList",JSON.toJSONString(info.getAccountInfoList()))
                             .addAttribute("associateCompany", JSON.toJSONString(info.getAssociateCompanies()))
                             .addAttribute("businessCondition", JSON.toJSONString(info.getBusinessCondition()))
                             .addAttribute("customerExcutive", JSON.toJSONString(info.getCustomerExcutives()))
                             .addAttribute("financeCondition", JSON.toJSONString(info.getFinanceConditions()))
                             .addAttribute("mfCust", JSON.toJSONString(info.getMfCustInfos()))
-                            .addAttribute("financingApply", JSON.toJSONString(info.getFinancingApplies()))
+                            .addAttribute("financingApply", JSON.toJSONString(info.getFinancingApply()))
                             .addAttribute("prouductMixe", JSON.toJSONString(info.getProductMixes()))
                             .addAttribute("updowncast", JSON.toJSONString(info.getUpdowncasts()))
                             .addAttribute("shareholders", JSON.toJSONString(info.getShareholders()))
-                            .addAttribute("changeInstruction", JSON.toJSONString(info.getChangesInstructions())));
+                            .addAttribute("changeInstruction", JSON.toJSONString(info.getChangesInstructions())));*/
                 }
             }
         }

+ 2 - 2
src/main/resources/init/setting.json

@@ -8,7 +8,7 @@
 },{
   "key": "api.uas.inner.url",
   "description": "UAS系统内网接口地址",
-  "value": "http://localhost:8030/ERP"
+  "value": "http://192.168.253.29:8080/ERP/"
 },{
   "key": "api.b2b.test.url",
   "description": "优软B2B平台测试接口地址",
@@ -27,7 +27,7 @@
 },{
   "key": "api.finance.service.test.url",
   "description": "金融保理平台(客户端)测试接口地址",
-  "value": "http://localhost:8001"
+  "value": "http://localhost:8081"
 },{
   "key": "api.finance.service.url",
   "description": "金融保理平台(客户端)正式接口地址",

+ 56 - 26
src/test/java/com/uas/erp/test/ConnectToFinanceTest.java

@@ -1,13 +1,15 @@
 package com.uas.erp.test;
 
+import ch.qos.logback.core.net.SyslogOutputStream;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.uas.api.crypto.util.FlexJsonUtils;
 import com.uas.erp.schedular.UasSchedulingApplication;
 import com.uas.erp.schedular.entity.Master;
-import com.uas.erp.schedular.finance.task.AbstractTask;
-import com.uas.erp.schedular.financeservice.domain.CustInfo;
-import com.uas.erp.schedular.financeservice.domain.CustomerInfo;
+import com.uas.erp.schedular.financeservice.domain.*;
+import com.uas.erp.schedular.financeservice.task.AbstractTask;
 import com.uas.erp.schedular.util.ContextHolder;
+import javafx.scene.control.TextFormatter;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -20,7 +22,7 @@ import java.util.List;
 
 /**
  * 从金融平台获取数据再连接ERP的测试
- *
+ * <p>
  * Created by hejq on 2017-12-22.
  */
 @RunWith(SpringJUnit4ClassRunner.class)
@@ -30,33 +32,61 @@ public class ConnectToFinanceTest extends AbstractTask {
     @Test
     public void testConnect() {
         Master master = new Master();
-        master.setMa_user("UAS");
-        master.setMa_uu(10041166L);
-        master.setMa_accesssecret("2c1ea0898633796fe050007f01002ea6");
+        master.setMa_user("UAS_TEST");
+        master.setMa_uu(10046597L);
+        master.setMa_accesssecret("60ed5581d63aa728e050007f0100453f");
         master.setMa_env("test");
-        master.setMa_name("UAS");
+        master.setMa_name("UAS_TEST");
         ContextHolder.setMaster(master);
-        String jsonStr = getForObject("/erp/customerInfo", String.class);
+        String jsonStr = getForObject("/erp/finance", String.class);
         JSONObject jsonObject = JSONObject.parseObject(jsonStr);
         String size = jsonObject.getString("size");
-        String custInfos = jsonObject.getString("custInfos");
-        List<CustInfo> infos = FlexJsonUtils.fromJsonArray(custInfos, CustInfo.class);
-        if (!CollectionUtils.isEmpty(infos)) {
-            for (CustInfo info : infos) {
-                CustomerInfo customer = new CustomerInfo(info);
+        String apply = jsonObject.getString("apply");
+        List<Apply> applies = FlexJsonUtils.fromJsonArray(apply, Apply.class);
+
+        if (!CollectionUtils.isEmpty(applies)) {
+            for (Apply apply1 : applies) {
                 String url = "/openapi/applicant/financingApply.action";
-                postForEntity(url, new ModelMap("customer", FlexJsonUtils.toJsonDeep(customer))
-                        .addAttribute("accountList", FlexJsonUtils.toJsonDeep(info.getAccountInfoList()))
-                        .addAttribute("associateCompany", FlexJsonUtils.toJsonDeep(info.getAssociateCompanies()))
-                        .addAttribute("businessCondition", FlexJsonUtils.toJsonDeep(info.getBusinessCondition()))
-                        .addAttribute("customerExcutive", FlexJsonUtils.toJsonDeep(info.getCustomerExcutives()))
-                        .addAttribute("financeCondition", FlexJsonUtils.toJsonDeep(info.getFinanceConditions()))
-                        .addAttribute("mfCust", FlexJsonUtils.toJsonDeep(info.getMfCustInfos()))
-                        .addAttribute("financingApply", FlexJsonUtils.toJsonDeep(info.getFinancingApplies()))
-                        .addAttribute("prouductMixe", FlexJsonUtils.toJsonDeep(info.getProductMixes()))
-                        .addAttribute("updowncast", FlexJsonUtils.toJsonDeep(info.getUpdowncasts()))
-                        .addAttribute("shareholders", FlexJsonUtils.toJsonDeep(info.getShareholders()))
-                        .addAttribute("changeInstruction", FlexJsonUtils.toJsonDeep(info.getChangesInstructions())));
+
+                List<AssociateCompanyInfo> companyInfos = apply1.getCustomerInfo() != null ? apply1.getCustomerInfo().getAssociateCompanies() : null;
+
+                List<CustomerExcutiveInfo> customerExcutiveInfos = apply1.getCustomerInfo() != null ? apply1.getCustomerInfo().getCustomerExcutives() : null;
+
+                BusinessConditionInfo conditionInfos = apply1.getCustomerInfo() != null ? apply1.getCustomerInfo().getBusinessCondition() : null;
+
+                List<FinanceConditionInfo> conditionInfo = apply1.getCustomerInfo() != null ? apply1.getCustomerInfo().getFinanceConditions() : null;
+
+                List<ProductMixInfo> productMixInfos = apply1.getCustomerInfo() != null ? apply1.getCustomerInfo().getProductMixes() : null;
+
+                List<PurcCustInfo> purcCustInfos = apply1.getCustomerInfo() != null ? apply1.getCustomerInfo().getMfCustInfos() : null;
+
+                List<UpdowncastInfo> updowncastInfos = apply1.getCustomerInfo() != null ? apply1.getCustomerInfo().getUpdowncasts() : null;
+
+                List<ShareholdersInfo> shareholdersInfos = apply1.getCustomerInfo() != null ? apply1.getCustomerInfo().getShareholders() : null;
+
+                List<ChangesInstructionInfo> changesInstructionInfos = apply1.getCustomerInfo() != null ? apply1.getCustomerInfo().getChangesInstructions() : null;
+
+                List<AccountInfo> accountInfos = apply1.getCustomerInfo() != null ? apply1.getCustomerInfo().getAccountInfoList() : null;
+
+                System.out.println(FlexJsonUtils.toJsonDeep(new ApplyInfo(apply1)));
+
+                System.out.println(FlexJsonUtils.toJsonDeep(apply1.getAttachList()));
+
+                postForEntity(url, new ModelMap("customer", FlexJsonUtils.toJsonDeep(new CustomerInfo(apply1.getCustomerInfo())))
+                        .addAttribute("apply", FlexJsonUtils.toJsonDeep(new ApplyInfo(apply1)))
+                        .addAttribute("associateCompany", FlexJsonUtils.toJsonDeep(companyInfos))
+                        .addAttribute("businessCondition", FlexJsonUtils.toJsonDeep(conditionInfos))
+                        .addAttribute("customerExcutive", FlexJsonUtils.toJsonDeep(customerExcutiveInfos))
+                        .addAttribute("financeCondition", FlexJsonUtils.toJsonDeep(conditionInfo))
+                        .addAttribute("mfCust", FlexJsonUtils.toJsonDeep(purcCustInfos))
+                        .addAttribute("attaches", FlexJsonUtils.toJsonDeep(apply1.getAttachList()))
+                        .addAttribute("prouductMixe", FlexJsonUtils.toJsonDeep(productMixInfos))
+                        .addAttribute("updowncast", FlexJsonUtils.toJsonDeep(updowncastInfos))
+                        .addAttribute("shareholders", FlexJsonUtils.toJsonDeep(shareholdersInfos))
+                        .addAttribute("changeInstruction", FlexJsonUtils.toJsonDeep(changesInstructionInfos))
+                        .addAttribute("accountList", FlexJsonUtils.toJsonDeep(accountInfos))
+                );
+
             }
         }
     }