Helius
2021-08-11 05d329244f158d1d16664c62b9a754c0905b4341
shanjifan datamove
2 files added
1 files modified
85 ■■■■ changed files
zq-erp/src/main/java/com/matrix/system/dataMove/SjfDataMoveServiceImpl.java 45 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/config/application.yml 23 ●●●●● patch | view | raw | blame | history
zq-erp/src/test/java/com/matrix/SjfDataMoveTest.java 17 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/dataMove/SjfDataMoveServiceImpl.java
New file
@@ -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;
    }
}
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
zq-erp/src/test/java/com/matrix/SjfDataMoveTest.java
New file
@@ -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;
}