历史订单 赠送
退款库存 回滚 日志打印 截断200
This commit is contained in:
@@ -14,14 +14,11 @@ import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
|
||||
|
||||
import java.net.http.HttpResponse;
|
||||
|
||||
|
||||
/**
|
||||
* 方法调用统一切面处理
|
||||
*
|
||||
* @author ww
|
||||
*/
|
||||
@Aspect
|
||||
@@ -45,7 +42,7 @@ public class ControllerAspect {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i] instanceof HttpServletRequest || args[i] instanceof HttpServletResponse) {
|
||||
args[i] = null;
|
||||
}else if (args[i] instanceof MultipartFile) {
|
||||
} else if (args[i] instanceof MultipartFile) {
|
||||
args[i] = "上传图片";
|
||||
}
|
||||
}
|
||||
@@ -63,16 +60,19 @@ public class ControllerAspect {
|
||||
ThreadUtil.execAsync(() -> {
|
||||
//请求的参数
|
||||
String resultJson = JSONObject.toJSONString(result);
|
||||
if (StrUtil.isNotBlank(resultJson) && resultJson.length() > 200) {
|
||||
resultJson = resultJson.substring(0, 200);
|
||||
}
|
||||
try {
|
||||
if (StrUtil.isNotBlank(resultJson) && !"null" .equals(resultJson)) {
|
||||
if (StrUtil.isNotBlank(resultJson) && !"null".equals(resultJson)) {
|
||||
log.info("""
|
||||
|
||||
>>>>>> {} {}
|
||||
>>>>>> IP: {}
|
||||
>>>>>> execute time:{}ms
|
||||
>>>>>> Request: {}
|
||||
>>>>>> Response: {}
|
||||
""",
|
||||
>>>>>> {} {}
|
||||
>>>>>> IP: {}
|
||||
>>>>>> execute time:{}ms
|
||||
>>>>>> Request: {}
|
||||
>>>>>> Response: {}
|
||||
""",
|
||||
method, requestUrl, requestIp, useTime,
|
||||
params,
|
||||
resultJson
|
||||
|
||||
@@ -56,6 +56,11 @@ public class RabbitConfig {
|
||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.PRODUCT_INFO_CHANGE_QUEUE, true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue orderRefundQueue() {
|
||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_REFUND_QUEUE, true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public DirectExchange directExchange() {
|
||||
@@ -82,4 +87,9 @@ public class RabbitConfig {
|
||||
public Binding bindingProductInfoChange(Queue productInfoChangeQueue, DirectExchange exchange) {
|
||||
return BindingBuilder.bind(productInfoChangeQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.PRODUCT_INFO_CHANGE_QUEUE);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindingOrderRefundExchange(Queue orderRefundQueue, DirectExchange exchange) {
|
||||
return BindingBuilder.bind(orderRefundQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_REFUND_QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ public interface RabbitConstants {
|
||||
|
||||
class Queue {
|
||||
public static final String ORDER_STOCK_QUEUE = "order.stock.queue";
|
||||
public static final String ORDER_REFUND_QUEUE = "order.refund.queue";
|
||||
public static final String ORDER_CANCEL_QUEUE = "order.cancel.queue";
|
||||
public static final String ORDER_PRINT_QUEUE = "order.print.queue";
|
||||
public static final String ORDER_MACHINE_PRINT_QUEUE = "order.machine.print.queue";
|
||||
|
||||
@@ -34,6 +34,14 @@ public class RabbitPublisher {
|
||||
sendMsg(RabbitConstants.Queue.ORDER_STOCK_QUEUE, orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款库存回滚消息(未校验商品退款是否退回库存)
|
||||
* @param refundMap Map <Long,BigDecimal> 商品Id,退单数量
|
||||
*/
|
||||
public void sendOrderRefundMsg(String refundMap) {
|
||||
sendMsg(RabbitConstants.Queue.ORDER_STOCK_QUEUE, refundMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单打印消息
|
||||
* @param orderId 订单id
|
||||
|
||||
@@ -169,6 +169,19 @@ public class OrderDetail implements Serializable {
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 是否赠送 0否 1是
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
private Integer isGift = 0;
|
||||
|
||||
|
||||
public void initGift() {
|
||||
if (price.compareTo(BigDecimal.ZERO) == 0) {
|
||||
isGift = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public BigDecimal getRefundNum() {
|
||||
return refundNum == null ? BigDecimal.ZERO : refundNum;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user