活动优惠模块
This commit is contained in:
parent
c8610f2b3e
commit
ba828626c8
@ -25,7 +25,7 @@ public class CodeGet {
|
||||
// 2、全局配置
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
gc.setOutputDir("guigu-ssyx-parent/service/service-product" + "/src/main/java");
|
||||
gc.setOutputDir("guigu-ssyx-parent/service/service-activity" + "/src/main/java");
|
||||
|
||||
gc.setServiceName("%sService"); //去掉Service接口的首字母I
|
||||
gc.setAuthor("atguigu");
|
||||
@ -34,17 +34,17 @@ public class CodeGet {
|
||||
|
||||
// 3、数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl("jdbc:mysql://82.157.68.223:3306/shequ-product?serverTimezone=GMT%2B8&useSSL=false");
|
||||
dsc.setUrl("jdbc:mysql://82.157.68.223:3306/shequ-activity?serverTimezone=GMT%2B8&useSSL=false");
|
||||
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
|
||||
dsc.setUsername("shequ-product");
|
||||
dsc.setPassword("shequ-product");
|
||||
dsc.setUsername("shequ-activity");
|
||||
dsc.setPassword("shequ-activity");
|
||||
dsc.setDbType(DbType.MYSQL);
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 4、包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
pc.setParent("com.atguigu.ssyx");
|
||||
pc.setModuleName("product"); //模块名
|
||||
pc.setModuleName("activity"); //模块名
|
||||
pc.setController("controller");
|
||||
pc.setService("service");
|
||||
pc.setMapper("mapper");
|
||||
@ -53,7 +53,7 @@ public class CodeGet {
|
||||
// 5、策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
|
||||
strategy.setInclude("attr", "attr_group", "category", "comment", "base_category_trademark", "comment_replay", "mq_repeat_record", "region_ware", "sku_attr_value", "sku_detail", "sku_image", "sku_info", "sku_poster", "sku_stock_history", "ware");
|
||||
strategy.setInclude("activity_info", "activity_rule", "activity_sku", "coupon_info", "coupon_range", "coupon_use", "home_subject", "home_subject_sku", "seckill", "seckill_sku", "seckill_sku_notice", "seckill_time", "sku_info");
|
||||
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略
|
||||
|
||||
|
@ -0,0 +1,82 @@
|
||||
package com.atguigu.ssyx.model.activity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class HomeSubject implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 专题名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 专题标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 专题副标题
|
||||
*/
|
||||
private String subTitle;
|
||||
|
||||
/**
|
||||
* 显示状态
|
||||
*/
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 详情连接
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 专题图片地址
|
||||
*/
|
||||
private String img;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记(0:不可用 1:可用)
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.atguigu.ssyx.model.activity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题商品
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class HomeSubjectSku implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 专题名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 专题id
|
||||
*/
|
||||
private Long subjectId;
|
||||
|
||||
/**
|
||||
* sku_id
|
||||
*/
|
||||
private Long skuId;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记(0:不可用 1:可用)
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
}
|
@ -5,6 +5,9 @@ import com.atguigu.ssyx.model.product.SkuInfo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ClassName: ProductFeignClient
|
||||
@ -21,4 +24,23 @@ public interface ProductFeignClient {
|
||||
|
||||
@GetMapping("/api/product/inner/getSkuInfo/{skuId}")
|
||||
SkuInfo getSkuInfo(@PathVariable("skuId") Long skuId);
|
||||
|
||||
/**
|
||||
* 根据关键字匹配sku列表
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/api/product/inner/findSkuInfoByKeyword/{keyword}")
|
||||
List<SkuInfo> findSkuInfoByKeyword(@PathVariable("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* 根据skuid列表得到sku信息列表
|
||||
*
|
||||
* @param skuIdList
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/api/product/inner/findSkuInfoList")
|
||||
List<SkuInfo> findSkuInfoList(@RequestBody List<Long> skuIdList);
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
<module>service-sys</module>
|
||||
<module>service-product</module>
|
||||
<module>service-search</module>
|
||||
<module>service-activity</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
28
guigu-ssyx-parent/service/service-activity/pom.xml
Normal file
28
guigu-ssyx-parent/service/service-activity/pom.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>service</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>service-activity</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>service-product-client</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
@ -0,0 +1,23 @@
|
||||
package com.atguigu.ssyx;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* ClassName: ServiceActivityApplication
|
||||
* Package: com.atguigu.ssyx
|
||||
*
|
||||
* @author yovinchen
|
||||
* @Create 2023/9/17 12:08
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients
|
||||
public class ServiceActivityApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ServiceActivityApplication.class, args);
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import com.atguigu.ssyx.activity.service.ActivityInfoService;
|
||||
import com.atguigu.ssyx.common.result.Result;
|
||||
import com.atguigu.ssyx.model.activity.ActivityInfo;
|
||||
import com.atguigu.ssyx.vo.activity.ActivityRuleVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Api(value = "ActivityInfo管理", tags = "活动管理")
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/admin/activity/activityInfo")
|
||||
public class ActivityInfoController {
|
||||
|
||||
@Autowired
|
||||
private ActivityInfoService activityInfoService;
|
||||
|
||||
@ApiOperation(value = "获取分页列表")
|
||||
@GetMapping("{page}/{limit}")
|
||||
public Result index(
|
||||
@ApiParam(name = "page", value = "当前页码", required = true) @PathVariable Long page,
|
||||
@ApiParam(name = "limit", value = "每页记录数", required = true) @PathVariable Long limit) {
|
||||
Page<ActivityInfo> pageParam = new Page<>(page, limit);
|
||||
IPage<ActivityInfo> pageModel = activityInfoService.selectPage(pageParam);
|
||||
return Result.ok(pageModel);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取活动")
|
||||
@GetMapping("get/{id}")
|
||||
public Result get(@PathVariable Long id) {
|
||||
ActivityInfo activityInfo = activityInfoService.getById(id);
|
||||
activityInfo.setActivityTypeString(activityInfo.getActivityType()
|
||||
.getComment());
|
||||
return Result.ok(activityInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增活动")
|
||||
@PostMapping("save")
|
||||
public Result save(@RequestBody ActivityInfo activityInfo) {
|
||||
activityInfoService.save(activityInfo);
|
||||
return Result.ok(null);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改活动")
|
||||
@PutMapping("update")
|
||||
public Result updateById(@RequestBody ActivityInfo activityInfo) {
|
||||
activityInfoService.updateById(activityInfo);
|
||||
return Result.ok(null);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除活动")
|
||||
@DeleteMapping("remove/{id}")
|
||||
public Result remove(@PathVariable Long id) {
|
||||
activityInfoService.removeById(id);
|
||||
return Result.ok(null);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据id列表删除活动")
|
||||
@DeleteMapping("batchRemove")
|
||||
public Result batchRemove(@RequestBody List<String> idList) {
|
||||
activityInfoService.removeByIds(idList);
|
||||
return Result.ok(null);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取活动规则")
|
||||
@GetMapping("findActivityRuleList/{id}")
|
||||
public Result findActivityRuleList(@PathVariable Long id) {
|
||||
return Result.ok(activityInfoService.findActivityRuleList(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增活动规则")
|
||||
@PostMapping("saveActivityRule")
|
||||
public Result saveActivityRule(@RequestBody ActivityRuleVo activityRuleVo) {
|
||||
activityInfoService.saveActivityRule(activityRuleVo);
|
||||
return Result.ok(null);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据关键字获取sku列表,活动使用")
|
||||
@GetMapping("findSkuInfoByKeyword/{keyword}")
|
||||
public Result findSkuInfoByKeyword(@PathVariable("keyword") String keyword) {
|
||||
return Result.ok(activityInfoService.findSkuInfoByKeyword(keyword));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠规则 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/activity-rule")
|
||||
public class ActivityRuleController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动参与商品 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/activity-sku")
|
||||
public class ActivitySkuController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券信息 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/coupon-info")
|
||||
public class CouponInfoController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券范围表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/coupon-range")
|
||||
public class CouponRangeController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券领用表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/coupon-use")
|
||||
public class CouponUseController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/home-subject")
|
||||
public class HomeSubjectController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题商品 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/home-subject-sku")
|
||||
public class HomeSubjectSkuController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/seckill")
|
||||
public class SeckillController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动商品关联 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/seckill-sku")
|
||||
public class SeckillSkuController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀商品通知订阅 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/seckill-sku-notice")
|
||||
public class SeckillSkuNoticeController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动场次 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/seckill-time")
|
||||
public class SeckillTimeController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* sku信息 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity/sku-info")
|
||||
public class SkuInfoController {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.ActivityInfo;
|
||||
import com.atguigu.ssyx.model.activity.ActivityRule;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import feign.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Repository
|
||||
public interface ActivityInfoMapper extends BaseMapper<ActivityInfo> {
|
||||
|
||||
List<ActivityRule> selectActivityRuleList(Long skuId);
|
||||
|
||||
List<Long> selectSkuIdListExist(@Param("skuIdList") List<Long> skuIdList);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.ActivityRule;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠规则 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Repository
|
||||
public interface ActivityRuleMapper extends BaseMapper<ActivityRule> {
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.ActivitySku;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动参与商品 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Repository
|
||||
public interface ActivitySkuMapper extends BaseMapper<ActivitySku> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.CouponInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券信息 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface CouponInfoMapper extends BaseMapper<CouponInfo> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.CouponRange;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券范围表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface CouponRangeMapper extends BaseMapper<CouponRange> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.CouponUse;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券领用表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface CouponUseMapper extends BaseMapper<CouponUse> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.HomeSubject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface HomeSubjectMapper extends BaseMapper<HomeSubject> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.HomeSubjectSku;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题商品 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface HomeSubjectSkuMapper extends BaseMapper<HomeSubjectSku> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.Seckill;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface SeckillMapper extends BaseMapper<Seckill> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.SeckillSku;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动商品关联 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface SeckillSkuMapper extends BaseMapper<SeckillSku> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.SeckillSkuNotice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀商品通知订阅 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface SeckillSkuNoticeMapper extends BaseMapper<SeckillSkuNotice> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.SeckillTime;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动场次 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface SeckillTimeMapper extends BaseMapper<SeckillTime> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.mapper;
|
||||
|
||||
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* sku信息 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface SkuInfoMapper extends BaseMapper<SkuInfo> {
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.ActivityRuleMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.ActivitySkuMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.CouponInfoMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.CouponRangeMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.CouponUseMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.HomeSubjectMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.HomeSubjectSkuMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.SeckillMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.SeckillSkuMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.SeckillSkuNoticeMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.SeckillTimeMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.SkuInfoMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,64 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
|
||||
import com.atguigu.ssyx.model.activity.ActivityInfo;
|
||||
import com.atguigu.ssyx.model.activity.ActivityRule;
|
||||
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||
import com.atguigu.ssyx.vo.activity.ActivityRuleVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface ActivityInfoService extends IService<ActivityInfo> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageParam
|
||||
* @return
|
||||
*/
|
||||
IPage<ActivityInfo> selectPage(Page<ActivityInfo> pageParam);
|
||||
|
||||
/**
|
||||
* 获取活动规则id
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> findActivityRuleList(Long activityId);
|
||||
|
||||
/**
|
||||
* 保存活动规则信息
|
||||
*
|
||||
* @param activityRuleVo
|
||||
*/
|
||||
void saveActivityRule(ActivityRuleVo activityRuleVo);
|
||||
|
||||
/**
|
||||
* 根据关键字获取sku信息列表
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
List<SkuInfo> findSkuInfoByKeyword(String keyword);
|
||||
|
||||
/**
|
||||
* 根据skuId获取促销规则信息
|
||||
*
|
||||
* @param skuId
|
||||
* @return
|
||||
*/
|
||||
List<ActivityRule> findActivityRule(Long skuId);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.ActivityRule;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠规则 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface ActivityRuleService extends IService<ActivityRule> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.ActivitySku;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动参与商品 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface ActivitySkuService extends IService<ActivitySku> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.CouponInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券信息 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface CouponInfoService extends IService<CouponInfo> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.CouponRange;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券范围表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface CouponRangeService extends IService<CouponRange> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.CouponUse;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券领用表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface CouponUseService extends IService<CouponUse> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.HomeSubject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface HomeSubjectService extends IService<HomeSubject> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.HomeSubjectSku;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题商品 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface HomeSubjectSkuService extends IService<HomeSubjectSku> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.Seckill;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface SeckillService extends IService<Seckill> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.SeckillSkuNotice;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀商品通知订阅 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface SeckillSkuNoticeService extends IService<SeckillSkuNotice> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.SeckillSku;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动商品关联 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface SeckillSkuService extends IService<SeckillSku> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.activity.SeckillTime;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动场次 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface SeckillTimeService extends IService<SeckillTime> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.atguigu.ssyx.activity.service;
|
||||
|
||||
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* sku信息 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
public interface SkuInfoService extends IService<SkuInfo> {
|
||||
|
||||
}
|
@ -0,0 +1,210 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.ActivityInfoMapper;
|
||||
import com.atguigu.ssyx.activity.mapper.ActivityRuleMapper;
|
||||
import com.atguigu.ssyx.activity.mapper.ActivitySkuMapper;
|
||||
import com.atguigu.ssyx.activity.service.ActivityInfoService;
|
||||
import com.atguigu.ssyx.client.product.ProductFeignClient;
|
||||
import com.atguigu.ssyx.enums.ActivityType;
|
||||
import com.atguigu.ssyx.model.activity.ActivityInfo;
|
||||
import com.atguigu.ssyx.model.activity.ActivityRule;
|
||||
import com.atguigu.ssyx.model.activity.ActivitySku;
|
||||
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||
import com.atguigu.ssyx.vo.activity.ActivityRuleVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class ActivityInfoServiceImpl extends ServiceImpl<ActivityInfoMapper, ActivityInfo> implements ActivityInfoService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ActivityInfoMapper activityInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private ActivityRuleMapper activityRuleMapper;
|
||||
|
||||
@Autowired
|
||||
private ActivitySkuMapper activitySkuMapper;
|
||||
|
||||
@Autowired
|
||||
private ProductFeignClient productFeignClient;
|
||||
|
||||
/**
|
||||
* 优惠活动列表方法
|
||||
*
|
||||
* @param pageParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<ActivityInfo> selectPage(Page<ActivityInfo> pageParam) {
|
||||
QueryWrapper<ActivityInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByDesc("id");
|
||||
|
||||
IPage<ActivityInfo> page = activityInfoMapper.selectPage(pageParam, queryWrapper);
|
||||
page.getRecords()
|
||||
.forEach(item -> {
|
||||
item.setActivityTypeString(item.getActivityType()
|
||||
.getComment());
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动规则列表方法
|
||||
*
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> findActivityRuleList(Long activityId) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
LambdaQueryWrapper<ActivityRule> queryWrapper = new LambdaQueryWrapper<ActivityRule>();
|
||||
queryWrapper.eq(ActivityRule::getActivityId, activityId);
|
||||
List<ActivityRule> activityRuleList = activityRuleMapper.selectList(queryWrapper);
|
||||
result.put("activityRuleList", activityRuleList);
|
||||
|
||||
LambdaQueryWrapper<ActivitySku> activitySkuQueryWrapper = new LambdaQueryWrapper<ActivitySku>();
|
||||
activitySkuQueryWrapper.eq(ActivitySku::getActivityId, activityId);
|
||||
List<ActivitySku> activitySkuList = activitySkuMapper.selectList(activitySkuQueryWrapper);
|
||||
List<Long> skuIdList = activitySkuList.stream()
|
||||
.map(ActivitySku::getSkuId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<SkuInfo> skuInfoList = null;
|
||||
if (!skuIdList.isEmpty()) {
|
||||
skuInfoList = productFeignClient.findSkuInfoList(skuIdList);
|
||||
}
|
||||
|
||||
result.put("skuInfoList", skuInfoList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存活动规则
|
||||
*
|
||||
* @param activityRuleVo
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void saveActivityRule(ActivityRuleVo activityRuleVo) {
|
||||
//第一步 根据活动id删除之前规则数据
|
||||
//ActivityRule数据删除
|
||||
Long activityId = activityRuleVo.getActivityId();
|
||||
activityRuleMapper.delete(new LambdaQueryWrapper<ActivityRule>().eq(ActivityRule::getActivityId, activityId));
|
||||
//ActivitySku数据删除
|
||||
activitySkuMapper.delete(new LambdaQueryWrapper<ActivitySku>().eq(ActivitySku::getActivityId, activityId));
|
||||
|
||||
//第二步 获取规则列表数据
|
||||
List<ActivityRule> activityRuleList = activityRuleVo.getActivityRuleList();
|
||||
ActivityInfo activityInfo = baseMapper.selectById(activityId);
|
||||
for (ActivityRule activityRule : activityRuleList) {
|
||||
activityRule.setActivityId(activityId);//活动id
|
||||
activityRule.setActivityType(activityInfo.getActivityType());//类型
|
||||
activityRuleMapper.insert(activityRule);
|
||||
}
|
||||
|
||||
//第三步 获取规则范围数据
|
||||
List<ActivitySku> activitySkuList = activityRuleVo.getActivitySkuList();
|
||||
for (ActivitySku activitySku : activitySkuList) {
|
||||
activitySku.setActivityId(activityId);
|
||||
activitySkuMapper.insert(activitySku);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键字查询sku信息列表
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SkuInfo> findSkuInfoByKeyword(String keyword) {
|
||||
//第一步 根据关键字查询sku匹配内容列表
|
||||
//// (1) service-product模块创建接口 据关键字查询sku匹配内容列表
|
||||
//// (2) service-activity远程调用得到sku内容列表
|
||||
List<SkuInfo> skuInfoList = productFeignClient.findSkuInfoByKeyword(keyword);
|
||||
//判断:如果根据关键字查询不到匹配内容,直接返回空集合
|
||||
if (skuInfoList.isEmpty()) {
|
||||
return skuInfoList;
|
||||
}
|
||||
|
||||
//从skuInfoList集合获取所有skuId
|
||||
List<Long> skuIdList = skuInfoList.stream()
|
||||
.map(SkuInfo::getId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//第二步 判断添加商品之前是否参加过活动,
|
||||
// 如果之前参加过,活动正在进行中,排除商品
|
||||
//// (1) 查询两张表判断 activity_info 和 activity_sku,编写SQL语句实现
|
||||
List<Long> existSkuIdList = baseMapper.selectSkuIdListExist(skuIdList);
|
||||
|
||||
//// (2) 判断逻辑处理:排除已经参加活动商品
|
||||
List<SkuInfo> findSkuList = new ArrayList<>();
|
||||
//遍历全部sku列表
|
||||
for (SkuInfo skuInfo : skuInfoList) {
|
||||
if (!existSkuIdList.contains(skuInfo.getId())) {
|
||||
findSkuList.add(skuInfo);
|
||||
}
|
||||
}
|
||||
return findSkuList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品获取规则数据
|
||||
*
|
||||
* @param skuId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ActivityRule> findActivityRule(Long skuId) {
|
||||
List<ActivityRule> activityRuleList = activityInfoMapper.selectActivityRuleList(skuId);
|
||||
if (!CollectionUtils.isEmpty(activityRuleList)) {
|
||||
for (ActivityRule activityRule : activityRuleList) {
|
||||
activityRule.setRuleDesc(this.getRuleDesc(activityRule));
|
||||
}
|
||||
}
|
||||
return activityRuleList;
|
||||
}
|
||||
|
||||
private String getRuleDesc(ActivityRule activityRule) {
|
||||
ActivityType activityType = activityRule.getActivityType();
|
||||
StringBuffer ruleDesc = new StringBuffer();
|
||||
if (activityType == ActivityType.FULL_REDUCTION) {
|
||||
ruleDesc.append("满")
|
||||
.append(activityRule.getConditionAmount())
|
||||
.append("元减")
|
||||
.append(activityRule.getBenefitAmount())
|
||||
.append("元");
|
||||
} else {
|
||||
ruleDesc.append("满")
|
||||
.append(activityRule.getConditionNum())
|
||||
.append("元打")
|
||||
.append(activityRule.getBenefitDiscount())
|
||||
.append("折");
|
||||
}
|
||||
return ruleDesc.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.ActivityRuleMapper;
|
||||
import com.atguigu.ssyx.activity.service.ActivityRuleService;
|
||||
import com.atguigu.ssyx.model.activity.ActivityRule;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠规则 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class ActivityRuleServiceImpl extends ServiceImpl<ActivityRuleMapper, ActivityRule> implements ActivityRuleService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.ActivitySkuMapper;
|
||||
import com.atguigu.ssyx.activity.service.ActivitySkuService;
|
||||
import com.atguigu.ssyx.model.activity.ActivitySku;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 活动参与商品 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class ActivitySkuServiceImpl extends ServiceImpl<ActivitySkuMapper, ActivitySku> implements ActivitySkuService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.CouponInfoMapper;
|
||||
import com.atguigu.ssyx.activity.service.CouponInfoService;
|
||||
import com.atguigu.ssyx.model.activity.CouponInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券信息 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponInfo> implements CouponInfoService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.CouponRangeMapper;
|
||||
import com.atguigu.ssyx.activity.service.CouponRangeService;
|
||||
import com.atguigu.ssyx.model.activity.CouponRange;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券范围表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class CouponRangeServiceImpl extends ServiceImpl<CouponRangeMapper, CouponRange> implements CouponRangeService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.CouponUseMapper;
|
||||
import com.atguigu.ssyx.activity.service.CouponUseService;
|
||||
import com.atguigu.ssyx.model.activity.CouponUse;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优惠券领用表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class CouponUseServiceImpl extends ServiceImpl<CouponUseMapper, CouponUse> implements CouponUseService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.HomeSubjectMapper;
|
||||
import com.atguigu.ssyx.activity.service.HomeSubjectService;
|
||||
import com.atguigu.ssyx.model.activity.HomeSubject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class HomeSubjectServiceImpl extends ServiceImpl<HomeSubjectMapper, HomeSubject> implements HomeSubjectService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.HomeSubjectSkuMapper;
|
||||
import com.atguigu.ssyx.activity.service.HomeSubjectSkuService;
|
||||
import com.atguigu.ssyx.model.activity.HomeSubjectSku;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题商品 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class HomeSubjectSkuServiceImpl extends ServiceImpl<HomeSubjectSkuMapper, HomeSubjectSku> implements HomeSubjectSkuService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.SeckillMapper;
|
||||
import com.atguigu.ssyx.activity.service.SeckillService;
|
||||
import com.atguigu.ssyx.model.activity.Seckill;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class SeckillServiceImpl extends ServiceImpl<SeckillMapper, Seckill> implements SeckillService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.SeckillSkuNoticeMapper;
|
||||
import com.atguigu.ssyx.activity.service.SeckillSkuNoticeService;
|
||||
import com.atguigu.ssyx.model.activity.SeckillSkuNotice;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀商品通知订阅 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class SeckillSkuNoticeServiceImpl extends ServiceImpl<SeckillSkuNoticeMapper, SeckillSkuNotice> implements SeckillSkuNoticeService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.SeckillSkuMapper;
|
||||
import com.atguigu.ssyx.activity.service.SeckillSkuService;
|
||||
import com.atguigu.ssyx.model.activity.SeckillSku;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动商品关联 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class SeckillSkuServiceImpl extends ServiceImpl<SeckillSkuMapper, SeckillSku> implements SeckillSkuService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.SeckillTimeMapper;
|
||||
import com.atguigu.ssyx.activity.service.SeckillTimeService;
|
||||
import com.atguigu.ssyx.model.activity.SeckillTime;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 秒杀活动场次 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class SeckillTimeServiceImpl extends ServiceImpl<SeckillTimeMapper, SeckillTime> implements SeckillTimeService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.atguigu.ssyx.activity.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.activity.mapper.SkuInfoMapper;
|
||||
import com.atguigu.ssyx.activity.service.SkuInfoService;
|
||||
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* sku信息 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2023-09-17
|
||||
*/
|
||||
@Service
|
||||
public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoMapper, SkuInfo> implements SkuInfoService {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
server:
|
||||
port: 8205
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
type-enums-package: com.atguigu.ssyx.enums
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://82.157.68.223:3306/shequ-activity?characterEncoding=utf-8&useSSL=false
|
||||
username: shequ-activity
|
||||
password: shequ-activity
|
||||
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
@ -0,0 +1,11 @@
|
||||
spring:
|
||||
application:
|
||||
name: service-activity
|
||||
profiles:
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: localhost:8848
|
||||
username: nacos
|
||||
password: nacos
|
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.ActivityInfoMapper">
|
||||
|
||||
<resultMap id="ActivityRuleMap" type="com.atguigu.ssyx.model.activity.ActivityRule" autoMapping="true"></resultMap>
|
||||
<resultMap id="CouponInfoMap" type="com.atguigu.ssyx.model.activity.CouponInfo" autoMapping="true"></resultMap>
|
||||
<resultMap id="ActivitySkuMap" type="com.atguigu.ssyx.model.activity.ActivitySku" autoMapping="true"></resultMap>
|
||||
|
||||
<!-- //根据所有skuId列表获取参与活动-->
|
||||
<select id="selectCartActivity" resultMap="ActivitySkuMap">
|
||||
select
|
||||
info.id as activityId,
|
||||
sku.sku_id as skuId
|
||||
from activity_info info
|
||||
inner join activity_sku sku on info.id = sku.activity_id
|
||||
<where>
|
||||
and sku.sku_id in
|
||||
<foreach collection="skuIdList" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</where>
|
||||
and now() between info.start_time and info.end_time
|
||||
</select>
|
||||
|
||||
<!--//2 根据skuId+分类id+userId查询优惠卷信息-->
|
||||
<select id="selectCouponInfoList" resultMap="CouponInfoMap">
|
||||
select info.id,
|
||||
info.coupon_type,
|
||||
info.coupon_name,
|
||||
info.amount,
|
||||
info.condition_amount,
|
||||
info.start_time,
|
||||
info.end_time,
|
||||
info.range_type,
|
||||
info.range_desc,
|
||||
info.publish_count,
|
||||
info.per_limit,
|
||||
info.use_count,
|
||||
info.receive_count,
|
||||
info.expire_time,
|
||||
info.publish_status,
|
||||
info.create_time,
|
||||
info.update_time,
|
||||
info.is_deleted,
|
||||
cuse.coupon_status
|
||||
from coupon_info info
|
||||
left join coupon_range crange on info.id = crange.coupon_id
|
||||
left join coupon_use cuse on info.id = cuse.coupon_id
|
||||
and cuse.user_id = #{userId}
|
||||
where (
|
||||
info.range_type = 1
|
||||
or (info.range_type = 2 and crange.range_id = #{skuId})
|
||||
or (info.range_type = 3 and crange.range_id = #{categoryId})
|
||||
)
|
||||
and now() between info.start_time and info.end_time
|
||||
order by info.amount desc
|
||||
</select>
|
||||
|
||||
<!--//根据skuId进行查询,查询sku对应活动里面规则列表-->
|
||||
<select id="findActivityRule" resultMap="ActivityRuleMap">
|
||||
select info.activity_type as activityType,
|
||||
rule.id,
|
||||
rule.activity_id,
|
||||
rule.condition_amount,
|
||||
rule.condition_num,
|
||||
rule.benefit_amount,
|
||||
rule.benefit_discount
|
||||
from activity_info info
|
||||
inner join activity_sku sku on info.id = sku.activity_id
|
||||
inner join activity_rule rule on info.id = rule.activity_id
|
||||
where sku.sku_id = #{skuId}
|
||||
and now() between info.start_time and info.end_time
|
||||
order by rule.condition_amount desc
|
||||
</select>
|
||||
|
||||
<!--// 如果之前参加过,活动正在进行中,排除商品-->
|
||||
<select id="selectSkuIdListExist" resultType="Long">
|
||||
select sku.sku_id
|
||||
from activity_info info
|
||||
inner join activity_sku sku on info.id = sku.activity_id
|
||||
<where>
|
||||
<if test="skuIdList != null">
|
||||
and sku.sku_id in
|
||||
<foreach collection="skuIdList" item="item"
|
||||
index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
and now() between info.start_time and info.end_time
|
||||
</select>
|
||||
<select id="selectActivityRuleList" resultType="com.atguigu.ssyx.model.activity.ActivityRule"></select>
|
||||
|
||||
</mapper>
|
@ -6,10 +6,9 @@ import com.atguigu.ssyx.product.service.CategoryService;
|
||||
import com.atguigu.ssyx.product.service.SkuInfoService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ClassName: ProductInnnerController
|
||||
@ -40,4 +39,15 @@ public class ProductInnnerController {
|
||||
return skuInfoService.getById(skuId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量获取sku信息")
|
||||
@PostMapping("inner/findSkuInfoList")
|
||||
public List<SkuInfo> findSkuInfoList(@RequestBody List<Long> skuIdList) {
|
||||
return skuInfoService.findSkuInfoList(skuIdList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据关键字获取sku列表")
|
||||
@GetMapping("inner/findSkuInfoByKeyword/{keyword}")
|
||||
public List<SkuInfo> findSkuInfoByKeyword(@PathVariable("keyword") String keyword) {
|
||||
return skuInfoService.findSkuInfoByKeyword(keyword);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,6 @@ public class SkuInfoController {
|
||||
|
||||
@ApiOperation(value = "删除商品sku信息")
|
||||
@DeleteMapping("remove/{id}")
|
||||
//TODO 删除es
|
||||
public Result remove(@PathVariable Long id) {
|
||||
try {
|
||||
skuInfoService.deleteById(id);
|
||||
@ -95,7 +94,6 @@ public class SkuInfoController {
|
||||
|
||||
@ApiOperation(value = "根据id列表删除商品sku信息")
|
||||
@DeleteMapping("batchRemove")
|
||||
//TODO 删除es
|
||||
public Result batchRemove(@RequestBody List<Long> idList) {
|
||||
try {
|
||||
skuInfoService.deleteByIds(idList);
|
||||
|
@ -18,21 +18,84 @@ import java.util.List;
|
||||
* @since 2023-09-15
|
||||
*/
|
||||
public interface SkuInfoService extends IService<SkuInfo> {
|
||||
/**
|
||||
* 获取sku分页列表
|
||||
*
|
||||
* @param pageParam
|
||||
* @param skuInfoQueryVo
|
||||
* @return
|
||||
*/
|
||||
IPage<SkuInfo> selectPage(Page<SkuInfo> pageParam, SkuInfoQueryVo skuInfoQueryVo);
|
||||
|
||||
/**
|
||||
* 新增商品sku信息
|
||||
*
|
||||
* @param skuInfoVo
|
||||
*/
|
||||
void saveSkuInfo(SkuInfoVo skuInfoVo);
|
||||
|
||||
/**
|
||||
* 获取商品sku信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SkuInfoVo getSkuInfoVo(Long id);
|
||||
|
||||
void updateSkuInfo(SkuInfoVo skuInfoVo);
|
||||
|
||||
/**
|
||||
* a商品审核
|
||||
*
|
||||
* @param skuId
|
||||
* @param status
|
||||
*/
|
||||
void check(Long skuId, Integer status);
|
||||
|
||||
/**
|
||||
* 商品上/下架
|
||||
*
|
||||
* @param skuId
|
||||
* @param status
|
||||
*/
|
||||
|
||||
void publish(Long skuId, Integer status);
|
||||
|
||||
/**
|
||||
* 新人专享
|
||||
*
|
||||
* @param skuId
|
||||
* @param status
|
||||
*/
|
||||
void isNewPerson(Long skuId, Integer status);
|
||||
|
||||
/**
|
||||
* 根据id列表删除商品sku信息
|
||||
*
|
||||
* @param idList
|
||||
*/
|
||||
void deleteByIds(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 根据id删除商品sku信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 批量获取sku信息
|
||||
*
|
||||
* @param skuIdList
|
||||
* @return
|
||||
*/
|
||||
List<SkuInfo> findSkuInfoList(List<Long> skuIdList);
|
||||
|
||||
/**
|
||||
* 根据关键字获取sku列表
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
List<SkuInfo> findSkuInfoByKeyword(String keyword);
|
||||
}
|
||||
|
@ -236,6 +236,11 @@ public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoMapper, SkuInfo> impl
|
||||
baseMapper.updateById(skuInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删商品sku信息
|
||||
*
|
||||
* @param idList
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<Long> idList) {
|
||||
baseMapper.deleteBatchIds(idList);
|
||||
@ -246,6 +251,11 @@ public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoMapper, SkuInfo> impl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID批量删商品sku信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(Long id) {
|
||||
baseMapper.deleteById(id);
|
||||
@ -254,6 +264,28 @@ public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoMapper, SkuInfo> impl
|
||||
rabbitService.sendMessage(MqConst.EXCHANGE_GOODS_DIRECT, MqConst.ROUTING_GOODS_LOWER, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取sku信息
|
||||
*
|
||||
* @param skuIdList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SkuInfo> findSkuInfoList(List<Long> skuIdList) {
|
||||
return baseMapper.selectBatchIds(skuIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键字获取sku列表
|
||||
*
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SkuInfo> findSkuInfoByKeyword(String keyword) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SkuInfo>().like(SkuInfo::getSkuName, keyword));
|
||||
}
|
||||
|
||||
private SkuInfoVo getSkuInfoDB(Long skuId) {
|
||||
SkuInfoVo skuInfoVo = new SkuInfoVo();
|
||||
|
||||
|
@ -4,7 +4,7 @@ server:
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
type-enums-package: com.atguigu.ssyx.enums
|
||||
spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
|
Loading…
Reference in New Issue
Block a user