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