提交 9c727658 编写于 作者: 鲸落和鲨掉's avatar 鲸落和鲨掉

添加Docker脚本文件,并上线测试

上级 bd509e13
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/bigmarket-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-app/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-app/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-domain/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-domain/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-infrastructure/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-infrastructure/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-trigger/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-trigger/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-types/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bigmarket-types/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/xfg-frame-archetype-lite-api/src/main/java" charset="UTF-8" />
......
......@@ -5,6 +5,7 @@
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
<option value="$PROJECT_DIR$/xfg-frame-archetype-lite-app/pom.xml" />
</list>
</option>
</component>
......
......@@ -22,6 +22,12 @@
<artifactId>jakarta.validation-api</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>cn.bugstack</groupId>
<artifactId>bigmarket-types</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
......
package cn.bugstack.trigger.api;
import cn.bugstack.trigger.api.dto.RaffleAwardListRequestDTO;
import cn.bugstack.trigger.api.dto.RaffleAwardListResponseDTO;
import cn.bugstack.trigger.api.dto.RaffleRequestDTO;
import cn.bugstack.trigger.api.dto.RaffleResponseDTO;
import cn.bugstack.types.model.Response;
import java.util.List;
public interface IRaffleService {
/**
* 策略装配接口
*
* @param strategyId 策略ID
* @return 装配结果
*/
Response<Boolean> strategyArmory(Long strategyId);
/**
* 查询抽奖奖品列表配置
*
* @param requestDTO 抽奖奖品列表查询请求参数
* @return 奖品列表数据
*/
Response<List<RaffleAwardListResponseDTO>> queryRaffleAwardList(RaffleAwardListRequestDTO requestDTO);
/**
* 随机抽奖接口
*
* @param requestDTO 请求参数
* @return 抽奖结果
*/
Response<RaffleResponseDTO> randomRaffle(RaffleRequestDTO requestDTO);
}
package cn.bugstack.trigger.api.dto;
import lombok.Data;
/**
* @ClassName: RaffleAwardListRequestDTO
* @Description: 抽奖奖品列表,请求对象
* @Author: zhaoyongfeng
* @Date: 2024/11/22 16:35
*/
@Data
public class RaffleAwardListRequestDTO {
// 抽奖策略ID
private Long strategyId;
}
package cn.bugstack.trigger.api.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName: RaffleAwardListRequestDTO
* @Description: 抽奖奖品列表,应答对象
* @Author: zhaoyongfeng
* @Date: 2024/11/22 16:35
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RaffleAwardListResponseDTO {
// 奖品ID
private Integer awardId;
// 奖品标题
private String awardTitle;
// 奖品副标题【抽奖1次后解锁】
private String awardSubtitle;
// 排序编号
private Integer sort;
}
package cn.bugstack.trigger.api.dto;
import lombok.Data;
/**
* @ClassName: RaffleAwardListRequestDTO
* @Description: 抽奖奖品列表,应答对象
* @Author: zhaoyongfeng
* @Date: 2024/11/22 16:35
*/
@Data
public class RaffleRequestDTO {
// 抽奖策略ID
private Long strategyId;
}
package cn.bugstack.trigger.api.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName: RaffleAwardListRequestDTO
* @Description: 抽奖奖品列表,应答对象
* @Author: zhaoyongfeng
* @Date: 2024/11/22 16:35
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RaffleResponseDTO {
// 奖品ID
private Integer awardId;
// 排序编号【策略奖品配置的奖品顺序编号】
private Integer awardIndex;
}
......@@ -2,7 +2,7 @@
FROM openjdk:8-jre-slim
# 作者
MAINTAINER xiaofuge
MAINTAINER zyf
# 配置
ENV PARAMS=""
......@@ -12,6 +12,6 @@ ENV TZ=PRC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 添加应用
ADD target/xfg-frame-archetype-lite-app.jar /xfg-frame-archetype-lite-app.jar
ADD target/big-market-app.jar /big-market-app.jar
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /xfg-frame-archetype-lite-app.jar $PARAMS"]
\ No newline at end of file
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /big-market-app.jar $PARAMS"]
# 普通镜像构建,随系统版本构建 amd/arm
docker build -t system/xfg-frame-archetype-lite-app:1.0-SNAPSHOT -f ./Dockerfile .
docker build -t zyf/big-market-app:1.0 -f ./Dockerfile .
# 兼容 amd、arm 构建镜像
# docker buildx build --load --platform liunx/amd64,linux/arm64 -t xiaofuge/xfg-frame-archetype-app:1.0 -f ./Dockerfile . --push
\ No newline at end of file
# docker buildx build --load --platform liunx/amd64,linux/arm64 -t xiaofuge/xfg-frame-archetype-app:1.0 -f ./Dockerfile . --push
24-11-21.15:10:59.570 [main ] WARN GenericWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'updateAwardStockJob': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cn.bugstack.domain.strategy.IRaffleStock' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
24-11-21.15:10:59.615 [main ] ERROR LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'cn.bugstack.domain.strategy.IRaffleStock' that could not be found.
Action:
Consider defining a bean of type 'cn.bugstack.domain.strategy.IRaffleStock' in your configuration.
24-11-21.15:10:59.618 [main ] ERROR TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@63475ace] to prepare test instance [cn.bugstack.test.domain.RaffleStrategyTest@46383a78]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:98)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124)
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'updateAwardStockJob': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cn.bugstack.domain.strategy.IRaffleStock' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:332)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:136)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:141)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:90)
... 27 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cn.bugstack.domain.strategy.IRaffleStock' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1801)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1357)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:544)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:520)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:673)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:228)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:329)
... 43 common frames omitted
24-11-21.15:12:01.523 [main ] WARN GenericWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'updateAwardStockJob': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cn.bugstack.domain.strategy.IRaffleStock' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
24-11-21.15:12:01.565 [main ] ERROR LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'cn.bugstack.domain.strategy.IRaffleStock' that could not be found.
Action:
Consider defining a bean of type 'cn.bugstack.domain.strategy.IRaffleStock' in your configuration.
24-11-21.15:12:01.568 [main ] ERROR TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@bccb269] to prepare test instance [cn.bugstack.test.domain.RaffleStrategyTest@6af91cc8]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:98)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124)
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'updateAwardStockJob': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cn.bugstack.domain.strategy.IRaffleStock' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:332)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:136)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:141)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:90)
... 27 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cn.bugstack.domain.strategy.IRaffleStock' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1801)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1357)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:544)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:520)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:673)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:228)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:329)
... 43 common frames omitted
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -95,7 +95,7 @@
</dependencies>
<build>
<finalName>xfg-frame-archetype-lite-app</finalName>
<finalName>big-market-app</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
......
server:
port: 8091
tomcat:
threads:
max: 200 # 设定处理客户请求的线程的最大数目,决定了服务器可以同时响应客户请求的数,默认200
min-spare: 50 # 初始化线程数,最小空闲线程数,默认是10
accept-count: 10 # 等待队列长度
# 应用配置
app:
config:
# 版本,方便通过接口版本升级
api-version: v1
# 跨域,开发阶段可以设置为 * 不限制
cross-origin: '*'
# 线程池配置
thread:
......
......@@ -23,10 +23,12 @@
from strategy_award
limit 10
</select>
<select id="queryStrategyAwardListByStrategyId" parameterType="java.lang.Long" resultMap="dataMap">
select strategy_id, award_id, award_count, award_count_surplus, award_rate
select strategy_id, award_id, award_title, award_subtitle, award_count, award_count_surplus, award_rate, sort
from strategy_award
where strategy_id = #{strategy_id}
where strategy_id = #{strategyId}
order by sort asc
</select>
<select id="queryStrategyAwardRuleModels" parameterType="cn.bugstack.infrastructure.persistent.po.StrategyAward" resultType="java.lang.String">
......@@ -40,6 +42,13 @@
where strategy_id = #{strategyId} and award_id = #{awardId} and award_count_surplus > 0
</update>
<select id="queryStrategyAward" parameterType="cn.bugstack.infrastructure.persistent.po.StrategyAward" resultMap="dataMap">
select strategy_id, award_id, award_title, award_subtitle, award_count, award_count_surplus, award_rate, rule_models, sort
from strategy_award
where strategy_id = #{strategyId} and award_id = #{awardId}
</select>
</mapper>
......@@ -43,10 +43,15 @@
<groupId>cn.bugstack</groupId>
<artifactId>bigmarket-types</artifactId>
</dependency>
<dependency>
<groupId>cn.bugstack</groupId>
<artifactId>bigmarket-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>xfg-frame-archetype-lite-domain</finalName>
<finalName>big-market-domain</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......
......@@ -2,6 +2,7 @@ package cn.bugstack.domain.strategy;
import cn.bugstack.domain.strategy.model.entity.RaffleAwardEntity;
import cn.bugstack.domain.strategy.model.entity.RaffleFactorEntity;
import cn.bugstack.domain.strategy.model.entity.StrategyAwardEntity;
import cn.bugstack.domain.strategy.repository.IStrategyRepository;
import cn.bugstack.domain.strategy.service.armory.IStrategyDispatch;
import cn.bugstack.domain.strategy.service.rule.chain.factory.DefaultChainFactory;
......@@ -18,7 +19,7 @@ import org.apache.commons.lang3.StringUtils;
* @Date: 2024/11/17 16:14
*/
@Slf4j
public abstract class AbstractRaffleStrategy implements IRaffleStrategy, IRaffleStock {
public abstract class AbstractRaffleStrategy implements IRaffleStrategy {
// 策略仓储服务 -> domain层像一个大厨,仓储层提供米面粮油
protected IStrategyRepository repository;
......@@ -36,7 +37,6 @@ public abstract class AbstractRaffleStrategy implements IRaffleStrategy, IRaffle
this.defaultTreeFactory = defaultTreeFactory;
}
@Override
public RaffleAwardEntity performRaffle(RaffleFactorEntity raffleFactorEntity) {
// 1. 参数校验
......@@ -50,9 +50,8 @@ public abstract class AbstractRaffleStrategy implements IRaffleStrategy, IRaffle
DefaultChainFactory.StrategyAwardVO chainStrategyAwardVO = raffleLogicChain(userId, strategyId);
log.info("抽奖策略计算-责任链 {} {} {} {}", userId, strategyId, chainStrategyAwardVO.getAwardId(), chainStrategyAwardVO.getLogicModel());
if (!DefaultChainFactory.LogicModel.RULE_DEFAULT.getCode().equals(chainStrategyAwardVO.getLogicModel())) {
return RaffleAwardEntity.builder()
.awardId(chainStrategyAwardVO.getAwardId())
.build();
// TODO awardConfig 暂时为空。黑名单指定积分奖品,后续需要在库表中配置上对应的1积分值,并获取到。
return buildRaffleAwardEntity(strategyId, chainStrategyAwardVO.getAwardId(), null);
}
// 3. 规则树抽奖过滤【奖品ID,会根据抽奖次数判断、库存判断、兜底兜里返回最终的可获得奖品信息】
......@@ -60,15 +59,18 @@ public abstract class AbstractRaffleStrategy implements IRaffleStrategy, IRaffle
log.info("抽奖策略计算-规则树 {} {} {} {}", userId, strategyId, treeStrategyAwardVO.getAwardId(), treeStrategyAwardVO.getAwardRuleValue());
// 4. 返回抽奖结果
return buildRaffleAwardEntity(strategyId, treeStrategyAwardVO.getAwardId(), treeStrategyAwardVO.getAwardRuleValue());
}
private RaffleAwardEntity buildRaffleAwardEntity(Long strategyId, Integer awardId, String awardConfig) {
StrategyAwardEntity strategyAward = repository.queryStrategyAwardEntity(strategyId, awardId);
return RaffleAwardEntity.builder()
.awardId(treeStrategyAwardVO.getAwardId())
.awardConfig(treeStrategyAwardVO.getAwardRuleValue())
.awardId(awardId)
.awardConfig(awardConfig)
.sort(strategyAward.getSort())
.build();
}
/**
* 抽奖计算,责任链抽象方法
*
......@@ -89,3 +91,4 @@ public abstract class AbstractRaffleStrategy implements IRaffleStrategy, IRaffle
public abstract DefaultTreeFactory.StrategyAwardVO raffleLogicTree(String userId, Long strategyId, Integer awardId);
}
package cn.bugstack.domain.strategy;
import cn.bugstack.domain.strategy.model.entity.StrategyAwardEntity;
import java.util.List;
public interface IRaffleAward {
/**
* 根据策略ID查询抽奖奖品列表配置
*
* @param strategyId 策略ID
* @return 奖品列表
*/
List<StrategyAwardEntity> queryRaffleStrategyAwardList(Long strategyId);
}
......@@ -16,15 +16,11 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@Builder
public class RaffleAwardEntity {
/** 策略ID */
private Long strategyId;
/** 奖品ID */
private Integer awardId;
/** 奖品对接标识 - 每一个都是一个对应的发奖策略 */
private String awardKey;
/** 奖品配置信息 */
private String awardConfig;
/** 奖品内容描述 */
private String awardDesc;
/** 奖品顺序号 */
private Integer sort;
}
......@@ -22,11 +22,18 @@ public class StrategyAwardEntity {
private Long strategyId;
/** 抽奖奖品ID - 内部流转使用 */
private Integer awardId;
/** 抽奖奖品标题 */
private String awardTitle;
/** 抽奖奖品副标题 */
private String awardSubtitle;
/** 奖品库存总量 */
private Integer awardCount;
/** 奖品库存剩余 */
private Integer awardCountSurplus;
/** 奖品中奖概率 */
private BigDecimal awardRate;
/** 排序 */
private Integer sort;
}
......@@ -75,4 +75,5 @@ public interface IStrategyRepository {
*/
void updateStrategyAwardStock(Long strategyId, Integer awardId);
StrategyAwardEntity queryStrategyAwardEntity(Long strategyId, Integer awardId);
}
package cn.bugstack.domain.strategy.service.raffle;
import cn.bugstack.domain.strategy.AbstractRaffleStrategy;
import cn.bugstack.domain.strategy.IRaffleAward;
import cn.bugstack.domain.strategy.IRaffleStock;
import cn.bugstack.domain.strategy.model.entity.StrategyAwardEntity;
import cn.bugstack.domain.strategy.model.valobj.RuleTreeVO;
import cn.bugstack.domain.strategy.model.valobj.StrategyAwardRuleModelVO;
import cn.bugstack.domain.strategy.model.valobj.StrategyAwardStockKeyVO;
......@@ -13,6 +16,8 @@ import cn.bugstack.domain.strategy.service.rule.tree.factory.engine.IDecisionTre
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName: DefaultRaffleStrategy
* @Description: 默认的抽奖策略实现
......@@ -21,7 +26,7 @@ import org.springframework.stereotype.Service;
*/
@Slf4j
@Service
public class DefaultRaffleStrategy extends AbstractRaffleStrategy {
public class DefaultRaffleStrategy extends AbstractRaffleStrategy implements IRaffleStock, IRaffleAward {
public DefaultRaffleStrategy(IStrategyRepository repository, IStrategyDispatch strategyDispatch, DefaultChainFactory defaultChainFactory, DefaultTreeFactory defaultTreeFactory) {
super(repository, strategyDispatch, defaultChainFactory, defaultTreeFactory);
......@@ -33,7 +38,6 @@ public class DefaultRaffleStrategy extends AbstractRaffleStrategy {
return logicChain.logic(userId, strategyId);
}
@Override
public DefaultTreeFactory.StrategyAwardVO raffleLogicTree(String userId, Long strategyId, Integer awardId) {
StrategyAwardRuleModelVO strategyAwardRuleModelVO = repository.queryStrategyAwardRuleModelVO(strategyId, awardId);
......@@ -48,7 +52,6 @@ public class DefaultRaffleStrategy extends AbstractRaffleStrategy {
return treeEngine.process(userId, strategyId, awardId);
}
@Override
public StrategyAwardStockKeyVO takeQueueValue() throws InterruptedException {
return repository.takeQueueValue();
......@@ -59,5 +62,11 @@ public class DefaultRaffleStrategy extends AbstractRaffleStrategy {
repository.updateStrategyAwardStock(strategyId, awardId);
}
@Override
public List<StrategyAwardEntity> queryRaffleStrategyAwardList(Long strategyId) {
return repository.queryStrategyAwardList(strategyId);
}
}
......@@ -66,7 +66,7 @@ public class DecisionTreeEngine implements IDecisionTreeEngine {
return nodeLine.getRuleNodeTo();
}
}
throw new RuntimeException("决策树引擎,nextNode 计算失败,未找到可执行节点!");
return null;
}
public boolean decisionLogic(String matterValue, RuleTreeNodeLineVO nodeLine) {
......
......@@ -30,7 +30,7 @@
</dependencies>
<build>
<finalName>xfg-frame-archetype-lite-infrastructure</finalName>
<finalName>big-market-infrastructure</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册