会员信息相关接口
This commit is contained in:
@@ -11,6 +11,7 @@ import com.czg.enums.ShopUserFlowBizEnum;
|
|||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -52,6 +53,17 @@ public class ShopUserController {
|
|||||||
return CzgResult.success(shopUserService.getPage(key, isVip));
|
return CzgResult.success(shopUserService.getPage(key, isVip));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取店铺用户详情
|
||||||
|
* @param id 会员用户id
|
||||||
|
* @return 用户详情
|
||||||
|
*/
|
||||||
|
@SaAdminCheckPermission("shopUser:detail")
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public CzgResult<ShopUser> detail(@RequestParam Integer id) {
|
||||||
|
return CzgResult.success(shopUserService.getOne(new QueryWrapper().eq(ShopUser::getId, id).eq(ShopUser::getShopId, StpKit.USER.getShopId())));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店铺用户信息添加
|
* 店铺用户信息添加
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package com.czg.controller.user;
|
package com.czg.controller.user;
|
||||||
|
|
||||||
|
import com.czg.account.dto.shopuser.ShopUserAddDTO;
|
||||||
import com.czg.account.dto.shopuser.ShopUserVipCardDTO;
|
import com.czg.account.dto.shopuser.ShopUserVipCardDTO;
|
||||||
import com.czg.account.entity.ShopUser;
|
import com.czg.account.entity.ShopUser;
|
||||||
import com.czg.account.service.ShopUserService;
|
import com.czg.account.service.ShopUserService;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店铺会员相关
|
* 店铺会员相关
|
||||||
@@ -30,7 +31,7 @@ public class UShopUserController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public CzgResult<ShopUser> get(Long shopId) {
|
public CzgResult<ShopUser> get(Long shopId) {
|
||||||
return CzgResult.success(shopUserService.getShopUserInfo(shopId == null ? StpKit.USER.getShopId() : shopId, StpKit.USER.getLoginIdAsLong()));
|
return CzgResult.success(shopUserService.getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId == null ? StpKit.USER.getShopId() : shopId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,4 +54,9 @@ public class UShopUserController {
|
|||||||
return shopUserService.getCode(StpKit.USER.getLoginIdAsLong(), shopId == null ? StpKit.USER.getShopId() : shopId);
|
return shopUserService.getCode(StpKit.USER.getLoginIdAsLong(), shopId == null ? StpKit.USER.getShopId() : shopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public CzgResult<Boolean> join(@RequestBody @Validated ShopUserAddDTO shopUserAddDTO) {
|
||||||
|
return shopUserService.join(StpKit.USER.getShopId(), StpKit.USER.getLoginIdAsLong(), shopUserAddDTO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,4 +35,6 @@ public interface ShopUserService extends IService<ShopUser> {
|
|||||||
Page<ShopUserVipCardDTO> vipCard(long userInfoId);
|
Page<ShopUserVipCardDTO> vipCard(long userInfoId);
|
||||||
|
|
||||||
CzgResult<String> getCode(long userInfoId, long shopId);
|
CzgResult<String> getCode(long userInfoId, long shopId);
|
||||||
|
|
||||||
|
CzgResult<Boolean> join(Long shopId, Long userId, ShopUserAddDTO shopUserAddDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,4 +182,18 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||||||
|
|
||||||
return date + platformNumber + shopIdLastTwoDigits + randomPart;
|
return date + platformNumber + shopIdLastTwoDigits + randomPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CzgResult<Boolean> join(Long shopId, Long userId, ShopUserAddDTO shopUserAddDTO) {
|
||||||
|
ShopUser shopUser = getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userId));
|
||||||
|
if (shopUser != null) {
|
||||||
|
throw new ApiNotPrintException("您已加入店铺会员");
|
||||||
|
}
|
||||||
|
|
||||||
|
shopUser = BeanUtil.copyProperties(shopUserAddDTO, ShopUser.class);
|
||||||
|
shopUser.setIsVip(1);
|
||||||
|
// shopUser.setCode();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user