迁移 叫号功能
This commit is contained in:
@@ -3,11 +3,13 @@ package com.czg.mergedata.cur.service.impl;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.czg.mergedata.common.resp.CzgResult;
|
import com.czg.mergedata.common.resp.CzgResult;
|
||||||
import com.czg.mergedata.common.utils.PageUtils;
|
import com.czg.mergedata.common.utils.PageUtils;
|
||||||
|
import com.czg.mergedata.cur.entity.CurCallConfig;
|
||||||
import com.czg.mergedata.cur.entity.CurCallQueue;
|
import com.czg.mergedata.cur.entity.CurCallQueue;
|
||||||
import com.czg.mergedata.cur.entity.CurCallTable;
|
import com.czg.mergedata.cur.entity.CurCallTable;
|
||||||
|
import com.czg.mergedata.cur.mapper.CurCallConfigMapper;
|
||||||
import com.czg.mergedata.cur.mapper.CurCallQueueMapper;
|
import com.czg.mergedata.cur.mapper.CurCallQueueMapper;
|
||||||
import com.czg.mergedata.cur.mapper.CurCallTableMapper;
|
import com.czg.mergedata.cur.mapper.CurCallTableMapper;
|
||||||
import com.czg.mergedata.cur.service.CurShopIdRelationService;
|
import com.czg.mergedata.cur.service.CurCallConfigService;
|
||||||
import com.czg.mergedata.old.entity.OldCallConfig;
|
import com.czg.mergedata.old.entity.OldCallConfig;
|
||||||
import com.czg.mergedata.old.entity.OldCallQueue;
|
import com.czg.mergedata.old.entity.OldCallQueue;
|
||||||
import com.czg.mergedata.old.entity.OldCallTable;
|
import com.czg.mergedata.old.entity.OldCallTable;
|
||||||
@@ -16,16 +18,12 @@ import com.czg.mergedata.old.service.OldCallQueueService;
|
|||||||
import com.czg.mergedata.old.service.OldCallTableService;
|
import com.czg.mergedata.old.service.OldCallTableService;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import com.czg.mergedata.cur.entity.CurCallConfig;
|
|
||||||
import com.czg.mergedata.cur.mapper.CurCallConfigMapper;
|
|
||||||
import com.czg.mergedata.cur.service.CurCallConfigService;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 叫号配置表 服务层实现。
|
* 叫号配置表 服务层实现。
|
||||||
@@ -36,9 +34,6 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class CurCallConfigServiceImpl extends ServiceImpl<CurCallConfigMapper, CurCallConfig> implements CurCallConfigService {
|
public class CurCallConfigServiceImpl extends ServiceImpl<CurCallConfigMapper, CurCallConfig> implements CurCallConfigService {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CurShopIdRelationService curShopIdRelationService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CurCallQueueMapper curCallQueueMapper;
|
private CurCallQueueMapper curCallQueueMapper;
|
||||||
|
|
||||||
@@ -61,72 +56,70 @@ public class CurCallConfigServiceImpl extends ServiceImpl<CurCallConfigMapper, C
|
|||||||
curCallQueueMapper.truncateTable();
|
curCallQueueMapper.truncateTable();
|
||||||
curCallTableMapper.truncateTable();
|
curCallTableMapper.truncateTable();
|
||||||
|
|
||||||
Map<Long, Long> oldAndCurShopIdMap = curShopIdRelationService.getOldShopIdRelation();
|
execCallConfig();
|
||||||
|
execCallQueue();
|
||||||
execCallConfig(oldAndCurShopIdMap);
|
execCallTable();
|
||||||
execCallQueue(oldAndCurShopIdMap);
|
|
||||||
execCallTable(oldAndCurShopIdMap);
|
|
||||||
|
|
||||||
return CzgResult.success("迁移成功");
|
return CzgResult.success("迁移成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execCallConfig(Map<Long, Long> oldAndCurShopIdMap) {
|
private void execCallConfig() {
|
||||||
Page<OldCallConfig> page = oldCallConfigService.page(PageUtils.buildPage());
|
Page<OldCallConfig> page = oldCallConfigService.page(PageUtils.buildPage());
|
||||||
|
|
||||||
while (!page.getRecords().isEmpty()) {
|
while (!page.getRecords().isEmpty()) {
|
||||||
saveCallConfig(page.getRecords(), oldAndCurShopIdMap);
|
saveCallConfig(page.getRecords());
|
||||||
page = oldCallConfigService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
page = oldCallConfigService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execCallQueue(Map<Long, Long> oldAndCurShopIdMap) {
|
private void execCallQueue() {
|
||||||
Page<OldCallQueue> page = oldCallQueueService.page(PageUtils.buildPage());
|
Page<OldCallQueue> page = oldCallQueueService.page(PageUtils.buildPage());
|
||||||
|
|
||||||
while (!page.getRecords().isEmpty()) {
|
while (!page.getRecords().isEmpty()) {
|
||||||
saveCallQueue(page.getRecords(), oldAndCurShopIdMap);
|
saveCallQueue(page.getRecords());
|
||||||
page = oldCallQueueService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
page = oldCallQueueService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execCallTable(Map<Long, Long> oldAndCurShopIdMap) {
|
private void execCallTable() {
|
||||||
Page<OldCallTable> page = oldCallTableService.page(PageUtils.buildPage());
|
Page<OldCallTable> page = oldCallTableService.page(PageUtils.buildPage());
|
||||||
|
|
||||||
while (!page.getRecords().isEmpty()) {
|
while (!page.getRecords().isEmpty()) {
|
||||||
saveCallTable(page.getRecords(), oldAndCurShopIdMap);
|
saveCallTable(page.getRecords());
|
||||||
page = oldCallTableService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
page = oldCallTableService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveCallConfig(List<OldCallConfig> oldCallConfigList, Map<Long, Long> oldAndCurShopIdMap) {
|
private void saveCallConfig(List<OldCallConfig> oldCallConfigList) {
|
||||||
List<CurCallConfig> curCallConfigList = new ArrayList<>();
|
List<CurCallConfig> curCallConfigList = new ArrayList<>();
|
||||||
|
|
||||||
for (OldCallConfig oldCallConfig : oldCallConfigList) {
|
for (OldCallConfig oldCallConfig : oldCallConfigList) {
|
||||||
CurCallConfig curCallConfig = BeanUtil.toBean(oldCallConfig, CurCallConfig.class);
|
CurCallConfig curCallConfig = BeanUtil.toBean(oldCallConfig, CurCallConfig.class);
|
||||||
curCallConfig.setShopId(oldAndCurShopIdMap.get(Long.valueOf(oldCallConfig.getShopId())));
|
curCallConfig.setShopId(Long.valueOf(oldCallConfig.getShopId()));
|
||||||
curCallConfigList.add(curCallConfig);
|
curCallConfigList.add(curCallConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveBatch(curCallConfigList);
|
saveBatch(curCallConfigList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveCallQueue(List<OldCallQueue> oldCallQueueList, Map<Long, Long> oldAndCurShopIdMap) {
|
private void saveCallQueue(List<OldCallQueue> oldCallQueueList) {
|
||||||
List<CurCallQueue> curCallQueueList = new ArrayList<>();
|
List<CurCallQueue> curCallQueueList = new ArrayList<>();
|
||||||
|
|
||||||
for (OldCallQueue oldCallQueue : oldCallQueueList) {
|
for (OldCallQueue oldCallQueue : oldCallQueueList) {
|
||||||
CurCallQueue curCallQueue = BeanUtil.toBean(oldCallQueue, CurCallQueue.class);
|
CurCallQueue curCallQueue = BeanUtil.toBean(oldCallQueue, CurCallQueue.class);
|
||||||
curCallQueue.setShopId(oldAndCurShopIdMap.get(Long.valueOf(oldCallQueue.getShopId())));
|
curCallQueue.setShopId(Long.valueOf(oldCallQueue.getShopId()));
|
||||||
curCallQueueList.add(curCallQueue);
|
curCallQueueList.add(curCallQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
curCallQueueMapper.insertBatch(curCallQueueList);
|
curCallQueueMapper.insertBatch(curCallQueueList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveCallTable(List<OldCallTable> oldCallTableList, Map<Long, Long> oldAndCurShopIdMap) {
|
private void saveCallTable(List<OldCallTable> oldCallTableList) {
|
||||||
List<CurCallTable> curCallTableList = new ArrayList<>();
|
List<CurCallTable> curCallTableList = new ArrayList<>();
|
||||||
|
|
||||||
for (OldCallTable oldCallTable : oldCallTableList) {
|
for (OldCallTable oldCallTable : oldCallTableList) {
|
||||||
CurCallTable curCallTable = BeanUtil.toBean(oldCallTable, CurCallTable.class);
|
CurCallTable curCallTable = BeanUtil.toBean(oldCallTable, CurCallTable.class);
|
||||||
curCallTable.setShopId(oldAndCurShopIdMap.get(Long.valueOf(oldCallTable.getShopId())));
|
curCallTable.setShopId(Long.valueOf(oldCallTable.getShopId()));
|
||||||
curCallTableList.add(curCallTable);
|
curCallTableList.add(curCallTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,13 @@
|
|||||||
#### 执行表
|
#### 执行表
|
||||||
- tb_shop_table_booking 表
|
- tb_shop_table_booking 表
|
||||||
|
|
||||||
|
### 9. 叫号功能
|
||||||
|
> /merge/call/mergeData
|
||||||
|
#### 执行表
|
||||||
|
- tb_call_config 表
|
||||||
|
- tb_call_queue 表
|
||||||
|
- tb_call_table 表
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user