mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-23 05:00:25 +08:00
refactor: 会员模块和营销模块重命名
This commit is contained in:
parent
a9cffbda4a
commit
dfafdf9acf
@ -68,7 +68,7 @@ youlai-mall
|
||||
├── sql # SQL脚本
|
||||
├── mysql5 # MySQL5脚本
|
||||
├── mysql8 # MySQL8脚本
|
||||
├── mall-sms # 营销服务(Sales Management Service)
|
||||
├── mall-marketing # 营销服务(Sales Management Service)
|
||||
├── sms-api # 营销服务-Feign客户端
|
||||
├── sms-boot # 营销服务-启动应用
|
||||
├── mall-product # 商品服务(Product Management Service)
|
||||
@ -76,9 +76,9 @@ youlai-mall
|
||||
├── product-boot # 商品服务-启动应用
|
||||
├── mall-order # 订单服务(Order Management Service)
|
||||
├── order-boot # 订单服务-启动应用
|
||||
├── mall-ums # 会员服务(User Management Service)
|
||||
├── ums-api # 会员服务-Feign客户端
|
||||
├── ums-boot # 会员服务-启动应用
|
||||
├── mall-member # 会员服务(User Management Service)
|
||||
├── member-api # 会员服务-Feign客户端
|
||||
├── member-boot # 会员服务-启动应用
|
||||
├── youlai-auth # 认证授权中心
|
||||
├── youlai-common # 公共模块
|
||||
├── common-core # 基础依赖
|
||||
|
@ -115,8 +115,8 @@ INSERT INTO `sys_menu` VALUES (11, 0, 1, '商品管理', '/product', 'Layout', N
|
||||
INSERT INTO `sys_menu` VALUES (12, 11, 1, '商品列表', 'goods', 'product/goods/index', NULL, 'goods-list', 1, 1, NULL, NULL, NULL, 1, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (13, 0, 2, '订单管理', '/oms', 'Layout', NULL, 'el-icon-ShoppingCart', 3, 1, '/oms/order', '0', 1, 1, '2021-08-28 09:12:21', '2024-03-03 23:52:32');
|
||||
INSERT INTO `sys_menu` VALUES (14, 13, 1, '订单列表', 'order', 'oms/order/index', NULL, 'el-icon-Document', 1, 1, NULL, 'null,13', NULL, 1, '2021-08-28 09:12:21', '2024-03-03 23:45:09');
|
||||
INSERT INTO `sys_menu` VALUES (15, 0, 1, '会员管理', '/ums', 'Layout', NULL, 'user', 4, 1, '/ums/member', NULL, NULL, 1, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (16, 15, 1, '会员列表', 'member', 'ums/member/index', NULL, 'peoples', 1, 1, NULL, NULL, NULL, 1, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (15, 0, 1, '会员管理', '/member', 'Layout', NULL, 'user', 4, 1, '/member/member', NULL, NULL, 1, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (16, 15, 1, '会员列表', 'member', 'member/member/index', NULL, 'peoples', 1, 1, NULL, NULL, NULL, 1, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (17, 11, 1, '品牌管理', 'brand', 'product/brand/index', NULL, 'brand', 5, 1, NULL, NULL, NULL, 1, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (18, 11, 1, '商品分类', 'category', 'product/category/index', NULL, 'menu', 3, 1, NULL, NULL, NULL, 1, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (19, 11, 1, '商品上架', 'goods-detail', 'product/goods/detail', NULL, 'publish', 2, 1, NULL, NULL, NULL, NULL, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
|
@ -130,8 +130,8 @@ INSERT INTO `sys_menu` VALUES (11, 0, 1, '商品管理', '/product', 'Layout', N
|
||||
INSERT INTO `sys_menu` VALUES (12, 11, 1, '商品列表', 'goods', 'product/goods/index', NULL, 'goods-list', 1, 1, NULL, NULL, NULL, 1, NULL, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (13, 0, 2, '订单管理', '/oms', 'Layout', NULL, 'el-icon-ShoppingCart', 3, 1, '/oms/order', '0', 1, 1, NULL, '2021-08-28 09:12:21', '2024-03-03 23:52:32');
|
||||
INSERT INTO `sys_menu` VALUES (14, 13, 1, '订单列表', 'order', 'oms/order/index', NULL, 'el-icon-Document', 1, 1, NULL, 'null,13', NULL, 1, NULL, '2021-08-28 09:12:21', '2024-03-03 23:45:09');
|
||||
INSERT INTO `sys_menu` VALUES (15, 0, 1, '会员管理', '/ums', 'Layout', NULL, 'user', 4, 1, '/ums/member', NULL, NULL, 1, NULL, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (16, 15, 1, '会员列表', 'member', 'ums/member/index', NULL, 'peoples', 1, 1, NULL, NULL, NULL, 1, NULL, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (15, 0, 1, '会员管理', '/member', 'Layout', NULL, 'user', 4, 1, '/member/member', NULL, NULL, 1, NULL, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (16, 15, 1, '会员列表', 'member', 'member/member/index', NULL, 'peoples', 1, 1, NULL, NULL, NULL, 1, NULL, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (17, 11, 1, '品牌管理', 'brand', 'product/brand/index', NULL, 'brand', 5, 1, NULL, NULL, NULL, 1, NULL, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (18, 11, 1, '商品分类', 'category', 'product/category/index', NULL, 'menu', 3, 1, NULL, NULL, NULL, 1, NULL, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
INSERT INTO `sys_menu` VALUES (19, 11, 1, '商品上架', 'goods-detail', 'product/goods/detail', NULL, 'publish', 2, 1, NULL, NULL, NULL, NULL, NULL, '2021-08-28 09:12:21', '2021-08-28 09:12:21');
|
||||
|
@ -3,13 +3,13 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>mall-sms</artifactId>
|
||||
<artifactId>mall-marketing</artifactId>
|
||||
<groupId>com.youlai</groupId>
|
||||
<version>3.2.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>sms-api</artifactId>
|
||||
<artifactId>marketing-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>com.youlai</groupId>
|
||||
<artifactId>ums-api</artifactId>
|
||||
<artifactId>member-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.sms.api.app;
|
||||
package com.youlai.mall.marketing.api;
|
||||
|
||||
import com.youlai.common.result.Result;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
@ -8,12 +8,12 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 优惠券领券记录APP端Feign接口
|
||||
*
|
||||
* @author huawei
|
||||
* @desc 优惠券领券记录APP端Feign接口
|
||||
* @email huawei_code@163.com
|
||||
* @since 2021/3/17
|
||||
*/
|
||||
@FeignClient(value = "mall-sms")
|
||||
@FeignClient(value = "mall-marketing")
|
||||
public interface CouponRecordFeignClient {
|
||||
|
||||
@GetMapping("/api.app/v1/coupon_record/list")
|
@ -3,13 +3,13 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>mall-sms</artifactId>
|
||||
<artifactId>mall-marketing</artifactId>
|
||||
<groupId>com.youlai</groupId>
|
||||
<version>3.2.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>sms-boot</artifactId>
|
||||
<artifactId>marketing-boot</artifactId>
|
||||
<properties>
|
||||
|
||||
<service.port>8804</service.port>
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>com.youlai</groupId>
|
||||
<artifactId>sms-api</artifactId>
|
||||
<artifactId>marketing-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
@ -16,9 +16,9 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients
|
||||
@EnableScheduling
|
||||
public class SmsApplication {
|
||||
public class MarketingApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SmsApplication.class, args);
|
||||
SpringApplication.run(MarketingApplication.class, args);
|
||||
}
|
||||
}
|
@ -5,9 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.common.result.PageResult;
|
||||
import com.youlai.common.result.Result;
|
||||
import com.youlai.mall.sms.model.entity.SmsAdvert;
|
||||
import com.youlai.mall.sms.model.entity.Advert;
|
||||
import com.youlai.mall.sms.model.query.AdvertPageQuery;
|
||||
import com.youlai.mall.sms.service.SmsAdvertService;
|
||||
import com.youlai.mall.sms.service.AdvertService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -20,13 +20,13 @@ import java.util.Arrays;
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/adverts")
|
||||
@RequiredArgsConstructor
|
||||
public class SmsAdvertController {
|
||||
public class AdvertController {
|
||||
|
||||
private final SmsAdvertService smsAdvertService;
|
||||
private final AdvertService advertService;
|
||||
|
||||
@Operation(summary= "广告分页列表")
|
||||
@GetMapping("/page")
|
||||
public PageResult<SmsAdvert> getAdvertPage(AdvertPageQuery queryParams) {
|
||||
public PageResult<Advert> getAdvertPage(AdvertPageQuery queryParams) {
|
||||
|
||||
// 查询参数
|
||||
int pageNum = queryParams.getPageNum();
|
||||
@ -34,11 +34,11 @@ public class SmsAdvertController {
|
||||
String keywords = queryParams.getKeywords();
|
||||
|
||||
// 分页查询
|
||||
Page<SmsAdvert> result = smsAdvertService.page(
|
||||
Page<Advert> result = advertService.page(
|
||||
new Page<>(pageNum, pageSize),
|
||||
new LambdaQueryWrapper<SmsAdvert>()
|
||||
.like(StrUtil.isNotBlank(keywords), SmsAdvert::getTitle, keywords)
|
||||
.orderByAsc(SmsAdvert::getSort)
|
||||
new LambdaQueryWrapper<Advert>()
|
||||
.like(StrUtil.isNotBlank(keywords), Advert::getTitle, keywords)
|
||||
.orderByAsc(Advert::getSort)
|
||||
);
|
||||
return PageResult.success(result);
|
||||
}
|
||||
@ -48,14 +48,14 @@ public class SmsAdvertController {
|
||||
public Result getAdvertDetail(
|
||||
@Parameter(description = "广告ID") @PathVariable Long id
|
||||
) {
|
||||
SmsAdvert advert = smsAdvertService.getById(id);
|
||||
Advert advert = advertService.getById(id);
|
||||
return Result.success(advert);
|
||||
}
|
||||
|
||||
@Operation(summary= "新增广告")
|
||||
@PostMapping
|
||||
public Result addAvert(@RequestBody SmsAdvert advert) {
|
||||
boolean status = smsAdvertService.save(advert);
|
||||
public Result addAvert(@RequestBody Advert advert) {
|
||||
boolean status = advertService.save(advert);
|
||||
return Result.judge(status);
|
||||
}
|
||||
|
||||
@ -63,15 +63,15 @@ public class SmsAdvertController {
|
||||
@PutMapping(value = "/{id}")
|
||||
public Result updateAdvert(
|
||||
@Parameter(description = "广告ID") @PathVariable Long id,
|
||||
@RequestBody SmsAdvert advert) {
|
||||
boolean status = smsAdvertService.updateById(advert);
|
||||
@RequestBody Advert advert) {
|
||||
boolean status = advertService.updateById(advert);
|
||||
return Result.judge(status);
|
||||
}
|
||||
|
||||
@Operation(summary= "删除广告")
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result deleteAdverts(@Parameter(description = "广告ID,多个以英文逗号(,)分割") @PathVariable("ids") String ids) {
|
||||
boolean status = smsAdvertService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
boolean status = advertService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.judge(status);
|
||||
|
||||
|
@ -6,7 +6,7 @@ import com.youlai.common.result.Result;
|
||||
import com.youlai.mall.sms.model.form.CouponForm;
|
||||
import com.youlai.mall.sms.model.query.CouponPageQuery;
|
||||
import com.youlai.mall.sms.model.vo.CouponPageVO;
|
||||
import com.youlai.mall.sms.service.SmsCouponService;
|
||||
import com.youlai.mall.sms.service.CouponService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -19,9 +19,9 @@ import jakarta.validation.Valid;
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/coupons")
|
||||
@RequiredArgsConstructor
|
||||
public class SmsCouponController {
|
||||
public class CouponController {
|
||||
|
||||
private final SmsCouponService couponService;
|
||||
private final CouponService couponService;
|
||||
|
||||
@Operation(summary= "优惠券分页列表")
|
||||
@GetMapping("/pages")
|
@ -2,7 +2,7 @@ package com.youlai.mall.sms.controller.app;
|
||||
|
||||
import com.youlai.common.result.Result;
|
||||
import com.youlai.mall.sms.model.vo.BannerVO;
|
||||
import com.youlai.mall.sms.service.SmsAdvertService;
|
||||
import com.youlai.mall.sms.service.AdvertService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -18,13 +18,13 @@ import java.util.List;
|
||||
@RequestMapping("/app-api/v1/adverts")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class AdvertController {
|
||||
public class AdvertAppController {
|
||||
|
||||
private SmsAdvertService smsAdvertService;
|
||||
private AdvertService advertService;
|
||||
@Operation(summary= "APP首页广告横幅列表")
|
||||
@GetMapping("/banners")
|
||||
public Result<List<BannerVO>> getBannerList() {
|
||||
List<BannerVO> list = smsAdvertService.getBannerList();
|
||||
List<BannerVO> list = advertService.getBannerList();
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ package com.youlai.mall.sms.converter;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.mall.sms.model.entity.SmsAdvert;
|
||||
import com.youlai.mall.sms.model.entity.Advert;
|
||||
import com.youlai.mall.sms.model.vo.BannerVO;
|
||||
import com.youlai.mall.sms.model.vo.AdvertPageVO;
|
||||
import org.mapstruct.Mapper;
|
||||
@ -18,11 +18,11 @@ import java.util.List;
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface AdvertConverter {
|
||||
|
||||
AdvertPageVO entity2PageVo(SmsAdvert entity);
|
||||
AdvertPageVO entity2PageVo(Advert entity);
|
||||
|
||||
Page<AdvertPageVO> entity2PageVo(Page<SmsAdvert> po);
|
||||
Page<AdvertPageVO> entity2PageVo(Page<Advert> po);
|
||||
|
||||
BannerVO entity2BannerVo(SmsAdvert entity);
|
||||
BannerVO entity2BannerVo(Advert entity);
|
||||
|
||||
List<BannerVO> entity2BannerVo(List<SmsAdvert> entities);
|
||||
List<BannerVO> entity2BannerVo(List<Advert> entities);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package com.youlai.mall.sms.converter;
|
||||
|
||||
|
||||
import com.youlai.mall.sms.model.entity.SmsCoupon;
|
||||
import com.youlai.mall.sms.model.entity.Coupon;
|
||||
import com.youlai.mall.sms.model.form.CouponForm;
|
||||
import com.youlai.mall.sms.model.vo.CouponPageVO;
|
||||
import org.mapstruct.Mapper;
|
||||
@ -29,20 +29,20 @@ public interface CouponConverter {
|
||||
),
|
||||
@Mapping(target = "minPointLabel", expression = "java(cn.hutool.core.util.NumberUtil.toStr(cn.hutool.core.util.NumberUtil.div(entity.getMinPoint(),new java.math.BigDecimal(100)).setScale(2)))"),
|
||||
})
|
||||
CouponPageVO entity2PageVO(SmsCoupon entity);
|
||||
CouponPageVO entity2PageVO(Coupon entity);
|
||||
|
||||
|
||||
List<CouponPageVO> entity2PageVO(List<SmsCoupon> entities);
|
||||
List<CouponPageVO> entity2PageVO(List<Coupon> entities);
|
||||
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "discount",expression = "java(cn.hutool.core.util.NumberUtil.div(form.getDiscount(),10L))"),
|
||||
})
|
||||
SmsCoupon toEntity(CouponForm form);
|
||||
Coupon toEntity(CouponForm form);
|
||||
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "discount",expression = "java(cn.hutool.core.util.NumberUtil.mul(entity.getDiscount(),10L))"),
|
||||
})
|
||||
CouponForm toForm(SmsCoupon entity);
|
||||
CouponForm toForm(Coupon entity);
|
||||
}
|
@ -2,12 +2,12 @@ package com.youlai.mall.sms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.mall.sms.model.entity.SmsAdvert;
|
||||
import com.youlai.mall.sms.model.entity.Advert;
|
||||
import com.youlai.mall.sms.model.query.AdvertPageQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SmsAdvertMapper extends BaseMapper<SmsAdvert> {
|
||||
public interface AdvertMapper extends BaseMapper<Advert> {
|
||||
|
||||
/**
|
||||
* 广告分页列表
|
||||
@ -16,5 +16,5 @@ public interface SmsAdvertMapper extends BaseMapper<SmsAdvert> {
|
||||
* @param queryParams
|
||||
* @return
|
||||
*/
|
||||
Page<SmsAdvert> getAdvertPage(Page<SmsAdvert> page, AdvertPageQuery queryParams);
|
||||
Page<Advert> getAdvertPage(Page<Advert> page, AdvertPageQuery queryParams);
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package com.youlai.mall.sms.mapper;
|
||||
|
||||
import com.youlai.mall.sms.model.entity.SmsCouponHistory;
|
||||
import com.youlai.mall.sms.model.entity.CouponHistory;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface SmsCouponHistoryMapper extends BaseMapper<SmsCouponHistory> {
|
||||
public interface CouponHistoryMapper extends BaseMapper<CouponHistory> {
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.youlai.mall.sms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.mall.sms.model.entity.SmsCoupon;
|
||||
import com.youlai.mall.sms.model.entity.Coupon;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.youlai.mall.sms.model.query.CouponPageQuery;
|
||||
import com.youlai.mall.sms.model.vo.CouponPageVO;
|
||||
@ -11,9 +11,9 @@ import java.util.List;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface SmsCouponMapper extends BaseMapper<SmsCoupon> {
|
||||
public interface CouponMapper extends BaseMapper<Coupon> {
|
||||
|
||||
List<SmsCoupon> getCouponPage(Page<CouponPageVO> page, CouponPageQuery queryParams);
|
||||
List<Coupon> getCouponPage(Page<CouponPageVO> page, CouponPageQuery queryParams);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.youlai.mall.sms.mapper;
|
||||
|
||||
import com.youlai.mall.sms.model.entity.SmsCouponSpuCategory;
|
||||
import com.youlai.mall.sms.model.entity.CouponSpuCategory;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @since 2022/6/30
|
||||
*/
|
||||
@Mapper
|
||||
public interface SmsCouponSpuCategoryMapper extends BaseMapper<SmsCouponSpuCategory> {
|
||||
public interface CouponSpuCategoryMapper extends BaseMapper<CouponSpuCategory> {
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.youlai.mall.sms.mapper;
|
||||
|
||||
import com.youlai.mall.sms.model.entity.SmsCouponSpu;
|
||||
import com.youlai.mall.sms.model.entity.CouponSpu;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @since 2022/6/30
|
||||
*/
|
||||
@Mapper
|
||||
public interface SmsCouponSpuMapper extends BaseMapper<SmsCouponSpu> {
|
||||
public interface CouponSpuMapper extends BaseMapper<CouponSpu> {
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.youlai.mall.sms.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.youlai.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
@ -14,14 +15,15 @@ import java.util.Date;
|
||||
* @since 2024/6/7
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sms_advert")
|
||||
@Data
|
||||
public class SmsAdvert extends BaseEntity {
|
||||
public class Advert extends BaseEntity {
|
||||
|
||||
private String title;
|
||||
|
||||
private String imageUrl;
|
||||
|
||||
@JsonFormat( pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
@ -18,9 +18,9 @@ import java.util.Date;
|
||||
* @since 2024/6/7
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName
|
||||
@TableName("sms_coupon")
|
||||
@Data
|
||||
public class SmsCoupon extends BaseEntity {
|
||||
public class Coupon extends BaseEntity {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ -85,7 +85,7 @@ public class SmsCoupon extends BaseEntity {
|
||||
/**
|
||||
* 有效期起始时间
|
||||
*/
|
||||
private Date validityBeginTime;
|
||||
private Date validityStartTime;
|
||||
|
||||
/**
|
||||
* 有效期截止时间
|
||||
@ -117,10 +117,4 @@ public class SmsCoupon extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 逻辑删除标识(0:正常;1:删除)
|
||||
*/
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private Integer deleted;
|
||||
|
||||
}
|
@ -8,12 +8,11 @@ import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName sms_coupon_history
|
||||
* 优惠券领取历史记录
|
||||
*/
|
||||
@TableName(value ="sms_coupon_history")
|
||||
@Data
|
||||
public class SmsCouponHistory implements Serializable {
|
||||
public class CouponHistory implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
@ -10,13 +10,13 @@ import lombok.experimental.Accessors;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName sms_coupon_spu
|
||||
* 优惠券与产品关联表
|
||||
*/
|
||||
|
||||
@TableName(value ="sms_coupon_spu")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SmsCouponSpu implements Serializable {
|
||||
public class CouponSpu implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
@ -12,7 +12,7 @@ import java.io.Serializable;
|
||||
@TableName(value ="sms_coupon_spu_category")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SmsCouponSpuCategory implements Serializable {
|
||||
public class CouponSpuCategory implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
@ -2,14 +2,14 @@ package com.youlai.mall.sms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.mall.sms.model.entity.SmsAdvert;
|
||||
import com.youlai.mall.sms.model.entity.Advert;
|
||||
import com.youlai.mall.sms.model.query.AdvertPageQuery;
|
||||
import com.youlai.mall.sms.model.vo.BannerVO;
|
||||
import com.youlai.mall.sms.model.vo.AdvertPageVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SmsAdvertService extends IService<SmsAdvert> {
|
||||
public interface AdvertService extends IService<Advert> {
|
||||
|
||||
/**
|
||||
* 广告分页列表
|
@ -0,0 +1,11 @@
|
||||
package com.youlai.mall.sms.service;
|
||||
|
||||
import com.youlai.mall.sms.model.entity.CouponHistory;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public interface CouponHistoryService extends IService<CouponHistory> {
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package com.youlai.mall.sms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.mall.sms.model.entity.SmsCoupon;
|
||||
import com.youlai.mall.sms.model.entity.Coupon;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.mall.sms.model.form.CouponForm;
|
||||
import com.youlai.mall.sms.model.query.CouponPageQuery;
|
||||
@ -13,7 +13,7 @@ import com.youlai.mall.sms.model.vo.CouponPageVO;
|
||||
* @author Ray
|
||||
* @since 2022/5/29
|
||||
*/
|
||||
public interface SmsCouponService extends IService<SmsCoupon> {
|
||||
public interface CouponService extends IService<Coupon> {
|
||||
|
||||
/**
|
||||
* 优惠券分页列表
|
@ -0,0 +1,11 @@
|
||||
package com.youlai.mall.sms.service;
|
||||
|
||||
import com.youlai.mall.sms.model.entity.CouponSpuCategory;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public interface CouponSpuCategoryService extends IService<CouponSpuCategory> {
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.youlai.mall.sms.service;
|
||||
|
||||
import com.youlai.mall.sms.model.entity.CouponSpu;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public interface CouponSpuService extends IService<CouponSpu> {
|
||||
|
||||
}
|
@ -5,12 +5,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.common.enums.StatusEnum;
|
||||
import com.youlai.mall.sms.converter.AdvertConverter;
|
||||
import com.youlai.mall.sms.model.entity.SmsAdvert;
|
||||
import com.youlai.mall.sms.mapper.SmsAdvertMapper;
|
||||
import com.youlai.mall.sms.model.entity.Advert;
|
||||
import com.youlai.mall.sms.mapper.AdvertMapper;
|
||||
import com.youlai.mall.sms.model.query.AdvertPageQuery;
|
||||
import com.youlai.mall.sms.model.vo.BannerVO;
|
||||
import com.youlai.mall.sms.model.vo.AdvertPageVO;
|
||||
import com.youlai.mall.sms.service.SmsAdvertService;
|
||||
import com.youlai.mall.sms.service.AdvertService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -24,7 +24,7 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SmsAdvertServiceImpl extends ServiceImpl<SmsAdvertMapper, SmsAdvert> implements SmsAdvertService {
|
||||
public class AdvertServiceImpl extends ServiceImpl<AdvertMapper, Advert> implements AdvertService {
|
||||
|
||||
private final AdvertConverter advertConverter;
|
||||
|
||||
@ -36,7 +36,7 @@ public class SmsAdvertServiceImpl extends ServiceImpl<SmsAdvertMapper, SmsAdvert
|
||||
*/
|
||||
@Override
|
||||
public Page<AdvertPageVO> getAdvertPage(AdvertPageQuery queryParams) {
|
||||
Page<SmsAdvert> page = this.baseMapper.getAdvertPage(new Page<>(queryParams.getPageNum(),
|
||||
Page<Advert> page = this.baseMapper.getAdvertPage(new Page<>(queryParams.getPageNum(),
|
||||
queryParams.getPageSize()),
|
||||
queryParams);
|
||||
return advertConverter.entity2PageVo(page);
|
||||
@ -48,9 +48,9 @@ public class SmsAdvertServiceImpl extends ServiceImpl<SmsAdvertMapper, SmsAdvert
|
||||
@Override
|
||||
public List<BannerVO> getBannerList() {
|
||||
|
||||
List<SmsAdvert> entities = this.list(new LambdaQueryWrapper<SmsAdvert>().
|
||||
eq(SmsAdvert::getStatus, StatusEnum.ENABLE.getValue())
|
||||
.select(SmsAdvert::getTitle, SmsAdvert::getImageUrl, SmsAdvert::getRedirectUrl)
|
||||
List<Advert> entities = this.list(new LambdaQueryWrapper<Advert>().
|
||||
eq(Advert::getStatus, StatusEnum.ENABLE.getValue())
|
||||
.select(Advert::getTitle, Advert::getImageUrl, Advert::getRedirectUrl)
|
||||
);
|
||||
return advertConverter.entity2BannerVo(entities);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.youlai.mall.sms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.mall.sms.model.entity.CouponHistory;
|
||||
import com.youlai.mall.sms.service.CouponHistoryService;
|
||||
import com.youlai.mall.sms.mapper.CouponHistoryMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class CouponHistoryServiceImpl extends ServiceImpl<CouponHistoryMapper, CouponHistory>
|
||||
implements CouponHistoryService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -9,16 +9,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.common.base.IBaseEnum;
|
||||
import com.youlai.mall.sms.enums.CouponApplicationScopeEnum;
|
||||
import com.youlai.mall.sms.converter.CouponConverter;
|
||||
import com.youlai.mall.sms.mapper.SmsCouponMapper;
|
||||
import com.youlai.mall.sms.model.entity.SmsCoupon;
|
||||
import com.youlai.mall.sms.model.entity.SmsCouponSpu;
|
||||
import com.youlai.mall.sms.model.entity.SmsCouponSpuCategory;
|
||||
import com.youlai.mall.sms.mapper.CouponMapper;
|
||||
import com.youlai.mall.sms.model.entity.Coupon;
|
||||
import com.youlai.mall.sms.model.entity.CouponSpu;
|
||||
import com.youlai.mall.sms.model.entity.CouponSpuCategory;
|
||||
import com.youlai.mall.sms.model.form.CouponForm;
|
||||
import com.youlai.mall.sms.model.query.CouponPageQuery;
|
||||
import com.youlai.mall.sms.model.vo.CouponPageVO;
|
||||
import com.youlai.mall.sms.service.SmsCouponService;
|
||||
import com.youlai.mall.sms.service.SmsCouponSpuCategoryService;
|
||||
import com.youlai.mall.sms.service.SmsCouponSpuService;
|
||||
import com.youlai.mall.sms.service.CouponService;
|
||||
import com.youlai.mall.sms.service.CouponSpuCategoryService;
|
||||
import com.youlai.mall.sms.service.CouponSpuService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -35,13 +35,13 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SmsCouponServiceImpl extends ServiceImpl<SmsCouponMapper, SmsCoupon> implements SmsCouponService {
|
||||
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements CouponService {
|
||||
|
||||
private final CouponConverter couponConverter;
|
||||
|
||||
private final SmsCouponSpuCategoryService smsCouponSpuCategoryService;
|
||||
private final CouponSpuCategoryService couponSpuCategoryService;
|
||||
|
||||
private final SmsCouponSpuService smsCouponSpuService;
|
||||
private final CouponSpuService couponSpuService;
|
||||
|
||||
/**
|
||||
* 优惠券分页列表
|
||||
@ -53,7 +53,7 @@ public class SmsCouponServiceImpl extends ServiceImpl<SmsCouponMapper, SmsCoupon
|
||||
public Page<CouponPageVO> getCouponPage(CouponPageQuery queryParams) {
|
||||
Page<CouponPageVO> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
|
||||
// 查询数据
|
||||
List<SmsCoupon> couponList = this.baseMapper.getCouponPage(page, queryParams);
|
||||
List<Coupon> couponList = this.baseMapper.getCouponPage(page, queryParams);
|
||||
// 实体转换
|
||||
List<CouponPageVO> records = couponConverter.entity2PageVO(couponList);
|
||||
page.setRecords(records);
|
||||
@ -68,7 +68,7 @@ public class SmsCouponServiceImpl extends ServiceImpl<SmsCouponMapper, SmsCoupon
|
||||
*/
|
||||
@Override
|
||||
public CouponForm getCouponFormData(Long couponId) {
|
||||
SmsCoupon entity = this.getById(couponId);
|
||||
Coupon entity = this.getById(couponId);
|
||||
// 实体转换entity->form
|
||||
CouponForm couponForm = couponConverter.toForm(entity);
|
||||
|
||||
@ -78,17 +78,17 @@ public class SmsCouponServiceImpl extends ServiceImpl<SmsCouponMapper, SmsCoupon
|
||||
if (applicationScopeEnum != null) {
|
||||
switch (applicationScopeEnum) {
|
||||
case SPU_CATEGORY:
|
||||
List<SmsCouponSpuCategory> couponSpuCategoryList = smsCouponSpuCategoryService.list(new LambdaQueryWrapper<SmsCouponSpuCategory>()
|
||||
.eq(SmsCouponSpuCategory::getCouponId, couponId)
|
||||
.select(SmsCouponSpuCategory::getCategoryId)
|
||||
List<CouponSpuCategory> couponSpuCategoryList = couponSpuCategoryService.list(new LambdaQueryWrapper<CouponSpuCategory>()
|
||||
.eq(CouponSpuCategory::getCouponId, couponId)
|
||||
.select(CouponSpuCategory::getCategoryId)
|
||||
);
|
||||
List<Long> categoryIds = couponSpuCategoryList.stream().map(item -> item.getCategoryId()).collect(Collectors.toList());
|
||||
couponForm.setSpuCategoryIds(categoryIds);
|
||||
break;
|
||||
case SPU:
|
||||
List<SmsCouponSpu> couponSpuList = smsCouponSpuService.list(new LambdaQueryWrapper<SmsCouponSpu>()
|
||||
.eq(SmsCouponSpu::getCouponId, couponId)
|
||||
.select(SmsCouponSpu::getSpuId)
|
||||
List<CouponSpu> couponSpuList = couponSpuService.list(new LambdaQueryWrapper<CouponSpu>()
|
||||
.eq(CouponSpu::getCouponId, couponId)
|
||||
.select(CouponSpu::getSpuId)
|
||||
);
|
||||
List<Long> spuIds = couponSpuList.stream().map(item -> item.getSpuId()).collect(Collectors.toList());
|
||||
couponForm.setSpuIds(spuIds);
|
||||
@ -106,7 +106,7 @@ public class SmsCouponServiceImpl extends ServiceImpl<SmsCouponMapper, SmsCoupon
|
||||
*/
|
||||
@Override
|
||||
public boolean saveCoupon(CouponForm couponForm) {
|
||||
SmsCoupon entity = couponConverter.toEntity(couponForm);
|
||||
Coupon entity = couponConverter.toEntity(couponForm);
|
||||
boolean result = this.save(entity);
|
||||
|
||||
if (result) {
|
||||
@ -122,20 +122,20 @@ public class SmsCouponServiceImpl extends ServiceImpl<SmsCouponMapper, SmsCoupon
|
||||
case SPU_CATEGORY:
|
||||
List<Long> spuCategoryIds = couponForm.getSpuCategoryIds();
|
||||
if (CollectionUtil.isNotEmpty(spuCategoryIds)) {
|
||||
List<SmsCouponSpuCategory> smsCouponSpuCategories = spuCategoryIds.stream()
|
||||
.map(spuCategoryId -> new SmsCouponSpuCategory().setCouponId(couponId).setCategoryId(spuCategoryId))
|
||||
List<CouponSpuCategory> smsCouponSpuCategories = spuCategoryIds.stream()
|
||||
.map(spuCategoryId -> new CouponSpuCategory().setCouponId(couponId).setCategoryId(spuCategoryId))
|
||||
.collect(Collectors.toList());
|
||||
smsCouponSpuCategoryService.saveBatch(smsCouponSpuCategories);
|
||||
couponSpuCategoryService.saveBatch(smsCouponSpuCategories);
|
||||
}
|
||||
break;
|
||||
|
||||
case SPU:
|
||||
List<Long> spuIds = couponForm.getSpuIds();
|
||||
if (CollectionUtil.isNotEmpty(spuIds)) {
|
||||
List<SmsCouponSpu> smsCouponSpuList = spuIds.stream()
|
||||
.map(spuId -> new SmsCouponSpu().setCouponId(couponId).setSpuId(spuId))
|
||||
List<CouponSpu> couponSpuList = spuIds.stream()
|
||||
.map(spuId -> new CouponSpu().setCouponId(couponId).setSpuId(spuId))
|
||||
.collect(Collectors.toList());
|
||||
smsCouponSpuService.saveBatch(smsCouponSpuList);
|
||||
couponSpuService.saveBatch(couponSpuList);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -152,7 +152,7 @@ public class SmsCouponServiceImpl extends ServiceImpl<SmsCouponMapper, SmsCoupon
|
||||
*/
|
||||
@Override
|
||||
public boolean updateCoupon(Long couponId, CouponForm couponForm) {
|
||||
SmsCoupon entity = couponConverter.toEntity(couponForm);
|
||||
Coupon entity = couponConverter.toEntity(couponForm);
|
||||
boolean result = this.updateById(entity);
|
||||
|
||||
if (result) {
|
||||
@ -166,37 +166,37 @@ public class SmsCouponServiceImpl extends ServiceImpl<SmsCouponMapper, SmsCoupon
|
||||
Assert.isTrue(applicationScopeEnum != null, "请指定优惠券适用范围");
|
||||
switch (applicationScopeEnum) {
|
||||
case ALL:
|
||||
smsCouponSpuCategoryService.remove(new LambdaQueryWrapper<SmsCouponSpuCategory>()
|
||||
.eq(SmsCouponSpuCategory::getCouponId, couponId)
|
||||
couponSpuCategoryService.remove(new LambdaQueryWrapper<CouponSpuCategory>()
|
||||
.eq(CouponSpuCategory::getCouponId, couponId)
|
||||
);
|
||||
smsCouponSpuService.remove(new LambdaQueryWrapper<SmsCouponSpu>()
|
||||
.eq(SmsCouponSpu::getCouponId, couponId)
|
||||
couponSpuService.remove(new LambdaQueryWrapper<CouponSpu>()
|
||||
.eq(CouponSpu::getCouponId, couponId)
|
||||
);
|
||||
|
||||
break;
|
||||
case SPU_CATEGORY:
|
||||
List<Long> spuCategoryIds = couponForm.getSpuCategoryIds();
|
||||
if (CollectionUtil.isNotEmpty(spuCategoryIds)) {
|
||||
smsCouponSpuCategoryService.remove(new LambdaQueryWrapper<SmsCouponSpuCategory>()
|
||||
.eq(SmsCouponSpuCategory::getCouponId, couponId)
|
||||
couponSpuCategoryService.remove(new LambdaQueryWrapper<CouponSpuCategory>()
|
||||
.eq(CouponSpuCategory::getCouponId, couponId)
|
||||
);
|
||||
List<SmsCouponSpuCategory> smsCouponSpuCategories = spuCategoryIds.stream()
|
||||
.map(spuCategoryId -> new SmsCouponSpuCategory().setCouponId(couponId)
|
||||
List<CouponSpuCategory> smsCouponSpuCategories = spuCategoryIds.stream()
|
||||
.map(spuCategoryId -> new CouponSpuCategory().setCouponId(couponId)
|
||||
.setCategoryId(spuCategoryId))
|
||||
.collect(Collectors.toList());
|
||||
smsCouponSpuCategoryService.saveBatch(smsCouponSpuCategories);
|
||||
couponSpuCategoryService.saveBatch(smsCouponSpuCategories);
|
||||
}
|
||||
break;
|
||||
case SPU:
|
||||
List<Long> spuIds = couponForm.getSpuIds();
|
||||
if (CollectionUtil.isNotEmpty(spuIds)) {
|
||||
smsCouponSpuService.remove(new LambdaQueryWrapper<SmsCouponSpu>()
|
||||
.eq(SmsCouponSpu::getCouponId, couponId)
|
||||
couponSpuService.remove(new LambdaQueryWrapper<CouponSpu>()
|
||||
.eq(CouponSpu::getCouponId, couponId)
|
||||
);
|
||||
List<SmsCouponSpu> smsCouponSpuList = spuIds.stream()
|
||||
.map(spuId -> new SmsCouponSpu().setCouponId(couponId).setSpuId(spuId))
|
||||
List<CouponSpu> couponSpuList = spuIds.stream()
|
||||
.map(spuId -> new CouponSpu().setCouponId(couponId).setSpuId(spuId))
|
||||
.collect(Collectors.toList());
|
||||
smsCouponSpuService.saveBatch(smsCouponSpuList);
|
||||
couponSpuService.saveBatch(couponSpuList);
|
||||
}
|
||||
break;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.youlai.mall.sms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.mall.sms.model.entity.CouponSpuCategory;
|
||||
import com.youlai.mall.sms.service.CouponSpuCategoryService;
|
||||
import com.youlai.mall.sms.mapper.CouponSpuCategoryMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class CouponSpuCategoryServiceImpl extends ServiceImpl<CouponSpuCategoryMapper, CouponSpuCategory>
|
||||
implements CouponSpuCategoryService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.youlai.mall.sms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.mall.sms.model.entity.CouponSpu;
|
||||
import com.youlai.mall.sms.service.CouponSpuService;
|
||||
import com.youlai.mall.sms.mapper.CouponSpuMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class CouponSpuServiceImpl extends ServiceImpl<CouponSpuMapper, CouponSpu>
|
||||
implements CouponSpuService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
spring:
|
||||
application:
|
||||
name: mall-ums
|
||||
name: mall-marketing
|
||||
profiles:
|
||||
active: dev
|
||||
|
@ -2,10 +2,10 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.youlai.mall.sms.mapper.SmsAdvertMapper">
|
||||
<mapper namespace="com.youlai.mall.sms.mapper.AdvertMapper">
|
||||
|
||||
<!-- 广告分页列表 -->
|
||||
<select id="getAdvertPage" resultType="com.youlai.mall.sms.model.entity.SmsAdvert">
|
||||
<select id="getAdvertPage" resultType="com.youlai.mall.sms.model.entity.Advert">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
@ -2,9 +2,9 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.youlai.mall.sms.mapper.SmsCouponHistoryMapper">
|
||||
<mapper namespace="com.youlai.mall.sms.mapper.CouponHistoryMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.youlai.mall.sms.model.entity.SmsCouponHistory">
|
||||
<resultMap id="BaseResultMap" type="com.youlai.mall.sms.model.entity.CouponHistory">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="couponId" column="coupon_id" jdbcType="BIGINT"/>
|
||||
<result property="memberId" column="member_id" jdbcType="BIGINT"/>
|
@ -2,10 +2,10 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.youlai.mall.sms.mapper.SmsCouponMapper">
|
||||
<mapper namespace="com.youlai.mall.sms.mapper.CouponMapper">
|
||||
|
||||
<!-- 优惠券分页列表 -->
|
||||
<select id="getCouponPage" resultType="com.youlai.mall.sms.model.entity.SmsCoupon">
|
||||
<select id="getCouponPage" resultType="com.youlai.mall.sms.model.entity.Coupon">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.youlai.mall.sms.mapper.SmsCouponSpuCategoryMapper">
|
||||
<mapper namespace="com.youlai.mall.sms.mapper.CouponSpuCategoryMapper">
|
||||
|
||||
|
||||
</mapper>
|
@ -2,9 +2,9 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.youlai.mall.sms.mapper.SmsCouponSpuMapper">
|
||||
<mapper namespace="com.youlai.mall.sms.mapper.CouponSpuMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.youlai.mall.sms.model.entity.SmsCouponSpu">
|
||||
<resultMap id="BaseResultMap" type="com.youlai.mall.sms.model.entity.CouponSpu">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="couponId" column="coupon_id" jdbcType="BIGINT"/>
|
||||
<result property="spuId" column="spu_id" jdbcType="BIGINT"/>
|
@ -9,7 +9,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
* @since 2021/7/3
|
||||
*/
|
||||
@SpringBootTest
|
||||
public class SmsApplicationTest {
|
||||
public class MarketingApplicationTest {
|
||||
|
||||
@Test
|
||||
public void contestLoad(){
|
@ -9,12 +9,12 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>mall-sms</artifactId>
|
||||
<artifactId>mall-marketing</artifactId>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>sms-api</module>
|
||||
<module>sms-boot</module>
|
||||
<module>marketing-api</module>
|
||||
<module>marketing-boot</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
@ -3,13 +3,13 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>mall-ums</artifactId>
|
||||
<artifactId>mall-member</artifactId>
|
||||
<groupId>com.youlai</groupId>
|
||||
<version>3.2.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ums-api</artifactId>
|
||||
<artifactId>member-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
@ -1,11 +1,10 @@
|
||||
package com.youlai.mall.ums.api;
|
||||
package com.youlai.mall.member.api;
|
||||
|
||||
import com.youlai.common.result.Result;
|
||||
import com.youlai.common.web.config.FeignDecoderConfig;
|
||||
import com.youlai.mall.ums.dto.CartItemDTO;
|
||||
import com.youlai.mall.ums.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.ums.dto.MemberAuthDTO;
|
||||
import com.youlai.mall.ums.dto.MemberRegisterDTO;
|
||||
import com.youlai.mall.member.dto.CartItemDTO;
|
||||
import com.youlai.mall.member.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.member.dto.MemberAuthDTO;
|
||||
import com.youlai.mall.member.dto.MemberRegisterDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -17,7 +16,7 @@ import java.util.List;
|
||||
* @author Ray
|
||||
* @since 2022/11/29
|
||||
*/
|
||||
@FeignClient(name = "mall-ums", contextId = "member", configuration = {FeignDecoderConfig.class})
|
||||
@FeignClient(name = "mall-member", contextId = "member", configuration = {FeignDecoderConfig.class})
|
||||
public interface MemberFeignClient {
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.dto;
|
||||
package com.youlai.mall.member.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.dto;
|
||||
package com.youlai.mall.member.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.dto;
|
||||
package com.youlai.mall.member.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.dto;
|
||||
package com.youlai.mall.member.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.dto;
|
||||
package com.youlai.mall.member.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.youlai.mall.ums.dto;
|
||||
package com.youlai.mall.member.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema
|
||||
@Data
|
||||
public class RechargeDTO {
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.dto;
|
||||
package com.youlai.mall.member.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -14,7 +14,7 @@ RUN echo "https://mirrors.ustc.edu.cn/alpine/v3.7/main/" > /etc/apk/repositories
|
||||
VOLUME /tmp
|
||||
|
||||
# 复制主机文件至镜像内,复制的目录需放置在 Dockerfile 文件同级目录下
|
||||
ADD target/ums-boot.jar app.jar
|
||||
ADD target/member-boot.jar app.jar
|
||||
|
||||
# 容器启动执行命令
|
||||
CMD java \
|
@ -3,13 +3,13 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>mall-ums</artifactId>
|
||||
<artifactId>mall-member</artifactId>
|
||||
<groupId>com.youlai</groupId>
|
||||
<version>3.2.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ums-boot</artifactId>
|
||||
<artifactId>member-boot</artifactId>
|
||||
|
||||
<properties>
|
||||
<service.port>8801</service.port>
|
||||
@ -80,7 +80,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>com.youlai</groupId>
|
||||
<artifactId>ums-api</artifactId>
|
||||
<artifactId>member-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums;
|
||||
package com.youlai.mall.member;
|
||||
|
||||
import com.youlai.mall.product.api.SkuFeignClient;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@ -9,8 +9,8 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient()
|
||||
@EnableFeignClients(basePackageClasses = { SkuFeignClient.class})
|
||||
public class UmsApplication {
|
||||
public class MemberApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(UmsApplication.class, args);
|
||||
SpringApplication.run(MemberApplication.class, args);
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
package com.youlai.mall.ums.controller.admin;
|
||||
package com.youlai.mall.member.controller.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.youlai.common.constant.GlobalConstants;
|
||||
import com.youlai.common.result.PageResult;
|
||||
import com.youlai.common.result.Result;
|
||||
import com.youlai.mall.ums.model.entity.UmsMember;
|
||||
import com.youlai.mall.ums.model.query.MemberPageQuery;
|
||||
import com.youlai.mall.ums.model.vo.MemberPageVO;
|
||||
import com.youlai.mall.ums.service.UmsMemberService;
|
||||
import com.youlai.mall.member.model.entity.Member;
|
||||
import com.youlai.mall.member.model.query.MemberPageQuery;
|
||||
import com.youlai.mall.member.model.vo.MemberPageVO;
|
||||
import com.youlai.mall.member.service.MemberService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -24,7 +24,7 @@ import java.util.Arrays;
|
||||
@RequiredArgsConstructor
|
||||
public class MemberController {
|
||||
|
||||
private final UmsMemberService memberService;
|
||||
private final MemberService memberService;
|
||||
|
||||
@Operation(summary= "会员分页列表")
|
||||
@GetMapping("/page")
|
||||
@ -37,7 +37,7 @@ public class MemberController {
|
||||
@PutMapping(value = "/{memberId}")
|
||||
public <T> Result<T> update(
|
||||
@Parameter(description = "会员ID") @PathVariable Long memberId,
|
||||
@RequestBody UmsMember member
|
||||
@RequestBody Member member
|
||||
) {
|
||||
boolean status = memberService.updateById(member);
|
||||
return Result.judge(status);
|
||||
@ -47,12 +47,12 @@ public class MemberController {
|
||||
@PatchMapping("/{memberId}/status")
|
||||
public <T> Result<T> updateMemberStatus(
|
||||
@Parameter(description = "会员ID") @PathVariable Long memberId,
|
||||
@RequestBody UmsMember member
|
||||
@RequestBody Member member
|
||||
) {
|
||||
boolean status = memberService.update(
|
||||
new LambdaUpdateWrapper<UmsMember>()
|
||||
.eq(UmsMember::getId, memberId)
|
||||
.set(UmsMember::getStatus, member.getStatus())
|
||||
new LambdaUpdateWrapper<Member>()
|
||||
.eq(Member::getId, memberId)
|
||||
.set(Member::getStatus, member.getStatus())
|
||||
);
|
||||
return Result.judge(status);
|
||||
}
|
||||
@ -62,9 +62,9 @@ public class MemberController {
|
||||
public <T> Result<T> delete(
|
||||
@Parameter(description = "会员ID,多个以英文逗号(,)拼接") @PathVariable String ids
|
||||
) {
|
||||
boolean status = memberService.update(new LambdaUpdateWrapper<UmsMember>()
|
||||
.in(UmsMember::getId, Arrays.asList(ids.split(",")))
|
||||
.set(UmsMember::getIsDeleted, GlobalConstants.STATUS_YES));
|
||||
boolean status = memberService.update(new LambdaUpdateWrapper<Member>()
|
||||
.in(Member::getId, Arrays.asList(ids.split(",")))
|
||||
.set(Member::getIsDeleted, GlobalConstants.STATUS_YES));
|
||||
return Result.judge(status);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.youlai.mall.ums.controller.app;
|
||||
package com.youlai.mall.member.controller.app;
|
||||
|
||||
import com.youlai.common.result.Result;
|
||||
import com.youlai.mall.ums.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.ums.model.entity.UmsAddress;
|
||||
import com.youlai.mall.ums.model.form.AddressForm;
|
||||
import com.youlai.mall.ums.service.UmsAddressService;
|
||||
import com.youlai.mall.member.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.member.model.entity.Address;
|
||||
import com.youlai.mall.member.model.form.AddressForm;
|
||||
import com.youlai.mall.member.service.AddressService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -19,9 +19,9 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/app-api/v1/addresses")
|
||||
@RequiredArgsConstructor
|
||||
public class AppAddressController {
|
||||
public class AddressController {
|
||||
|
||||
private final UmsAddressService addressService;
|
||||
private final AddressService addressService;
|
||||
|
||||
@Operation(summary= "获取当前会员地址列表")
|
||||
@GetMapping
|
||||
@ -32,11 +32,11 @@ public class AppAddressController {
|
||||
|
||||
@Operation(summary= "获取地址详情")
|
||||
@GetMapping("/{addressId}")
|
||||
public Result<UmsAddress> getAddressDetail(
|
||||
public Result<Address> getAddressDetail(
|
||||
@Parameter(description = "地址ID") @PathVariable Long addressId
|
||||
) {
|
||||
UmsAddress umsAddress = addressService.getById(addressId);
|
||||
return Result.success(umsAddress);
|
||||
Address address = addressService.getById(addressId);
|
||||
return Result.success(address);
|
||||
}
|
||||
|
||||
@Operation(summary= "新增地址")
|
@ -1,9 +1,9 @@
|
||||
package com.youlai.mall.ums.controller.app;
|
||||
package com.youlai.mall.member.controller.app;
|
||||
|
||||
import com.youlai.common.result.Result;
|
||||
import com.youlai.common.security.util.SecurityUtils;
|
||||
import com.youlai.mall.ums.dto.CartItemDTO;
|
||||
import com.youlai.mall.ums.service.CartService;
|
||||
import com.youlai.mall.member.dto.CartItemDTO;
|
||||
import com.youlai.mall.member.service.CartService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -24,7 +24,7 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/app-api/v1/cart-items")
|
||||
@RequiredArgsConstructor
|
||||
public class AppCartController {
|
||||
public class CartController {
|
||||
|
||||
private final CartService cartService;
|
||||
|
@ -1,14 +1,14 @@
|
||||
package com.youlai.mall.ums.controller.app;
|
||||
package com.youlai.mall.member.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.youlai.common.result.Result;
|
||||
import com.youlai.common.security.util.SecurityUtils;
|
||||
import com.youlai.mall.ums.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.ums.dto.MemberAuthDTO;
|
||||
import com.youlai.mall.ums.dto.MemberRegisterDTO;
|
||||
import com.youlai.mall.ums.model.dto.MemberDTO;
|
||||
import com.youlai.mall.ums.model.entity.UmsMember;
|
||||
import com.youlai.mall.ums.service.UmsMemberService;
|
||||
import com.youlai.mall.member.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.member.dto.MemberAuthDTO;
|
||||
import com.youlai.mall.member.dto.MemberRegisterDTO;
|
||||
import com.youlai.mall.member.model.dto.MemberDTO;
|
||||
import com.youlai.mall.member.model.entity.Member;
|
||||
import com.youlai.mall.member.service.MemberService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -21,18 +21,18 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/app-api/v1/members")
|
||||
@RequiredArgsConstructor
|
||||
public class AppMemberController {
|
||||
public class MemberAppController {
|
||||
|
||||
private final UmsMemberService memberService;
|
||||
private final MemberService memberService;
|
||||
|
||||
@Operation(summary = "根据会员ID获取OpenId")
|
||||
@GetMapping("/{memberId}/openid")
|
||||
public Result<String> getMemberOpenId(
|
||||
@Parameter(description = "会员ID") @PathVariable Long memberId
|
||||
) {
|
||||
UmsMember member = memberService.getOne(new LambdaQueryWrapper<UmsMember>()
|
||||
.eq(UmsMember::getId, memberId)
|
||||
.select(UmsMember::getOpenid));
|
||||
Member member = memberService.getOne(new LambdaQueryWrapper<Member>()
|
||||
.eq(Member::getId, memberId)
|
||||
.select(Member::getOpenid));
|
||||
String openid = member.getOpenid();
|
||||
return Result.success(openid);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.youlai.mall.member.convert;
|
||||
|
||||
import com.youlai.mall.member.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.member.model.entity.Address;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员地址对象转换器
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2022/6/21 23:52
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface AddressConvert {
|
||||
|
||||
MemberAddressDTO entity2Dto(Address entity);
|
||||
|
||||
List<MemberAddressDTO> entity2Dto(List<Address> entities);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
|
||||
package com.youlai.mall.member.convert;
|
||||
|
||||
import com.youlai.mall.member.model.cache.CartItemCache;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 购物车对象转化器
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface CartConverter {
|
||||
|
||||
|
||||
com.youlai.mall.member.dto.CartItemDTO convertToDto(CartItemCache cache);
|
||||
|
||||
List<com.youlai.mall.member.dto.CartItemDTO> convertToDto(List<CartItemCache> caches);
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.youlai.mall.ums.convert;
|
||||
package com.youlai.mall.member.convert;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.mall.ums.dto.MemberAuthDTO;
|
||||
import com.youlai.mall.ums.dto.MemberRegisterDTO;
|
||||
import com.youlai.mall.ums.model.bo.MemberBO;
|
||||
import com.youlai.mall.ums.model.entity.UmsMember;
|
||||
import com.youlai.mall.ums.model.vo.MemberPageVO;
|
||||
import com.youlai.mall.member.dto.MemberAuthDTO;
|
||||
import com.youlai.mall.member.dto.MemberRegisterDTO;
|
||||
import com.youlai.mall.member.model.bo.MemberBO;
|
||||
import com.youlai.mall.member.model.entity.Member;
|
||||
import com.youlai.mall.member.model.vo.MemberPageVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
@ -22,14 +21,14 @@ public interface MemberConvert {
|
||||
@Mappings({
|
||||
@Mapping(target = "username", source = "openid")
|
||||
})
|
||||
MemberAuthDTO entity2OpenidAuthDTO(UmsMember entity);
|
||||
MemberAuthDTO entity2OpenidAuthDTO(Member entity);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "username", source = "mobile")
|
||||
})
|
||||
MemberAuthDTO entity2MobileAuthDTO(UmsMember entity);
|
||||
MemberAuthDTO entity2MobileAuthDTO(Member entity);
|
||||
|
||||
UmsMember registerDto2Entity(MemberRegisterDTO memberRegisterDTO);
|
||||
Member registerDto2Entity(MemberRegisterDTO memberRegisterDTO);
|
||||
|
||||
|
||||
@Mappings({
|
@ -1,9 +1,9 @@
|
||||
package com.youlai.mall.ums.listener;
|
||||
package com.youlai.mall.member.listener;
|
||||
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import com.youlai.common.rabbitmq.constant.RabbitMqConstants;
|
||||
import com.youlai.mall.ums.service.CartService;
|
||||
import com.youlai.mall.member.service.CartService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
@ -1,8 +1,8 @@
|
||||
package com.youlai.mall.ums.mapper;
|
||||
package com.youlai.mall.member.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.youlai.mall.ums.model.bo.AddressBO;
|
||||
import com.youlai.mall.ums.model.entity.UmsAddress;
|
||||
import com.youlai.mall.member.model.bo.AddressBO;
|
||||
import com.youlai.mall.member.model.entity.Address;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@ -14,7 +14,7 @@ import java.util.List;
|
||||
* @since 2024/4/8
|
||||
*/
|
||||
@Mapper
|
||||
public interface UmsAddressMapper extends BaseMapper<UmsAddress> {
|
||||
public interface AddressMapper extends BaseMapper<Address> {
|
||||
|
||||
|
||||
/**
|
@ -1,18 +1,12 @@
|
||||
package com.youlai.mall.ums.mapper;
|
||||
package com.youlai.mall.member.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.mall.ums.model.bo.MemberBO;
|
||||
import com.youlai.mall.ums.model.entity.UmsMember;
|
||||
import com.youlai.mall.ums.model.query.MemberPageQuery;
|
||||
import org.apache.ibatis.annotations.Many;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import com.youlai.mall.member.model.bo.MemberBO;
|
||||
import com.youlai.mall.member.model.entity.Member;
|
||||
import com.youlai.mall.member.model.query.MemberPageQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 会员访问层
|
||||
@ -21,7 +15,7 @@ import java.util.List;
|
||||
* @since 2024/4/7
|
||||
*/
|
||||
@Mapper
|
||||
public interface UmsMemberMapper extends BaseMapper<UmsMember> {
|
||||
public interface MemberMapper extends BaseMapper<Member> {
|
||||
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.model.bo;
|
||||
package com.youlai.mall.member.model.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.model.bo;
|
||||
package com.youlai.mall.member.model.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.model.dto;
|
||||
package com.youlai.mall.member.model.cache;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.model.dto;
|
||||
package com.youlai.mall.member.model.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
@ -1,9 +1,11 @@
|
||||
package com.youlai.mall.ums.model.entity;
|
||||
package com.youlai.mall.member.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.youlai.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 会员地址实体类
|
||||
@ -11,8 +13,10 @@ import lombok.Data;
|
||||
* @author Ray Hao
|
||||
* @since 2022/2/12
|
||||
*/
|
||||
@Data
|
||||
public class UmsAddress extends BaseEntity {
|
||||
@TableName("ums_address")
|
||||
@Getter
|
||||
@Setter
|
||||
public class Address extends BaseEntity {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.model.entity;
|
||||
package com.youlai.mall.member.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.youlai.common.base.BaseEntity;
|
||||
@ -13,7 +13,7 @@ import java.time.LocalDate;
|
||||
* @since 2022/2/12
|
||||
*/
|
||||
@Data
|
||||
public class UmsMember extends BaseEntity {
|
||||
public class Member extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 会员性别
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.model.form;
|
||||
package com.youlai.mall.member.model.form;
|
||||
|
||||
import com.youlai.common.web.constraint.CheckCityValid;
|
||||
import com.youlai.common.web.constraint.CityType;
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.model.query;
|
||||
package com.youlai.mall.member.model.query;
|
||||
|
||||
import com.youlai.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
@ -1,6 +1,6 @@
|
||||
package com.youlai.mall.ums.model.vo;
|
||||
package com.youlai.mall.member.model.vo;
|
||||
|
||||
import com.youlai.mall.ums.model.bo.AddressBO;
|
||||
import com.youlai.mall.member.model.bo.AddressBO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.youlai.mall.ums.service;
|
||||
package com.youlai.mall.member.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.mall.ums.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.ums.model.entity.UmsAddress;
|
||||
import com.youlai.mall.ums.model.form.AddressForm;
|
||||
import com.youlai.mall.member.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.member.model.entity.Address;
|
||||
import com.youlai.mall.member.model.form.AddressForm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -14,7 +14,7 @@ import java.util.List;
|
||||
* @author Ray
|
||||
* @since 2022/2/12
|
||||
*/
|
||||
public interface UmsAddressService extends IService<UmsAddress> {
|
||||
public interface AddressService extends IService<Address> {
|
||||
|
||||
/**
|
||||
* 新增地址
|
@ -1,7 +1,7 @@
|
||||
package com.youlai.mall.ums.service;
|
||||
package com.youlai.mall.member.service;
|
||||
|
||||
|
||||
import com.youlai.mall.ums.dto.CartItemDTO;
|
||||
import com.youlai.mall.member.dto.CartItemDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,15 +1,15 @@
|
||||
package com.youlai.mall.ums.service;
|
||||
package com.youlai.mall.member.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.mall.ums.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.ums.dto.MemberAuthDTO;
|
||||
import com.youlai.mall.ums.dto.MemberRegisterDTO;
|
||||
import com.youlai.mall.ums.model.dto.MemberDTO;
|
||||
import com.youlai.mall.ums.model.entity.UmsMember;
|
||||
import com.youlai.mall.ums.model.query.MemberPageQuery;
|
||||
import com.youlai.mall.ums.model.vo.MemberPageVO;
|
||||
import com.youlai.mall.member.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.member.dto.MemberAuthDTO;
|
||||
import com.youlai.mall.member.dto.MemberRegisterDTO;
|
||||
import com.youlai.mall.member.model.dto.MemberDTO;
|
||||
import com.youlai.mall.member.model.entity.Member;
|
||||
import com.youlai.mall.member.model.query.MemberPageQuery;
|
||||
import com.youlai.mall.member.model.vo.MemberPageVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -19,7 +19,7 @@ import java.util.List;
|
||||
* @author Ray
|
||||
* @since 2022/2/12
|
||||
*/
|
||||
public interface UmsMemberService extends IService<UmsMember> {
|
||||
public interface MemberService extends IService<Member> {
|
||||
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.service.impl;
|
||||
package com.youlai.mall.member.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -6,11 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.common.constant.GlobalConstants;
|
||||
import com.youlai.common.security.util.SecurityUtils;
|
||||
import com.youlai.mall.ums.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.ums.mapper.UmsAddressMapper;
|
||||
import com.youlai.mall.ums.model.entity.UmsAddress;
|
||||
import com.youlai.mall.ums.model.form.AddressForm;
|
||||
import com.youlai.mall.ums.service.UmsAddressService;
|
||||
import com.youlai.mall.member.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.member.mapper.AddressMapper;
|
||||
import com.youlai.mall.member.model.entity.Address;
|
||||
import com.youlai.mall.member.model.form.AddressForm;
|
||||
import com.youlai.mall.member.service.AddressService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -26,7 +26,7 @@ import java.util.stream.Collectors;
|
||||
* @since 2022/2/12
|
||||
*/
|
||||
@Service
|
||||
public class UmsAddressServiceImpl extends ServiceImpl<UmsAddressMapper, UmsAddress> implements UmsAddressService {
|
||||
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements AddressService {
|
||||
|
||||
/**
|
||||
* 新增地址
|
||||
@ -39,18 +39,18 @@ public class UmsAddressServiceImpl extends ServiceImpl<UmsAddressMapper, UmsAddr
|
||||
public boolean addAddress(AddressForm addressForm) {
|
||||
Long memberId = SecurityUtils.getMemberId();
|
||||
|
||||
UmsAddress umsAddress = new UmsAddress();
|
||||
BeanUtil.copyProperties(addressForm, umsAddress);
|
||||
umsAddress.setMemberId(memberId);
|
||||
boolean result = this.save(umsAddress);
|
||||
Address address = new Address();
|
||||
BeanUtil.copyProperties(addressForm, address);
|
||||
address.setMemberId(memberId);
|
||||
boolean result = this.save(address);
|
||||
if (result) {
|
||||
// 修改其他默认地址为非默认
|
||||
if (GlobalConstants.STATUS_YES.equals(addressForm.getIsDefault())) {
|
||||
this.update(new LambdaUpdateWrapper<UmsAddress>()
|
||||
.eq(UmsAddress::getMemberId, memberId)
|
||||
.eq(UmsAddress::getIsDefault, 1)
|
||||
.ne(UmsAddress::getId,umsAddress.getId())
|
||||
.set(UmsAddress::getIsDefault, 0)
|
||||
this.update(new LambdaUpdateWrapper<Address>()
|
||||
.eq(Address::getMemberId, memberId)
|
||||
.eq(Address::getIsDefault, 1)
|
||||
.ne(Address::getId, address.getId())
|
||||
.set(Address::getIsDefault, 0)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -67,19 +67,19 @@ public class UmsAddressServiceImpl extends ServiceImpl<UmsAddressMapper, UmsAddr
|
||||
public boolean updateAddress(AddressForm addressForm) {
|
||||
Long memberId = SecurityUtils.getMemberId();
|
||||
|
||||
UmsAddress umsAddress = new UmsAddress();
|
||||
BeanUtil.copyProperties(addressForm, umsAddress);
|
||||
Address address = new Address();
|
||||
BeanUtil.copyProperties(addressForm, address);
|
||||
|
||||
boolean result = this.updateById(umsAddress);
|
||||
boolean result = this.updateById(address);
|
||||
|
||||
if(result){
|
||||
// 修改其他默认地址为非默认
|
||||
if (GlobalConstants.STATUS_YES.equals(addressForm.getIsDefault())) {
|
||||
this.update(new LambdaUpdateWrapper<UmsAddress>()
|
||||
.eq(UmsAddress::getMemberId, memberId)
|
||||
.eq(UmsAddress::getIsDefault, 1)
|
||||
.ne(UmsAddress::getId, umsAddress.getId())
|
||||
.set(UmsAddress::getIsDefault, 0)
|
||||
this.update(new LambdaUpdateWrapper<Address>()
|
||||
.eq(Address::getMemberId, memberId)
|
||||
.eq(Address::getIsDefault, 1)
|
||||
.ne(Address::getId, address.getId())
|
||||
.set(Address::getIsDefault, 0)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -94,11 +94,11 @@ public class UmsAddressServiceImpl extends ServiceImpl<UmsAddressMapper, UmsAddr
|
||||
@Override
|
||||
public List<MemberAddressDTO> listCurrentMemberAddresses() {
|
||||
Long memberId = SecurityUtils.getMemberId();
|
||||
List<UmsAddress> umsAddressList = this.list(new LambdaQueryWrapper<UmsAddress>()
|
||||
.eq(UmsAddress::getMemberId, memberId)
|
||||
.orderByDesc(UmsAddress::getIsDefault) // 默认地址排在首位
|
||||
List<Address> addressList = this.list(new LambdaQueryWrapper<Address>()
|
||||
.eq(Address::getMemberId, memberId)
|
||||
.orderByDesc(Address::getIsDefault) // 默认地址排在首位
|
||||
);
|
||||
List<MemberAddressDTO> memberAddressList = Optional.ofNullable(umsAddressList).orElse(new ArrayList<>()).stream()
|
||||
List<MemberAddressDTO> memberAddressList = Optional.ofNullable(addressList).orElse(new ArrayList<>()).stream()
|
||||
.map(umsAddress -> {
|
||||
MemberAddressDTO memberAddressDTO = new MemberAddressDTO();
|
||||
BeanUtil.copyProperties(umsAddress, memberAddressDTO);
|
@ -1,14 +1,14 @@
|
||||
package com.youlai.mall.ums.service.impl;
|
||||
package com.youlai.mall.member.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.youlai.common.constant.RedisConstants;
|
||||
import com.youlai.common.security.util.SecurityUtils;
|
||||
import com.youlai.mall.member.dto.CartItemDTO;
|
||||
import com.youlai.mall.product.api.SkuFeignClient;
|
||||
import com.youlai.mall.product.model.dto.SkuDTO;
|
||||
import com.youlai.mall.ums.convert.CartConverter;
|
||||
import com.youlai.mall.ums.model.dto.CartItemCache;
|
||||
import com.youlai.mall.ums.dto.CartItemDTO;
|
||||
import com.youlai.mall.ums.service.CartService;
|
||||
import com.youlai.mall.member.convert.CartConverter;
|
||||
import com.youlai.mall.member.model.cache.CartItemCache;
|
||||
import com.youlai.mall.member.service.CartService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.BoundHashOperations;
|
||||
@ -54,7 +54,7 @@ public class CartServiceImpl implements CartService {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<CartItemDTO> cartItems = cartConverter.cartItemCacheToVo(cartItemCaches);
|
||||
List<CartItemDTO> cartItems = cartConverter.convertToDto(cartItemCaches);
|
||||
|
||||
// 动态获取商品信息(实时商品价格、库存、图片)到购物车列表
|
||||
List<Long> skuIds = cartItems.stream().map(CartItemDTO::getSkuId).toList();
|
@ -1,4 +1,4 @@
|
||||
package com.youlai.mall.ums.service.impl;
|
||||
package com.youlai.mall.member.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
@ -9,20 +9,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.common.result.ResultCode;
|
||||
import com.youlai.common.security.util.SecurityUtils;
|
||||
import com.youlai.common.web.exception.BizException;
|
||||
import com.youlai.mall.ums.convert.AddressConvert;
|
||||
import com.youlai.mall.ums.convert.MemberConvert;
|
||||
import com.youlai.mall.ums.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.ums.dto.MemberAuthDTO;
|
||||
import com.youlai.mall.ums.dto.MemberRegisterDTO;
|
||||
import com.youlai.mall.ums.mapper.UmsMemberMapper;
|
||||
import com.youlai.mall.ums.model.bo.MemberBO;
|
||||
import com.youlai.mall.ums.model.entity.UmsAddress;
|
||||
import com.youlai.mall.ums.model.entity.UmsMember;
|
||||
import com.youlai.mall.ums.model.dto.MemberDTO;
|
||||
import com.youlai.mall.ums.model.query.MemberPageQuery;
|
||||
import com.youlai.mall.ums.model.vo.MemberPageVO;
|
||||
import com.youlai.mall.ums.service.UmsAddressService;
|
||||
import com.youlai.mall.ums.service.UmsMemberService;
|
||||
import com.youlai.mall.member.convert.AddressConvert;
|
||||
import com.youlai.mall.member.convert.MemberConvert;
|
||||
import com.youlai.mall.member.dto.MemberAddressDTO;
|
||||
import com.youlai.mall.member.dto.MemberAuthDTO;
|
||||
import com.youlai.mall.member.dto.MemberRegisterDTO;
|
||||
import com.youlai.mall.member.mapper.MemberMapper;
|
||||
import com.youlai.mall.member.model.bo.MemberBO;
|
||||
import com.youlai.mall.member.model.entity.Address;
|
||||
import com.youlai.mall.member.model.entity.Member;
|
||||
import com.youlai.mall.member.model.dto.MemberDTO;
|
||||
import com.youlai.mall.member.model.query.MemberPageQuery;
|
||||
import com.youlai.mall.member.model.vo.MemberPageVO;
|
||||
import com.youlai.mall.member.service.AddressService;
|
||||
import com.youlai.mall.member.service.MemberService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -38,10 +38,10 @@ import java.util.List;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember> implements UmsMemberService {
|
||||
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {
|
||||
|
||||
|
||||
private final UmsAddressService addressService;
|
||||
private final AddressService addressService;
|
||||
private final MemberConvert memberConvert;
|
||||
private final AddressConvert addressConvert;
|
||||
|
||||
@ -67,11 +67,11 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
|
||||
*/
|
||||
@Override
|
||||
public MemberAuthDTO getMemberByOpenid(String openid) {
|
||||
UmsMember entity = this.getOne(new LambdaQueryWrapper<UmsMember>()
|
||||
.eq(UmsMember::getOpenid, openid)
|
||||
.select(UmsMember::getId,
|
||||
UmsMember::getOpenid,
|
||||
UmsMember::getStatus
|
||||
Member entity = this.getOne(new LambdaQueryWrapper<Member>()
|
||||
.eq(Member::getOpenid, openid)
|
||||
.select(Member::getId,
|
||||
Member::getOpenid,
|
||||
Member::getStatus
|
||||
)
|
||||
);
|
||||
|
||||
@ -89,11 +89,11 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
|
||||
*/
|
||||
@Override
|
||||
public MemberAuthDTO getMemberByMobile(String mobile) {
|
||||
UmsMember entity = this.getOne(new LambdaQueryWrapper<UmsMember>()
|
||||
.eq(UmsMember::getMobile, mobile)
|
||||
.select(UmsMember::getId,
|
||||
UmsMember::getMobile,
|
||||
UmsMember::getStatus
|
||||
Member entity = this.getOne(new LambdaQueryWrapper<Member>()
|
||||
.eq(Member::getMobile, mobile)
|
||||
.select(Member::getId,
|
||||
Member::getMobile,
|
||||
Member::getStatus
|
||||
)
|
||||
);
|
||||
|
||||
@ -108,7 +108,7 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
|
||||
*/
|
||||
@Override
|
||||
public Long addMember(MemberRegisterDTO registerDto) {
|
||||
UmsMember entity = memberConvert.registerDto2Entity(registerDto);
|
||||
Member entity = memberConvert.registerDto2Entity(registerDto);
|
||||
boolean result = this.save(entity);
|
||||
Assert.isTrue(result, "注册新增会员失败");
|
||||
return entity.getId();
|
||||
@ -120,17 +120,17 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
|
||||
@Override
|
||||
public MemberDTO getCurrMemberInfo() {
|
||||
Long memberId = SecurityUtils.getMemberId();
|
||||
UmsMember umsMember = this.getOne(new LambdaQueryWrapper<UmsMember>()
|
||||
.eq(UmsMember::getId, memberId)
|
||||
.select(UmsMember::getId,
|
||||
UmsMember::getNickName,
|
||||
UmsMember::getAvatarUrl,
|
||||
UmsMember::getMobile,
|
||||
UmsMember::getBalance
|
||||
Member member = this.getOne(new LambdaQueryWrapper<Member>()
|
||||
.eq(Member::getId, memberId)
|
||||
.select(Member::getId,
|
||||
Member::getNickName,
|
||||
Member::getAvatarUrl,
|
||||
Member::getMobile,
|
||||
Member::getBalance
|
||||
)
|
||||
);
|
||||
MemberDTO memberDTO = new MemberDTO();
|
||||
BeanUtil.copyProperties(umsMember, memberDTO);
|
||||
BeanUtil.copyProperties(member, memberDTO);
|
||||
return memberDTO;
|
||||
}
|
||||
|
||||
@ -142,8 +142,8 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
|
||||
*/
|
||||
@Override
|
||||
public List<MemberAddressDTO> listMemberAddress(Long memberId) {
|
||||
List<UmsAddress> entities = addressService.list(new LambdaQueryWrapper<UmsAddress>()
|
||||
.eq(UmsAddress::getMemberId, memberId)
|
||||
List<Address> entities = addressService.list(new LambdaQueryWrapper<Address>()
|
||||
.eq(Address::getMemberId, memberId)
|
||||
);
|
||||
return addressConvert.entity2Dto(entities);
|
||||
}
|
||||
@ -157,7 +157,7 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
|
||||
*/
|
||||
@Override
|
||||
public boolean deductMemberBalance(Long memberId, Long deductionAmount) {
|
||||
UmsMember member = this.getById(memberId);
|
||||
Member member = this.getById(memberId);
|
||||
Assert.isTrue(member.getBalance() >= deductionAmount, "会员账户余额不足");
|
||||
member.setBalance(member.getBalance() - deductionAmount);
|
||||
return this.updateById(member);
|
@ -1,6 +1,5 @@
|
||||
spring:
|
||||
application:
|
||||
name: mall-sms
|
||||
name: mall-member
|
||||
profiles:
|
||||
active: dev
|
||||
|
@ -5,7 +5,7 @@
|
||||
<mapper namespace="com.youlai.mall.ums.mapper.UmsAddressMapper">
|
||||
|
||||
<!-- 根据会员ID获取地址列表 -->
|
||||
<select id="listAddressesByMemberId" resultType="com.youlai.mall.ums.model.bo.AddressBO">
|
||||
<select id="listAddressesByMemberId" resultType="com.youlai.mall.member.model.bo.AddressBO">
|
||||
SELECT
|
||||
id,
|
||||
member_id,
|
@ -4,10 +4,10 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.youlai.mall.ums.mapper.UmsMemberMapper">
|
||||
|
||||
<resultMap id="MemberPageResultMap" type="com.youlai.mall.ums.model.bo.MemberBO">
|
||||
<resultMap id="MemberPageResultMap" type="com.youlai.mall.member.model.bo.MemberBO">
|
||||
<collection property="addresses"
|
||||
column="{memberId=id}"
|
||||
select="com.youlai.mall.ums.mapper.UmsAddressMapper$listAddressesByMemberId">
|
||||
select="com.youlai.mall.member.mapper.AddressMapper$listAddressesByMemberId">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
@ -9,11 +9,11 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>mall-ums</artifactId>
|
||||
<artifactId>mall-member</artifactId>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>ums-api</module>
|
||||
<module>ums-boot</module>
|
||||
<module>member-api</module>
|
||||
<module>member-boot</module>
|
||||
</modules>
|
||||
</project>
|
@ -55,7 +55,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>com.youlai</groupId>
|
||||
<artifactId>ums-api</artifactId>
|
||||
<artifactId>member-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.youlai.mall.order;
|
||||
|
||||
import com.youlai.mall.product.api.SkuFeignClient;
|
||||
import com.youlai.mall.ums.api.MemberFeignClient;
|
||||
import com.youlai.mall.member.api.MemberFeignClient;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user