shopId为空时 余额为0
This commit is contained in:
@@ -29,6 +29,7 @@ import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||
import com.chaozhanggui.system.cashierservice.wxUtil.WechatUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -78,7 +79,9 @@ public class UserContoller {
|
||||
// }
|
||||
@GetMapping("/shopUserInfo")
|
||||
public Result shopUserInfo(@RequestParam("userId") String userId ,@RequestHeader("openId") String openId,@RequestParam("shopId") String shopId ) throws Exception {
|
||||
TbShopUser shopUser = shopUserMapper.selectByUserIdAndShopId(userId,shopId);
|
||||
TbShopUser shopUser=new TbShopUser();
|
||||
if (StringUtils.isNotBlank(shopId)) {
|
||||
shopUser = shopUserMapper.selectByUserIdAndShopId(userId, shopId);
|
||||
if (ObjectUtil.isEmpty(shopUser)) {
|
||||
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
||||
shopUser = new TbShopUser();
|
||||
@@ -103,6 +106,9 @@ public class UserContoller {
|
||||
shopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
shopUserMapper.insert(shopUser);
|
||||
}
|
||||
}else {
|
||||
shopUser.setAmount(BigDecimal.ZERO);
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS,shopUser);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user