添加定时器;添加凌晨库存同步任务;修订订单相关返回;移除lettuce改为jedis
This commit is contained in:
parent
03f19ba0b3
commit
ab860e32ad
@ -47,6 +47,16 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.lettuce</groupId>
|
||||
<artifactId>lettuce-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
</dependency>
|
||||
<!--redis分布式锁依赖-->
|
||||
<dependency>
|
||||
|
||||
@ -4,10 +4,15 @@ import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = {"com.cpop.**"})
|
||||
@MapperScan("com.cpop.**.mapper")
|
||||
@EnableAsync
|
||||
@EnableScheduling
|
||||
public class CpopMallWebApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@ -28,7 +28,7 @@ spring:
|
||||
password:
|
||||
#连接超时
|
||||
timeout: 5000
|
||||
lettuce:
|
||||
jedis:
|
||||
pool:
|
||||
#
|
||||
min-idle: 0
|
||||
|
||||
@ -29,7 +29,7 @@ spring:
|
||||
password: Jambox.123*
|
||||
#连接超时
|
||||
timeout: 5000
|
||||
lettuce:
|
||||
jedis:
|
||||
pool:
|
||||
#
|
||||
min-idle: 0
|
||||
|
||||
@ -30,7 +30,7 @@ spring:
|
||||
password: Jambox.123*
|
||||
#连接超时
|
||||
timeout: 5000
|
||||
lettuce:
|
||||
jedis:
|
||||
pool:
|
||||
#
|
||||
min-idle: 0
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package com.cpop.mall.business.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @Description:
|
||||
* @create 2023-10-28 15:25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "商城物流订单")
|
||||
public class LogisticsOrderBo implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单主键
|
||||
*/
|
||||
@NotBlank(message = "订单主键不能为空")
|
||||
@ApiModelProperty(value = "订单主键",required = true)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 物流订单号
|
||||
*/
|
||||
@NotBlank(message = "物流订单号不能为空")
|
||||
@ApiModelProperty(value = "物流订单号",required = true)
|
||||
private String logisticsOrder;
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.cpop.mall.business.bo;
|
||||
|
||||
import com.cpop.core.annontation.StringArrayConvert;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -49,13 +50,6 @@ public class PlaceOrderBo implements Serializable {
|
||||
@ApiModelProperty(value = "品牌id",required = true)
|
||||
private String brandId;
|
||||
|
||||
/**
|
||||
* 店铺(校区)id
|
||||
*/
|
||||
@NotBlank(message = "店铺(校区)id不能为空")
|
||||
@ApiModelProperty(value = "店铺(校区)id",required = true)
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 下单人真实姓名
|
||||
*/
|
||||
@ -76,6 +70,13 @@ public class PlaceOrderBo implements Serializable {
|
||||
@ApiModelProperty(value = "收货人电话",required = true)
|
||||
private String receivePhone;
|
||||
|
||||
/**
|
||||
* 当前订单所有产品名
|
||||
*/
|
||||
@StringArrayConvert
|
||||
@ApiModelProperty(value = "当前订单所有产品名")
|
||||
private String productNames;
|
||||
|
||||
/**
|
||||
* 收货地址
|
||||
*/
|
||||
@ -137,5 +138,12 @@ public class PlaceOrderBo implements Serializable {
|
||||
@NotNull(message = "下单数量不能为空")
|
||||
@ApiModelProperty(value = "下单数量",required = true)
|
||||
private Integer number;
|
||||
|
||||
/**
|
||||
* 店铺(校区)id
|
||||
*/
|
||||
//TODO:@NotBlank(message = "店铺(校区)id不能为空")
|
||||
@ApiModelProperty(value = "店铺(校区)id",required = true)
|
||||
private String storeId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,27 +1,19 @@
|
||||
package com.cpop.mall.business.controller.backstage;
|
||||
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.mall.business.bo.LogisticsOrderBo;
|
||||
import com.cpop.mall.business.bo.OrderPageBo;
|
||||
import com.cpop.mall.business.bo.ProductPageBo;
|
||||
import com.cpop.mall.business.vo.OrderPageVo;
|
||||
import com.cpop.mall.business.vo.ProductPageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.cpop.mall.business.entity.Order;
|
||||
import com.cpop.mall.business.service.OrderService;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.cpop.mall.business.vo.OrderPageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER;
|
||||
|
||||
/**
|
||||
* 商城订单表 控制层。
|
||||
@ -51,4 +43,50 @@ public class BackstageOrderController {
|
||||
return R.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* @descriptions 输入物流订单
|
||||
* @author DB
|
||||
* @date 2023/10/12 10:48
|
||||
* @param bo 请求参数
|
||||
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||
*/
|
||||
@ApiOperation("输入物流订单")
|
||||
@PostMapping("/inputLogisticsOrder")
|
||||
public R<Void> inputLogisticsOrder(@RequestBody @Validated LogisticsOrderBo bo) {
|
||||
orderService.inputLogisticsOrder(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 转变订单状态
|
||||
* @param id 订单id
|
||||
* @param orderStatus 订单状态
|
||||
* @return R<Void>
|
||||
* @Author DB
|
||||
* @Date: 2023/10/28 15:49
|
||||
*/
|
||||
@PutMapping("/changeOrderStatus")
|
||||
@ApiOperation("转变订单状态")
|
||||
public R<Void> changeOrderStatus(@RequestParam("id") @ApiParam(value = "订单id",required = true) String id,
|
||||
@RequestParam("orderStatus") @ApiParam(value = "订单状态") Integer orderStatus) {
|
||||
orderService.updateChain()
|
||||
.set(ORDER.ORDER_STATUS, orderStatus + 1)
|
||||
.where(ORDER.ID.eq(id)).update();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 删除订单
|
||||
* @param id 主键
|
||||
* @return R<Void>
|
||||
* @Author DB
|
||||
* @Date: 2023/10/28 16:20
|
||||
*/
|
||||
@ApiOperation("删除订单")
|
||||
@DeleteMapping("/removeOrderById/{id}")
|
||||
public R<Void> removeOrderById(@PathVariable String id) {
|
||||
orderService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,27 +3,15 @@ package com.cpop.mall.business.controller.backstage;
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.mall.business.bo.OrderRefundPageBo;
|
||||
import com.cpop.mall.business.bo.OrderRejectRefundBo;
|
||||
import com.cpop.mall.business.bo.ProductPageBo;
|
||||
import com.cpop.mall.business.vo.OrderRefundPageVo;
|
||||
import com.cpop.mall.business.vo.ProductPageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.cpop.mall.business.entity.OrderRefund;
|
||||
import com.cpop.mall.business.service.OrderRefundService;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.cpop.mall.business.vo.OrderRefundPageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 商城订单退款记录表 控制层。
|
||||
@ -48,7 +36,7 @@ public class BackstageOrderRefundController {
|
||||
*/
|
||||
@GetMapping("/getOrderRefundPage")
|
||||
@ApiOperation("分页查询商城-退款列表")
|
||||
public R<Page<OrderRefundPageVo>> getOrderRefundPage(@RequestBody @ApiParam("分页参数") OrderRefundPageBo bo) {
|
||||
public R<Page<OrderRefundPageVo>> getOrderRefundPage(@ApiParam("分页参数") OrderRefundPageBo bo) {
|
||||
Page<OrderRefundPageVo> page = orderRefundService.getOrderRefundPage(bo);
|
||||
return R.ok(page);
|
||||
}
|
||||
@ -74,7 +62,7 @@ public class BackstageOrderRefundController {
|
||||
* @param bo 请求参数
|
||||
* @return: com.cpop.core.base.R<java.lang.Void>
|
||||
*/
|
||||
@PutMapping("/rejectRefund")
|
||||
@PostMapping("/rejectRefund")
|
||||
@ApiOperation("拒绝退款")
|
||||
public R<Void> rejectRefund(@RequestBody @Validated OrderRejectRefundBo bo) {
|
||||
orderRefundService.rejectRefund(bo);
|
||||
|
||||
@ -3,7 +3,10 @@ package com.cpop.mall.business.controller.mini;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.mall.business.bo.*;
|
||||
import com.cpop.mall.business.bo.OrderApplyRefundBo;
|
||||
import com.cpop.mall.business.bo.OrderEvaluateBo;
|
||||
import com.cpop.mall.business.bo.OrderPageBo;
|
||||
import com.cpop.mall.business.bo.PlaceOrderBo;
|
||||
import com.cpop.mall.business.entity.OrderEvaluate;
|
||||
import com.cpop.mall.business.service.OrderEvaluateService;
|
||||
import com.cpop.mall.business.service.OrderService;
|
||||
@ -40,7 +43,7 @@ public class MiniOrderController {
|
||||
* @return: com.cpop.core.base.R<com.mybatisflex.core.paginate.Page<com.cpop.mall.business.entity.Product>>
|
||||
*/
|
||||
@GetMapping("/getOrderPage")
|
||||
@ApiOperation("我的订单列表")
|
||||
@ApiOperation("小程序-我的订单列表")
|
||||
public R<Page<OrderPageVo>> getOrderPage(@ApiParam("分页参数") OrderPageBo bo) {
|
||||
Page<OrderPageVo> page = orderService.getOrderPage(bo);
|
||||
return R.ok(page);
|
||||
|
||||
@ -6,14 +6,12 @@ import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 商城订单表 实体类。
|
||||
*
|
||||
@ -60,11 +58,6 @@ public class Order extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private String brandId;
|
||||
|
||||
/**
|
||||
* 店铺(校区)id
|
||||
*/
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
|
||||
@ -6,15 +6,11 @@ import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 商城订单详情表 实体类。
|
||||
@ -57,6 +53,11 @@ public class OrderDetail extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private Integer number;
|
||||
|
||||
/**
|
||||
* 店铺(校区)id
|
||||
*/
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 逻辑删除(0否1是)
|
||||
*/
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
package com.cpop.mall.business.service;
|
||||
|
||||
import com.cpop.mall.business.bo.LogisticsOrderBo;
|
||||
import com.cpop.mall.business.bo.OrderApplyRefundBo;
|
||||
import com.cpop.mall.business.bo.OrderPageBo;
|
||||
import com.cpop.mall.business.bo.PlaceOrderBo;
|
||||
import com.cpop.mall.business.entity.Order;
|
||||
import com.cpop.mall.business.vo.OrderPageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cpop.mall.business.entity.Order;
|
||||
|
||||
/**
|
||||
* 商城订单表 服务层。
|
||||
@ -61,5 +62,11 @@ public interface OrderService extends IService<Order> {
|
||||
*/
|
||||
void cancelOrder(String orderId);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 输入物流订单
|
||||
* @param bo 请求参数
|
||||
* @Author DB
|
||||
* @Date: 2023/10/28 15:27
|
||||
*/
|
||||
void inputLogisticsOrder(LogisticsOrderBo bo);
|
||||
}
|
||||
|
||||
@ -8,14 +8,15 @@ import com.cpop.core.utils.sql.SqlUtils;
|
||||
import com.cpop.mall.business.bo.OrderRefundPageBo;
|
||||
import com.cpop.mall.business.bo.OrderRejectRefundBo;
|
||||
import com.cpop.mall.business.entity.Order;
|
||||
import com.cpop.mall.business.entity.OrderRefund;
|
||||
import com.cpop.mall.business.mapper.OrderRefundMapper;
|
||||
import com.cpop.mall.business.service.OrderRefundService;
|
||||
import com.cpop.mall.business.service.OrderService;
|
||||
import com.cpop.mall.business.vo.OrderRefundPageVo;
|
||||
import com.cpop.mall.framework.handler.WxPayHandler;
|
||||
import com.cpop.system.business.entity.ProfitSharing;
|
||||
import com.cpop.system.business.service.ProfitSharingService;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReturnRequest;
|
||||
import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReturnResult;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
@ -23,9 +24,6 @@ import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.mall.business.entity.OrderRefund;
|
||||
import com.cpop.mall.business.mapper.OrderRefundMapper;
|
||||
import com.cpop.mall.business.service.OrderRefundService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -35,7 +33,6 @@ import static com.cpop.mall.business.entity.table.OrderRefundTableDef.ORDER_REFU
|
||||
import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER;
|
||||
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
|
||||
import static com.cpop.system.business.entity.table.ProfitSharingTableDef.PROFIT_SHARING;
|
||||
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
|
||||
|
||||
/**
|
||||
* 商城订单退款记录表 服务层实现。
|
||||
@ -122,22 +119,28 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
|
||||
@Override
|
||||
public Page<OrderRefundPageVo> getOrderRefundPage(OrderRefundPageBo bo) {
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
QueryWrapper queryWrapper = QueryWrapper.create();
|
||||
if (null != bo.getRefundStatus()) {
|
||||
if (-1 == bo.getRefundStatus()) {
|
||||
queryWrapper.and(ORDER_REFUND.REFUND_STATUS.in(1, 2));
|
||||
} else {
|
||||
queryWrapper.and(ORDER_REFUND.REFUND_STATUS.eq(bo.getRefundStatus()));
|
||||
}
|
||||
}
|
||||
return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(),
|
||||
QueryWrapper.create().select(ORDER_REFUND.REFUND_STATUS,ORDER_REFUND.REFUND_REASON,ORDER_REFUND.ID,ORDER_REFUND.ORDER_ID,ORDER_REFUND.CREATE_TIME)
|
||||
queryWrapper.select(ORDER_REFUND.REFUND_STATUS,ORDER_REFUND.REFUND_REASON,ORDER_REFUND.ID,ORDER_REFUND.ORDER_ID,ORDER_REFUND.CREATE_TIME)
|
||||
//订单相关参数
|
||||
.select(ORDER.ORDER_STATUS,ORDER.OUT_ORDER_NO,ORDER.PRODUCT_NAMES,ORDER.TOTAL_AMOUNT,ORDER.PAY_USER_NAME,ORDER.BRAND_ID,
|
||||
ORDER.STORE_ID,ORDER.RECEIVE_PHONE,ORDER.RECEIVE_ADDRESS,ORDER.LOGISTICS_ORDER,ORDER.REMARKS)
|
||||
.select(ORDER.ORDER_STATUS,ORDER.OUT_ORDER_NO,ORDER.PRODUCT_NAMES,ORDER.TOTAL_AMOUNT,ORDER.PAY_USER_NAME,ORDER.BRAND_ID,ORDER.RECEIVE_NAME,
|
||||
ORDER.RECEIVE_PHONE,ORDER.RECEIVE_ADDRESS,ORDER.LOGISTICS_ORDER,ORDER.REMARKS)
|
||||
//品牌/店铺或校区
|
||||
.select(BRAND.BRAND_NAME,STORE.STORE_NAME)
|
||||
.select(BRAND.BRAND_NAME)
|
||||
.from(ORDER_REFUND)
|
||||
.leftJoin(ORDER).on(ORDER.ID.eq(ORDER_REFUND.ORDER_ID))
|
||||
.leftJoin(SYS_USER).on(SYS_USER.ID.eq(ORDER.PAY_USER_ID))
|
||||
.leftJoin(BRAND).on(BRAND.ID.eq(ORDER.BRAND_ID))
|
||||
.leftJoin(STORE).on(STORE.ID.eq(ORDER.STORE_ID))
|
||||
.and(ORDER.PRODUCT_NAMES.like(bo.getProductName()))
|
||||
.and(ORDER.PAY_USER_NAME.like(bo.getPayUserName()))
|
||||
.and(SYS_USER.PHONE_NUMBER.eq(bo.getPayUserPhone()))
|
||||
.and(ORDER_REFUND.REFUND_STATUS.eq(bo.getRefundStatus())),
|
||||
.and(SYS_USER.PHONE_NUMBER.eq(bo.getPayUserPhone())),
|
||||
OrderRefundPageVo.class);
|
||||
}
|
||||
|
||||
|
||||
@ -5,36 +5,30 @@ import com.cpop.common.utils.StringUtils;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.common.utils.ip.IpUtils;
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
import com.cpop.core.base.enums.OrderSource;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.base.exception.ServiceException;
|
||||
import com.cpop.core.service.RedisService;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.core.utils.sql.SqlUtils;
|
||||
import com.cpop.mall.business.bo.LogisticsOrderBo;
|
||||
import com.cpop.mall.business.bo.OrderApplyRefundBo;
|
||||
import com.cpop.mall.business.bo.OrderPageBo;
|
||||
import com.cpop.mall.business.bo.PlaceOrderBo;
|
||||
import com.cpop.mall.business.dto.WxPayGoodsDetailDto;
|
||||
import com.cpop.mall.business.entity.*;
|
||||
import com.cpop.mall.business.mapper.OrderMapper;
|
||||
import com.cpop.mall.business.service.*;
|
||||
import com.cpop.mall.business.vo.OrderPageVo;
|
||||
import com.cpop.mall.framework.handler.WxPayHandler;
|
||||
import com.cpop.mall.framework.constant.MallRedisConstant;
|
||||
import com.cpop.system.business.entity.ProfitSharing;
|
||||
import com.cpop.system.business.service.ProfitSharingService;
|
||||
import com.cpop.mall.framework.handler.WxPayHandler;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReceiver;
|
||||
import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingRequest;
|
||||
import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingResult;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
||||
import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.mall.business.mapper.OrderMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -47,10 +41,11 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
|
||||
import static com.cpop.mall.business.entity.table.OrderDetailTableDef.ORDER_DETAIL;
|
||||
import static com.cpop.mall.business.entity.table.OrderRefundTableDef.ORDER_REFUND;
|
||||
import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER;
|
||||
import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD;
|
||||
import static com.cpop.mall.business.entity.table.ProductTableDef.PRODUCT;
|
||||
import static com.cpop.system.business.entity.table.ProfitSharingTableDef.PROFIT_SHARING;
|
||||
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
|
||||
|
||||
|
||||
/**
|
||||
@ -89,7 +84,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
queryWrapper.where(ORDER.PAY_USER_ID.eq(loginUserInfo.getString("userId")));
|
||||
}
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
return this.mapper.paginateWithRelationsAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()),
|
||||
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()),
|
||||
queryWrapper
|
||||
.select(ORDER.ALL_COLUMNS)
|
||||
.from(ORDER)
|
||||
@ -100,7 +95,23 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
//订单状态
|
||||
.and(ORDER.ORDER_STATUS.eq(bo.getOrderStatus()))
|
||||
.orderBy(ORDER.CREATE_TIME.desc()),
|
||||
OrderPageVo.class);
|
||||
OrderPageVo.class,
|
||||
//子查询
|
||||
item -> item.field(OrderPageVo::getDetailList)
|
||||
.queryWrapper(pageVo -> queryChain()
|
||||
//产品
|
||||
.select(PRODUCT.PRODUCT_NAME, PRODUCT.PIC_URL, PRODUCT.PIC_DETAIL_URL)
|
||||
//订单详情
|
||||
.select(ORDER_DETAIL.ORDER_ID, ORDER_DETAIL.PRODUCT_RECORD_ID, ORDER_DETAIL.AMOUNT, ORDER_DETAIL.POINT, ORDER_DETAIL.STORE_ID)
|
||||
//规格
|
||||
.select(PRODUCT_RECORD.RECORD_NAMES)
|
||||
//校区
|
||||
.select(STORE.STORE_NAME)
|
||||
.from(ORDER_DETAIL)
|
||||
.leftJoin(PRODUCT_RECORD).on(PRODUCT_RECORD.ID.eq(ORDER_DETAIL.PRODUCT_RECORD_ID))
|
||||
.leftJoin(PRODUCT).on(PRODUCT.ID.eq(PRODUCT_RECORD.PRODUCT_ID))
|
||||
.leftJoin(STORE).on(STORE.ID.eq(ORDER_DETAIL.STORE_ID))
|
||||
.where(ORDER_DETAIL.ORDER_ID.eq(pageVo.getId()))));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,7 +174,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
return wxPayService.createOrder(orderRequest);
|
||||
} else {
|
||||
//TODO:积分支付直接扣库存
|
||||
return null;
|
||||
return pointPay(recordNumIsEnough, order.getId());
|
||||
}
|
||||
} catch (Exception e){
|
||||
//回滚库存
|
||||
@ -175,12 +186,25 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
}
|
||||
}
|
||||
|
||||
private void pointPay(Map<String, Integer> recordNumIsEnough){
|
||||
/*List<ProductRecord> productRecords = productRecordService.listByIds(orderDetails.stream().map(OrderDetail::getProductRecordId).collect(Collectors.toSet()));
|
||||
/**
|
||||
* @Description: 积分支付
|
||||
* @param recordNumIsEnough
|
||||
* @return
|
||||
* @Author DB
|
||||
* @Date: 2023/10/28 9:33
|
||||
*/
|
||||
private Object pointPay(Map<String, Integer> recordNumIsEnough,String orderId){
|
||||
ProductRecordService productRecordService = SpringUtils.getBean(ProductRecordService.class);
|
||||
List<ProductRecord> productRecords = productRecordService.listByIds(recordNumIsEnough.keySet());
|
||||
productRecords.forEach(item -> {
|
||||
item.setRecordNum(item.getRecordNum() - orderNumMap.get(item.getId()));
|
||||
item.setRecordNum(item.getRecordNum() - recordNumIsEnough.get(item.getId()));
|
||||
});
|
||||
productRecordService.updateBatch(productRecords);*/
|
||||
productRecordService.updateBatch(productRecords);
|
||||
//TODO:通知到云?
|
||||
//修改订单状态
|
||||
return this.updateChain()
|
||||
.set(ORDER.ORDER_STATUS, 3).where(ORDER.ID.eq(orderId)).update();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -235,9 +259,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
*/
|
||||
@Override
|
||||
public void applyRefund(OrderApplyRefundBo bo) {
|
||||
//查询是否有进行中的退款申请
|
||||
OrderRefundService orderRefundService = SpringUtils.getBean(OrderRefundService.class);
|
||||
long applying = orderRefundService.queryChain().where(ORDER_REFUND.ORDER_ID.eq(bo.getOrderId()))
|
||||
.and(ORDER_REFUND.REFUND_STATUS.eq(0)).count();
|
||||
if (applying > 0) {
|
||||
throw new ServiceException("你已申请此订单退款,现在暂在处理中,如需跟多信息请和客服联系");
|
||||
}
|
||||
OrderRefund orderRefund = BeanUtils.mapToClass(bo, OrderRefund.class);
|
||||
orderRefund.setRefundStatus(0);
|
||||
SpringUtils.getBean(OrderRefundService.class).save(orderRefund);
|
||||
orderRefundService.save(orderRefund);
|
||||
//修改订单状态
|
||||
this.updateChain().set(ORDER.ORDER_STATUS, 3).where(ORDER.ID.eq(bo.getOrderId())).update();
|
||||
}
|
||||
@ -320,4 +351,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
redisService.longIncrement(MallRedisConstant.STOCK_RECORD_NUM + key, value.longValue());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 输入物流订单
|
||||
* @param bo 请求参数
|
||||
* @Author DB
|
||||
* @Date: 2023/10/28 15:27
|
||||
*/
|
||||
@Override
|
||||
public void inputLogisticsOrder(LogisticsOrderBo bo) {
|
||||
this.updateChain().set(ORDER.ORDER_STATUS, 2)
|
||||
.set(ORDER.LOGISTICS_ORDER, bo.getLogisticsOrder())
|
||||
.where(ORDER.ID.eq(bo.getId())).update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
package com.cpop.mall.business.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.common.constant.Constants;
|
||||
import com.cpop.common.utils.StringUtils;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
import com.cpop.core.base.enums.SourceType;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.core.utils.sql.SqlUtils;
|
||||
|
||||
@ -1,9 +1,41 @@
|
||||
package com.cpop.mall.business.task;
|
||||
|
||||
import com.cpop.core.service.RedisService;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.mall.business.entity.ProductRecord;
|
||||
import com.cpop.mall.business.service.ProductRecordService;
|
||||
import com.cpop.mall.framework.constant.MallRedisConstant;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/10/27 17:26
|
||||
* @description 凌晨同步库存任务
|
||||
*/
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ProductRecordSyncStockTask {
|
||||
|
||||
/**
|
||||
* @Description: 每天1点05分进行库存同步
|
||||
* @Author DB
|
||||
* @Date: 2023/10/28 10:08
|
||||
*/
|
||||
@Scheduled(cron="0 5 1 * * ?")
|
||||
public void syncMysqlStockToRedis(){
|
||||
log.info("===============================开始<-库存信息同步->开始===============================");
|
||||
//获取所有库存
|
||||
List<ProductRecord> productRecords = SpringUtils.getBean(ProductRecordService.class).list();
|
||||
RedisService redisService = SpringUtils.getBean(RedisService.class);
|
||||
productRecords.forEach(item->{
|
||||
redisService.setCacheObject(MallRedisConstant.STOCK_RECORD_NUM + item.getProductId(), item.getRecordNum());
|
||||
log.info("商品记录id为:{};商品库存为:{}", item.getProductId(), item.getRecordNum());
|
||||
});
|
||||
log.info("===============================结束<-库存信息结束->结束===============================");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,114 +0,0 @@
|
||||
package com.cpop.mall.business.vo;
|
||||
|
||||
import com.mybatisflex.annotation.RelationOneToMany;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @createTime 2023/10/28 0:28
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "小程序商城订单分页返回对象")
|
||||
public class MiniOrderPageVo implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 订单状态(0:待付款;1:待发货;2:待确认;3:已完成;4:退款/售后中)
|
||||
*/
|
||||
@ApiModelProperty("订单状态(0:待付款;1:待发货;2:待确认;3:已完成;4:退款/售后中)")
|
||||
private Integer orderStatus;
|
||||
|
||||
/**
|
||||
* 外部订单号
|
||||
*/
|
||||
@ApiModelProperty("外部订单号")
|
||||
private String outOrderNo;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
@ApiModelProperty("总金额")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 总积分
|
||||
*/
|
||||
@ApiModelProperty("总积分")
|
||||
private Long totalPoint;
|
||||
|
||||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
@ApiModelProperty("品牌id")
|
||||
private String brandId;
|
||||
|
||||
/**
|
||||
* 店铺(校区)id
|
||||
*/
|
||||
@ApiModelProperty("店铺(校区)id")
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
@ApiModelProperty("商品名")
|
||||
private String productNames;
|
||||
|
||||
/**
|
||||
* 下单用户id
|
||||
*/
|
||||
@ApiModelProperty("下单用户id")
|
||||
private String payUserId;
|
||||
|
||||
/**
|
||||
* 收货人名
|
||||
*/
|
||||
@ApiModelProperty("收货人名")
|
||||
private String receiveName;
|
||||
|
||||
/**
|
||||
* 收货人电话
|
||||
*/
|
||||
@ApiModelProperty("收货人电话")
|
||||
private String receivePhone;
|
||||
|
||||
/**
|
||||
* 收货地址
|
||||
*/
|
||||
@ApiModelProperty("收货地址")
|
||||
private String receiveAddress;
|
||||
|
||||
/**
|
||||
* 物流订单号
|
||||
*/
|
||||
@ApiModelProperty("物流订单号")
|
||||
private String logisticsOrder;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 订单详情vo
|
||||
*/
|
||||
@ApiModelProperty("订单详情")
|
||||
@RelationOneToMany(selfField = "id",
|
||||
targetField = "orderId",
|
||||
targetTable = "cp_mall_order_detail")
|
||||
private List<OrderDetailVo> detailList;
|
||||
}
|
||||
@ -36,6 +36,18 @@ public class OrderDetailVo implements Serializable {
|
||||
@ApiModelProperty("商品规格")
|
||||
private String recordNames;
|
||||
|
||||
/**
|
||||
* 店铺(校区)id
|
||||
*/
|
||||
@ApiModelProperty("店铺(校区)id")
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 店铺名
|
||||
*/
|
||||
@ApiModelProperty("店铺名")
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
@ -47,4 +59,22 @@ public class OrderDetailVo implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty("积分")
|
||||
private Integer point;
|
||||
|
||||
/**
|
||||
* 积分
|
||||
*/
|
||||
@ApiModelProperty("产品名")
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 积分
|
||||
*/
|
||||
@ApiModelProperty("微缩图")
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 积分
|
||||
*/
|
||||
@ApiModelProperty("详情图")
|
||||
private String picDetailUrl;
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
package com.cpop.mall.business.vo;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.RelationOneToMany;
|
||||
import com.mybatisflex.annotation.RelationOneToOne;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -10,6 +8,7 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -59,16 +58,10 @@ public class OrderPageVo implements Serializable {
|
||||
private String brandId;
|
||||
|
||||
/**
|
||||
* 店铺(校区)id
|
||||
* 支付类型
|
||||
*/
|
||||
@ApiModelProperty("店铺(校区)id")
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
@ApiModelProperty("商品名")
|
||||
private String productNames;
|
||||
@ApiModelProperty("支付类型")
|
||||
private Integer payType;
|
||||
|
||||
/**
|
||||
* 下单用户id
|
||||
@ -76,6 +69,12 @@ public class OrderPageVo implements Serializable {
|
||||
@ApiModelProperty("下单用户id")
|
||||
private String payUserId;
|
||||
|
||||
/**
|
||||
* 下单用户名
|
||||
*/
|
||||
@ApiModelProperty("下单用户名")
|
||||
private String payUserName;
|
||||
|
||||
/**
|
||||
* 收货人名
|
||||
*/
|
||||
@ -100,18 +99,28 @@ public class OrderPageVo implements Serializable {
|
||||
@ApiModelProperty("物流订单号")
|
||||
private String logisticsOrder;
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
@ApiModelProperty("商品名")
|
||||
private String productNames;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 下单时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@ApiModelProperty("下单时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 订单详情vo
|
||||
*/
|
||||
@ApiModelProperty("订单详情")
|
||||
@RelationOneToMany(selfField = "id",
|
||||
targetField = "orderId",
|
||||
targetTable = "cp_mall_order_detail")
|
||||
private List<OrderDetailVo> detailList;
|
||||
}
|
||||
|
||||
@ -68,30 +68,24 @@ public class OrderRefundPageVo implements Serializable {
|
||||
@ApiModelProperty("品牌id")
|
||||
private String brandId;
|
||||
|
||||
/**
|
||||
* 店铺(校区)id
|
||||
*/
|
||||
@ApiModelProperty("店铺(校区)id")
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 品牌名
|
||||
*/
|
||||
@ApiModelProperty("品牌名")
|
||||
private String brandName;
|
||||
|
||||
/**
|
||||
* 店铺(校区)名
|
||||
*/
|
||||
@ApiModelProperty("店铺(校区)名")
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* 下单用户id
|
||||
*/
|
||||
@ApiModelProperty("下单用户id")
|
||||
private String payUserId;
|
||||
|
||||
/**
|
||||
* 下单用户
|
||||
*/
|
||||
@ApiModelProperty("下单用户")
|
||||
private String payUserName;
|
||||
|
||||
/**
|
||||
* 收货人名
|
||||
*/
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.cpop.mall.business.vo;
|
||||
|
||||
import com.cpop.mall.business.entity.ProductSpecification;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mybatisflex.annotation.RelationOneToMany;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@ -132,12 +131,12 @@ public class ProductPageVo implements Serializable {
|
||||
* 交易数量
|
||||
*/
|
||||
@ApiModelProperty("交易数量")
|
||||
private Long tradeNum;
|
||||
private Long tradeNum = 0L;
|
||||
|
||||
/**
|
||||
* 交易金额
|
||||
*/
|
||||
@ApiModelProperty("交易金额")
|
||||
private BigDecimal tradePrice;
|
||||
private BigDecimal tradePrice = BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user