会员信息

This commit is contained in:
cun-nan 2023-11-29 16:56:28 +08:00
parent f45dfbd0de
commit d4b1d72608
3 changed files with 33 additions and 3 deletions

View File

@ -5,8 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.CertifiedMember;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.MtInvitation;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.CertifiedMemberMapper;
import com.fuint.business.userManager.mapper.LJUserMapper;
@ -145,6 +148,9 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
balanceService.deleteUserBalanceByUserId(id);
}
@Autowired
private ILJStoreService storeService;
/**
* 添加会员信息
* @param user
@ -155,7 +161,6 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
LJUser user1 = new LJUser();
user1.setStoreId(storeId);
if (user.getMobile()==null || user.getMobile().equals("")){
return 0;
}
@ -196,6 +201,7 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
user1.setDescription(user.getDescription());
user1.setOfficial(user.getOfficial());
int row = baseMapper.insert(user1);
// 查询添加后的用户id
LJUser ljUser = this.selectUserByMobile(user.getMobile());
// 添加用户储值卡信息
@ -209,6 +215,18 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
balance.setSecondCard(user.getSecondCard());
balance.setFixingLevel(user.getFixingLevel());
balanceService.insertUserBalance(balance);
Integer chainStoreId = null;
// 根据店铺id查询店铺所对应的连锁店id
LJStore store = storeService.selectStoreByStoreId(storeId);
if (!ObjectUtil.isEmpty(store)){
chainStoreId = store.getChainStoreId();
}
// 添加邀请注册信息
MtInvitation invitation = new MtInvitation();
invitation.setUserid(ljUser.getId());
invitation.setStoreId(storeId);
invitation.setStaffid(nowAccountInfo.getStaffId());
invitation.setChainStoreId(chainStoreId);
return row;
}
@ -221,7 +239,6 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
public int updateUser(LJUserVo userVo) {
LJUser user = new LJUser();
user.setUserNo(userVo.getUserNo());
user.setStoreId(userVo.getStoreId());
user.setAvatar(userVo.getAvatar());
user.setName(userVo.getName());
user.setOpenId(userVo.getOpenId());

View File

@ -15,6 +15,7 @@ public class LJUserVo extends BaseEntity {
* 用户id
*/
private Integer id;
private Integer balanceId;
// 会员号
@ExcelProperty(value = "会员号")
@ -105,4 +106,8 @@ public class LJUserVo extends BaseEntity {
* 邀请人id
*/
private Integer inviterid;
/**
* 连锁店id
*/
private Integer chainStoreId;
}

View File

@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.store.entity.MtStore;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.MtInvitation;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.MtInvitationMapper;
@ -36,6 +38,7 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
@ -722,6 +725,8 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
@Resource
private UserBalanceService userBalanceService;
@Autowired
private ILJStoreService iljStoreService;
@Override
@ -822,7 +827,7 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
// 新增会员余额信息
userBalanceService.insertUserBalance(userBalanceAdd);
}
LJStore store = iljStoreService.selectStoreByStoreId(Integer.parseInt(storeId));
// 查询关联表里面是否有信息
MtInvitation mtInvitation1 = mtInvitationMapper.queryByStoreId(Integer.parseInt(storeId), user.getId());
if (ObjectUtil.isEmpty(mtInvitation1)) {
@ -831,6 +836,9 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
mtInvitation.setStoreId(Integer.parseInt(storeId));
mtInvitation.setStaffid(Integer.parseInt(staffId));
mtInvitation.setInviterid(Integer.parseInt(inviterId));
if (!ObjectUtil.isEmpty(store)){
mtInvitation.setChainStoreId(store.getChainStoreId());
}
mtInvitationMapper.insert(mtInvitation);
}
}