LG88888888 3 年之前
父节点
当前提交
42c4a9a3e2

+ 28 - 2
src/main/java/net/chenlin/dp/common/openapi4j/service/CustomerService.java

@@ -139,7 +139,33 @@ public class CustomerService extends BaseService {
 		}
 		return record;
 	}
-	
-	
 
+
+	/**
+	 * 通过平台的交易号修改客户
+	 * @param jsonBody
+	 * @param to_account
+	 * @return
+	 * @throws OpenAPIException
+	 */
+	public JSONObject edit(String jsonBody, String to_account) throws OpenAPIException {
+		JSONObject record;
+		try {
+			String tradeId = TradeService.getTradeId();
+			Map<String, String> paramMap = new HashMap();
+			paramMap.put("to_account", to_account);
+//			paramMap.put("tradeid", tradeId);
+			String url = this.createURL("customer/edit", paramMap);
+			logger.debug(url);
+			String resultStr = HttpUtil.post(url, jsonBody);
+			logger.debug(resultStr);
+			JSONObject resultRecord = Record.parseObject(resultStr);
+			Thread.sleep(3000);
+			record = Record.parseObject(HttpUtil.get(resultRecord.getString("url")));
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			throw new OpenAPIException(e.getMessage(), e);
+		}
+		return record;
+	}
 }

+ 17 - 1
src/main/java/net/chenlin/dp/common/openapi4j/service/PurchaseOrderService.java

@@ -106,7 +106,23 @@ public class PurchaseOrderService extends BaseService {
         }
         return record;
     }
-
+    public JSONObject shenghe(String jsonBody, String to_account) throws OpenAPIException {
+        JSONObject record;
+        try {
+            Map<String, String> paramMap = new HashMap();
+            paramMap.put("to_account", to_account);
+            String url = this.createURL("purchaseorder/audit", paramMap);
+            logger.debug(url);
+            String resultStr = HttpUtil.post(url, jsonBody);
+            logger.debug(resultStr);
+            JSONObject resultRecord = Record.parseObject(resultStr);
+            Thread.sleep(3000);
+            record = Record.parseObject(HttpUtil.get(resultRecord.getString("url")));
+        } catch (Exception e) {
+            throw new OpenAPIException(e.getMessage(), e);
+        }
+        return record;
+    }
     /**
      * 
      * 新增一张采购订单

+ 18 - 0
src/main/java/net/chenlin/dp/common/openapi4j/service/SaleOrderService.java

@@ -60,6 +60,24 @@ public class SaleOrderService extends BaseService {
         return record;
     }
 
+
+    public JSONObject shenghe(String jsonboy, String to_account) throws OpenAPIException {
+        JSONObject record;
+        try {
+            Map<String, String> paramMap = new HashMap();
+            paramMap.put("to_account", to_account);
+            String url = this.createURL("saleorder/audit", paramMap);
+            logger.debug(url);
+            String resultStr = HttpUtil.post(url, jsonboy);
+            logger.debug(resultStr);
+            JSONObject resultRecord = Record.parseObject(resultStr);
+            Thread.sleep(3000);
+            record = Record.parseObject(HttpUtil.get(resultRecord.getString("url")));
+        } catch (Exception e) {
+            throw new OpenAPIException(e.getMessage(), e);
+        }
+        return record;
+    }
     /**
      * 
      * 获取销售订单列表信息 

+ 8 - 1
src/main/java/net/chenlin/dp/common/support/orm/db/DynamicDataSourceConfig.java

@@ -23,11 +23,18 @@ public class DynamicDataSourceConfig {
         return DruidDataSourceBuilder.create().build();
     }
 
+    @Bean
+    @ConfigurationProperties("spring.datasource.druid.slave-data-source")
+    public DataSource slaveDataSource(){
+        return DruidDataSourceBuilder.create().build();
+    }
+
     @Bean
     @Primary
-    public DynamicDataSource dataSource(DataSource defaultDataSource) {
+    public DynamicDataSource dataSource(DataSource defaultDataSource,DataSource slaveDataSource) {
         Map<String, DataSource> targetDataSources = new HashMap<>(2);
         targetDataSources.put(DataSourceEnum.MASTER.getName(), defaultDataSource);
+        targetDataSources.put(DataSourceEnum.SLAVE.getName(), slaveDataSource);
         return new DynamicDataSource(defaultDataSource, targetDataSources);
     }
 }