店铺信息不存在
This commit is contained in:
parent
a789eea6b0
commit
f4af3a279f
|
|
@ -64,39 +64,44 @@ public class UserContoller {
|
|||
@GetMapping("/shopUserInfo")
|
||||
public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception {
|
||||
TbShopUser shopUser = new TbShopUser();
|
||||
TbShopInfo tbShopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
|
||||
TbShopInfo tbShopInfo = new TbShopInfo();
|
||||
if (StringUtils.isNotBlank(shopId) && !shopId.equals("null")) {
|
||||
shopUser = shopUserMapper.selectByUserIdAndShopId(userId, shopId);
|
||||
if (ObjectUtil.isEmpty(shopUser)) {
|
||||
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
||||
tbShopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
|
||||
if(tbShopInfo!=null){
|
||||
shopUser = shopUserMapper.selectByUserIdAndShopId(userId, shopId);
|
||||
if (ObjectUtil.isEmpty(shopUser)) {
|
||||
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
||||
// shopUser = shopUserMapper.selectByPhoneAndShopId(tbUserInfo.getTelephone(), shopId);
|
||||
// if(ObjectUtil.isEmpty(shopUser)){
|
||||
shopUser = new TbShopUser();
|
||||
shopUser.setName(tbUserInfo.getNickName());
|
||||
shopUser.setSex(tbUserInfo.getSex());
|
||||
shopUser.setBirthDay(tbUserInfo.getBirthDay());
|
||||
shopUser.setLevel(Byte.parseByte("1"));
|
||||
String dynamicCode = RandomUtil.randomNumbers(8);
|
||||
shopUser.setCode(dynamicCode);
|
||||
shopUser.setTelephone(tbUserInfo.getTelephone());
|
||||
shopUser.setAmount(BigDecimal.ZERO);
|
||||
shopUser.setIsVip(Byte.parseByte("0"));
|
||||
shopUser.setCreditAmount(BigDecimal.ZERO);
|
||||
shopUser.setConsumeAmount(BigDecimal.ZERO);
|
||||
shopUser.setConsumeNumber(0);
|
||||
shopUser.setLevelConsume(BigDecimal.ZERO);
|
||||
shopUser.setStatus(Byte.parseByte("1"));
|
||||
shopUser.setShopId(shopId);
|
||||
shopUser.setUserId(userId);
|
||||
shopUser.setMiniOpenId(openId);
|
||||
shopUser.setCreatedAt(System.currentTimeMillis());
|
||||
shopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
shopUserMapper.insert(shopUser);
|
||||
shopUser = new TbShopUser();
|
||||
shopUser.setName(tbUserInfo.getNickName());
|
||||
shopUser.setSex(tbUserInfo.getSex());
|
||||
shopUser.setBirthDay(tbUserInfo.getBirthDay());
|
||||
shopUser.setLevel(Byte.parseByte("1"));
|
||||
String dynamicCode = RandomUtil.randomNumbers(8);
|
||||
shopUser.setCode(dynamicCode);
|
||||
shopUser.setTelephone(tbUserInfo.getTelephone());
|
||||
shopUser.setAmount(BigDecimal.ZERO);
|
||||
shopUser.setIsVip(Byte.parseByte("0"));
|
||||
shopUser.setCreditAmount(BigDecimal.ZERO);
|
||||
shopUser.setConsumeAmount(BigDecimal.ZERO);
|
||||
shopUser.setConsumeNumber(0);
|
||||
shopUser.setLevelConsume(BigDecimal.ZERO);
|
||||
shopUser.setStatus(Byte.parseByte("1"));
|
||||
shopUser.setShopId(shopId);
|
||||
shopUser.setUserId(userId);
|
||||
shopUser.setMiniOpenId(openId);
|
||||
shopUser.setCreatedAt(System.currentTimeMillis());
|
||||
shopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
shopUserMapper.insert(shopUser);
|
||||
// }else {
|
||||
// shopUser.setUserId(userId);
|
||||
// shopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
// shopUserMapper.updateByPrimaryKey(shopUser);
|
||||
// }
|
||||
}
|
||||
}else {
|
||||
return Result.fail("店铺信息不存在");
|
||||
}
|
||||
} else {
|
||||
shopUser.setAmount(BigDecimal.ZERO);
|
||||
|
|
|
|||
Loading…
Reference in New Issue