|
|
@@ -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))
|
|
|
+ );
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|