From f24e61e9b0d8efc55f974bbec25fb0fb73b04ece Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Sat, 10 Jul 2021 14:18:57 +0800
Subject: [PATCH] Merge branch 'data_move' of http://120.27.238.55:7000/r/beauty-erp into data_move
---
zq-erp/src/main/java/com/matrix/system/dataMove/DateMoveServiceImpl.java | 155 +++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 142 insertions(+), 13 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/dataMove/DateMoveServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/dataMove/DateMoveServiceImpl.java
index 68f1701..00f664b 100644
--- a/zq-erp/src/main/java/com/matrix/system/dataMove/DateMoveServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/dataMove/DateMoveServiceImpl.java
@@ -64,7 +64,7 @@
private RedisClient redisClient;
private Long companyId = 35L;
- private Long shopId = 38L;
+ private Long shopId = 60L;
public List<Map<String, Object>> dataMove() {
return jdbcTemplate.queryForList("select * from sys_vip_info limit 10");
@@ -104,6 +104,7 @@
return shopInfos;
}
+ @Transactional(rollbackFor = Exception.class)
public void toNewShopInfo(List<SysShopInfo> shopInfos) {
if (CollUtil.isNotEmpty(shopInfos)) {
Map<Long, Long> oldAndNewId = new HashMap<>();
@@ -122,17 +123,20 @@
query.setShopNo(shopInfo.getShopNo());
Long oldId = shopInfo.getId();
shopInfo.setId(null);
- // TODO 若迁往正式环境,这里需要变动
- if (!shopInfo.getShopName().contains("美度") && !shopInfo.getShopName().contains("总店")) {
- sysShopInfoDao.insert(shopInfo);
- oldAndNewId.put(oldId, shopInfo.getId());
- } else {
- if (shopInfo.getShopName().equals("总店")) {
- shopInfo.setShopName("美度(总部)");
- }
- SysShopInfo sysShopInfo = sysShopInfoDao.selectByShopName(shopInfo.getShopName());
- oldAndNewId.put(oldId, sysShopInfo.getId());
- }
+
+ sysShopInfoDao.insert(shopInfo);
+ oldAndNewId.put(oldId, shopInfo.getId());
+// // TODO 若迁往正式环境,这里需要变动
+// if (!shopInfo.getShopName().contains("美度") && !shopInfo.getShopName().contains("总店")) {
+// sysShopInfoDao.insert(shopInfo);
+// oldAndNewId.put(oldId, shopInfo.getId());
+// } else {
+// if (shopInfo.getShopName().equals("总店")) {
+// shopInfo.setShopName("美度(总部)");
+// }
+// SysShopInfo sysShopInfo = sysShopInfoDao.selectByShopName(shopInfo.getShopName());
+// oldAndNewId.put(oldId, sysShopInfo.getId());
+// }
}
redisClient.saveMapValue("shopId", oldAndNewId);
}
@@ -170,7 +174,7 @@
sysUsers.setSuRegisterTime((Date) map.get("register_time"));
sysUsers.setCreateBy(AppConstance.SYSTEM_USER);
sysUsers.setUpdateBy(AppConstance.SYSTEM_USER);
- sysUsers.setSuPassword(PasswordUtil.getEncrypUserPwd(sysUsers));
+// sysUsers.setSuPassword(PasswordUtil.getEncrypUserPwd(sysUsers));
list.add(sysUsers);
}
return list;
@@ -669,6 +673,20 @@
}
}
+ if ("否".equals(shoppingGoods.getIsOnce())) {
+ shoppingGoods.setIsOnce("0");
+ } else {
+ shoppingGoods.setIsOnce("1");
+ }
+
+ if (StrUtil.isNotBlank(shoppingGoods.getIsPresent())) {
+ if ("否".equals(shoppingGoods.getIsPresent())) {
+ shoppingGoods.setIsPresent("0");
+ } else {
+ shoppingGoods.setIsPresent("1");
+ }
+ }
+
Long oldId = shoppingGoods.getId();
shoppingGoods.setId(null);
shoppingGoodsDao.insert(shoppingGoods);
@@ -682,6 +700,20 @@
Long oldIdTc = assembleGood.getAssembleSkuId() == null ? assembleGood.getAssembleProjId() : assembleGood.getAssembleSkuId();
if (assembleGood.getShoppingGoods() != null) {
+
+ if ("否".equals(assembleGood.getShoppingGoods().getIsOnce())) {
+ assembleGood.getShoppingGoods().setIsOnce("0");
+ } else {
+ assembleGood.getShoppingGoods().setIsOnce("1");
+ }
+
+ if (StrUtil.isNotBlank(assembleGood.getShoppingGoods().getIsPresent())) {
+ if ("否".equals(assembleGood.getShoppingGoods().getIsPresent())) {
+ assembleGood.getShoppingGoods().setIsPresent("0");
+ } else {
+ assembleGood.getShoppingGoods().setIsPresent("1");
+ }
+ }
assembleGood.getShoppingGoods().setId(null);
shoppingGoodsDao.insert(assembleGood.getShoppingGoods());
@@ -753,6 +785,20 @@
Integer cateId = goodsCategory.get(shoppingGoods.getCateId().toString());
if (cateId != null) {
shoppingGoods.setCateId(Long.parseLong(cateId.toString()));
+ }
+ }
+
+ if ("否".equals(shoppingGoods.getIsOnce())) {
+ shoppingGoods.setIsOnce("0");
+ } else {
+ shoppingGoods.setIsOnce("1");
+ }
+
+ if (StrUtil.isNotBlank(shoppingGoods.getIsPresent())) {
+ if ("否".equals(shoppingGoods.getIsPresent())) {
+ shoppingGoods.setIsPresent("0");
+ } else {
+ shoppingGoods.setIsPresent("1");
}
}
@@ -1563,4 +1609,87 @@
}
+
+ @DS("slave")
+ public Map<String, List<Long>> roleOld() {
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList("select a.id, a.name, a.role_id, b.role_name from users a inner join sys_role b on find_in_set(b.role_id, a.role_id)");
+
+ List<Long> jkgw = new ArrayList<>();
+ List<Long> mls = new ArrayList<>();
+ for (Map<String, Object> map : maps) {
+ String roleName = map.get("role_name").toString();
+
+ if ("健康顾问".equals(roleName)) {
+ jkgw.add((Long) map.get("id"));
+ } else {
+ mls.add((Long) map.get("id"));
+ }
+ }
+
+ Map<String, List<Long>> result = new HashMap<>();
+ result.put("jkgw", jkgw);
+ result.put("mls", mls);
+ return result;
+ }
+
+ public void roleNew(Map<String, List<Long>> role) {
+ List<Long> jkgw = role.get("jkgw");
+ List<Long> mls = role.get("mls");
+ Map<String, Integer> sysUsersMap = getRedisIds("sys_users");
+
+ for (Long aLong : jkgw) {
+ Integer id = sysUsersMap.get(aLong.toString());
+ SysUsers sysUsers = new SysUsers();
+ sysUsers.setSuId(id.longValue());
+ sysUsers.setRoleIds("56");
+ sysUsersDao.updateByModel(sysUsers);
+ }
+
+ for (Long ml : mls) {
+ Integer id = sysUsersMap.get(ml.toString());
+ SysUsers sysUsers = new SysUsers();
+ sysUsers.setSuId(id.longValue());
+ sysUsers.setRoleIds("55");
+ sysUsersDao.updateByModel(sysUsers);
+ }
+
+ }
+
+ @DS("slave")
+ public Map<String, String> roleOld2() {
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from sys_shopstaff_info where find_in_set('美疗师', POST_TYPE_NAME) or find_in_set('健康顾问', POST_TYPE_NAME)");
+ Map<String, String> result = new HashMap<>();
+ for (Map<String, Object> map : maps) {
+
+ result.put(map.get("id").toString(), map.get("POST_TYPE_NAME").toString());
+ }
+
+ return result;
+ }
+
+ public void roleNew2(Map<String, String> map) {
+
+ Map<String, Integer> shopStaff = getRedisIds("shop_staff");
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ String id = entry.getKey();
+ Integer newId = shopStaff.get(id);
+
+ SysUsers sysUsers = new SysUsers();
+ sysUsers.setSuId(newId.longValue());
+ if (entry.getValue().contains("健康顾问,")) {
+ sysUsers.setRoleIds("56");
+ }
+
+ if (entry.getValue().contains("美疗师,")) {
+ sysUsers.setRoleIds("55");
+ }
+
+ if (entry.getValue().contains("健康顾问,美疗师,")) {
+ sysUsers.setRoleIds("55,56");
+ }
+
+ sysUsersDao.updateByModel(sysUsers);
+ }
+ }
+
}
--
Gitblit v1.9.1