mirror of
https://github.com/YunaiV/ruoyi-vue-pro.git
synced 2026-04-19 13:38:39 +00:00
Merge branch 'develop' of https://gitee.com/zhijiantianya/ruoyi-vue-pro
This commit is contained in:
@@ -21,7 +21,8 @@ import org.springframework.context.annotation.Bean;
|
|||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@ConditionalOnClass(name = {
|
@ConditionalOnClass(name = {
|
||||||
"org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer",
|
"org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer",
|
||||||
"io.opentracing.Tracer"
|
"io.opentracing.Tracer",
|
||||||
|
"jakarta.servlet.Filter"
|
||||||
})
|
})
|
||||||
@EnableConfigurationProperties(TracerProperties.class)
|
@EnableConfigurationProperties(TracerProperties.class)
|
||||||
@ConditionalOnProperty(prefix = "yudao.tracer", value = "enable", matchIfMissing = true)
|
@ConditionalOnProperty(prefix = "yudao.tracer", value = "enable", matchIfMissing = true)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.common.pojo.SortingField;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.enums.DbTypeEnum;
|
import cn.iocoder.yudao.framework.mybatis.core.enums.DbTypeEnum;
|
||||||
import com.baomidou.mybatisplus.annotation.DbType;
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
@@ -47,16 +48,36 @@ public class MyBatisUtils {
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("PatternVariableCanBeUsed")
|
||||||
public static <T> void addOrder(Wrapper<T> wrapper, Collection<SortingField> sortingFields) {
|
public static <T> void addOrder(Wrapper<T> wrapper, Collection<SortingField> sortingFields) {
|
||||||
if (CollUtil.isEmpty(sortingFields)) {
|
if (CollUtil.isEmpty(sortingFields)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QueryWrapper<T> query = (QueryWrapper<T>) wrapper;
|
if (wrapper instanceof QueryWrapper<T>) {
|
||||||
for (SortingField sortingField : sortingFields) {
|
QueryWrapper<T> query = (QueryWrapper<T>) wrapper;
|
||||||
query.orderBy(true,
|
for (SortingField sortingField : sortingFields) {
|
||||||
SortingField.ORDER_ASC.equals(sortingField.getOrder()),
|
query.orderBy(true,
|
||||||
StrUtil.toUnderlineCase(sortingField.getField()));
|
SortingField.ORDER_ASC.equals(sortingField.getOrder()),
|
||||||
|
StrUtil.toUnderlineCase(sortingField.getField()));
|
||||||
|
}
|
||||||
|
} else if (wrapper instanceof LambdaQueryWrapper<T>) {
|
||||||
|
// LambdaQueryWrapper 不直接支持字符串字段排序,使用 last 方法拼接 ORDER BY
|
||||||
|
LambdaQueryWrapper<T> lambdaQuery = (LambdaQueryWrapper<T>) wrapper;
|
||||||
|
StringBuilder orderBy = new StringBuilder();
|
||||||
|
for (SortingField sortingField : sortingFields) {
|
||||||
|
if (StrUtil.isNotEmpty(orderBy)) {
|
||||||
|
orderBy.append(", ");
|
||||||
|
}
|
||||||
|
orderBy.append(StrUtil.toUnderlineCase(sortingField.getField()))
|
||||||
|
.append(" ")
|
||||||
|
.append(SortingField.ORDER_ASC.equals(sortingField.getOrder()) ? "ASC" : "DESC");
|
||||||
|
}
|
||||||
|
lambdaQuery.last("ORDER BY " + orderBy);
|
||||||
|
// 另外个思路:https://blog.csdn.net/m0_59084856/article/details/138450913
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("Unsupported wrapper type: " + wrapper.getClass().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ public class ApiEncryptFilter extends ApiRequestFilter {
|
|||||||
*
|
*
|
||||||
* @param request 请求
|
* @param request 请求
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("PatternVariableCanBeUsed")
|
||||||
private ApiEncrypt getApiEncrypt(HttpServletRequest request) {
|
private ApiEncrypt getApiEncrypt(HttpServletRequest request) {
|
||||||
try {
|
try {
|
||||||
HandlerExecutionChain mappingHandler = requestMappingHandlerMapping.getHandler(request);
|
HandlerExecutionChain mappingHandler = requestMappingHandlerMapping.getHandler(request);
|
||||||
@@ -135,7 +136,8 @@ public class ApiEncryptFilter extends ApiRequestFilter {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Object handler = mappingHandler.getHandler();
|
Object handler = mappingHandler.getHandler();
|
||||||
if (handler instanceof HandlerMethod handlerMethod) {
|
if (handler instanceof HandlerMethod) {
|
||||||
|
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||||
ApiEncrypt annotation = handlerMethod.getMethodAnnotation(ApiEncrypt.class);
|
ApiEncrypt annotation = handlerMethod.getMethodAnnotation(ApiEncrypt.class);
|
||||||
if (annotation == null) {
|
if (annotation == null) {
|
||||||
annotation = handlerMethod.getBeanType().getAnnotation(ApiEncrypt.class);
|
annotation = handlerMethod.getBeanType().getAnnotation(ApiEncrypt.class);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import org.springframework.web.bind.MissingServletRequestParameterException;
|
|||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||||
|
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -92,6 +93,9 @@ public class GlobalExceptionHandler {
|
|||||||
if (ex instanceof ValidationException) {
|
if (ex instanceof ValidationException) {
|
||||||
return validationException((ValidationException) ex);
|
return validationException((ValidationException) ex);
|
||||||
}
|
}
|
||||||
|
if (ex instanceof MaxUploadSizeExceededException) {
|
||||||
|
return maxUploadSizeExceededExceptionHandler((MaxUploadSizeExceededException) ex);
|
||||||
|
}
|
||||||
if (ex instanceof NoHandlerFoundException) {
|
if (ex instanceof NoHandlerFoundException) {
|
||||||
return noHandlerFoundExceptionHandler((NoHandlerFoundException) ex);
|
return noHandlerFoundExceptionHandler((NoHandlerFoundException) ex);
|
||||||
}
|
}
|
||||||
@@ -209,6 +213,14 @@ public class GlobalExceptionHandler {
|
|||||||
return CommonResult.error(BAD_REQUEST);
|
return CommonResult.error(BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理上传文件过大异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(MaxUploadSizeExceededException.class)
|
||||||
|
public CommonResult<?> maxUploadSizeExceededExceptionHandler(MaxUploadSizeExceededException ex) {
|
||||||
|
return CommonResult.error(BAD_REQUEST.getCode(), "上传文件过大,请调整后重试");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理 SpringMVC 请求地址不存在
|
* 处理 SpringMVC 请求地址不存在
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public interface CouponConvert {
|
|||||||
CouponRespDTO convert(CouponDO bean);
|
CouponRespDTO convert(CouponDO bean);
|
||||||
|
|
||||||
default CouponDO convert(CouponTemplateDO template, Long userId) {
|
default CouponDO convert(CouponTemplateDO template, Long userId) {
|
||||||
CouponDO couponDO = new CouponDO()
|
CouponDO coupon = new CouponDO()
|
||||||
.setTemplateId(template.getId())
|
.setTemplateId(template.getId())
|
||||||
.setName(template.getName())
|
.setName(template.getName())
|
||||||
.setTakeType(template.getTakeType())
|
.setTakeType(template.getTakeType())
|
||||||
@@ -44,13 +44,13 @@ public interface CouponConvert {
|
|||||||
.setStatus(CouponStatusEnum.UNUSED.getStatus())
|
.setStatus(CouponStatusEnum.UNUSED.getStatus())
|
||||||
.setUserId(userId);
|
.setUserId(userId);
|
||||||
if (CouponTemplateValidityTypeEnum.DATE.getType().equals(template.getValidityType())) {
|
if (CouponTemplateValidityTypeEnum.DATE.getType().equals(template.getValidityType())) {
|
||||||
couponDO.setValidStartTime(template.getValidStartTime());
|
coupon.setValidStartTime(template.getValidStartTime());
|
||||||
couponDO.setValidEndTime(template.getValidEndTime());
|
coupon.setValidEndTime(template.getValidEndTime());
|
||||||
} else if (CouponTemplateValidityTypeEnum.TERM.getType().equals(template.getValidityType())) {
|
} else if (CouponTemplateValidityTypeEnum.TERM.getType().equals(template.getValidityType())) {
|
||||||
couponDO.setValidStartTime(LocalDateTime.now().plusDays(template.getFixedStartTerm()));
|
coupon.setValidStartTime(LocalDateTime.now().plusDays(template.getFixedStartTerm()));
|
||||||
couponDO.setValidEndTime(LocalDateTime.now().plusDays(template.getFixedEndTerm()));
|
coupon.setValidEndTime(coupon.getValidStartTime().plusDays(template.getFixedEndTerm()));
|
||||||
}
|
}
|
||||||
return couponDO;
|
return coupon;
|
||||||
}
|
}
|
||||||
|
|
||||||
CouponPageReqVO convert(AppCouponPageReqVO pageReqVO, Collection<Long> userIds);
|
CouponPageReqVO convert(AppCouponPageReqVO pageReqVO, Collection<Long> userIds);
|
||||||
|
|||||||
@@ -43,6 +43,40 @@ public class TradeStatusSyncToWxaOrderHandler implements TradeOrderHandler {
|
|||||||
if (ObjUtil.notEqual(order.getPayChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
|
if (ObjUtil.notEqual(order.getPayChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 上传订单物流信息到微信小程序
|
||||||
|
uploadWxaOrderShippingInfo(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterReceiveOrder(TradeOrderDO order) {
|
||||||
|
// 注意:只有微信小程序支付的订单,才需要同步
|
||||||
|
if (ObjUtil.notEqual(order.getPayChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PayOrderRespDTO payOrder = payOrderApi.getOrder(order.getPayOrderId());
|
||||||
|
SocialWxaOrderNotifyConfirmReceiveReqDTO reqDTO = new SocialWxaOrderNotifyConfirmReceiveReqDTO()
|
||||||
|
.setTransactionId(payOrder.getChannelOrderNo())
|
||||||
|
.setReceivedTime(order.getReceiveTime());
|
||||||
|
try {
|
||||||
|
socialClientApi.notifyWxaOrderConfirmReceive(UserTypeEnum.MEMBER.getValue(), reqDTO);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("[afterReceiveOrder][订单({}) 通知订单收货到微信小程序失败]", order, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果是门店自提订单,上传订单物流信息到微信小程序
|
||||||
|
// 原因是,门店自提订单没有 “afterDeliveryOrder” 阶段。可见 https://t.zsxq.com/KWD3u 反馈
|
||||||
|
if (DeliveryTypeEnum.PICK_UP.getType().equals(order.getDeliveryType())) {
|
||||||
|
uploadWxaOrderShippingInfo(order);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传订单物流信息到微信小程序
|
||||||
|
*
|
||||||
|
* @param order 订单
|
||||||
|
*/
|
||||||
|
private void uploadWxaOrderShippingInfo(TradeOrderDO order) {
|
||||||
PayOrderRespDTO payOrder = payOrderApi.getOrder(order.getPayOrderId());
|
PayOrderRespDTO payOrder = payOrderApi.getOrder(order.getPayOrderId());
|
||||||
SocialWxaOrderUploadShippingInfoReqDTO reqDTO = new SocialWxaOrderUploadShippingInfoReqDTO()
|
SocialWxaOrderUploadShippingInfoReqDTO reqDTO = new SocialWxaOrderUploadShippingInfoReqDTO()
|
||||||
.setTransactionId(payOrder.getChannelOrderNo())
|
.setTransactionId(payOrder.getChannelOrderNo())
|
||||||
@@ -65,23 +99,6 @@ public class TradeStatusSyncToWxaOrderHandler implements TradeOrderHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterReceiveOrder(TradeOrderDO order) {
|
|
||||||
// 注意:只有微信小程序支付的订单,才需要同步
|
|
||||||
if (ObjUtil.notEqual(order.getPayChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PayOrderRespDTO payOrder = payOrderApi.getOrder(order.getPayOrderId());
|
|
||||||
SocialWxaOrderNotifyConfirmReceiveReqDTO reqDTO = new SocialWxaOrderNotifyConfirmReceiveReqDTO()
|
|
||||||
.setTransactionId(payOrder.getChannelOrderNo())
|
|
||||||
.setReceivedTime(order.getReceiveTime());
|
|
||||||
try {
|
|
||||||
socialClientApi.notifyWxaOrderConfirmReceive(UserTypeEnum.MEMBER.getValue(), reqDTO);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
log.error("[afterReceiveOrder][订单({}) 通知订单收货到微信小程序失败]", order, ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO @芋艿:【设置路径】 https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%85%AD%E3%80%81%E6%B6%88%E6%81%AF%E8%B7%B3%E8%BD%AC%E8%B7%AF%E5%BE%84%E8%AE%BE%E7%BD%AE%E6%8E%A5%E5%8F%A3
|
// TODO @芋艿:【设置路径】 https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%85%AD%E3%80%81%E6%B6%88%E6%81%AF%E8%B7%B3%E8%BD%AC%E8%B7%AF%E5%BE%84%E8%AE%BE%E7%BD%AE%E6%8E%A5%E5%8F%A3
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user