From 113a78c242743578dceca029a793f54c6c059987 Mon Sep 17 00:00:00 2001
From: wzy <wzy19931122ai@163.com>
Date: Fri, 09 Jul 2021 23:40:27 +0800
Subject: [PATCH] “fix”
---
zq-erp/src/main/java/com/matrix/system/dataMove/DateMoveServiceImpl.java | 129 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 116 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 d9cad7e..32ef850 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
@@ -5,6 +5,7 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.matrix.component.redis.RedisClient;
+import com.matrix.core.tools.DateUtil;
import com.matrix.core.tools.StringUtils;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.constance.AppConstance;
@@ -63,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");
@@ -103,11 +104,12 @@
return shopInfos;
}
+ @Transactional(rollbackFor = Exception.class)
public void toNewShopInfo(List<SysShopInfo> shopInfos) {
if (CollUtil.isNotEmpty(shopInfos)) {
Map<Long, Long> oldAndNewId = new HashMap<>();
for (SysShopInfo shopInfo : shopInfos) {
- if (shopInfo.getShopName().equals("总部")) {
+ if (shopInfo.getShopName().equals("总店")) {
shopInfo.setShopType(1);
shopInfo.setIsOpenNet(2);
} else {
@@ -121,14 +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 {
- 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);
}
@@ -166,19 +174,20 @@
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;
}
@Transactional(rollbackFor = Exception.class)
- public void newSysUsers(List<SysUsers> list) {
+ public void newSysUsers(List<SysUsers> list) throws UnsupportedEncodingException, NoSuchAlgorithmException {
if (CollUtil.isNotEmpty(list)) {
Map<Long, Long> sysUsersOldAndNew = new HashMap<>();
for (SysUsers sysUsers : list) {
Long oldId = sysUsers.getSuId();
sysUsers.setSuId(null);
+ sysUsers.setSuPassword(PasswordUtil.getEncrypUserPwd(sysUsers));
sysUsersDao.insert(sysUsers);
sysUsersOldAndNew.put(oldId, sysUsers.getSuId());
}
@@ -238,6 +247,7 @@
}
}
+ // sys_users 中 id 为 200 的无法找到
Long staffId = sysVipInfo.getStaffId();
if (staffId != null) {
Object o = sysUsersMap.get(staffId.toString());
@@ -491,6 +501,11 @@
shoppingGood.setIsDel(1);
shoppingGood.setZjm(StringUtils.toHanyuPinyin(shoppingGood.getName()) + "," + StringUtils.toHeadWordHanyuPinyin(shoppingGood.getName()));
+ if (shoppingGood.getCarUseCount() != null) {
+ shoppingGood.setIsCourse("Y");
+ shoppingGood.setIsInfinite("N");
+ }
+
shoppingGood.setWeiDescription("数据迁移-tc");
List<ShoppingGoodsAssemble> assembleList = mapsToListBean(assembles, ShoppingGoodsAssemble.class);
@@ -632,6 +647,7 @@
}
shoppingGood.setAssembleGoods(assembleList);
+ shoppingGood.setIsInfinite("N");
}
return shoppingGoods;
@@ -657,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);
@@ -670,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());
@@ -741,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");
}
}
@@ -975,6 +1033,9 @@
for (SysOrder sysOrder : list) {
Long oldOrderId = sysOrder.getId();
sysOrder.setId(null);
+ sysOrder.setCreateBy("数据迁移");
+ sysOrder.setCreateTime(sysOrder.getOrderTime() == null ? DateUtil.stringToDate("2018-10-17 19:03:28", DateUtil.DATE_FORMAT_SS) : sysOrder.getOrderTime());
+ sysOrder.setUpdateTime(sysOrder.getOrderTime() == null ? DateUtil.stringToDate("2018-10-17 19:03:28", DateUtil.DATE_FORMAT_SS) : sysOrder.getOrderTime());
sysOrderDao.insert(sysOrder);
orderIds.put(oldOrderId, sysOrder.getId());
@@ -1001,6 +1062,8 @@
}
flow.setOrderId(sysOrder.getId());
flow.setCreateBy("数据迁移");
+ flow.setCreateTime(sysOrder.getCreateTime());
+ flow.setUpdateTime(sysOrder.getUpdateTime());
sysOrderFlowDao.insert(flow);
}
}
@@ -1073,7 +1136,7 @@
"\t\ta.balance,\n" +
"\t\ta.remark,\n" +
" b.name projName,\n" +
- " sum(a.SURPLUS_COUNT) SURPLUS_COUNT\n" +
+ " a.SURPLUS_COUNT\n" +
"\t\tfrom sys_proj_use a\n" +
"\t\tleft join shopping_goods b on a.TAOCAN_ID= b.ID\n" +
"where TAOCAN_ID IS NOT NULL\n" +
@@ -1472,6 +1535,9 @@
for (MoneyCardUse moneyCardUse : moneyCardUses) {
moneyCardUse.setIsVipCar("N");
+ ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(moneyCardUse.getGoodsId());
+ moneyCardUse.setCardName(shoppingGoods.getName());
+
Integer vipId = null;
if (moneyCardUse.getVipId() != null) {
vipId = vipInfos.get(moneyCardUse.getVipId().toString());
@@ -1506,4 +1572,41 @@
}
}
+
+ @Transactional(rollbackFor = Exception.class)
+ public void tyOrderAndAchieveMove() {
+ jdbcTemplate.update("update sys_order set orderType=1, is_has_refund=2 where 1=1");
+
+ List<SysOrderFlow> flows = sysOrderFlowDao.selectOrderFlowByType();
+ if (CollUtil.isNotEmpty(flows)) {
+ for (SysOrderFlow flow : flows) {
+ SysOrder sysOrder = sysOrderDao.selectById(flow.getOrderId());
+ sysOrder.setIsHasRefund(1);
+ sysOrderDao.update(sysOrder);
+ }
+ }
+
+ List<AchieveNew> achieveNews = achieveNewDao.selectAchieveForOrder();
+ if (CollUtil.isNotEmpty(achieveNews)) {
+ for (AchieveNew achieveNew : achieveNews) {
+ if ("现金业绩".equalsIgnoreCase(achieveNew.getAchieveType())) {
+ achieveNew.setPayMethod("现金");
+ } else {
+ achieveNew.setPayMethod("划扣");
+ }
+
+// if (achieveNew.getConsume() == null) {
+// achieveNew.setPayMethod("现金");
+// } else {
+// achieveNew.setPayMethod("划扣");
+// }
+ achieveNew.setAchieveType("顾问业绩");
+ achieveNew.setGoodsCash(Double.parseDouble(achieveNew.getT1()));
+ achieveNewDao.updateByModel(achieveNew);
+ }
+
+ }
+
+ }
+
}
--
Gitblit v1.9.1