同步
This commit is contained in:
commit
5a4f8e2a72
@ -293,7 +293,10 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_
|
|||||||
|
|
||||||
2.禁止将本开源的代码和资源进行任何形式任何名义的出售.
|
2.禁止将本开源的代码和资源进行任何形式任何名义的出售.
|
||||||
|
|
||||||
3.限制商用,如果需要商业使用请联系我们。QQ3409056806.
|
3.软件受国家计算机软件著作权保护(登记号:2021SR0805085)。
|
||||||
|
|
||||||
|
4.限制商用,如果需要商业使用请联系我们。QQ3409056806.
|
||||||
|
|
||||||
|
|
||||||
### 交流群
|
### 交流群
|
||||||
|
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
package cn.lili.controller;
|
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
||||||
import springfox.documentation.spring.web.SpringfoxWebMvcConfiguration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SwaggerBootstrapUiDemoApplication
|
|
||||||
*
|
|
||||||
* @author Chopper
|
|
||||||
* @version v1.0
|
|
||||||
* 2020-12-09 20:09
|
|
||||||
*/
|
|
||||||
@ConditionalOnClass(SpringfoxWebMvcConfiguration.class)
|
|
||||||
public class SwaggerBootstrapUiDemoApplication implements WebMvcConfigurer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
|
||||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +1,13 @@
|
|||||||
package cn.lili.controller.other;
|
package cn.lili.controller.other;
|
||||||
|
|
||||||
import cn.lili.common.enums.ResultUtil;
|
import cn.lili.common.enums.ResultUtil;
|
||||||
|
import cn.lili.common.utils.PageUtil;
|
||||||
|
import cn.lili.common.vo.PageVO;
|
||||||
import cn.lili.common.vo.ResultMessage;
|
import cn.lili.common.vo.ResultMessage;
|
||||||
|
import cn.lili.modules.system.entity.dos.AppVersion;
|
||||||
import cn.lili.modules.system.service.AppVersionService;
|
import cn.lili.modules.system.service.AppVersionService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@ -33,4 +38,13 @@ public class AppVersionBuyerController {
|
|||||||
public ResultMessage<Object> getAppVersion(@PathVariable String appType) {
|
public ResultMessage<Object> getAppVersion(@PathVariable String appType) {
|
||||||
return ResultUtil.data(appVersionService.getAppVersion(appType));
|
return ResultUtil.data(appVersionService.getAppVersion(appType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取版本号")
|
||||||
|
@ApiImplicitParam(name = "appType", value = "app类型", required = true, paramType = "path")
|
||||||
|
@GetMapping("/appVersion/{type}")
|
||||||
|
public ResultMessage<IPage<AppVersion>> appVersion(PageVO pageVO, @PathVariable String appType) {
|
||||||
|
|
||||||
|
IPage<AppVersion> page=appVersionService.page(PageUtil.initPage(pageVO), new LambdaQueryWrapper<AppVersion>().eq(AppVersion::getType, appType));
|
||||||
|
return ResultUtil.data(page);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import cn.lili.modules.payment.kit.dto.PayParam;
|
|||||||
import cn.lili.modules.payment.kit.enums.PaymentClientEnum;
|
import cn.lili.modules.payment.kit.enums.PaymentClientEnum;
|
||||||
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
||||||
import cn.lili.modules.payment.kit.params.dto.CashierParam;
|
import cn.lili.modules.payment.kit.params.dto.CashierParam;
|
||||||
import cn.lili.modules.payment.service.PaymentService;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
@ -35,8 +34,6 @@ public class CashierController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CashierSupport cashierSupport;
|
private CashierSupport cashierSupport;
|
||||||
@Autowired
|
|
||||||
private PaymentService paymentService;
|
|
||||||
|
|
||||||
|
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
|
@ -124,7 +124,7 @@ spring:
|
|||||||
props:
|
props:
|
||||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||||
sql:
|
sql:
|
||||||
show: true
|
show: false
|
||||||
|
|
||||||
# 忽略TOKEN 鉴权 的url
|
# 忽略TOKEN 鉴权 的url
|
||||||
ignored:
|
ignored:
|
||||||
|
@ -121,7 +121,7 @@ spring:
|
|||||||
props:
|
props:
|
||||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||||
sql:
|
sql:
|
||||||
show: true
|
show: false
|
||||||
|
|
||||||
# 忽略鉴权url
|
# 忽略鉴权url
|
||||||
ignored:
|
ignored:
|
||||||
|
@ -121,7 +121,7 @@ spring:
|
|||||||
props:
|
props:
|
||||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||||
sql:
|
sql:
|
||||||
show: true
|
show: false
|
||||||
|
|
||||||
# 忽略鉴权url
|
# 忽略鉴权url
|
||||||
ignored:
|
ignored:
|
||||||
@ -209,6 +209,18 @@ jasypt:
|
|||||||
password: lili
|
password: lili
|
||||||
|
|
||||||
lili:
|
lili:
|
||||||
|
#短信模版配置
|
||||||
|
sms:
|
||||||
|
#登录
|
||||||
|
LOGIN: SMS_205755300
|
||||||
|
#注册
|
||||||
|
REGISTER: SMS_205755298
|
||||||
|
#找回密码
|
||||||
|
FIND_USER: SMS_205755301
|
||||||
|
#设置密码
|
||||||
|
UPDATE_PASSWORD: SMS_205755297
|
||||||
|
#支付密码
|
||||||
|
WALLET_PASSWORD: SMS_205755301
|
||||||
system:
|
system:
|
||||||
isDemoSite: true
|
isDemoSite: true
|
||||||
licences: 'temporary'
|
licences: 'temporary'
|
||||||
|
@ -121,7 +121,7 @@ spring:
|
|||||||
props:
|
props:
|
||||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||||
sql:
|
sql:
|
||||||
show: true
|
show: false
|
||||||
|
|
||||||
# 忽略鉴权url
|
# 忽略鉴权url
|
||||||
ignored:
|
ignored:
|
||||||
@ -210,6 +210,18 @@ jasypt:
|
|||||||
password: lili
|
password: lili
|
||||||
|
|
||||||
lili:
|
lili:
|
||||||
|
#短信模版配置
|
||||||
|
sms:
|
||||||
|
#登录
|
||||||
|
LOGIN: SMS_205755300
|
||||||
|
#注册
|
||||||
|
REGISTER: SMS_205755298
|
||||||
|
#找回密码
|
||||||
|
FIND_USER: SMS_205755301
|
||||||
|
#设置密码
|
||||||
|
UPDATE_PASSWORD: SMS_205755297
|
||||||
|
#支付密码
|
||||||
|
WALLET_PASSWORD: SMS_205755301
|
||||||
system:
|
system:
|
||||||
isDemoSite: false
|
isDemoSite: false
|
||||||
statistics:
|
statistics:
|
||||||
@ -237,7 +249,7 @@ lili:
|
|||||||
# jwt 细节设定
|
# jwt 细节设定
|
||||||
jwt-setting:
|
jwt-setting:
|
||||||
# token过期时间(分钟)
|
# token过期时间(分钟)
|
||||||
tokenExpireTime: 60
|
tokenExpireTime: 1
|
||||||
|
|
||||||
# 使用Spring @Cacheable注解失效时间
|
# 使用Spring @Cacheable注解失效时间
|
||||||
cache:
|
cache:
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package cn.lili.event.impl;
|
||||||
|
|
||||||
|
import cn.lili.event.TradeEvent;
|
||||||
|
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||||
|
import cn.lili.modules.order.order.service.TradeService;
|
||||||
|
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态处理类
|
||||||
|
*
|
||||||
|
* @author Chopper
|
||||||
|
* @date 2020-07-03 11:20
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class OrderStatusHandlerExecute implements TradeEvent {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TradeService tradeService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void orderCreate(TradeDTO tradeDTO) {
|
||||||
|
//如果订单需要支付金额为0,则将订单步入到下一个流程
|
||||||
|
if (tradeDTO.getPriceDetailDTO().getFlowPrice() <= 0) {
|
||||||
|
tradeService.payTrade(tradeDTO.getSn(), PaymentMethodEnum.BANK_TRANSFER.name(), "-1");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
package cn.lili.trigger.executor;
|
package cn.lili.trigger.executor;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.common.delayqueue.PintuanOrderMessage;
|
import cn.lili.common.trigger.message.PintuanOrderMessage;
|
||||||
import cn.lili.common.delayqueue.PromotionMessage;
|
import cn.lili.common.trigger.message.PromotionMessage;
|
||||||
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
||||||
import cn.lili.common.trigger.interfaces.TimeTriggerExecutor;
|
import cn.lili.common.trigger.interfaces.TimeTriggerExecutor;
|
||||||
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
||||||
|
@ -121,7 +121,7 @@ spring:
|
|||||||
props:
|
props:
|
||||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||||
sql:
|
sql:
|
||||||
show: true
|
show: false
|
||||||
|
|
||||||
# 忽略鉴权url
|
# 忽略鉴权url
|
||||||
ignored:
|
ignored:
|
||||||
|
@ -232,4 +232,35 @@ public interface Cache<T> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Set<ZSetOperations.TypedTuple<Object>> reverseRangeWithScores(String sortedSetName, Integer start, Integer end);
|
Set<ZSetOperations.TypedTuple<Object>> reverseRangeWithScores(String sortedSetName, Integer start, Integer end);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向Zset里添加成员
|
||||||
|
*
|
||||||
|
* @param key key值
|
||||||
|
* @param score 分数
|
||||||
|
* @param value 值
|
||||||
|
* @return 增加状态
|
||||||
|
*/
|
||||||
|
boolean zAdd(String key, long score, String value);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 某key 下 某一分值区间的队列
|
||||||
|
*
|
||||||
|
* @param key 缓存key
|
||||||
|
* @param from 开始时间
|
||||||
|
* @param to 结束时间
|
||||||
|
* @return 数据
|
||||||
|
*/
|
||||||
|
Set<ZSetOperations.TypedTuple<Object>> zRangeByScore(String key, int from, long to);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除 Zset队列值
|
||||||
|
*
|
||||||
|
* @param key key值
|
||||||
|
* @param value 删除的集合
|
||||||
|
* @return 删除数量
|
||||||
|
*/
|
||||||
|
Long zRemove(String key, String... value);
|
||||||
}
|
}
|
||||||
|
@ -242,4 +242,47 @@ public class RedisCache implements Cache {
|
|||||||
public Set<ZSetOperations.TypedTuple<Object>> reverseRangeWithScores(String sortedSetName, Integer start, Integer end) {
|
public Set<ZSetOperations.TypedTuple<Object>> reverseRangeWithScores(String sortedSetName, Integer start, Integer end) {
|
||||||
return this.redisTemplate.opsForZSet().reverseRangeWithScores(sortedSetName, start, end);
|
return this.redisTemplate.opsForZSet().reverseRangeWithScores(sortedSetName, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向Zset里添加成员
|
||||||
|
*
|
||||||
|
* @param key key值
|
||||||
|
* @param score 分数,通常用于排序
|
||||||
|
* @param value 值
|
||||||
|
* @return 增加状态
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean zAdd(String key, long score, String value) {
|
||||||
|
Boolean result = redisTemplate.opsForZSet().add(key, value, score);
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 某key 下 某一分值区间的队列
|
||||||
|
*
|
||||||
|
* @param key 缓存key
|
||||||
|
* @param from 开始时间
|
||||||
|
* @param to 结束时间
|
||||||
|
* @return 数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Set<ZSetOperations.TypedTuple<Object>> zRangeByScore(String key, int from, long to) {
|
||||||
|
Set<ZSetOperations.TypedTuple<Object>> set = redisTemplate.opsForZSet().rangeByScoreWithScores(key, from, to);
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除 Zset队列值
|
||||||
|
*
|
||||||
|
* @param key key值
|
||||||
|
* @param value 删除的集合
|
||||||
|
* @return 删除数量
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Long zRemove(String key, String... value) {
|
||||||
|
return redisTemplate.opsForZSet().remove(key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,7 @@ public enum ResultCode {
|
|||||||
/**
|
/**
|
||||||
* 支付
|
* 支付
|
||||||
*/
|
*/
|
||||||
|
PAY_UN_WANTED(32000, "当前订单不需要付款,返回订单列表等待系统订单出库即可"),
|
||||||
PAY_SUCCESS(32001, "支付成功"),
|
PAY_SUCCESS(32001, "支付成功"),
|
||||||
PAY_INCONSISTENT_ERROR(32002, "付款金额和应付金额不一致"),
|
PAY_INCONSISTENT_ERROR(32002, "付款金额和应付金额不一致"),
|
||||||
PAY_DOUBLE_ERROR(32003, "订单已支付,不能再次进行支付"),
|
PAY_DOUBLE_ERROR(32003, "订单已支付,不能再次进行支付"),
|
||||||
|
@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletRequestWrapper;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 防止Xss sql注入
|
* 防止Xss
|
||||||
*
|
*
|
||||||
* @author Chopper
|
* @author Chopper
|
||||||
* @version v1.0
|
* @version v1.0
|
||||||
@ -93,8 +93,8 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
|||||||
private String cleanXSS(String value) {
|
private String cleanXSS(String value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
//推荐使用ESAPI库来避免脚本攻击,value = ESAPI.encoder().canonicalize(value);
|
//推荐使用ESAPI库来避免脚本攻击,value = ESAPI.encoder().canonicalize(value);
|
||||||
// 避免空字符串
|
// // 避免空字符串
|
||||||
value = value.replaceAll(" ", "");
|
// value = value.replaceAll(" ", "");
|
||||||
// 避免script 标签
|
// 避免script 标签
|
||||||
Pattern scriptPattern = Pattern.compile("<script>(.*?)</script>", Pattern.CASE_INSENSITIVE);
|
Pattern scriptPattern = Pattern.compile("<script>(.*?)</script>", Pattern.CASE_INSENSITIVE);
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
value = scriptPattern.matcher(value).replaceAll("");
|
||||||
|
@ -10,6 +10,7 @@ import cn.lili.common.sms.AliSmsUtil;
|
|||||||
import cn.lili.common.sms.SmsUtil;
|
import cn.lili.common.sms.SmsUtil;
|
||||||
import cn.lili.common.utils.CommonUtil;
|
import cn.lili.common.utils.CommonUtil;
|
||||||
import cn.lili.common.verification.enums.VerificationEnums;
|
import cn.lili.common.verification.enums.VerificationEnums;
|
||||||
|
import cn.lili.config.properties.SmsTemplateSetting;
|
||||||
import cn.lili.modules.connect.util.Base64Utils;
|
import cn.lili.modules.connect.util.Base64Utils;
|
||||||
import cn.lili.modules.member.entity.dos.Member;
|
import cn.lili.modules.member.entity.dos.Member;
|
||||||
import cn.lili.modules.member.service.MemberService;
|
import cn.lili.modules.member.service.MemberService;
|
||||||
@ -51,6 +52,9 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MemberService memberService;
|
private MemberService memberService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SmsTemplateSetting smsTemplateSetting;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendSmsCode(String mobile, VerificationEnums verificationEnums, String uuid) {
|
public void sendSmsCode(String mobile, VerificationEnums verificationEnums, String uuid) {
|
||||||
//获取短信配置
|
//获取短信配置
|
||||||
@ -75,17 +79,17 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
switch (verificationEnums) {
|
switch (verificationEnums) {
|
||||||
//登录
|
//登录
|
||||||
case LOGIN: {
|
case LOGIN: {
|
||||||
templateCode = "SMS_205755300";
|
templateCode = smsTemplateSetting.getLOGIN();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//注册
|
//注册
|
||||||
case REGISTER: {
|
case REGISTER: {
|
||||||
templateCode = "SMS_205755298";
|
templateCode = smsTemplateSetting.getREGISTER();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//找回密码
|
//找回密码
|
||||||
case FIND_USER: {
|
case FIND_USER: {
|
||||||
templateCode = "SMS_205755301";
|
templateCode = smsTemplateSetting.getFIND_USER();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//修改密码
|
//修改密码
|
||||||
@ -96,7 +100,15 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
}
|
}
|
||||||
//更新为用户最新手机号
|
//更新为用户最新手机号
|
||||||
mobile = member.getMobile();
|
mobile = member.getMobile();
|
||||||
templateCode = "SMS_205755297";
|
templateCode = smsTemplateSetting.getUPDATE_PASSWORD();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//设置支付密码
|
||||||
|
case WALLET_PASSWORD: {
|
||||||
|
Member member = memberService.getById(UserContext.getCurrentUser().getId());
|
||||||
|
//更新为用户最新手机号
|
||||||
|
mobile = member.getMobile();
|
||||||
|
templateCode = smsTemplateSetting.getWALLET_PASSWORD();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//如果不是有效的验证码手段,则此处不进行短信操作
|
//如果不是有效的验证码手段,则此处不进行短信操作
|
||||||
|
@ -17,6 +17,8 @@ import org.springframework.messaging.support.MessageBuilder;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 延时任务实现
|
||||||
|
*
|
||||||
* @author paulG
|
* @author paulG
|
||||||
* @since 2020/11/5
|
* @since 2020/11/5
|
||||||
**/
|
**/
|
||||||
@ -32,8 +34,23 @@ public class RocketmqTimerTrigger implements TimeTrigger {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(String executorName, Object param, Long triggerTime, String uniqueKey, String topic) {
|
public void add(TimeTriggerMsg timeTriggerMsg) {
|
||||||
|
this.addExecute(timeTriggerMsg.getTriggerExecutor(), timeTriggerMsg.getParam(), timeTriggerMsg.getTriggerTime(), timeTriggerMsg.getUniqueKey(), timeTriggerMsg.getTopic());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加延时任务
|
||||||
|
*
|
||||||
|
* @param executorName 执行器beanId
|
||||||
|
* @param param 执行参数
|
||||||
|
* @param triggerTime 执行时间 时间戳 秒为单位
|
||||||
|
* @param uniqueKey 如果是一个 需要有 修改/取消 延时任务功能的延时任务,<br/>
|
||||||
|
* 请填写此参数,作为后续删除,修改做为唯一凭证 <br/>
|
||||||
|
* 建议参数为:COUPON_{ACTIVITY_ID} 例如 coupon_123<br/>
|
||||||
|
* 业务内全局唯一
|
||||||
|
* @param topic rocketmq topic
|
||||||
|
*/
|
||||||
|
public void addExecute(String executorName, Object param, Long triggerTime, String uniqueKey, String topic) {
|
||||||
|
|
||||||
TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(executorName, triggerTime, param, uniqueKey, topic);
|
TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(executorName, triggerTime, param, uniqueKey, topic);
|
||||||
Message<TimeTriggerMsg> message = MessageBuilder.withPayload(timeTriggerMsg).build();
|
Message<TimeTriggerMsg> message = MessageBuilder.withPayload(timeTriggerMsg).build();
|
||||||
@ -41,13 +58,9 @@ public class RocketmqTimerTrigger implements TimeTrigger {
|
|||||||
this.rocketMQTemplate.asyncSend(topic, message, RocketmqSendCallbackBuilder.commonCallback());
|
this.rocketMQTemplate.asyncSend(topic, message, RocketmqSendCallbackBuilder.commonCallback());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void add(TimeTriggerMsg timeTriggerMsg) {
|
|
||||||
this.add(timeTriggerMsg.getTriggerExecutor(), timeTriggerMsg.getParam(), timeTriggerMsg.getTriggerTime(), timeTriggerMsg.getUniqueKey(), timeTriggerMsg.getTopic());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addDelay(TimeTriggerMsg timeTriggerMsg, int delayTime) {
|
public void addDelay(TimeTriggerMsg timeTriggerMsg, int delayTime) {
|
||||||
|
//执行器唯一key
|
||||||
String uniqueKey = timeTriggerMsg.getUniqueKey();
|
String uniqueKey = timeTriggerMsg.getUniqueKey();
|
||||||
if (StringUtils.isEmpty(uniqueKey)) {
|
if (StringUtils.isEmpty(uniqueKey)) {
|
||||||
uniqueKey = StringUtils.getRandStr(10);
|
uniqueKey = StringUtils.getRandStr(10);
|
||||||
@ -56,7 +69,7 @@ public class RocketmqTimerTrigger implements TimeTrigger {
|
|||||||
String generateKey = TimeTriggerUtil.generateKey(timeTriggerMsg.getTriggerExecutor(), timeTriggerMsg.getTriggerTime(), uniqueKey);
|
String generateKey = TimeTriggerUtil.generateKey(timeTriggerMsg.getTriggerExecutor(), timeTriggerMsg.getTriggerTime(), uniqueKey);
|
||||||
this.cache.put(generateKey, 1);
|
this.cache.put(generateKey, 1);
|
||||||
//设置延时任务
|
//设置延时任务
|
||||||
if (Boolean.TRUE.equals(promotionDelayQueue.addJobId(JSONUtil.toJsonStr(timeTriggerMsg), delayTime))) {
|
if (Boolean.TRUE.equals(promotionDelayQueue.addJob(JSONUtil.toJsonStr(timeTriggerMsg), delayTime))) {
|
||||||
log.info("add Redis key {}", generateKey);
|
log.info("add Redis key {}", generateKey);
|
||||||
log.info("定时执行在【" + DateUtil.toString(timeTriggerMsg.getTriggerTime(), "yyyy-MM-dd HH:mm:ss") + "】,消费【" + timeTriggerMsg.getParam().toString() + "】");
|
log.info("定时执行在【" + DateUtil.toString(timeTriggerMsg.getTriggerTime(), "yyyy-MM-dd HH:mm:ss") + "】,消费【" + timeTriggerMsg.getParam().toString() + "】");
|
||||||
} else {
|
} else {
|
||||||
@ -73,7 +86,7 @@ public class RocketmqTimerTrigger implements TimeTrigger {
|
|||||||
@Override
|
@Override
|
||||||
public void delete(String executorName, Long triggerTime, String uniqueKey, String topic) {
|
public void delete(String executorName, Long triggerTime, String uniqueKey, String topic) {
|
||||||
String generateKey = TimeTriggerUtil.generateKey(executorName, triggerTime, uniqueKey);
|
String generateKey = TimeTriggerUtil.generateKey(executorName, triggerTime, uniqueKey);
|
||||||
log.info("delete redis key {} -----------------------", generateKey);
|
log.info("删除延时任务{}", generateKey);
|
||||||
this.cache.remove(generateKey);
|
this.cache.remove(generateKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.lili.common.delayqueue;
|
package cn.lili.common.trigger.delay;
|
||||||
|
|
||||||
import cn.lili.common.utils.RedisUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import cn.lili.common.cache.Cache;
|
||||||
import cn.lili.common.utils.ThreadPoolUtil;
|
import cn.lili.common.utils.ThreadPoolUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -22,7 +23,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public abstract class AbstractDelayQueueMachineFactory {
|
public abstract class AbstractDelayQueueMachineFactory {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtil redisUtil;
|
private Cache cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入任务id
|
* 插入任务id
|
||||||
@ -31,12 +32,14 @@ public abstract class AbstractDelayQueueMachineFactory {
|
|||||||
* @param time 延时时间(单位 :秒)
|
* @param time 延时时间(单位 :秒)
|
||||||
* @return 是否插入成功
|
* @return 是否插入成功
|
||||||
*/
|
*/
|
||||||
public boolean addJobId(String jobId, Integer time) {
|
public boolean addJob(String jobId, Integer time) {
|
||||||
|
//获取时间
|
||||||
Calendar instance = Calendar.getInstance();
|
Calendar instance = Calendar.getInstance();
|
||||||
instance.add(Calendar.SECOND, time);
|
instance.add(Calendar.SECOND, time);
|
||||||
long delaySeconds = instance.getTimeInMillis() / 1000;
|
long delaySeconds = instance.getTimeInMillis() / 1000;
|
||||||
boolean result = redisUtil.zadd(setDelayQueueName(), delaySeconds, jobId);
|
//增加延时任务 参数依次为:队列名称、执行时间、任务id
|
||||||
log.info("redis add delay, key {}, delay time {}", setDelayQueueName(), time);
|
boolean result = cache.zAdd(setDelayQueueName(), delaySeconds, jobId);
|
||||||
|
log.info("增加延时任务, 缓存key {}, 等待时间 {}", setDelayQueueName(), time);
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -45,21 +48,24 @@ public abstract class AbstractDelayQueueMachineFactory {
|
|||||||
* 延时队列机器开始运作
|
* 延时队列机器开始运作
|
||||||
*/
|
*/
|
||||||
private void startDelayQueueMachine() {
|
private void startDelayQueueMachine() {
|
||||||
log.info(String.format("延时队列机器{%s}开始运作", setDelayQueueName()));
|
log.info("延时队列机器{}开始运作", setDelayQueueName());
|
||||||
|
|
||||||
// 发生异常捕获并且继续不能让战斗停下来
|
// 监听redis队列
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
// 获取当前时间的时间戳
|
// 获取当前时间的时间戳
|
||||||
long now = System.currentTimeMillis() / 1000;
|
long now = System.currentTimeMillis() / 1000;
|
||||||
// 获取当前时间前的任务列表
|
// 获取当前时间前的任务列表
|
||||||
Set<DefaultTypedTuple> tuples = redisUtil.zrangeByScoreWithScores(setDelayQueueName(), 0, now);
|
Set<DefaultTypedTuple> tuples = cache.zRangeByScore(setDelayQueueName(), 0, now);
|
||||||
// 如果不为空则遍历判断其是否满足取消要求
|
|
||||||
if (!CollectionUtils.isEmpty(tuples)) {
|
|
||||||
for (DefaultTypedTuple tuple : tuples) {
|
|
||||||
|
|
||||||
|
// 如果任务不为空
|
||||||
|
if (!CollectionUtils.isEmpty(tuples)) {
|
||||||
|
log.info("执行任务:{}", JSONUtil.toJsonStr(tuples));
|
||||||
|
|
||||||
|
for (DefaultTypedTuple tuple : tuples) {
|
||||||
String jobId = (String) tuple.getValue();
|
String jobId = (String) tuple.getValue();
|
||||||
Long num = redisUtil.zremove(setDelayQueueName(), jobId);
|
// 移除缓存,如果移除成功则表示当前线程处理了延时任务,则执行延时任务
|
||||||
|
Long num = cache.zRemove(setDelayQueueName(), jobId);
|
||||||
// 如果移除成功, 则执行
|
// 如果移除成功, 则执行
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
ThreadPoolUtil.execute(() -> invoke(jobId));
|
ThreadPoolUtil.execute(() -> invoke(jobId));
|
||||||
@ -68,7 +74,7 @@ public abstract class AbstractDelayQueueMachineFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(String.format("处理延时任务发生异常,异常原因为{%s}", e.getMessage()), e);
|
log.error("处理延时任务发生异常,异常原因为{}", e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
// 间隔一秒钟搞一次
|
// 间隔一秒钟搞一次
|
||||||
try {
|
try {
|
@ -1,7 +1,6 @@
|
|||||||
package cn.lili.common.trigger.delay;
|
package cn.lili.common.trigger.delay;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.common.delayqueue.AbstractDelayQueueMachineFactory;
|
|
||||||
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
||||||
import cn.lili.common.trigger.model.TimeTriggerMsg;
|
import cn.lili.common.trigger.model.TimeTriggerMsg;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cn.lili.common.delayqueue;
|
package cn.lili.common.trigger.enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 延时任务类型
|
* 延时任务类型
|
@ -9,19 +9,6 @@ import cn.lili.common.trigger.model.TimeTriggerMsg;
|
|||||||
*/
|
*/
|
||||||
public interface TimeTrigger {
|
public interface TimeTrigger {
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加延时任务
|
|
||||||
*
|
|
||||||
* @param executorName 执行器beanId
|
|
||||||
* @param param 执行参数
|
|
||||||
* @param triggerTime 执行时间 时间戳 秒为单位
|
|
||||||
* @param uniqueKey 如果是一个 需要有 修改/取消 延时任务功能的延时任务,<br/>
|
|
||||||
* 请填写此参数,作为后续删除,修改做为唯一凭证 <br/>
|
|
||||||
* 建议参数为:COUPON_{ACTIVITY_ID} 例如 coupon_123<br/>
|
|
||||||
* 业务内全局唯一
|
|
||||||
* @param topic rocketmq topic
|
|
||||||
*/
|
|
||||||
void add(String executorName, Object param, Long triggerTime, String uniqueKey, String topic);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加延时任务
|
* 添加延时任务
|
||||||
|
@ -2,14 +2,15 @@ package cn.lili.common.trigger.interfaces;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 延时任务执行器接口
|
* 延时任务执行器接口
|
||||||
* @author Chopper
|
|
||||||
*
|
*
|
||||||
|
* @author Chopper
|
||||||
*/
|
*/
|
||||||
public interface TimeTriggerExecutor {
|
public interface TimeTriggerExecutor {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行任务
|
* 执行任务
|
||||||
|
*
|
||||||
* @param object 任务参数
|
* @param object 任务参数
|
||||||
*/
|
*/
|
||||||
void execute(Object object);
|
void execute(Object object);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cn.lili.common.delayqueue;
|
package cn.lili.common.trigger.message;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -1,4 +1,4 @@
|
|||||||
package cn.lili.common.delayqueue;
|
package cn.lili.common.trigger.message;
|
||||||
|
|
||||||
import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
|
import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
@ -1,6 +1,8 @@
|
|||||||
package cn.lili.common.trigger.model;
|
package cn.lili.common.trigger.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 延时任务执行器常量
|
||||||
|
*
|
||||||
* @author paulG
|
* @author paulG
|
||||||
* @since 2020/8/20
|
* @since 2020/8/20
|
||||||
**/
|
**/
|
||||||
@ -16,14 +18,4 @@ public abstract class TimeExecuteConstant {
|
|||||||
*/
|
*/
|
||||||
public static final String BROADCAST_EXECUTOR = "broadcastTimeTriggerExecutor";
|
public static final String BROADCAST_EXECUTOR = "broadcastTimeTriggerExecutor";
|
||||||
|
|
||||||
/**
|
|
||||||
* 拼团延迟加载执行器
|
|
||||||
*/
|
|
||||||
public static final String PINTUAN_EXECUTOR = "pintuanTimeTriggerExecutor";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拼团延迟加载执行器
|
|
||||||
*/
|
|
||||||
public static final String FULL_DISCOUNT_EXECUTOR = "fullDiscountTimeTriggerExecutor";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
package cn.lili.common.delayqueue;
|
package cn.lili.common.trigger.util;
|
||||||
|
|
||||||
|
import cn.lili.common.trigger.enums.DelayQueueType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 延时任务工具类
|
* 延时任务工具类
|
@ -0,0 +1,26 @@
|
|||||||
|
package cn.lili.config.properties;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信模版设置
|
||||||
|
*
|
||||||
|
* @author Chopper
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "lili.sms")
|
||||||
|
public class SmsTemplateSetting {
|
||||||
|
//登录
|
||||||
|
private String LOGIN = "SMS_205755300";
|
||||||
|
//注册
|
||||||
|
private String REGISTER = "SMS_205755298";
|
||||||
|
//找回密码
|
||||||
|
private String FIND_USER = "SMS_205755301";
|
||||||
|
//设置密码
|
||||||
|
private String UPDATE_PASSWORD = "SMS_205755297";
|
||||||
|
//设置支付密码
|
||||||
|
private String WALLET_PASSWORD = "SMS_205755297";
|
||||||
|
}
|
@ -2,14 +2,14 @@ package cn.lili.modules.broadcast.serviceimpl;
|
|||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.common.delayqueue.BroadcastMessage;
|
import cn.lili.common.delayqueue.BroadcastMessage;
|
||||||
import cn.lili.common.delayqueue.DelayQueueTools;
|
|
||||||
import cn.lili.common.delayqueue.DelayQueueType;
|
|
||||||
import cn.lili.common.enums.ResultCode;
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.security.context.UserContext;
|
import cn.lili.common.security.context.UserContext;
|
||||||
|
import cn.lili.common.trigger.enums.DelayQueueType;
|
||||||
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
||||||
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
||||||
import cn.lili.common.trigger.model.TimeTriggerMsg;
|
import cn.lili.common.trigger.model.TimeTriggerMsg;
|
||||||
|
import cn.lili.common.trigger.util.DelayQueueTools;
|
||||||
import cn.lili.common.utils.BeanUtil;
|
import cn.lili.common.utils.BeanUtil;
|
||||||
import cn.lili.common.utils.DateUtil;
|
import cn.lili.common.utils.DateUtil;
|
||||||
import cn.lili.common.utils.PageUtil;
|
import cn.lili.common.utils.PageUtil;
|
||||||
|
@ -216,8 +216,8 @@ public class Order extends BaseEntity {
|
|||||||
} else {
|
} else {
|
||||||
this.setOrderType(tradeDTO.getCartTypeEnum().name());
|
this.setOrderType(tradeDTO.getCartTypeEnum().name());
|
||||||
}
|
}
|
||||||
//设定订单默认状态
|
|
||||||
this.setId(orderId);
|
//设置默认支付状态
|
||||||
this.setOrderStatus(OrderStatusEnum.UNPAID.name());
|
this.setOrderStatus(OrderStatusEnum.UNPAID.name());
|
||||||
this.setPayStatus(PayStatusEnum.UNPAID.name());
|
this.setPayStatus(PayStatusEnum.UNPAID.name());
|
||||||
this.setDeliverStatus(DeliverStatusEnum.UNDELIVERED.name());
|
this.setDeliverStatus(DeliverStatusEnum.UNDELIVERED.name());
|
||||||
|
@ -4,26 +4,22 @@ import cn.lili.base.BaseEntity;
|
|||||||
import cn.lili.modules.base.entity.enums.ClientTypeEnum;
|
import cn.lili.modules.base.entity.enums.ClientTypeEnum;
|
||||||
import cn.lili.modules.order.order.entity.enums.OrderTypeEnum;
|
import cn.lili.modules.order.order.entity.enums.OrderTypeEnum;
|
||||||
import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
|
import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单
|
* 订单支付日志:实际为订单部分字段提取过来的一个vo
|
||||||
*
|
*
|
||||||
* @author Chopper
|
* @author Chopper
|
||||||
* @date 2020/11/17 7:30 下午
|
* @date 2020/11/17 7:30 下午
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "li_order")
|
|
||||||
@TableName("li_order")
|
|
||||||
@ApiModel(value = "订单")
|
@ApiModel(value = "订单")
|
||||||
public class PaymentLog extends BaseEntity {
|
public class PaymentLog extends BaseEntity {
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@ import cn.hutool.json.JSONUtil;
|
|||||||
import cn.hutool.poi.excel.ExcelUtil;
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
import cn.hutool.poi.excel.ExcelWriter;
|
import cn.hutool.poi.excel.ExcelWriter;
|
||||||
import cn.lili.common.aop.syslog.annotation.SystemLogPoint;
|
import cn.lili.common.aop.syslog.annotation.SystemLogPoint;
|
||||||
import cn.lili.common.delayqueue.DelayQueueTools;
|
import cn.lili.common.trigger.util.DelayQueueTools;
|
||||||
import cn.lili.common.delayqueue.DelayQueueType;
|
import cn.lili.common.trigger.enums.DelayQueueType;
|
||||||
import cn.lili.common.delayqueue.PintuanOrderMessage;
|
import cn.lili.common.trigger.message.PintuanOrderMessage;
|
||||||
import cn.lili.common.enums.ResultCode;
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.rocketmq.RocketmqSendCallbackBuilder;
|
import cn.lili.common.rocketmq.RocketmqSendCallbackBuilder;
|
||||||
|
@ -145,7 +145,14 @@ public class CashierSupport {
|
|||||||
public CashierParam cashierParam(PayParam payParam) {
|
public CashierParam cashierParam(PayParam payParam) {
|
||||||
for (CashierExecute paramInterface : cashierExecuteList) {
|
for (CashierExecute paramInterface : cashierExecuteList) {
|
||||||
CashierParam cashierParam = paramInterface.getPaymentParams(payParam);
|
CashierParam cashierParam = paramInterface.getPaymentParams(payParam);
|
||||||
if (cashierParam != null) {
|
//如果为空,则表示收银台参数初始化不匹配,继续匹配下一条
|
||||||
|
if (cashierParam == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//如果订单不需要付款,则抛出异常,直接返回
|
||||||
|
if (cashierParam.getPrice() <= 0) {
|
||||||
|
throw new ServiceException(ResultCode.PAY_UN_WANTED);
|
||||||
|
}
|
||||||
cashierParam.setSupport(support(payParam.getClientType()));
|
cashierParam.setSupport(support(payParam.getClientType()));
|
||||||
cashierParam.setWalletValue(memberWalletService.getMemberWallet(UserContext.getCurrentUser().getId()).getMemberWallet());
|
cashierParam.setWalletValue(memberWalletService.getMemberWallet(UserContext.getCurrentUser().getId()).getMemberWallet());
|
||||||
OrderSetting orderSetting = JSONUtil.toBean(settingService.get(SettingEnum.ORDER_SETTING.name()).getSettingValue(), OrderSetting.class);
|
OrderSetting orderSetting = JSONUtil.toBean(settingService.get(SettingEnum.ORDER_SETTING.name()).getSettingValue(), OrderSetting.class);
|
||||||
@ -153,12 +160,17 @@ public class CashierSupport {
|
|||||||
cashierParam.setAutoCancel(cashierParam.getCreateTime().getTime() + minute * 1000 * 60);
|
cashierParam.setAutoCancel(cashierParam.getCreateTime().getTime() + minute * 1000 * 60);
|
||||||
return cashierParam;
|
return cashierParam;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
log.error("错误的支付请求:{}", payParam.toString());
|
log.error("错误的支付请求:{}", payParam.toString());
|
||||||
throw new ServiceException(ResultCode.PAY_CASHIER_ERROR);
|
throw new ServiceException(ResultCode.PAY_CASHIER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付结果
|
||||||
|
*
|
||||||
|
* @param payParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Boolean paymentResult(PayParam payParam) {
|
public Boolean paymentResult(PayParam payParam) {
|
||||||
for (CashierExecute cashierExecute : cashierExecuteList) {
|
for (CashierExecute cashierExecute : cashierExecuteList) {
|
||||||
if (cashierExecute.cashierEnum().name().equals(payParam.getOrderType())) {
|
if (cashierExecute.cashierEnum().name().equals(payParam.getOrderType())) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cn.lili.modules.promotion.service;
|
package cn.lili.modules.promotion.service;
|
||||||
|
|
||||||
import cn.lili.common.delayqueue.PromotionMessage;
|
import cn.lili.common.trigger.message.PromotionMessage;
|
||||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package cn.lili.modules.promotion.serviceimpl;
|
package cn.lili.modules.promotion.serviceimpl;
|
||||||
|
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.lili.common.delayqueue.DelayQueueTools;
|
import cn.lili.common.trigger.util.DelayQueueTools;
|
||||||
import cn.lili.common.delayqueue.DelayQueueType;
|
import cn.lili.common.trigger.enums.DelayQueueType;
|
||||||
import cn.lili.common.delayqueue.PromotionMessage;
|
import cn.lili.common.trigger.message.PromotionMessage;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
||||||
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package cn.lili.modules.promotion.serviceimpl;
|
package cn.lili.modules.promotion.serviceimpl;
|
||||||
|
|
||||||
import cn.lili.common.delayqueue.DelayQueueTools;
|
import cn.lili.common.trigger.util.DelayQueueTools;
|
||||||
import cn.lili.common.delayqueue.DelayQueueType;
|
import cn.lili.common.trigger.enums.DelayQueueType;
|
||||||
import cn.lili.common.delayqueue.PromotionMessage;
|
import cn.lili.common.trigger.message.PromotionMessage;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
||||||
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package cn.lili.modules.promotion.serviceimpl;
|
package cn.lili.modules.promotion.serviceimpl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.lili.common.delayqueue.DelayQueueTools;
|
import cn.lili.common.trigger.util.DelayQueueTools;
|
||||||
import cn.lili.common.delayqueue.DelayQueueType;
|
import cn.lili.common.trigger.enums.DelayQueueType;
|
||||||
import cn.lili.common.delayqueue.PromotionMessage;
|
import cn.lili.common.trigger.message.PromotionMessage;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
||||||
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package cn.lili.modules.promotion.serviceimpl;
|
package cn.lili.modules.promotion.serviceimpl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.lili.common.delayqueue.DelayQueueTools;
|
import cn.lili.common.trigger.util.DelayQueueTools;
|
||||||
import cn.lili.common.delayqueue.DelayQueueType;
|
import cn.lili.common.trigger.enums.DelayQueueType;
|
||||||
import cn.lili.common.delayqueue.PromotionMessage;
|
import cn.lili.common.trigger.message.PromotionMessage;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
||||||
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
||||||
|
@ -3,7 +3,7 @@ package cn.lili.modules.promotion.serviceimpl;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.common.delayqueue.PromotionMessage;
|
import cn.lili.common.trigger.message.PromotionMessage;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.utils.DateUtil;
|
import cn.lili.common.utils.DateUtil;
|
||||||
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
|
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package cn.lili.modules.promotion.serviceimpl;
|
package cn.lili.modules.promotion.serviceimpl;
|
||||||
|
|
||||||
import cn.lili.common.delayqueue.DelayQueueTools;
|
import cn.lili.common.trigger.util.DelayQueueTools;
|
||||||
import cn.lili.common.delayqueue.DelayQueueType;
|
import cn.lili.common.trigger.enums.DelayQueueType;
|
||||||
import cn.lili.common.delayqueue.PromotionMessage;
|
import cn.lili.common.trigger.message.PromotionMessage;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
import cn.lili.common.trigger.interfaces.TimeTrigger;
|
||||||
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
||||||
|
@ -153,10 +153,16 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
|
|||||||
//索引名称拼接
|
//索引名称拼接
|
||||||
String indexName = elasticsearchProperties.getIndexPrefix() + "_" + EsSuffix.GOODS_INDEX_NAME;
|
String indexName = elasticsearchProperties.getIndexPrefix() + "_" + EsSuffix.GOODS_INDEX_NAME;
|
||||||
|
|
||||||
//如果索引不存在,则创建索引
|
//索引初始化,因为mapping结构问题:
|
||||||
if (!indexExist(indexName)) {
|
//但是如果索引已经自动生成过,这里就不会创建索引,设置mapping,所以这里决定在初始化索引的同时,将已有索引删除,重新创建
|
||||||
createIndexRequest(indexName);
|
|
||||||
|
//如果索引存在,则删除,重新生成。 这里应该有更优解。
|
||||||
|
if (this.indexExist(indexName)) {
|
||||||
|
deleteIndexRequest(indexName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//如果索引不存在,则创建索引
|
||||||
|
createIndexRequest(indexName);
|
||||||
if (goodsIndexList != null && !goodsIndexList.isEmpty()) {
|
if (goodsIndexList != null && !goodsIndexList.isEmpty()) {
|
||||||
goodsIndexRepository.deleteAll();
|
goodsIndexRepository.deleteAll();
|
||||||
for (EsGoodsIndex goodsIndex : goodsIndexList) {
|
for (EsGoodsIndex goodsIndex : goodsIndexList) {
|
||||||
|
@ -6,7 +6,7 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信配置
|
* 短信配置
|
||||||
*
|
* 这里在前台不做调整,方便客户直接把服务商的内容配置在我们平台
|
||||||
* @author Chopper
|
* @author Chopper
|
||||||
* @date 2020/11/30 15:23
|
* @date 2020/11/30 15:23
|
||||||
*/
|
*/
|
||||||
@ -17,7 +17,7 @@ public class SmsSetting implements Serializable {
|
|||||||
* 节点地址
|
* 节点地址
|
||||||
* key
|
* key
|
||||||
* 密钥
|
* 密钥
|
||||||
* 签名,这里在前台不做调整,方便客户直接把服务商的内容配置在我们平台
|
* 签名
|
||||||
*/
|
*/
|
||||||
private String regionId;
|
private String regionId;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVers
|
|||||||
@Override
|
@Override
|
||||||
public boolean checkAppVersion(AppVersion appVersion) {
|
public boolean checkAppVersion(AppVersion appVersion) {
|
||||||
//检测版本是否存在
|
//检测版本是否存在
|
||||||
if(null!=this.getOne(new LambdaQueryWrapper<AppVersion>().eq(AppVersion::getVersion,appVersion))){
|
if(null!=this.getOne(new LambdaQueryWrapper<AppVersion>().eq(AppVersion::getVersion,appVersion.getVersion()))){
|
||||||
throw new ServiceException(ResultCode.APP_VERSION_EXIST);
|
throw new ServiceException(ResultCode.APP_VERSION_EXIST);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -121,7 +121,7 @@ spring:
|
|||||||
props:
|
props:
|
||||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||||
sql:
|
sql:
|
||||||
show: true
|
show: false
|
||||||
|
|
||||||
# 忽略鉴权url
|
# 忽略鉴权url
|
||||||
ignored:
|
ignored:
|
||||||
|
1
pom.xml
1
pom.xml
@ -25,6 +25,7 @@
|
|||||||
<module>seller-api</module>
|
<module>seller-api</module>
|
||||||
<module>common-api</module>
|
<module>common-api</module>
|
||||||
<module>consumer</module>
|
<module>consumer</module>
|
||||||
|
<module>admin</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public class OrderStoreController {
|
|||||||
|
|
||||||
@ApiOperation(value = "上传文件进行订单批量发货")
|
@ApiOperation(value = "上传文件进行订单批量发货")
|
||||||
@ApiImplicitParam(name = "file", value = "订单列表", required = true, dataType = "file", paramType = "query")
|
@ApiImplicitParam(name = "file", value = "订单列表", required = true, dataType = "file", paramType = "query")
|
||||||
@PutMapping(value = "/batchDeliver")
|
@PostMapping(value = "/batchDeliver")
|
||||||
public void batchDeliver(@RequestParam MultipartFile file) {
|
public void batchDeliver(@RequestParam MultipartFile file) {
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
try {
|
try {
|
||||||
|
@ -121,7 +121,7 @@ spring:
|
|||||||
props:
|
props:
|
||||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||||
sql:
|
sql:
|
||||||
show: true
|
show: false
|
||||||
|
|
||||||
# 忽略鉴权url
|
# 忽略鉴权url
|
||||||
ignored:
|
ignored:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user