From d388e2788b7ef088d7cd40f901b0acdcec460bc3 Mon Sep 17 00:00:00 2001
From: wzy <wzy19931122ai@163.com>
Date: Thu, 01 Apr 2021 00:19:23 +0800
Subject: [PATCH] modify
---
zq-erp/src/test/java/com/matrix/DataMoveTest.java | 4
zq-erp/src/main/java/com/matrix/system/dataMove/DateMoveServiceImpl.java | 135 ++++++++++++++++++++++++++++++++++++++------
zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml | 6 +
3 files changed, 122 insertions(+), 23 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 c6ccb3d..086cf75 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
@@ -1060,28 +1060,39 @@
@DS("slave")
public List<SysProjUse> projUseMoveOld() {
- List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from sys_proj_use");
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList("select\n" +
+ "\t\ta.ID,\n" +
+ "\t\ta.VIP_ID,\n" +
+ "\t\ta.TAOCAN_ID,\n" +
+ "\t\ta.FAIL_TIME,\n" +
+ "\t\ta.SOURCE,\n" +
+ "\t\ta.STATUS,\n" +
+ "\t\ta.ORDER_ITEM_ID,\n" +
+ "\t\ta.PLATFORM_FLAG,\n" +
+ "\t\ta.type,\n" +
+ "\t\ta.balance,\n" +
+ "\t\ta.remark,\n" +
+ " b.name projName,\n" +
+ " sum(a.SURPLUS_COUNT) 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" +
+ "GROUP BY PLATFORM_FLAG\n" +
+ "order by a.status");
List<SysProjUse> projUses = mapsToListBean(maps, SysProjUse.class);
Map<String, Integer> goodProj = getRedisIds("shopping_goods_proj");
Map<String, Integer> goodTc = getRedisIds("shopping_goods_tc");
Map<String, Integer> vipInfos = getRedisIds("vip_info");
+ Map<String, Integer> order_item = getRedisIds("order_item");
for (SysProjUse projUse : projUses) {
+ projUse.setType("套餐");
if (projUse.getTaocanId() != null) {
Integer tcId = goodTc.get(projUse.getTaocanId().toString());
if (tcId != null) {
- projUse.setTaocanId(tcId.longValue());
+ projUse.setProjId(tcId.longValue());
} else {
- projUse.setTaocanId(-projUse.getTaocanId());
- }
- }
-
- if (projUse.getProjId() != null) {
- Integer projId = goodProj.get(projUse.getProjId().toString());
- if (projId != null) {
- projUse.setProjId(projId.longValue());
- } else {
- projUse.setProjId(-projUse.getProjId());
+ projUse.setProjId(-projUse.getTaocanId());
}
}
@@ -1091,6 +1102,78 @@
} else {
projUse.setVipId(-projUse.getVipId());
}
+
+ if (projUse.getOrderItemId() != null && projUse.getOrderItemId() != 1) {
+ Integer itemID = order_item.get(projUse.getOrderItemId().toString());
+ if (itemID != null) {
+ projUse.setOrderItemId(itemID.longValue());
+ } else {
+ projUse.setOrderItemId(-projUse.getOrderItemId());
+ }
+ }
+
+ if ("无效".equals(projUse.getStatus())) {
+ projUse.setIsOver("Y");
+ }
+
+ List<Map<String, Object>> projInfos = jdbcTemplate.queryForList("select a.*, b.PROJ_NAME from sys_proj_use a\n" +
+ "left join sys_proj_info b on a.PROJ_ID=b.ID\n" +
+ "where PLATFORM_FLAG='" + projUse.getPlatformFlag()+"'");
+
+ List<SysProjUse> projInfoUses = mapsToListBean(projInfos, SysProjUse.class);
+ for (SysProjUse projInfoUse : projInfoUses) {
+ if (projInfoUse.getProjId() != null) {
+ Integer projId = goodProj.get(projInfoUse.getProjId().toString());
+ if (projId != null) {
+ projInfoUse.setProjId(projId.longValue());
+ } else {
+ projInfoUse.setProjId(-projInfoUse.getProjId());
+ }
+ }
+
+ Integer vipId2 = vipInfos.get(projInfoUse.getVipId().toString());
+ if (vipId2 != null) {
+ projInfoUse.setVipId(vipId2.longValue());
+ } else {
+ projInfoUse.setVipId(-projInfoUse.getVipId());
+ }
+ projInfoUse.setType("项目");
+ }
+
+ projUse.setTaocanProjUse(projInfoUses);
+ }
+
+ List<Map<String, Object>> projUsesInfoMap = jdbcTemplate.queryForList("select a.*, b.PROJ_NAME from sys_proj_use a left join sys_proj_info b on a.PROJ_ID=b.id where TAOCAN_ID is null");
+ List<SysProjUse> sysProjUses = mapsToListBean(projUsesInfoMap, SysProjUse.class);
+ for (SysProjUse sysProjUse : sysProjUses) {
+ sysProjUse.setType("项目");
+ sysProjUse.setDeductionNum(1);
+
+ if (sysProjUse.getProjId() != null) {
+ Integer projId = goodProj.get(sysProjUse.getProjId().toString());
+ if (projId != null) {
+ sysProjUse.setProjId(projId.longValue());
+ } else {
+ sysProjUse.setProjId(-sysProjUse.getProjId());
+ }
+ }
+
+ Integer vipId2 = vipInfos.get(sysProjUse.getVipId().toString());
+ if (vipId2 != null) {
+ sysProjUse.setVipId(vipId2.longValue());
+ } else {
+ sysProjUse.setVipId(-sysProjUse.getVipId());
+ }
+
+ if (sysProjUse.getOrderItemId() != null && sysProjUse.getOrderItemId() != 1) {
+ Integer itemID = order_item.get(sysProjUse.getOrderItemId().toString());
+ if (itemID != null) {
+ sysProjUse.setOrderItemId(itemID.longValue());
+ } else {
+ sysProjUse.setOrderItemId(-sysProjUse.getOrderItemId());
+ }
+ }
+ projUses.add(sysProjUse);
}
return projUses;
}
@@ -1103,15 +1186,28 @@
if (CollUtil.isNotEmpty(list)) {
Map<Long, Long> map = new HashMap<>();
for (SysProjUse sysProjUse : list) {
- if(sysProjUse.getType() == "套餐卡") {
- sysProjUse.setType("套餐");
- } else if (StrUtil.isEmpty(sysProjUse.getType())){
- sysProjUse.setType("项目");
- }
-
Long oldId = sysProjUse.getId();
sysProjUse.setId(null);
- sysProjUseDao.insert(sysProjUse);
+ sysProjUse.setCreateBy("数据迁移");
+ sysProjUse.setTaocanId(null);
+
+ List<SysProjUse> taocanProjUses = sysProjUse.getTaocanProjUse();
+ if (CollUtil.isNotEmpty(taocanProjUses)) {
+ sysProjUse.setIsCourse("N");
+ sysProjUseDao.insert(sysProjUse);
+ for (SysProjUse taocanProjUse : taocanProjUses) {
+ taocanProjUse.setTaocanId(sysProjUse.getId());
+ Long projOldId = taocanProjUse.getId();
+ taocanProjUse.setId(null);
+ taocanProjUse.setCreateBy("数据迁移");
+ taocanProjUse.setDeductionNum(1);
+ sysProjUseDao.insert(taocanProjUse);
+ map.put(projOldId, taocanProjUse.getId());
+ }
+ } else {
+ sysProjUseDao.insert(sysProjUse);
+ }
+
map.put(oldId, sysProjUse.getId());
}
@@ -1299,6 +1395,7 @@
achieveNew.setId(null);
achieveNew.setOrderItemId(beautyMaps.get(achieveNew.getOrderItemId()));
achieveNew.setServiceOrderId(newId);
+ achieveNew.setCompanyId(companyId);
}
achieveNewDao.batchInsert(achieveNews);
}
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
index c849888..d05844a 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
@@ -165,7 +165,8 @@
proj_name,
tcName,
deductionNum,
- is_course
+ is_course,
+ create_by
)
VALUES (
#{id},
@@ -187,7 +188,8 @@
#{projName},
#{tcName},
#{deductionNum},
- #{isCourse}
+ #{isCourse},
+ #{createBy}
)
</insert>
diff --git a/zq-erp/src/test/java/com/matrix/DataMoveTest.java b/zq-erp/src/test/java/com/matrix/DataMoveTest.java
index 57be88b..e007343 100644
--- a/zq-erp/src/test/java/com/matrix/DataMoveTest.java
+++ b/zq-erp/src/test/java/com/matrix/DataMoveTest.java
@@ -122,7 +122,7 @@
dataMove.shopStaffInfoNew(dataMove.shopStaffInfoOld());
}
- @Test
+// @Test
public void orderMoveTest() {
dataMove.orderNew(dataMove.orderOld());
}
@@ -132,7 +132,7 @@
dataMove.bedInfoNew(dataMove.bedInfoOld());
}
-// @Test
+ @Test
public void projUseMoveTest() {
dataMove.projUseNew(dataMove.projUseMoveOld());
}
--
Gitblit v1.9.1