|
|
|
@@ -4,12 +4,14 @@ 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.CurMemberPointsLog;
|
|
|
|
import com.czg.mergedata.cur.entity.CurMemberPointsLog;
|
|
|
|
|
|
|
|
import com.czg.mergedata.cur.entity.CurPointsBasicSetting;
|
|
|
|
import com.czg.mergedata.cur.entity.CurPointsExchangeRecord;
|
|
|
|
import com.czg.mergedata.cur.entity.CurPointsExchangeRecord;
|
|
|
|
import com.czg.mergedata.cur.entity.CurPointsGoodsSetting;
|
|
|
|
import com.czg.mergedata.cur.entity.CurPointsGoodsSetting;
|
|
|
|
import com.czg.mergedata.cur.mapper.CurMemberPointsLogMapper;
|
|
|
|
import com.czg.mergedata.cur.mapper.CurMemberPointsLogMapper;
|
|
|
|
|
|
|
|
import com.czg.mergedata.cur.mapper.CurPointsBasicSettingMapper;
|
|
|
|
import com.czg.mergedata.cur.mapper.CurPointsExchangeRecordMapper;
|
|
|
|
import com.czg.mergedata.cur.mapper.CurPointsExchangeRecordMapper;
|
|
|
|
import com.czg.mergedata.cur.mapper.CurPointsGoodsSettingMapper;
|
|
|
|
import com.czg.mergedata.cur.mapper.CurPointsGoodsSettingMapper;
|
|
|
|
import com.czg.mergedata.cur.service.CurShopIdRelationService;
|
|
|
|
import com.czg.mergedata.cur.service.CurPointsBasicSettingService;
|
|
|
|
import com.czg.mergedata.old.entity.OldMemberPointsLog;
|
|
|
|
import com.czg.mergedata.old.entity.OldMemberPointsLog;
|
|
|
|
import com.czg.mergedata.old.entity.OldPointsBasicSetting;
|
|
|
|
import com.czg.mergedata.old.entity.OldPointsBasicSetting;
|
|
|
|
import com.czg.mergedata.old.entity.OldPointsExchangeRecord;
|
|
|
|
import com.czg.mergedata.old.entity.OldPointsExchangeRecord;
|
|
|
|
@@ -20,16 +22,12 @@ import com.czg.mergedata.old.service.OldPointsExchangeRecordService;
|
|
|
|
import com.czg.mergedata.old.service.OldPointsGoodsSettingService;
|
|
|
|
import com.czg.mergedata.old.service.OldPointsGoodsSettingService;
|
|
|
|
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.CurPointsBasicSetting;
|
|
|
|
|
|
|
|
import com.czg.mergedata.cur.mapper.CurPointsBasicSettingMapper;
|
|
|
|
|
|
|
|
import com.czg.mergedata.cur.service.CurPointsBasicSettingService;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 积分基本设置 服务层实现。
|
|
|
|
* 积分基本设置 服务层实现。
|
|
|
|
@@ -40,9 +38,6 @@ import java.util.Map;
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class CurPointsBasicSettingServiceImpl extends ServiceImpl<CurPointsBasicSettingMapper, CurPointsBasicSetting> implements CurPointsBasicSettingService {
|
|
|
|
public class CurPointsBasicSettingServiceImpl extends ServiceImpl<CurPointsBasicSettingMapper, CurPointsBasicSetting> implements CurPointsBasicSettingService {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private CurShopIdRelationService curShopIdRelationService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CurPointsExchangeRecordMapper curPointsExchangeRecordMapper;
|
|
|
|
private CurPointsExchangeRecordMapper curPointsExchangeRecordMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -72,56 +67,54 @@ public class CurPointsBasicSettingServiceImpl extends ServiceImpl<CurPointsBasic
|
|
|
|
curPointsGoodsSettingMapper.truncateTable();
|
|
|
|
curPointsGoodsSettingMapper.truncateTable();
|
|
|
|
curMemberPointsLogMapper.truncateTable();
|
|
|
|
curMemberPointsLogMapper.truncateTable();
|
|
|
|
|
|
|
|
|
|
|
|
Map<Long, Long> oldAndCurShopIdMap = curShopIdRelationService.getOldShopIdRelation();
|
|
|
|
execPointsBasicSetting();
|
|
|
|
|
|
|
|
execPointsExchangeRecord();
|
|
|
|
execPointsBasicSetting(oldAndCurShopIdMap);
|
|
|
|
execPointsGoodsSetting();
|
|
|
|
execPointsExchangeRecord(oldAndCurShopIdMap);
|
|
|
|
execMemberPointsLog();
|
|
|
|
execPointsGoodsSetting(oldAndCurShopIdMap);
|
|
|
|
|
|
|
|
execMemberPointsLog(oldAndCurShopIdMap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return CzgResult.success("迁移成功");
|
|
|
|
return CzgResult.success("迁移成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void execPointsBasicSetting(Map<Long, Long> oldAndCurShopIdMap) {
|
|
|
|
private void execPointsBasicSetting() {
|
|
|
|
Page<OldPointsBasicSetting> page = oldPointsBasicSettingService.page(PageUtils.buildPage());
|
|
|
|
Page<OldPointsBasicSetting> page = oldPointsBasicSettingService.page(PageUtils.buildPage());
|
|
|
|
|
|
|
|
|
|
|
|
while (!page.getRecords().isEmpty()) {
|
|
|
|
while (!page.getRecords().isEmpty()) {
|
|
|
|
savePointsBasicSetting(page.getRecords(), oldAndCurShopIdMap);
|
|
|
|
savePointsBasicSetting(page.getRecords());
|
|
|
|
|
|
|
|
|
|
|
|
page = oldPointsBasicSettingService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
|
|
|
page = oldPointsBasicSettingService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void execPointsExchangeRecord(Map<Long, Long> oldAndCurShopIdMap) {
|
|
|
|
private void execPointsExchangeRecord() {
|
|
|
|
Page<OldPointsExchangeRecord> page = oldPointsExchangeRecordService.page(PageUtils.buildPage());
|
|
|
|
Page<OldPointsExchangeRecord> page = oldPointsExchangeRecordService.page(PageUtils.buildPage());
|
|
|
|
while (!page.getRecords().isEmpty()) {
|
|
|
|
while (!page.getRecords().isEmpty()) {
|
|
|
|
savePointsExchangeRecord(page.getRecords(), oldAndCurShopIdMap);
|
|
|
|
savePointsExchangeRecord(page.getRecords());
|
|
|
|
page = oldPointsExchangeRecordService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
|
|
|
page = oldPointsExchangeRecordService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void execPointsGoodsSetting(Map<Long, Long> oldAndCurShopIdMap) {
|
|
|
|
private void execPointsGoodsSetting() {
|
|
|
|
Page<OldPointsGoodsSetting> page = oldPointsGoodsSettingService.page(PageUtils.buildPage());
|
|
|
|
Page<OldPointsGoodsSetting> page = oldPointsGoodsSettingService.page(PageUtils.buildPage());
|
|
|
|
while (!page.getRecords().isEmpty()) {
|
|
|
|
while (!page.getRecords().isEmpty()) {
|
|
|
|
savePointsGoodsSetting(page.getRecords(), oldAndCurShopIdMap);
|
|
|
|
savePointsGoodsSetting(page.getRecords());
|
|
|
|
page = oldPointsGoodsSettingService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
|
|
|
page = oldPointsGoodsSettingService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void execMemberPointsLog(Map<Long, Long> oldAndCurShopIdMap) {
|
|
|
|
private void execMemberPointsLog() {
|
|
|
|
Page<OldMemberPointsLog> page = oldMemberPointsLogService.page(PageUtils.buildPage());
|
|
|
|
Page<OldMemberPointsLog> page = oldMemberPointsLogService.page(PageUtils.buildPage());
|
|
|
|
while (!page.getRecords().isEmpty()) {
|
|
|
|
while (!page.getRecords().isEmpty()) {
|
|
|
|
saveMemberPointsLog(page.getRecords(), oldAndCurShopIdMap);
|
|
|
|
saveMemberPointsLog(page.getRecords());
|
|
|
|
page = oldMemberPointsLogService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
|
|
|
page = oldMemberPointsLogService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void savePointsBasicSetting(List<OldPointsBasicSetting> oldPointsBasicSettingList, Map<Long, Long> oldAndCurShopIdMap) {
|
|
|
|
private void savePointsBasicSetting(List<OldPointsBasicSetting> oldPointsBasicSettingList) {
|
|
|
|
List<CurPointsBasicSetting> curPointsBasicSettingList = new ArrayList<>();
|
|
|
|
List<CurPointsBasicSetting> curPointsBasicSettingList = new ArrayList<>();
|
|
|
|
for (OldPointsBasicSetting oldPointsBasicSetting : oldPointsBasicSettingList) {
|
|
|
|
for (OldPointsBasicSetting oldPointsBasicSetting : oldPointsBasicSettingList) {
|
|
|
|
CurPointsBasicSetting curPointsBasicSetting = BeanUtil.toBean(oldPointsBasicSetting, CurPointsBasicSetting.class);
|
|
|
|
CurPointsBasicSetting curPointsBasicSetting = BeanUtil.toBean(oldPointsBasicSetting, CurPointsBasicSetting.class);
|
|
|
|
|
|
|
|
|
|
|
|
curPointsBasicSetting.setShopId(oldAndCurShopIdMap.get(oldPointsBasicSetting.getShopId()));
|
|
|
|
curPointsBasicSetting.setShopId(oldPointsBasicSetting.getShopId());
|
|
|
|
|
|
|
|
|
|
|
|
curPointsBasicSettingList.add(curPointsBasicSetting);
|
|
|
|
curPointsBasicSettingList.add(curPointsBasicSetting);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -129,36 +122,37 @@ public class CurPointsBasicSettingServiceImpl extends ServiceImpl<CurPointsBasic
|
|
|
|
saveBatch(curPointsBasicSettingList);
|
|
|
|
saveBatch(curPointsBasicSettingList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void savePointsExchangeRecord(List<OldPointsExchangeRecord> oldPointsExchangeRecordList, Map<Long, Long> oldAndCurShopIdMap) {
|
|
|
|
private void savePointsExchangeRecord(List<OldPointsExchangeRecord> oldPointsExchangeRecordList) {
|
|
|
|
List<CurPointsExchangeRecord> curPointsExchangeRecordList = new ArrayList<>();
|
|
|
|
List<CurPointsExchangeRecord> curPointsExchangeRecordList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
for (OldPointsExchangeRecord oldPointsExchangeRecord : oldPointsExchangeRecordList) {
|
|
|
|
for (OldPointsExchangeRecord oldPointsExchangeRecord : oldPointsExchangeRecordList) {
|
|
|
|
CurPointsExchangeRecord curPointsExchangeRecord = BeanUtil.toBean(oldPointsExchangeRecord, CurPointsExchangeRecord.class);
|
|
|
|
CurPointsExchangeRecord curPointsExchangeRecord = BeanUtil.toBean(oldPointsExchangeRecord, CurPointsExchangeRecord.class);
|
|
|
|
curPointsExchangeRecord.setShopId(oldAndCurShopIdMap.get(oldPointsExchangeRecord.getShopId()));
|
|
|
|
curPointsExchangeRecord.setUserId(oldPointsExchangeRecord.getMemberId());
|
|
|
|
|
|
|
|
curPointsExchangeRecord.setNickName(oldPointsExchangeRecord.getMemberName());
|
|
|
|
curPointsExchangeRecordList.add(curPointsExchangeRecord);
|
|
|
|
curPointsExchangeRecordList.add(curPointsExchangeRecord);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
curPointsExchangeRecordMapper.insertBatch(curPointsExchangeRecordList);
|
|
|
|
curPointsExchangeRecordMapper.insertBatch(curPointsExchangeRecordList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void savePointsGoodsSetting(List<OldPointsGoodsSetting> oldPointsGoodsSettingList, Map<Long, Long> oldAndCurShopIdMap) {
|
|
|
|
private void savePointsGoodsSetting(List<OldPointsGoodsSetting> oldPointsGoodsSettingList) {
|
|
|
|
List<CurPointsGoodsSetting> curPointsGoodsSettingList = new ArrayList<>();
|
|
|
|
List<CurPointsGoodsSetting> curPointsGoodsSettingList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
for (OldPointsGoodsSetting oldPointsGoodsSetting : oldPointsGoodsSettingList) {
|
|
|
|
for (OldPointsGoodsSetting oldPointsGoodsSetting : oldPointsGoodsSettingList) {
|
|
|
|
CurPointsGoodsSetting curPointsGoodsSetting = BeanUtil.toBean(oldPointsGoodsSetting, CurPointsGoodsSetting.class);
|
|
|
|
CurPointsGoodsSetting curPointsGoodsSetting = BeanUtil.toBean(oldPointsGoodsSetting, CurPointsGoodsSetting.class);
|
|
|
|
curPointsGoodsSetting.setShopId(oldAndCurShopIdMap.get(oldPointsGoodsSetting.getShopId()));
|
|
|
|
curPointsGoodsSetting.setShopId(oldPointsGoodsSetting.getShopId());
|
|
|
|
curPointsGoodsSettingList.add(curPointsGoodsSetting);
|
|
|
|
curPointsGoodsSettingList.add(curPointsGoodsSetting);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
curPointsGoodsSettingMapper.insertBatch(curPointsGoodsSettingList);
|
|
|
|
curPointsGoodsSettingMapper.insertBatch(curPointsGoodsSettingList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void saveMemberPointsLog(List<OldMemberPointsLog> oldMemberPointsLogList, Map<Long, Long> oldAndCurShopIdMap) {
|
|
|
|
private void saveMemberPointsLog(List<OldMemberPointsLog> oldMemberPointsLogList) {
|
|
|
|
List<CurMemberPointsLog> curMemberPointsLogs = new ArrayList<>();
|
|
|
|
List<CurMemberPointsLog> curMemberPointsLogs = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
for (OldMemberPointsLog oldMemberPointsLog : oldMemberPointsLogList) {
|
|
|
|
for (OldMemberPointsLog oldMemberPointsLog : oldMemberPointsLogList) {
|
|
|
|
CurMemberPointsLog memberPointsLog = BeanUtil.toBean(oldMemberPointsLog, CurMemberPointsLog.class);
|
|
|
|
CurMemberPointsLog memberPointsLog = BeanUtil.toBean(oldMemberPointsLog, CurMemberPointsLog.class);
|
|
|
|
memberPointsLog.setShopId(oldAndCurShopIdMap.get(oldMemberPointsLog.getShopId()));
|
|
|
|
memberPointsLog.setUserId(oldMemberPointsLog.getMemberId());
|
|
|
|
curMemberPointsLogs.add(memberPointsLog);
|
|
|
|
curMemberPointsLogs.add(memberPointsLog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|