迁移shop user
This commit is contained in:
@@ -81,7 +81,7 @@ public class CodeGen {
|
|||||||
//设置表前缀和只生成哪些表,setGenerateTable 未配置时,生成所有表
|
//设置表前缀和只生成哪些表,setGenerateTable 未配置时,生成所有表
|
||||||
globalConfig.getStrategyConfig()
|
globalConfig.getStrategyConfig()
|
||||||
.setTablePrefix("tb_")
|
.setTablePrefix("tb_")
|
||||||
.setGenerateTable("tb_shop_id_relation");
|
.setGenerateTable("tb_user_info");
|
||||||
|
|
||||||
EntityConfig entityConfig = globalConfig.getEntityConfig();
|
EntityConfig entityConfig = globalConfig.getEntityConfig();
|
||||||
if (isOldVersion) {
|
if (isOldVersion) {
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.czg.mergedata.controller;
|
||||||
|
|
||||||
|
import com.czg.mergedata.common.resp.CzgResult;
|
||||||
|
import com.czg.mergedata.cur.service.CurShopUserService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author GYJoker
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("shopUser")
|
||||||
|
public class ShopUserController {
|
||||||
|
@Resource
|
||||||
|
private CurShopUserService curShopUserService;
|
||||||
|
|
||||||
|
@RequestMapping("mergeShopUser")
|
||||||
|
public CzgResult<String> mergeShopUser() {
|
||||||
|
return curShopUserService.mergeShopUser();
|
||||||
|
}
|
||||||
|
}
|
||||||
136
src/main/java/com/czg/mergedata/cur/entity/CurShopUser.java
Normal file
136
src/main/java/com/czg/mergedata/cur/entity/CurShopUser.java
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
package com.czg.mergedata.cur.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户储值会员 实体类。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_shop_user")
|
||||||
|
public class CurShopUser implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (随机)
|
||||||
|
*/
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户Id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账户积分
|
||||||
|
*/
|
||||||
|
private Integer accountPoints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钱包余额
|
||||||
|
*/
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消费累计
|
||||||
|
*/
|
||||||
|
private BigDecimal consumeAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消费次数累计
|
||||||
|
*/
|
||||||
|
private Integer consumeCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0-不可使用 1可使用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否会员,
|
||||||
|
*/
|
||||||
|
private Integer isVip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员编号
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员码
|
||||||
|
*/
|
||||||
|
private String dynamicCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最近一次积分变动时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime lastPointsChangeTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最近一次浮动积分
|
||||||
|
*/
|
||||||
|
private Integer lastFloatPoints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成为会员的时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime joinTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String headImg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生日
|
||||||
|
*/
|
||||||
|
private String birthDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1男 0女
|
||||||
|
*/
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
100
src/main/java/com/czg/mergedata/cur/entity/CurUserInfo.java
Normal file
100
src/main/java/com/czg/mergedata/cur/entity/CurUserInfo.java
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
package com.czg.mergedata.cur.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户端 用户信息表 实体类。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_user_info")
|
||||||
|
public class CurUserInfo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户头像
|
||||||
|
*/
|
||||||
|
private String headImg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电话号码
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员生日
|
||||||
|
*/
|
||||||
|
private String birthDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0-女 1男
|
||||||
|
*/
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信 openid
|
||||||
|
*/
|
||||||
|
private String wechatOpenId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝 openid
|
||||||
|
*/
|
||||||
|
private String alipayOpenId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1正常
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最近登录时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime lastLoginTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付密码
|
||||||
|
*/
|
||||||
|
private String payPwd;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.czg.mergedata.cur.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.UseDataSource;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.mergedata.cur.entity.CurShopUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户储值会员 映射层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@UseDataSource("ds1")
|
||||||
|
public interface CurShopUserMapper extends BaseMapper<CurShopUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.czg.mergedata.cur.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.UseDataSource;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.mergedata.cur.entity.CurUserInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户端 用户信息表 映射层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@UseDataSource("ds1")
|
||||||
|
public interface CurUserInfoMapper extends BaseMapper<CurUserInfo> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ import com.mybatisflex.annotation.UseDataSource;
|
|||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
import com.czg.mergedata.cur.entity.CurShopIdRelation;
|
import com.czg.mergedata.cur.entity.CurShopIdRelation;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务层。
|
* 服务层。
|
||||||
*
|
*
|
||||||
@@ -13,4 +15,6 @@ import com.czg.mergedata.cur.entity.CurShopIdRelation;
|
|||||||
@UseDataSource("ds1")
|
@UseDataSource("ds1")
|
||||||
public interface CurShopIdRelationService extends IService<CurShopIdRelation> {
|
public interface CurShopIdRelationService extends IService<CurShopIdRelation> {
|
||||||
|
|
||||||
|
Map<Long, Long> getOldShopIdRelation();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.czg.mergedata.cur.service;
|
||||||
|
|
||||||
|
import com.czg.mergedata.common.resp.CzgResult;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.mergedata.cur.entity.CurShopUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户储值会员 服务层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface CurShopUserService extends IService<CurShopUser> {
|
||||||
|
|
||||||
|
CzgResult<String> mergeShopUser();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.mergedata.cur.service;
|
||||||
|
|
||||||
|
import com.czg.mergedata.cur.entity.CurUserInfo;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户端 用户信息表 服务层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface CurUserInfoService extends IService<CurUserInfo> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,10 @@ import com.czg.mergedata.cur.service.CurShopIdRelationService;
|
|||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务层实现。
|
* 服务层实现。
|
||||||
*
|
*
|
||||||
@@ -15,4 +19,13 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class CurShopIdRelationServiceImpl extends ServiceImpl<CurShopIdRelationMapper, CurShopIdRelation> implements CurShopIdRelationService{
|
public class CurShopIdRelationServiceImpl extends ServiceImpl<CurShopIdRelationMapper, CurShopIdRelation> implements CurShopIdRelationService{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, Long> getOldShopIdRelation() {
|
||||||
|
List<CurShopIdRelation> list = list();
|
||||||
|
Map<Long, Long> map = new HashMap<>();
|
||||||
|
for (CurShopIdRelation curShopIdRelation : list) {
|
||||||
|
map.put(curShopIdRelation.getOldShopId(), curShopIdRelation.getCurShopId());
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
package com.czg.mergedata.cur.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.czg.mergedata.common.resp.CzgResult;
|
||||||
|
import com.czg.mergedata.common.utils.PageUtils;
|
||||||
|
import com.czg.mergedata.cur.entity.CurShopUser;
|
||||||
|
import com.czg.mergedata.cur.entity.CurUserInfo;
|
||||||
|
import com.czg.mergedata.cur.mapper.CurShopUserMapper;
|
||||||
|
import com.czg.mergedata.cur.service.CurShopIdRelationService;
|
||||||
|
import com.czg.mergedata.cur.service.CurShopUserService;
|
||||||
|
import com.czg.mergedata.cur.service.CurUserInfoService;
|
||||||
|
import com.czg.mergedata.old.entity.OldShopUser;
|
||||||
|
import com.czg.mergedata.old.entity.OldUserInfo;
|
||||||
|
import com.czg.mergedata.old.service.OldShopUserService;
|
||||||
|
import com.czg.mergedata.old.service.OldUserInfoService;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户储值会员 服务层实现。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CurShopUserServiceImpl extends ServiceImpl<CurShopUserMapper, CurShopUser> implements CurShopUserService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CurShopIdRelationService curShopIdRelationService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OldUserInfoService oldUserInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CurUserInfoService curUserInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OldShopUserService oldShopUserService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public CzgResult<String> mergeShopUser() {
|
||||||
|
Map<Long, Long> oldAndCurShopIdMap = curShopIdRelationService.getOldShopIdRelation();
|
||||||
|
|
||||||
|
execUserInfo();
|
||||||
|
execShopUser(oldAndCurShopIdMap);
|
||||||
|
|
||||||
|
return CzgResult.success("处理成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void execUserInfo() {
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
|
queryWrapper.ne(OldUserInfo::getId, 1);
|
||||||
|
|
||||||
|
Page<OldUserInfo> page = oldUserInfoService.page(PageUtils.buildPage(), queryWrapper);
|
||||||
|
|
||||||
|
while (page.hasNext() || page.getPageNumber() == 1) {
|
||||||
|
saveCurUserInfo(page.getRecords());
|
||||||
|
|
||||||
|
page = oldUserInfoService.page(PageUtils.buildPage(page.getPageNumber() + 1), queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void execShopUser(Map<Long, Long> oldAndCurShopIdMap) {
|
||||||
|
Page<OldShopUser> page = oldShopUserService.page(PageUtils.buildPage());
|
||||||
|
|
||||||
|
while (page.hasNext() || page.getPageNumber() == 1) {
|
||||||
|
saveCurShopUser(page.getRecords(), oldAndCurShopIdMap);
|
||||||
|
|
||||||
|
page = oldShopUserService.page(PageUtils.buildPage(page.getPageNumber() + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveCurUserInfo(List<OldUserInfo> oldUserInfoList) {
|
||||||
|
// List<CurUserInfo> curShopUserList = new ArrayList<>();
|
||||||
|
// oldUserInfoList.forEach();
|
||||||
|
List<CurUserInfo> curShopUserList =oldUserInfoList.stream().map(oldUserInfo -> {
|
||||||
|
CurUserInfo curUserInfo = new CurUserInfo();
|
||||||
|
curUserInfo.setId(Long.valueOf(oldUserInfo.getId()));
|
||||||
|
curUserInfo.setHeadImg(oldUserInfo.getHeadImg());
|
||||||
|
curUserInfo.setNickName(oldUserInfo.getNickName());
|
||||||
|
curUserInfo.setPhone(oldUserInfo.getTelephone());
|
||||||
|
curUserInfo.setBirthDay(oldUserInfo.getBirthDay());
|
||||||
|
curUserInfo.setSex(oldUserInfo.getSex());
|
||||||
|
if ("ALIPAY-APP".equals(oldUserInfo.getSourcePath())) {
|
||||||
|
curUserInfo.setAlipayOpenId(oldUserInfo.getMiniAppOpenId());
|
||||||
|
} else {
|
||||||
|
curUserInfo.setWechatOpenId(oldUserInfo.getMiniAppOpenId());
|
||||||
|
}
|
||||||
|
curUserInfo.setStatus(oldUserInfo.getStatus());
|
||||||
|
curUserInfo.setLastLoginTime(DateUtil.toLocalDateTime(oldUserInfo.getLastLeaveAt() == null ? new Date() : new Date(oldUserInfo.getLastLeaveAt())));
|
||||||
|
curUserInfo.setPayPwd(oldUserInfo.getPwd());
|
||||||
|
curUserInfo.setCreateTime(DateUtil.toLocalDateTime(oldUserInfo.getCreatedAt() == null? new Date() : new Date(oldUserInfo.getCreatedAt())));
|
||||||
|
|
||||||
|
return curUserInfo;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
curUserInfoService.saveBatch(curShopUserList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveCurShopUser(List<OldShopUser> oldShopUserList, Map<Long, Long> oldAndCurShopIdMap) {
|
||||||
|
List<CurShopUser> curShopUserList = oldShopUserList.stream().map(oldShopUser -> {
|
||||||
|
CurShopUser curShopUser = new CurShopUser();
|
||||||
|
Long shopId = oldAndCurShopIdMap.get(Long.valueOf(oldShopUser.getId()));
|
||||||
|
curShopUser.setShopId(shopId == null ? 1L : shopId);
|
||||||
|
curShopUser.setUserId(Long.valueOf(oldShopUser.getId()));
|
||||||
|
curShopUser.setAccountPoints(oldShopUser.getAccountPoints());
|
||||||
|
curShopUser.setAmount(oldShopUser.getAmount());
|
||||||
|
curShopUser.setConsumeAmount(oldShopUser.getConsumeAmount());
|
||||||
|
curShopUser.setConsumeCount(oldShopUser.getConsumeNumber());
|
||||||
|
curShopUser.setStatus(oldShopUser.getStatus());
|
||||||
|
curShopUser.setIsVip(oldShopUser.getIsVip());
|
||||||
|
curShopUser.setCode(oldShopUser.getCode());
|
||||||
|
curShopUser.setLastPointsChangeTime(oldShopUser.getLastPointsChangeTime());
|
||||||
|
curShopUser.setLastFloatPoints(oldShopUser.getLastFloatPoints());
|
||||||
|
curShopUser.setJoinTime(oldShopUser.getJoinTime());
|
||||||
|
curShopUser.setHeadImg(oldShopUser.getHeadImg());
|
||||||
|
curShopUser.setNickName(oldShopUser.getName());
|
||||||
|
curShopUser.setPhone(oldShopUser.getTelephone());
|
||||||
|
curShopUser.setBirthDay(oldShopUser.getBirthDay());
|
||||||
|
curShopUser.setSex(curShopUser.getSex());
|
||||||
|
curShopUser.setCreateTime(DateUtil.toLocalDateTime(oldShopUser.getCreatedAt() == null ? new Date() : new Date(oldShopUser.getCreatedAt())));
|
||||||
|
|
||||||
|
return curShopUser;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
saveBatch(curShopUserList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.czg.mergedata.cur.service.impl;
|
||||||
|
|
||||||
|
import com.czg.mergedata.cur.entity.CurUserInfo;
|
||||||
|
import com.czg.mergedata.cur.mapper.CurUserInfoMapper;
|
||||||
|
import com.czg.mergedata.cur.service.CurUserInfoService;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户端 用户信息表 服务层实现。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CurUserInfoServiceImpl extends ServiceImpl<CurUserInfoMapper, CurUserInfo> implements CurUserInfoService{
|
||||||
|
}
|
||||||
190
src/main/java/com/czg/mergedata/old/entity/OldShopUser.java
Normal file
190
src/main/java/com/czg/mergedata/old/entity/OldShopUser.java
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
package com.czg.mergedata.old.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户储值会员 实体类。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_shop_user")
|
||||||
|
public class OldShopUser implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (随机)
|
||||||
|
*/
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钱包余额
|
||||||
|
*/
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权金额
|
||||||
|
*/
|
||||||
|
private BigDecimal creditAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消费累计
|
||||||
|
*/
|
||||||
|
private BigDecimal consumeAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消费数量累计
|
||||||
|
*/
|
||||||
|
private Integer consumeNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 等级积分
|
||||||
|
*/
|
||||||
|
private BigDecimal levelConsume;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0-不可使用 1可使用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理Id
|
||||||
|
*/
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户Id
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级Id
|
||||||
|
*/
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级的层级
|
||||||
|
*/
|
||||||
|
private String parentLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 真实名字
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String headImg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生日
|
||||||
|
*/
|
||||||
|
private String birthDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
private String telephone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否会员,
|
||||||
|
*/
|
||||||
|
private Integer isVip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员编号
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否通过关注而成为会员的,此字段固定后不改
|
||||||
|
*/
|
||||||
|
private Integer isAttention;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注时间
|
||||||
|
*/
|
||||||
|
private Integer attentionAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否股东(分销商)
|
||||||
|
*/
|
||||||
|
private Integer isShareholder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级1-顶级 2-次级 3最低
|
||||||
|
*/
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销类型 auto-自动获取 set手动设置 charge充值
|
||||||
|
*/
|
||||||
|
private String distributeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private Long createdAt;
|
||||||
|
|
||||||
|
private Long updatedAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序openId
|
||||||
|
*/
|
||||||
|
private String miniOpenId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员码
|
||||||
|
*/
|
||||||
|
private String dynamicCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成为会员的时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime joinTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账户积分
|
||||||
|
*/
|
||||||
|
private Integer accountPoints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最近一次积分变动时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime lastPointsChangeTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最近一次浮动积分
|
||||||
|
*/
|
||||||
|
private Integer lastFloatPoints;
|
||||||
|
|
||||||
|
}
|
||||||
245
src/main/java/com/czg/mergedata/old/entity/OldUserInfo.java
Normal file
245
src/main/java/com/czg/mergedata/old/entity/OldUserInfo.java
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
package com.czg.mergedata.old.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_user_info")
|
||||||
|
public class OldUserInfo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钱包余额
|
||||||
|
*/
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计充值
|
||||||
|
*/
|
||||||
|
private BigDecimal chargeAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授信额度
|
||||||
|
*/
|
||||||
|
private BigDecimal lineOfCredit;
|
||||||
|
|
||||||
|
private BigDecimal consumeAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消费次数累计
|
||||||
|
*/
|
||||||
|
private Integer consumeNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总积分
|
||||||
|
*/
|
||||||
|
private Integer totalScore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 锁定积分
|
||||||
|
*/
|
||||||
|
private Integer lockScore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员卡号
|
||||||
|
*/
|
||||||
|
private String cardNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员密码
|
||||||
|
*/
|
||||||
|
private String cardPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 等级
|
||||||
|
*/
|
||||||
|
private String levelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户头像
|
||||||
|
*/
|
||||||
|
private String headImg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电话号码
|
||||||
|
*/
|
||||||
|
private String telephone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序Id
|
||||||
|
*/
|
||||||
|
private String wxMaAppId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员生日
|
||||||
|
*/
|
||||||
|
private String birthDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0-女 1男
|
||||||
|
*/
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序的openId
|
||||||
|
*/
|
||||||
|
private String miniAppOpenId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公众号openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联合Id
|
||||||
|
*/
|
||||||
|
private String unionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户类型-保留字段
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 'DOCTOR'-->医生,'USER'->用户
|
||||||
|
*/
|
||||||
|
private Integer identify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1正常
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 引荐人
|
||||||
|
*/
|
||||||
|
private String parentId;
|
||||||
|
|
||||||
|
private String parentLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上家类开型,店铺-SHOP/ 个人- PERSON
|
||||||
|
*/
|
||||||
|
private String parentType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注进入的活动Id
|
||||||
|
*/
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户Id
|
||||||
|
*/
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0未认证,1认证
|
||||||
|
*/
|
||||||
|
private Integer isResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否在线
|
||||||
|
*/
|
||||||
|
private Integer isOnline;
|
||||||
|
|
||||||
|
private Integer isVip;
|
||||||
|
|
||||||
|
private Integer vipEffectAt;
|
||||||
|
|
||||||
|
private String tips;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户来源:公众号 WECHAT 小程序 WECHAT-APP 手机注册 TELEPHONE 移动端 APP
|
||||||
|
*/
|
||||||
|
private String sourcePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否推广员 1 是 0不是
|
||||||
|
*/
|
||||||
|
private Integer isSalesPerson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否关注公众号
|
||||||
|
*/
|
||||||
|
private Integer isAttentionMp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 城市
|
||||||
|
*/
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
private String searchWord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最近登陆时间
|
||||||
|
*/
|
||||||
|
private Long lastLogInAt;
|
||||||
|
|
||||||
|
private Long lastLeaveAt;
|
||||||
|
|
||||||
|
private Long createdAt;
|
||||||
|
|
||||||
|
private Long updatedAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定时间
|
||||||
|
*/
|
||||||
|
private Long bindParentAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上上家
|
||||||
|
*/
|
||||||
|
private String grandParentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联 用户id 微信端和app端关联
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private String isPwd;
|
||||||
|
|
||||||
|
private String pwd;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.czg.mergedata.old.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.UseDataSource;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.mergedata.old.entity.OldShopUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户储值会员 映射层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@UseDataSource("ds2")
|
||||||
|
public interface OldShopUserMapper extends BaseMapper<OldShopUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.czg.mergedata.old.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.UseDataSource;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.mergedata.old.entity.OldUserInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 映射层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@UseDataSource("ds2")
|
||||||
|
public interface OldUserInfoMapper extends BaseMapper<OldUserInfo> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.mergedata.old.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.mergedata.old.entity.OldShopUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户储值会员 服务层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface OldShopUserService extends IService<OldShopUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.mergedata.old.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.mergedata.old.entity.OldUserInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface OldUserInfoService extends IService<OldUserInfo> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.czg.mergedata.old.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.mergedata.old.entity.OldShopUser;
|
||||||
|
import com.czg.mergedata.old.mapper.OldShopUserMapper;
|
||||||
|
import com.czg.mergedata.old.service.OldShopUserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户储值会员 服务层实现。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OldShopUserServiceImpl extends ServiceImpl<OldShopUserMapper, OldShopUser> implements OldShopUserService{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.czg.mergedata.old.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.mergedata.old.entity.OldUserInfo;
|
||||||
|
import com.czg.mergedata.old.mapper.OldUserInfoMapper;
|
||||||
|
import com.czg.mergedata.old.service.OldUserInfoService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务层实现。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OldUserInfoServiceImpl extends ServiceImpl<OldUserInfoMapper, OldUserInfo> implements OldUserInfoService{
|
||||||
|
|
||||||
|
}
|
||||||
7
src/main/resources/mapper/cur/ShopUserMapper.xml
Normal file
7
src/main/resources/mapper/cur/ShopUserMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.mergedata.cur.mapper.CurShopUserMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
7
src/main/resources/mapper/cur/UserInfoMapper.xml
Normal file
7
src/main/resources/mapper/cur/UserInfoMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.mergedata.cur.mapper.CurUserInfoMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
7
src/main/resources/mapper/old/ShopUserMapper.xml
Normal file
7
src/main/resources/mapper/old/ShopUserMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.mergedata.old.mapper.OldShopUserMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
7
src/main/resources/mapper/old/UserInfoMapper.xml
Normal file
7
src/main/resources/mapper/old/UserInfoMapper.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.mergedata.old.mapper.OldUserInfoMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user