会员卡管理接口

This commit is contained in:
张松 2025-02-15 14:58:39 +08:00
parent 2a909f7b26
commit faa6f448c0
6 changed files with 55 additions and 4 deletions

View File

@ -4,6 +4,7 @@ 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 jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -28,4 +29,15 @@ public class UShopUserController {
public CzgResult<ShopUser> get() { public CzgResult<ShopUser> get() {
return CzgResult.success(shopUserService.getShopUserInfo(StpKit.USER.getShopId(), StpKit.USER.getLoginIdAsLong())); return CzgResult.success(shopUserService.getShopUserInfo(StpKit.USER.getShopId(), StpKit.USER.getLoginIdAsLong()));
} }
/**
* 获取当前用户所有店铺会员信息
* @return 店铺会员信息列表
*/
@GetMapping("/vipCard")
public CzgResult<Page<ShopUser>> list() {
return CzgResult.success(shopUserService.vipCard(StpKit.USER.getLoginIdAsLong()));
}
} }

View File

@ -0,0 +1,25 @@
package com.czg.account.dto.shopuser;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author Administrator
*/
@Data
public class ShopUserVipCardDTO {
/**
* 店铺logo
*/
private String logo;
/**
* 店铺名
*/
private String shopName;
/**
* 用户余额
*/
private BigDecimal amount;
}

View File

@ -28,4 +28,9 @@ public interface ShopUserService extends IService<ShopUser> {
Boolean add(Long shopId, ShopUserAddDTO shopUserAddDTO); Boolean add(Long shopId, ShopUserAddDTO shopUserAddDTO);
/**
* 获取小程序登录用户所有店铺会员信息
*/
Page<ShopUser> vipCard(long userInfoId);
} }

View File

@ -1,6 +1,7 @@
package com.czg.service.account.mapper; package com.czg.service.account.mapper;
import com.czg.account.dto.shopuser.ShopUserSummaryDTO; import com.czg.account.dto.shopuser.ShopUserSummaryDTO;
import com.czg.account.dto.shopuser.ShopUserVipCardDTO;
import com.czg.account.entity.ShopUser; import com.czg.account.entity.ShopUser;
import com.mybatisflex.core.BaseMapper; import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
@ -24,4 +25,6 @@ public interface ShopUserMapper extends BaseMapper<ShopUser> {
int decrAccount(@Param("shopId") long shopId, @Param("id") Long id, @Param("time") LocalDateTime time, @Param("money") BigDecimal money); int decrAccount(@Param("shopId") long shopId, @Param("id") Long id, @Param("time") LocalDateTime time, @Param("money") BigDecimal money);
ShopUserSummaryDTO selectUserSummary(@Param("shopId") Long shopId, @Param("isVip") Integer isVip); ShopUserSummaryDTO selectUserSummary(@Param("shopId") Long shopId, @Param("isVip") Integer isVip);
Page<ShopUserVipCardDTO> selectVipCard(@Param("page") Page<Object> objectPage, @Param("userInfoId") long userInfoId);
} }

View File

@ -2,10 +2,7 @@ package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.czg.account.dto.shopuser.ShopUserAddDTO; import com.czg.account.dto.shopuser.*;
import com.czg.account.dto.shopuser.ShopUserEditDTO;
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
import com.czg.account.dto.shopuser.ShopUserSummaryDTO;
import com.czg.account.entity.ShopUser; import com.czg.account.entity.ShopUser;
import com.czg.account.entity.ShopUserFlow; import com.czg.account.entity.ShopUserFlow;
import com.czg.account.entity.UserInfo; import com.czg.account.entity.UserInfo;
@ -120,4 +117,10 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser>
shopUser.setJoinTime(shopUser.getIsVip() != null &&shopUser.getIsVip() == 1 ? DateUtil.date().toLocalDateTime() : null); shopUser.setJoinTime(shopUser.getIsVip() != null &&shopUser.getIsVip() == 1 ? DateUtil.date().toLocalDateTime() : null);
return save(shopUser); return save(shopUser);
} }
@Override
public Page<ShopUser> vipCard(long userInfoId) {
Page<ShopUserVipCardDTO> infos = mapper.selectVipCard(PageUtil.buildPage(), userInfoId);
return null;
}
} }

View File

@ -38,4 +38,7 @@
and a.is_vip=#{isVip} and a.is_vip=#{isVip}
</if> </if>
</select> </select>
<select id="selectVipCard" resultType="com.czg.account.dto.shopuser.ShopUserVipCardDTO">
</select>
</mapper> </mapper>