Merge remote-tracking branch 'origin/master'
# Conflicts: # .idea/encodings.xmlmaster
commit
696689516e
|
@ -4,7 +4,7 @@
|
||||||
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-authen/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-kill/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-system/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-system/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-xxl/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-xxl/src/main/java" charset="UTF-8" />
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="MavenProjectsManager">
|
<component name="MavenProjectsManager">
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-modules</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>bwie-kill</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 系统公共 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringBoot Web-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson</artifactId>
|
||||||
|
<version>3.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Druid -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.2.8</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Mybatis 依赖配置 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.3</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Pagehelper -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bwie.kill;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class KillApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(KillApplication.class,args);
|
||||||
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
|
LocalDateTime with = localDateTime.with(LocalTime.of(0, 0, 0));
|
||||||
|
System.out.println(localDateTime.toLocalTime());
|
||||||
|
System.out.println(with.toLocalDate().toString()+" 00:00:00");
|
||||||
|
String localeString = new Date().toLocaleString();
|
||||||
|
System.out.println(localeString);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.bwie.kill.config;
|
||||||
|
|
||||||
|
import org.redisson.Redisson;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.redisson.config.Config;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MyRedissonConfig {
|
||||||
|
@Bean
|
||||||
|
public RedissonClient getRedisson() {
|
||||||
|
// 默认连接地址 127.0.0.1:6379
|
||||||
|
// RedissonClient redisson = Redisson.create();
|
||||||
|
//1.创建配置
|
||||||
|
//Redis url should start with redis:// or rediss:// (for SSL connection)
|
||||||
|
Config config = new Config();
|
||||||
|
config.useSingleServer().setAddress("redis://124.221.30.134:6379");
|
||||||
|
//2.根据config创建处RedissonClient实例
|
||||||
|
RedissonClient redisson = Redisson.create(config);
|
||||||
|
return redisson;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import com.bwie.kill.domain.request.VoKillConfigRequest;
|
||||||
|
import com.bwie.kill.service.KillConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/kill/config")
|
||||||
|
public class KillConfigController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillConfigService killConfigService;
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
private Result<PageResult<KillConfig>> getList(@RequestBody VoKillConfigRequest req){
|
||||||
|
return Result.success(
|
||||||
|
killConfigService.getList(req)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
private Result<String> getUpdate(@RequestBody KillConfig killConfig){
|
||||||
|
killConfigService.updateById(killConfig);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/save")
|
||||||
|
private Result<String> getSave(@RequestBody KillConfig killConfig){
|
||||||
|
killConfigService.save(killConfig);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/delete")
|
||||||
|
private Result<String> getDelete(@RequestParam Long id){
|
||||||
|
killConfigService.removeById(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import com.bwie.kill.domain.request.VoKillGoodsRequest;
|
||||||
|
import com.bwie.kill.service.KillGoodsService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/kill/goods")
|
||||||
|
public class KillGoodsController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillGoodsService killGoodsService;
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
public Result<PageResult<KillGoods>> getKillGoodsList(@RequestBody VoKillGoodsRequest req){
|
||||||
|
return Result.success(
|
||||||
|
killGoodsService.getKillGoodsList(req)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
public Result<String> getUpdate(@RequestBody KillGoods killGoods){
|
||||||
|
killGoodsService.updateById(killGoods);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<String> getAdd(@RequestBody KillGoods killGoods){
|
||||||
|
killGoodsService.save(killGoods);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/del")
|
||||||
|
public Result<String> getDel(@RequestParam Long id){
|
||||||
|
killGoodsService.removeById(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.kill.service.KillGoodsServerService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/kill/server")
|
||||||
|
public class KillGoodsServerController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillGoodsServerService killGoodsServerService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/kill/sku")
|
||||||
|
public class KillSkuAttrValueController {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.kill.service.KillConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("kill")
|
||||||
|
public class killController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillConfigService killConfigService;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("goods_sku")
|
||||||
|
public class Goods {
|
||||||
|
/**
|
||||||
|
* skuId
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* spuId
|
||||||
|
*/
|
||||||
|
private Long spuId;
|
||||||
|
/**
|
||||||
|
* sku名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 所属分类id
|
||||||
|
*/
|
||||||
|
private Long catagoryId;
|
||||||
|
/**
|
||||||
|
* 默认图片
|
||||||
|
*/
|
||||||
|
private String defaultImage;
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 副标题
|
||||||
|
*/
|
||||||
|
private String subtitle;
|
||||||
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
|
private BigDecimal price;
|
||||||
|
/**
|
||||||
|
* 重量(克)
|
||||||
|
*/
|
||||||
|
private Integer weight;
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("kill_config")
|
||||||
|
public class KillConfig {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 秒杀名称
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 轮番图
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer killStatus;
|
||||||
|
/**
|
||||||
|
* 秒杀时段
|
||||||
|
*/
|
||||||
|
private String killDate;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("kill_goods")
|
||||||
|
public class KillGoods {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 秒杀配置表id
|
||||||
|
*/
|
||||||
|
private Long configId;
|
||||||
|
/**
|
||||||
|
* 秒杀配置标题
|
||||||
|
*/
|
||||||
|
private String configTitle;
|
||||||
|
/**
|
||||||
|
* 秒杀时段
|
||||||
|
*/
|
||||||
|
private String killDate;
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Long goodsSpuId;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String goodsName;
|
||||||
|
/**
|
||||||
|
* 商品图片
|
||||||
|
*/
|
||||||
|
private String goodsImage;
|
||||||
|
/**
|
||||||
|
* 活动标题
|
||||||
|
*/
|
||||||
|
private String activityTitle;
|
||||||
|
/**
|
||||||
|
* 原价
|
||||||
|
*/
|
||||||
|
private BigDecimal oldPrice;
|
||||||
|
/**
|
||||||
|
* 秒杀价
|
||||||
|
*/
|
||||||
|
private BigDecimal killPrice;
|
||||||
|
/**
|
||||||
|
* 活动简介
|
||||||
|
*/
|
||||||
|
private String activityIntroduce;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
/**
|
||||||
|
* 0:包邮 1:不包邮
|
||||||
|
*/
|
||||||
|
private Long freightStatus;
|
||||||
|
/**
|
||||||
|
* 当天参与活动次数
|
||||||
|
*/
|
||||||
|
private Integer activityNum;
|
||||||
|
/**
|
||||||
|
* 活动日期
|
||||||
|
*/
|
||||||
|
private Date activityDate;
|
||||||
|
/**
|
||||||
|
* 活动状态
|
||||||
|
*/
|
||||||
|
private Integer activityStatus;
|
||||||
|
private String createTime;
|
||||||
|
private String updateTime;
|
||||||
|
private String isDelete;
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("kill_sku_attr_value")
|
||||||
|
public class KillSkuAttrValue {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 商品属性id
|
||||||
|
*/
|
||||||
|
private Long goodsSkuAttrId;
|
||||||
|
/**
|
||||||
|
* 秒杀表id
|
||||||
|
*/
|
||||||
|
private Long killGoodsId;
|
||||||
|
/**
|
||||||
|
* 秒杀价格
|
||||||
|
*/
|
||||||
|
private BigDecimal killPrice;
|
||||||
|
/**
|
||||||
|
* 限量
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
/**
|
||||||
|
* 锁定库存数
|
||||||
|
*/
|
||||||
|
private Integer lockNumber;
|
||||||
|
/**
|
||||||
|
* 剩余库存数
|
||||||
|
*/
|
||||||
|
private Integer lastNum;
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class PagesUtil {
|
||||||
|
private Long total;
|
||||||
|
|
||||||
|
private List<KillGoods> list;
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VoKillConfigRequest {
|
||||||
|
/**
|
||||||
|
* 秒杀名称
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer killStatus;
|
||||||
|
|
||||||
|
private Integer pageNum=1;
|
||||||
|
|
||||||
|
private Integer pageSize=3;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VoKillGoodsRequest {
|
||||||
|
/**
|
||||||
|
* 活动状态
|
||||||
|
*/
|
||||||
|
private Integer activityStatus;
|
||||||
|
/**
|
||||||
|
* 秒杀配置标题
|
||||||
|
*/
|
||||||
|
private String configTitle;
|
||||||
|
/**
|
||||||
|
* id或名称搜索
|
||||||
|
*/
|
||||||
|
private String goodsInfo;
|
||||||
|
|
||||||
|
private Integer pageNum=1;
|
||||||
|
|
||||||
|
private Integer pageSize=5;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.kill.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.kill.domain.Goods;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import javax.annotation.ManagedBean;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface GoodsMapper extends BaseMapper<Goods> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface KillConfigMapper extends BaseMapper<KillConfig> {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface KillGoodsMapper extends BaseMapper<KillGoods> {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.kill.domain.KillSkuAttrValue;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface KillSkuAttrValueMapper extends BaseMapper<KillSkuAttrValue> {
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.kill.domain.Goods;
|
||||||
|
|
||||||
|
public interface GoodsService extends IService<Goods> {
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.kill.domain.Goods;
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import com.bwie.kill.domain.request.VoKillConfigRequest;
|
||||||
|
|
||||||
|
public interface KillConfigService extends IService<KillConfig> {
|
||||||
|
/**
|
||||||
|
* 秒杀配置列表
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageResult<KillConfig> getList(VoKillConfigRequest req);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
public interface KillGoodsServerService {
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import com.bwie.kill.domain.request.VoKillGoodsRequest;
|
||||||
|
|
||||||
|
public interface KillGoodsService extends IService<KillGoods> {
|
||||||
|
/**
|
||||||
|
* 秒杀商品列表
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageResult<KillGoods> getKillGoodsList(VoKillGoodsRequest req);
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.kill.domain.Goods;
|
||||||
|
import com.bwie.kill.domain.KillSkuAttrValue;
|
||||||
|
|
||||||
|
public interface KillSkuAttrValueService extends IService<KillSkuAttrValue> {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.kill.domain.Goods;
|
||||||
|
import com.bwie.kill.mapper.GoodsMapper;
|
||||||
|
import com.bwie.kill.service.GoodsService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods>
|
||||||
|
implements GoodsService {
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import com.bwie.kill.domain.request.VoKillConfigRequest;
|
||||||
|
import com.bwie.kill.mapper.KillConfigMapper;
|
||||||
|
import com.bwie.kill.service.KillConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class KillConfigServiceImpl extends ServiceImpl<KillConfigMapper, KillConfig>
|
||||||
|
implements KillConfigService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KillConfig> getList(VoKillConfigRequest req) {
|
||||||
|
|
||||||
|
IPage<KillConfig> page = new Page<>(req.getPageNum(), req.getPageSize());
|
||||||
|
|
||||||
|
IPage<KillConfig> iPage = page(page, new LambdaQueryWrapper<KillConfig>()
|
||||||
|
.eq(KillConfig::getKillStatus, req.getKillStatus())
|
||||||
|
.eq(KillConfig::getTitle, req.getTitle()));
|
||||||
|
|
||||||
|
return PageResult.toPageResult(iPage.getPages(),iPage.getRecords());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.bwie.kill.service.KillGoodsServerService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class KillGoodsServerServiceImpl implements KillGoodsServerService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.common.utils.StringUtils;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import com.bwie.kill.domain.request.PagesUtil;
|
||||||
|
import com.bwie.kill.domain.request.VoKillGoodsRequest;
|
||||||
|
import com.bwie.kill.mapper.KillGoodsMapper;
|
||||||
|
import com.bwie.kill.service.KillGoodsService;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class KillGoodsServiceImpl extends ServiceImpl<KillGoodsMapper, KillGoods>
|
||||||
|
implements KillGoodsService {
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
@Autowired
|
||||||
|
private RedissonClient redissonClient;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KillGoods> getKillGoodsList(VoKillGoodsRequest req) {
|
||||||
|
|
||||||
|
if (StringUtils.isAllBlank(req.getConfigTitle(),req.getGoodsInfo()) && req.getActivityStatus() == null){
|
||||||
|
|
||||||
|
if (redisCache.hasKey("listPage"+req.getPageNum())){
|
||||||
|
String cacheObject = redisCache.getCacheObject("listPage" + req.getPageNum());
|
||||||
|
PagesUtil pagesUtil = JSONObject.parseObject(cacheObject, PagesUtil.class);
|
||||||
|
return PageResult.toPageResult(pagesUtil.getTotal(),pagesUtil.getList());
|
||||||
|
}else {
|
||||||
|
IPage<KillGoods> page = new Page<>(req.getPageNum(), req.getPageSize());
|
||||||
|
IPage<KillGoods> iPage = page(page);
|
||||||
|
PagesUtil pagesUtil = PagesUtil.builder().total(iPage.getPages())
|
||||||
|
.list(iPage.getRecords())
|
||||||
|
.build();
|
||||||
|
redisCache.setCacheObject("listPage"+req.getPageNum(),JSONObject.toJSONString(pagesUtil));
|
||||||
|
|
||||||
|
return PageResult.toPageResult(iPage.getPages(),iPage.getRecords());
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
IPage<KillGoods> page = new Page<>(req.getPageNum(), req.getPageSize());
|
||||||
|
LambdaQueryWrapper<KillGoods> queryWrapper = new LambdaQueryWrapper<KillGoods>();
|
||||||
|
if (req.getActivityStatus() != null){
|
||||||
|
queryWrapper.eq(KillGoods::getActivityStatus, req.getActivityStatus());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(req.getConfigTitle())){
|
||||||
|
queryWrapper.eq(KillGoods::getConfigTitle, req.getConfigTitle());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(req.getGoodsInfo())){
|
||||||
|
String str = req.getGoodsInfo();
|
||||||
|
if (str.matches("\\d+")){
|
||||||
|
queryWrapper.eq(KillGoods::getId,req.getGoodsInfo());
|
||||||
|
}else {
|
||||||
|
queryWrapper.like(KillGoods::getGoodsName,req.getGoodsInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IPage<KillGoods> iPage = page(page, queryWrapper);
|
||||||
|
return PageResult.toPageResult(iPage.getPages(),iPage.getRecords());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.kill.domain.KillSkuAttrValue;
|
||||||
|
import com.bwie.kill.mapper.KillSkuAttrValueMapper;
|
||||||
|
import com.bwie.kill.service.KillSkuAttrValueService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class KillSkuAttrValueServiceImpl extends ServiceImpl<KillSkuAttrValueMapper, KillSkuAttrValue>
|
||||||
|
implements KillSkuAttrValueService {
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9111
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
# 允许定义相同的bean对象 去覆盖原有的
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: bwie-Kill
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 124.221.30.134:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 124.221.30.134:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -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.bwie.system.mapper.SysMapper">
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue