mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2025-01-03 17:42:20 +08:00
fix:移除多余日志
This commit is contained in:
parent
bd249300f0
commit
a652073ff8
@ -39,6 +39,10 @@ public class OmsOrderItem extends BaseEntity {
|
||||
* 商品sku编号
|
||||
*/
|
||||
private String skuCode;
|
||||
|
||||
|
||||
private String skuName;
|
||||
|
||||
/**
|
||||
* 商品sku名字
|
||||
*/
|
||||
@ -92,6 +96,4 @@ public class OmsOrderItem extends BaseEntity {
|
||||
*/
|
||||
private Integer deleted;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
|
||||
@ -36,13 +37,13 @@ public class OrderController {
|
||||
@ApiOperation("订单列表")
|
||||
@GetMapping
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page",defaultValue = "1", value = "页码", paramType = "query", dataType = "Long"),
|
||||
@ApiImplicitParam(name = "limit",defaultValue = "10", value = "每页数量", paramType = "query", dataType = "Long"),
|
||||
@ApiImplicitParam(name = "page", defaultValue = "1", value = "页码", paramType = "query", dataType = "Long"),
|
||||
@ApiImplicitParam(name = "limit", defaultValue = "10", value = "每页数量", paramType = "query", dataType = "Long"),
|
||||
@ApiImplicitParam(name = "status", value = "订单状态", paramType = "query", dataType = "Integer")
|
||||
})
|
||||
public Result list(
|
||||
Long page,
|
||||
Long limit,
|
||||
@RequestParam(defaultValue = "1") Long page,
|
||||
@RequestParam(defaultValue = "10") Long limit,
|
||||
Integer status
|
||||
) {
|
||||
IPage<OmsOrder> result = orderService.list(new Page<>(page, limit), new OmsOrder().setStatus(status));
|
||||
|
@ -18,7 +18,7 @@ public interface OrderMapper extends BaseMapper<OmsOrder> {
|
||||
|
||||
|
||||
@Select("<script>" +
|
||||
" select id,order_sn,total_amount,pay_amount,status from oms_order" +
|
||||
" select id,order_sn,total_amount,pay_amount,status,total_amount,total_quantity,gmt_create from oms_order" +
|
||||
" where 1=1 " +
|
||||
" <if test ='order.status !=null ' >" +
|
||||
" AND status= #{order.status} " +
|
||||
|
@ -39,10 +39,7 @@ import org.springframework.data.redis.core.script.DefaultRedisScript;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.stream.Collectors;
|
||||
@ -67,7 +64,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OmsOrder> impleme
|
||||
*/
|
||||
@Override
|
||||
public OrderConfirmVO confirm(OrderConfirmDTO orderConfirmDTO) {
|
||||
log.info("=======================订单确认=======================\n订单确认信息:{}",orderConfirmDTO);
|
||||
log.info("=======================订单确认=======================\n订单确认信息:{}", orderConfirmDTO);
|
||||
OrderConfirmVO orderConfirmVO = new OrderConfirmVO();
|
||||
Long memberId = RequestUtils.getUserId();
|
||||
// 获取购买商品信息
|
||||
@ -125,7 +122,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OmsOrder> impleme
|
||||
@Override
|
||||
@GlobalTransactional
|
||||
public OrderSubmitVO submit(OrderSubmitDTO submitDTO) {
|
||||
log.info("=======================订单提交=======================\n订单提交信息:{}",submitDTO);
|
||||
log.info("=======================订单提交=======================\n订单提交信息:{}", submitDTO);
|
||||
// 订单重复提交校验
|
||||
String orderToken = submitDTO.getOrderToken();
|
||||
DefaultRedisScript<Long> redisScript = new DefaultRedisScript<>(RELEASE_LOCK_LUA_SCRIPT, Long.class);
|
||||
@ -174,13 +171,18 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OmsOrder> impleme
|
||||
.setSourceType(OrderTypeEnum.APP.getCode())
|
||||
.setMemberId(RequestUtils.getUserId())
|
||||
.setRemark(submitDTO.getRemark())
|
||||
.setPayAmount(submitDTO.getPayAmount());
|
||||
.setPayAmount(submitDTO.getPayAmount())
|
||||
.setTotalQuantity(orderItems.stream().map(item -> item.getCount()).reduce(0, (x, y) -> x + y))
|
||||
.setTotalAmount(orderItems.stream().map(item -> item.getPrice() * item.getCount()).reduce(0l, (x, y) -> x + y))
|
||||
.setGmtCreate(new Date());
|
||||
;
|
||||
this.save(order);
|
||||
|
||||
// 创建订单商品
|
||||
List<OmsOrderItem> orderItemList = orderItems.stream().map(item -> OmsOrderItem.builder()
|
||||
.orderId(order.getId())
|
||||
.skuId(item.getSkuId())
|
||||
.skuName(item.getTitle())
|
||||
.skuPrice(item.getPrice())
|
||||
.skuPic(item.getPic())
|
||||
.skuQuantity(item.getCount())
|
||||
@ -215,18 +217,18 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OmsOrder> impleme
|
||||
log.info("=======================订单取消,订单ID:{}=======================", id);
|
||||
OmsOrder order = this.getById(id);
|
||||
|
||||
if ( order != null &&!OrderStatusEnum.PENDING_PAYMENT.getCode().equals(order.getStatus()) ) {
|
||||
if (order != null && !OrderStatusEnum.PENDING_PAYMENT.getCode().equals(order.getStatus())) {
|
||||
throw new BizException("取消失败,订单状态不支持取消"); // 通过自定义异常,将异常信息抛出由异常处理器捕获显示给前端页面
|
||||
}
|
||||
order.setStatus(OrderStatusEnum.USER_CANCEL.getCode());
|
||||
boolean result = this.updateById(order);
|
||||
if(result){
|
||||
if (result) {
|
||||
// 释放被锁定的库存
|
||||
Result unlockResult = skuFeignService.unlockStock(order.getOrderSn());
|
||||
if(!Result.isSuccess(unlockResult)){
|
||||
throw new BizException(unlockResult.getMsg());
|
||||
if (!Result.isSuccess(unlockResult)) {
|
||||
throw new BizException(unlockResult.getMsg());
|
||||
}
|
||||
result=true;
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -247,7 +249,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OmsOrder> impleme
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<OmsOrder> list(Page<OmsOrder> page, OmsOrder order) {
|
||||
List<OmsOrder> list = this.baseMapper.list(page, order);
|
||||
|
@ -11,7 +11,7 @@ public class PmsSku extends BaseEntity {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Long spuId;
|
||||
private String title;
|
||||
private String name;
|
||||
private String code;
|
||||
private String pic;
|
||||
private Long originPrice;
|
||||
|
@ -10,5 +10,7 @@ public class MemberVO {
|
||||
|
||||
private String avatar;
|
||||
|
||||
private Long balance;
|
||||
|
||||
|
||||
}
|
||||
|
@ -11,3 +11,4 @@ spring:
|
||||
config:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yaml
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
|
@ -59,6 +59,18 @@
|
||||
<appender-ref ref="LOGIN_LOGSTASH"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.alibaba.nacos" level="ERROR" additivity="true">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.data.redis" level="ERROR" additivity="true">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
<logger name="io.lettuce" level="ERROR" additivity="true">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
<!-- 根logger -->
|
||||
<root>
|
||||
<level>INFO</level>
|
||||
|
Loading…
Reference in New Issue
Block a user