From 05d329244f158d1d16664c62b9a754c0905b4341 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 11 Aug 2021 16:26:09 +0800
Subject: [PATCH] shanjifan datamove
---
zq-erp/src/main/java/com/matrix/system/dataMove/SjfDataMoveServiceImpl.java | 45 ++++++++++++++++++++++
zq-erp/src/main/resources/config/application.yml | 23 ++++-------
zq-erp/src/test/java/com/matrix/SjfDataMoveTest.java | 17 ++++++++
3 files changed, 71 insertions(+), 14 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/dataMove/SjfDataMoveServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/dataMove/SjfDataMoveServiceImpl.java
new file mode 100644
index 0000000..fdb70b6
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/dataMove/SjfDataMoveServiceImpl.java
@@ -0,0 +1,45 @@
+package com.matrix.system.dataMove;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.matrix.system.shopXcx.bean.ShopProductAttribute;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author wzy
+ * @date 2021-08-11
+ **/
+@Service
+public class SjfDataMoveServiceImpl {
+
+ @Autowired
+ private JdbcTemplate jdbcTemplate;
+
+
+ public <T> List<T> mapsToListBean(List<Map<String, Object>> maps, Class<T> t) {
+ List<T> list = new ArrayList<>();
+ for (Map<String, Object> map : maps) {
+ String s = JSONObject.toJSONString(map);
+ T object = JSONObject.parseObject(s, t);
+ list.add(object);
+ }
+ return list;
+ }
+
+ public <T> T mapToBane(Map<String, Object> map, Class<T> t) {
+ String s = JSONObject.toJSONString(map);
+ return JSONObject.parseObject(s, t);
+ }
+
+ @DS("slave")
+ public List<ShopProductAttribute> oldProductAttr() {
+ return null;
+ }
+
+}
diff --git a/zq-erp/src/main/resources/config/application.yml b/zq-erp/src/main/resources/config/application.yml
index 0dda1a5..fcb48e6 100644
--- a/zq-erp/src/main/resources/config/application.yml
+++ b/zq-erp/src/main/resources/config/application.yml
@@ -21,22 +21,17 @@
strict: false
datasource:
master:
-# url: jdbc:mysql://120.27.238.55:3306/hive_test_meidu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
-# username: ct_test
-# password: 123456
-# driver-class-name: com.mysql.jdbc.Driver
- url: jdbc:mysql://47.111.134.136:3306/db_meidu_prd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
- username: meidu_data
- password: meidu_4321#&@
+# url: jdbc:mysql://47.111.134.136:3306/db_meidu_prd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
+# username: meidu_data
+# password: meidu_4321#&@
+ url: jdbc:mysql://159.75.200.233:3306/shanjifan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
+ username: shanjifan
+ password: Shanjf123!@#
driver-class-name: com.mysql.jdbc.Driver
-# url: jdbc:mysql://124.70.222.34/hive_prd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
-# username: hive
-# password: hive123!@#
-# driver-class-name: com.mysql.jdbc.Driver
slave:
- url: jdbc:mysql://localhost:3306/db_meidu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
- username: root
- password: root
+ url: jdbc:mysql://159.75.200.233:3306/shanjifan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
+ username: shanjifan
+ password: Shanjf123!@#
driver-class-name: com.mysql.jdbc.Driver
druid:
filters: stat,slf4j
diff --git a/zq-erp/src/test/java/com/matrix/SjfDataMoveTest.java b/zq-erp/src/test/java/com/matrix/SjfDataMoveTest.java
new file mode 100644
index 0000000..d69fd25
--- /dev/null
+++ b/zq-erp/src/test/java/com/matrix/SjfDataMoveTest.java
@@ -0,0 +1,17 @@
+package com.matrix;
+
+import com.matrix.system.dataMove.SjfDataMoveServiceImpl;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {ZqErpApplication.class},webEnvironment =SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class SjfDataMoveTest {
+
+ @Autowired
+ private SjfDataMoveServiceImpl sjfDataMoveService;
+
+}
--
Gitblit v1.9.1