|
|
@@ -0,0 +1,90 @@
|
|
|
+package com.uas.erp.schedular.financeservice.task;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.uas.api.crypto.util.FlexJsonUtils;
|
|
|
+import com.uas.erp.schedular.financeservice.domain.AccountInfo;
|
|
|
+import com.uas.erp.schedular.financeservice.domain.CustInfo;
|
|
|
+import com.uas.erp.schedular.financeservice.domain.CustomerInfo;
|
|
|
+import com.uas.erp.schedular.task.support.Method;
|
|
|
+import com.uas.erp.schedular.task.support.Role;
|
|
|
+import com.uas.erp.schedular.task.support.TaskMapping;
|
|
|
+import com.uas.erp.schedular.util.ContextHolder;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by hejq on 2017-12-21.
|
|
|
+ */
|
|
|
+@Component
|
|
|
+@TaskMapping(title = "金融服务", role = Role.SELLER)
|
|
|
+public class CustomerInfoTask extends AbstractTask {
|
|
|
+
|
|
|
+ /* @TaskMapping(title = "申请企业从金融平台下载客户的申请数据", fixedDelay = 60000, method = Method.DOWNLOAD)
|
|
|
+ public void downloadFinance() {
|
|
|
+ String jsonStr = getForObject("/erp/customerInfo", 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"));
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ @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"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将下载的数据的idStr传回金融平台进行更新操作
|
|
|
+ *
|
|
|
+ * @param idStr
|
|
|
+ */
|
|
|
+ private void onSaleDownSuccess(String idStr) {
|
|
|
+ if(!StringUtils.isEmpty(idStr))
|
|
|
+ post("/erp/customerInfo/back", dataWrap(idStr));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下载的数据传输到ERP做处理,这边不做处理
|
|
|
+ *
|
|
|
+ * @param custInfos
|
|
|
+ */
|
|
|
+ private void saveCustInfo(String custInfos) {
|
|
|
+ if(!StringUtils.isEmpty(custInfos)) {
|
|
|
+ List<CustInfo> infos = FlexJsonUtils.fromJsonArray(custInfos, CustInfo.class);
|
|
|
+ if(!CollectionUtils.isEmpty(infos)) {
|
|
|
+ for(CustInfo info : infos) {
|
|
|
+ CustomerInfo customer = new CustomerInfo();
|
|
|
+ String url = "/openapi/applicant/financingApply.action";
|
|
|
+/* 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.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())));*/
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|