更新9.24
This commit is contained in:
parent
ae6c9ef867
commit
e55c689e79
@ -114,6 +114,11 @@ public class FleetInfo extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车队负责人id
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单次充值金额
|
* 单次充值金额
|
||||||
*/
|
*/
|
||||||
|
@ -126,5 +126,10 @@ public class FleetMember extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.fuint.business.fleet.service.impl;
|
package com.fuint.business.fleet.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@ -17,15 +18,26 @@ import com.fuint.business.fleet.vo.FleetInfoVo;
|
|||||||
import com.fuint.business.member.entity.LJStaff;
|
import com.fuint.business.member.entity.LJStaff;
|
||||||
import com.fuint.business.member.service.ILJStaffService;
|
import com.fuint.business.member.service.ILJStaffService;
|
||||||
import com.fuint.business.store.mapper.MtStoreMapper;
|
import com.fuint.business.store.mapper.MtStoreMapper;
|
||||||
|
import com.fuint.business.storeInformation.entity.LJStore;
|
||||||
|
import com.fuint.business.storeInformation.service.ILJStoreService;
|
||||||
|
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||||
|
import com.fuint.business.userManager.entity.MtInvitation;
|
||||||
|
import com.fuint.business.userManager.entity.UserBalance;
|
||||||
|
import com.fuint.business.userManager.mapper.MtInvitationMapper;
|
||||||
|
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||||
|
import com.fuint.business.userManager.service.UserBalanceService;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
|
import com.fuint.common.service.MemberService;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
import com.fuint.repository.mapper.MtUserMapper;
|
import com.fuint.repository.mapper.MtUserMapper;
|
||||||
import com.fuint.repository.model.MtUser;
|
import com.fuint.repository.model.MtUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,6 +61,19 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper,FleetInfo>
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MtStoreMapper mtStoreMapper;
|
private MtStoreMapper mtStoreMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MtInvitationMapper mtInvitationMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
LJUserGradeService ljUserGradeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserBalanceService userBalanceService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ILJStoreService iljStoreService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<FleetInfoVo> queryPage(Page page, FleetInfoVo fleetInfo) {
|
public IPage<FleetInfoVo> queryPage(Page page, FleetInfoVo fleetInfo) {
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
@ -98,14 +123,51 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper,FleetInfo>
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insert(FleetInfo fleetInfo) {
|
public int insert(FleetInfo fleetInfo) {
|
||||||
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
FleetInfo fleetInfo1 = selectByName(fleetInfo.getFleetName());
|
FleetInfo fleetInfo1 = selectByName(fleetInfo.getFleetName());
|
||||||
if (ObjectUtil.isNotEmpty(fleetInfo1)){
|
if (ObjectUtil.isNotEmpty(fleetInfo1)){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
//判断当前车队负责人是否存在账号
|
||||||
|
MtUser mtUser = mtUserMapper.selectOne(new LambdaQueryWrapper<MtUser>()
|
||||||
|
.eq(MtUser::getMobile, fleetInfo.getMobile())
|
||||||
|
.last("limit 1"));
|
||||||
|
if (ObjectUtil.isEmpty(mtUser)) {
|
||||||
|
mtUser = new MtUser();
|
||||||
|
mtUser.setUserNo(editUserNo());
|
||||||
|
mtUser.setMobile(fleetInfo.getMobile());
|
||||||
|
mtUser.setName(fleetInfo.getFleetLeader());
|
||||||
|
mtUser.setDescription("车队信息自动注册");
|
||||||
|
mtUser.setCreateTime(DateUtil.date());
|
||||||
|
mtUserMapper.insert(mtUser);
|
||||||
|
|
||||||
|
|
||||||
|
//注册完成后再查询一次
|
||||||
|
mtUser = mtUserMapper.selectOne(new LambdaQueryWrapper<MtUser>()
|
||||||
|
.eq(MtUser::getMobile, fleetInfo.getMobile())
|
||||||
|
.last("limit 1"));
|
||||||
|
createVaseInfo(mtUser, nowAccountInfo.getStoreId().toString(), fleetInfo.getStaffId(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fleetInfo.setUserId(mtUser.getId());
|
||||||
|
|
||||||
fleetInfo.setStoreId(nowAccountInfo.getStoreId());
|
fleetInfo.setStoreId(nowAccountInfo.getStoreId());
|
||||||
fleetInfo.setChainStoreId(nowAccountInfo.getChainStoreId());
|
fleetInfo.setChainStoreId(nowAccountInfo.getChainStoreId());
|
||||||
return baseMapper.insert(fleetInfo);
|
int insert = baseMapper.insert(fleetInfo);
|
||||||
|
if (insert > 0) {
|
||||||
|
// fleet_member表新增一条记录
|
||||||
|
FleetInfo fleetInfo2 = baseMapper.selectOne(new LambdaQueryWrapper<FleetInfo>()
|
||||||
|
.eq(FleetInfo::getUserId, mtUser.getId()));
|
||||||
|
FleetMember fleetMember = new FleetMember();
|
||||||
|
BeanUtil.copyProperties(fleetInfo, fleetMember);
|
||||||
|
fleetMember.setFleetId(fleetInfo2.getId());
|
||||||
|
fleetMember.setUserId(mtUser.getId());
|
||||||
|
fleetMember.setMobile(fleetInfo.getMobile());
|
||||||
|
fleetMember.setName(fleetInfo.getFleetLeader());
|
||||||
|
return fleetMemberMapper.insert(fleetMember);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,4 +232,86 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper,FleetInfo>
|
|||||||
fleetInfoUniVo.setStoreName(mtStoreMapper.selectById(storeId).getName());
|
fleetInfoUniVo.setStoreName(mtStoreMapper.selectById(storeId).getName());
|
||||||
return fleetInfoUniVo;
|
return fleetInfoUniVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户的基础信息
|
||||||
|
*/
|
||||||
|
private void createVaseInfo (MtUser mtUser, String storeId,String staffId, String inviterId) {
|
||||||
|
LJStore store = iljStoreService.selectStoreByStoreId(Integer.parseInt(storeId));
|
||||||
|
|
||||||
|
// 根据userid和连锁店id查询是否存在对应的余额信息
|
||||||
|
UserBalance userBalance = userBalanceService.selectUserBalance(mtUser.getId(), store.getChainStoreId());
|
||||||
|
if (ObjectUtil.isEmpty(userBalance)) {
|
||||||
|
// 新增余额信息
|
||||||
|
UserBalance userBalanceAdd = new UserBalance();
|
||||||
|
userBalanceAdd.setMtUserId(mtUser.getId());
|
||||||
|
userBalanceAdd.setStoreId(Integer.parseInt(storeId));
|
||||||
|
userBalanceAdd.setChainStoreId(store.getChainStoreId());
|
||||||
|
userBalanceAdd.setCardBalance(0.0);
|
||||||
|
userBalanceAdd.setGiveAmount(0.0);
|
||||||
|
userBalanceAdd.setPoints(0);
|
||||||
|
userBalanceAdd.setUsedPoints(0);
|
||||||
|
userBalanceAdd.setGrowthValue(0);
|
||||||
|
userBalanceAdd.setConsumeNum(0);
|
||||||
|
userBalanceAdd.setUserStatus("0");
|
||||||
|
userBalanceAdd.setUserSource("门店扫码");
|
||||||
|
LJUserGrade ljUserGrade = ljUserGradeService.selectUserGradeByStoreId(Integer.parseInt(storeId));
|
||||||
|
if (ObjectUtil.isNotEmpty(ljUserGrade) && ObjectUtil.isNotEmpty(ljUserGrade.getId())) {
|
||||||
|
userBalanceAdd.setGradeId(ljUserGrade.getId());
|
||||||
|
}
|
||||||
|
// 新增会员余额信息
|
||||||
|
userBalanceService.insertUserBalance(userBalanceAdd);
|
||||||
|
}else {
|
||||||
|
LJUserGrade ljUserGrade = ljUserGradeService.selectUserGradeByStoreId(Integer.parseInt(storeId));
|
||||||
|
if (ObjectUtil.isNotEmpty(ljUserGrade) && ObjectUtil.isNotEmpty(ljUserGrade.getId())) {
|
||||||
|
userBalance.setGradeId(ljUserGrade.getId());
|
||||||
|
}
|
||||||
|
userBalanceService.updateUserBalance(userBalance);
|
||||||
|
}
|
||||||
|
// 查询关联表里面是否有信息 (注册邀请)
|
||||||
|
MtInvitation mtInvitation1 = mtInvitationMapper.queryByStoreId(Integer.parseInt(storeId), mtUser.getId());
|
||||||
|
if (ObjectUtil.isEmpty(mtInvitation1)) {
|
||||||
|
MtInvitation mtInvitation = new MtInvitation();
|
||||||
|
mtInvitation.setUserId(mtUser.getId());
|
||||||
|
mtInvitation.setStoreId(Integer.parseInt(storeId));
|
||||||
|
if (ObjectUtil.isNotEmpty(staffId) && staffId !="") {
|
||||||
|
mtInvitation.setStaffId(Integer.parseInt(staffId));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(inviterId) && inviterId !="") {
|
||||||
|
mtInvitation.setInviterId(Integer.parseInt(inviterId));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!ObjectUtil.isEmpty(store)){
|
||||||
|
mtInvitation.setChainStoreId(store.getChainStoreId());
|
||||||
|
}
|
||||||
|
mtInvitationMapper.insert(mtInvitation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//生成用户编号
|
||||||
|
private String editUserNo() {
|
||||||
|
Random random = new Random();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
sb.append(random.nextInt(10));
|
||||||
|
}
|
||||||
|
String digits = sb.toString();
|
||||||
|
|
||||||
|
int sum = 0;
|
||||||
|
for (int i = 0; i < digits.length(); i++) {
|
||||||
|
int digit = Integer.parseInt(String.valueOf(digits.charAt(i)));
|
||||||
|
if (i % 2 == 0) {
|
||||||
|
sum += digit;
|
||||||
|
} else {
|
||||||
|
sum += digit * 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int checksum = (10 - (sum % 10)) % 10;
|
||||||
|
|
||||||
|
String number = digits + checksum;
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.fuint.business.fleet.service.impl;
|
package com.fuint.business.fleet.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@ -12,13 +13,28 @@ import com.fuint.business.fleet.mapper.FleetMemberMapper;
|
|||||||
import com.fuint.business.fleet.service.FleetInfoService;
|
import com.fuint.business.fleet.service.FleetInfoService;
|
||||||
import com.fuint.business.fleet.service.FleetMemberService;
|
import com.fuint.business.fleet.service.FleetMemberService;
|
||||||
import com.fuint.business.fleet.vo.FleetMemberVo;
|
import com.fuint.business.fleet.vo.FleetMemberVo;
|
||||||
|
import com.fuint.business.storeInformation.entity.LJStore;
|
||||||
|
import com.fuint.business.storeInformation.service.ILJStoreService;
|
||||||
|
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||||
|
import com.fuint.business.userManager.entity.MtInvitation;
|
||||||
|
import com.fuint.business.userManager.entity.UserBalance;
|
||||||
|
import com.fuint.business.userManager.mapper.MtInvitationMapper;
|
||||||
|
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||||
import com.fuint.business.userManager.service.LJUserService;
|
import com.fuint.business.userManager.service.LJUserService;
|
||||||
|
import com.fuint.business.userManager.service.UserBalanceService;
|
||||||
import com.fuint.business.userManager.vo.LJUserVo;
|
import com.fuint.business.userManager.vo.LJUserVo;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
|
import com.fuint.common.service.impl.MemberServiceImpl;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
|
import com.fuint.repository.mapper.MtUserMapper;
|
||||||
|
import com.fuint.repository.model.MtUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车队成员(FleetMember)表服务实现类
|
* 车队成员(FleetMember)表服务实现类
|
||||||
*
|
*
|
||||||
@ -32,6 +48,19 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper,FleetM
|
|||||||
private LJUserService userService;
|
private LJUserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private FleetInfoService fleetInfoService;
|
private FleetInfoService fleetInfoService;
|
||||||
|
@Autowired
|
||||||
|
private MtUserMapper mtUserMapper;
|
||||||
|
@Resource
|
||||||
|
private MtInvitationMapper mtInvitationMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
LJUserGradeService ljUserGradeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserBalanceService userBalanceService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ILJStoreService iljStoreService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<FleetMemberVo> queryPage(Page page, FleetMemberVo fleetMember) {
|
public IPage<FleetMemberVo> queryPage(Page page, FleetMemberVo fleetMember) {
|
||||||
@ -72,16 +101,34 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper,FleetM
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insert(FleetMember fleetMember) {
|
public int insert(FleetMember fleetMember) {
|
||||||
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
FleetMember fleetMember1 = queryByMobile(fleetMember.getMobile());
|
FleetMember fleetMember1 = queryByMobile(fleetMember.getMobile());
|
||||||
if (ObjectUtil.isNotEmpty(fleetMember1)) {
|
if (ObjectUtil.isNotEmpty(fleetMember1)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
LJUserVo user = userService.selectUserByMobileAndChantStoreId(fleetMember.getMobile());
|
// LJUserVo user = userService.selectUserByMobileAndChantStoreId(fleetMember.getMobile());
|
||||||
if (ObjectUtil.isEmpty(user)){
|
//判断当前车队负责人是否存在账号
|
||||||
return 2;
|
MtUser mtUser = mtUserMapper.selectOne(new LambdaQueryWrapper<MtUser>()
|
||||||
|
.eq(MtUser::getMobile, fleetMember.getMobile())
|
||||||
|
.last("limit 1"));
|
||||||
|
if (ObjectUtil.isEmpty(mtUser)){
|
||||||
|
//注册用户
|
||||||
|
mtUser = new MtUser();
|
||||||
|
mtUser.setUserNo(editUserNo());
|
||||||
|
mtUser.setMobile(fleetMember.getMobile());
|
||||||
|
mtUser.setName(fleetMember.getName());
|
||||||
|
mtUser.setDescription("车队成员自动注册");
|
||||||
|
mtUser.setCreateTime(DateUtil.date());
|
||||||
|
mtUserMapper.insert(mtUser);
|
||||||
|
|
||||||
|
//注册完成后再查询一次
|
||||||
|
mtUser = mtUserMapper.selectOne(new LambdaQueryWrapper<MtUser>()
|
||||||
|
.eq(MtUser::getMobile, fleetMember.getMobile())
|
||||||
|
.last("limit 1"));
|
||||||
|
createVaseInfo(mtUser, nowAccountInfo.getStoreId().toString(), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
fleetMember.setUserId(mtUser.getId());
|
||||||
fleetMember.setStoreId(nowAccountInfo.getStoreId());
|
fleetMember.setStoreId(nowAccountInfo.getStoreId());
|
||||||
fleetMember.setChainStoreId(nowAccountInfo.getChainStoreId());
|
fleetMember.setChainStoreId(nowAccountInfo.getChainStoreId());
|
||||||
return baseMapper.insert(fleetMember);
|
return baseMapper.insert(fleetMember);
|
||||||
@ -144,4 +191,84 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper,FleetM
|
|||||||
fleetMember.setIfLogOff("1");
|
fleetMember.setIfLogOff("1");
|
||||||
return baseMapper.updateById(fleetMember);
|
return baseMapper.updateById(fleetMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户的基础信息
|
||||||
|
*/
|
||||||
|
private void createVaseInfo (MtUser mtUser, String storeId,String staffId, String inviterId) {
|
||||||
|
LJStore store = iljStoreService.selectStoreByStoreId(Integer.parseInt(storeId));
|
||||||
|
|
||||||
|
// 根据userid和连锁店id查询是否存在对应的余额信息
|
||||||
|
UserBalance userBalance = userBalanceService.selectUserBalance(mtUser.getId(), store.getChainStoreId());
|
||||||
|
if (ObjectUtil.isEmpty(userBalance)) {
|
||||||
|
// 新增余额信息
|
||||||
|
UserBalance userBalanceAdd = new UserBalance();
|
||||||
|
userBalanceAdd.setMtUserId(mtUser.getId());
|
||||||
|
userBalanceAdd.setStoreId(Integer.parseInt(storeId));
|
||||||
|
userBalanceAdd.setChainStoreId(store.getChainStoreId());
|
||||||
|
userBalanceAdd.setCardBalance(0.0);
|
||||||
|
userBalanceAdd.setGiveAmount(0.0);
|
||||||
|
userBalanceAdd.setPoints(0);
|
||||||
|
userBalanceAdd.setUsedPoints(0);
|
||||||
|
userBalanceAdd.setGrowthValue(0);
|
||||||
|
userBalanceAdd.setConsumeNum(0);
|
||||||
|
userBalanceAdd.setUserStatus("0");
|
||||||
|
userBalanceAdd.setUserSource("门店扫码");
|
||||||
|
LJUserGrade ljUserGrade = ljUserGradeService.selectUserGradeByStoreId(Integer.parseInt(storeId));
|
||||||
|
if (ObjectUtil.isNotEmpty(ljUserGrade) && ObjectUtil.isNotEmpty(ljUserGrade.getId())) {
|
||||||
|
userBalanceAdd.setGradeId(ljUserGrade.getId());
|
||||||
|
}
|
||||||
|
// 新增会员余额信息
|
||||||
|
userBalanceService.insertUserBalance(userBalanceAdd);
|
||||||
|
}else {
|
||||||
|
LJUserGrade ljUserGrade = ljUserGradeService.selectUserGradeByStoreId(Integer.parseInt(storeId));
|
||||||
|
if (ObjectUtil.isNotEmpty(ljUserGrade) && ObjectUtil.isNotEmpty(ljUserGrade.getId())) {
|
||||||
|
userBalance.setGradeId(ljUserGrade.getId());
|
||||||
|
}
|
||||||
|
userBalanceService.updateUserBalance(userBalance);
|
||||||
|
}
|
||||||
|
// 查询关联表里面是否有信息 (注册邀请)
|
||||||
|
MtInvitation mtInvitation1 = mtInvitationMapper.queryByStoreId(Integer.parseInt(storeId), mtUser.getId());
|
||||||
|
if (ObjectUtil.isEmpty(mtInvitation1)) {
|
||||||
|
MtInvitation mtInvitation = new MtInvitation();
|
||||||
|
mtInvitation.setUserId(mtUser.getId());
|
||||||
|
mtInvitation.setStoreId(Integer.parseInt(storeId));
|
||||||
|
if (ObjectUtil.isNotEmpty(staffId) && staffId !="") {
|
||||||
|
mtInvitation.setStaffId(Integer.parseInt(staffId));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(inviterId) && inviterId !="") {
|
||||||
|
mtInvitation.setInviterId(Integer.parseInt(inviterId));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!ObjectUtil.isEmpty(store)){
|
||||||
|
mtInvitation.setChainStoreId(store.getChainStoreId());
|
||||||
|
}
|
||||||
|
mtInvitationMapper.insert(mtInvitation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//生成用户编号
|
||||||
|
private String editUserNo() {
|
||||||
|
Random random = new Random();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
sb.append(random.nextInt(10));
|
||||||
|
}
|
||||||
|
String digits = sb.toString();
|
||||||
|
|
||||||
|
int sum = 0;
|
||||||
|
for (int i = 0; i < digits.length(); i++) {
|
||||||
|
int digit = Integer.parseInt(String.valueOf(digits.charAt(i)));
|
||||||
|
if (i % 2 == 0) {
|
||||||
|
sum += digit;
|
||||||
|
} else {
|
||||||
|
sum += digit * 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int checksum = (10 - (sum % 10)) % 10;
|
||||||
|
|
||||||
|
String number = digits + checksum;
|
||||||
|
return number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,8 @@ public class MtUserCarNoController extends BaseController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public ResponseObject list(){
|
public ResponseObject list(Integer storeId){
|
||||||
return getSuccessResult(mtUserCarNoService.getCarNoList());
|
return getSuccessResult(mtUserCarNoService.getCarNoList(storeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +33,9 @@ public class MtUserCarNo implements Serializable {
|
|||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所属商户")
|
||||||
|
private Integer storeId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户id")
|
@ApiModelProperty(value = "用户id")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public interface IMtUserCarNoService extends IService<MtUserCarNo> {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<MtUserCarNo> getCarNoList();
|
List<MtUserCarNo> getCarNoList(Integer storeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增用户车牌号
|
* 新增用户车牌号
|
||||||
|
@ -31,10 +31,11 @@ public class MtUserCarNoServiceImpl extends ServiceImpl<MtUserCarNoMapper, MtUse
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<MtUserCarNo> getCarNoList() {
|
public List<MtUserCarNo> getCarNoList(Integer storeId) {
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
return baseMapper.selectList(new LambdaQueryWrapper<MtUserCarNo>()
|
return baseMapper.selectList(new LambdaQueryWrapper<MtUserCarNo>()
|
||||||
.eq(MtUserCarNo::getUserId, nowAccountInfo.getId()));
|
.eq(MtUserCarNo::getUserId, nowAccountInfo.getId())
|
||||||
|
.eq(MtUserCarNo::getStoreId, storeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user