|
|
@@ -0,0 +1,91 @@
|
|
|
+package com.uas.erp.test;
|
|
|
+
|
|
|
+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.domain.*;
|
|
|
+import com.uas.erp.schedular.finance.task.AbstractTask;
|
|
|
+import com.uas.erp.schedular.util.ContextHolder;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+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.List;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * 从金融平台获取数据再连接ERP的测试
|
|
|
+ * <p>
|
|
|
+ * Created by hejq on 2017-12-22.
|
|
|
+ */
|
|
|
+@RunWith(SpringJUnit4ClassRunner.class)
|
|
|
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = UasSchedulingApplication.class)
|
|
|
+public class ConnectToFinanceTest extends AbstractTask {
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testConnect() {
|
|
|
+ Master master = new Master();
|
|
|
+ master.setMa_user("YITOA_BL");
|
|
|
+ master.setMa_uu(10046945L);
|
|
|
+ master.setMa_accesssecret("600d3f07955ba67fe050007f01002db2");
|
|
|
+ master.setMa_env("test");
|
|
|
+ master.setMa_name("YITOA_BL");
|
|
|
+ ContextHolder.setMaster(master);
|
|
|
+ String jsonStr = getForObject("/erp/finance", String.class);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(jsonStr);
|
|
|
+ String size = jsonObject.getString("size");
|
|
|
+ String apply = jsonObject.getString("apply");
|
|
|
+ List<Apply> applies = FlexJsonUtils.fromJsonArray(apply, Apply.class);
|
|
|
+ System.out.println("applies"+applies);
|
|
|
+ if (!CollectionUtils.isEmpty(applies)) {
|
|
|
+ for (Apply apply1 : applies) {
|
|
|
+ String url = "/openapi/applicant/financingApply.action";
|
|
|
+
|
|
|
+ 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;
|
|
|
+
|
|
|
+ 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;
|
|
|
+
|
|
|
+ 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))
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String idStr = jsonObject.getString("idStr");
|
|
|
+ if (!StringUtils.isEmpty(idStr)) {
|
|
|
+ post("/erp/finance/back", dataWrap(idStr));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|