修复售后订单问题 修复支付问题
This commit is contained in:
@ -1236,7 +1236,7 @@ CREATE TABLE `merchant_details` (
|
||||
BEGIN;
|
||||
INSERT INTO `merchant_details` (`details_id`, `title`, `pay_type`, `appid`, `mch_id`, `cert_store_type`, `key_private`, `key_public`, `key_cert`, `key_cert_pwd`, `notify_url`, `return_url`, `sign_type`, `seller`, `sub_app_id`, `sub_mch_id`, `input_charset`, `is_test`, `updater`, `creator`, `create_time`, `update_time`, `deleted`) VALUES ('1', '支付宝配置', 'aliPay', '2021001187645179', '', NULL, 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCNAg588CxTezsPtMT4WcLXUyzyf0qBnzSACek820D4RLdJ0KiOfQzAe3MK1rEaywwWNMJbwrKoEp/bA6DNTRsXvzZ8tF1F5MXi6GdETn3ItHGdwasJM28hvZX2plYY5aQYEpqGZJBlgfQRkeYSe1pwq4JzAELXNzVbtuokssVq3WKVVIIFXEuHxrsC1SGssn0enFd7Q6kUq1O1JLcAQWAHjf9gdVFfzXex0yN6EYGRqWlr8AC5lIr0STKmNIZeCV4WlsEah9askpAyNrlKBGy0lwdfeMQVtJo3WucM9DE2dqePN5RZIECvvYWdMjmAilomx+7di72PnmAGkkHbmosDAgMBAAECggEAMisaJn949daxQ7xIHCgrd1rDch+xzX5sOmXMUvebHPmt0JhpcBCzucPyQVfzORom2bu5rtYNpFjEATNAQer+CavhYer2CIkFkt6m5xmaDQ+OINen16UyE+oU8eVqWn9Rq7LqwYgEC+l5gcrL9aVnnxCWX/4mydV9qXzhv17PeF5yqEIjrAbhQMQbVrPLQTwi3wbC7sm6Z29A5idhld4AsXjlWPXnFzkeZFl8Qc/g5QOHFjs8uIcz+K7uE3H9Gs2LSz07bh0m9jloy/90Q0OzZbPI1NIU3oDTV7/eaRldXw3o9+8uz58MDWhYoWTLLjlkWJZJcJrfnW+P7tDEWpjv2QKBgQDyCZ0dzcz9w4IN5ujOWdplNv3M/MwSb0mGCnHv3tfnvJj4GnTmeIIWic8RhSlyN12Ph+wYaBHTEc+zaXKq5FmnEtKMPXzVci9RbCECTt5M8eYEA4wuYKnAGqPsyzvnffxGAUdvalVmkyRidI/cj+ACDmWjqnsalF9Hd2mMcrhqtQKBgQCVJHL1nJKSjgFqwN80tqlz862rsFaHOsSDT89nPHgTsmr30QFk6FL+BU/wrPsXCg5pMVZtUmw3c8X1TXd9YCnu7wg2+obIUbbXBxQTdhJMq/DUL6hGsfBLkzLzs9moyL76c4gZFqXr/d/POevzIlnATFolnoDOzoEvp7YsMyBZ1wKBgHVJb1eX+PQnn4g5EyuboxdVFJwXDJUKVKiduySv6hQj8kSYHXnpf7CIS02EJ9dvOOlqxl/1Xl3Xzbx1JtnlGgS6PEk1Kp8MXB2qtjw2F8dVmU7soSuAMAIlZrZCrd650FvkFsfI0WWJfCIxtdz942FbtKkg3dK9f4ZUOVOT7AXZAoGAQbsyv3UmVFkp3rbqqPzoaiY3oLezKx6HhagjLMjF00iLRHVlO+f4y+Pje5uBfoH8H/iSstPkxfvMf3SI+UTstlW7NR/tT1RUVSjVfE5Jemk9Vwc6Dw5VbbmOd0II6A6xvQg2L3h/4CagAWDx0NKO4+XCxVm6Q2tYHHy6GXjfBTkCgYEA2x+2PAq8iqX80cLqvh7vSoCh5m6H3aSGM8h+ZgF0lkijavQyIXE0oJxuJUpqgzv/XKqUCVQbaEHuNqKczLr0+QEE+vmexaRqKiUAL4/5xLEjfKk96QE7WbjXypJVBT5KeFPc5JDkNZN/R6d8q2/o4hiNdCyg+S4l/YOOev6YWDY=', 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj4e+D+2LfhldbNImCtjGbsxNQiQe6zp0SwS0iywib4pEqwS0gVDUi11uaG4R78cm7kV0GwWuYbeyl3wLmsr9269HJ/FjwWrNJLLwCLqJzNSkBssW7TXge++X3uHK93VeYmu7lRxdk5G/CqOdp5IhqveQOLxHURm+AC9iLtdtxnaCXFxcb54O63mfuZ5/9XJfBRt0boTe8vWTnr8w95PG5XlCBK0lmfZvtUazn/RYBIeCV28bwusQURvAg0Kc/gBoa3wIWiZhzaAiklUaXWoqR+yuoBwzKht8TLkXaOVxswphSoxsddrsn28Fw6rDfRiMKk3S6JcwY58P1n2By+LUPQIDAQAB', NULL, NULL, 'http://yshop.l1.ttut.cc/app-api/order/payBack1.json', '', 'RSA2', '2088821836348568', NULL, NULL, 'UTF-8', 0, '1', NULL, NULL, '2023-09-25 10:33:31', b'0');
|
||||
INSERT INTO `merchant_details` (`details_id`, `title`, `pay_type`, `appid`, `mch_id`, `cert_store_type`, `key_private`, `key_public`, `key_cert`, `key_cert_pwd`, `notify_url`, `return_url`, `sign_type`, `seller`, `sub_app_id`, `sub_mch_id`, `input_charset`, `is_test`, `updater`, `creator`, `create_time`, `update_time`, `deleted`) VALUES ('2', '微信app支付配置', 'wxPay', 'wxf0713a10bbae8732', '1558500071', 'STR', 'zk7BHJJWThinkSztbI6zye9ZA70uNFtT', NULL, NULL, NULL, 'https://b2c-pro-api-dev.zkthink.com/app-api/order/pay/wxPayNotify', NULL, 'MD5', NULL, NULL, NULL, 'utf-8', 0, '1', '1', '2023-09-20 09:58:03', '2023-11-14 15:26:56', b'0');
|
||||
INSERT INTO `merchant_details` (`details_id`, `title`, `pay_type`, `appid`, `mch_id`, `cert_store_type`, `key_private`, `key_public`, `key_cert`, `key_cert_pwd`, `notify_url`, `return_url`, `sign_type`, `seller`, `sub_app_id`, `sub_mch_id`, `input_charset`, `is_test`, `updater`, `creator`, `create_time`, `update_time`, `deleted`) VALUES ('3', '微信小程序支付配置', 'wxPay', 'wxf0713a10bbae8732', '1558500071', 'STR', 'zk7BHJJWThinkSztbI6zye9ZA70uNFtT', '', '', '', 'https://b2c-pro-api-dev.zkthink.com/app-api/order/pay/wxPayNotify', '', 'MD5', NULL, NULL, NULL, 'UTF-8', 0, '1', NULL, NULL, '2023-11-14 15:26:16', b'0');
|
||||
INSERT INTO `merchant_details` (`details_id`, `title`, `pay_type`, `appid`, `mch_id`, `cert_store_type`, `key_private`, `key_public`, `key_cert`, `key_cert_pwd`, `notify_url`, `return_url`, `sign_type`, `seller`, `sub_app_id`, `sub_mch_id`, `input_charset`, `is_test`, `updater`, `creator`, `create_time`, `update_time`, `deleted`) VALUES ('3', '微信小程序支付配置', 'wxPay', 'wxe4938661906993b5', '1558500071', 'STR', 'zk7BHJJWThinkSztbI6zye9ZA70uNFtT', '', '', '', 'https://b2c-pro-api-dev.zkthink.com/app-api/order/pay/wxPayNotify', '', 'MD5', NULL, NULL, NULL, 'UTF-8', 0, '1', NULL, NULL, '2023-11-14 15:26:16', b'0');
|
||||
INSERT INTO `merchant_details` (`details_id`, `title`, `pay_type`, `appid`, `mch_id`, `cert_store_type`, `key_private`, `key_public`, `key_cert`, `key_cert_pwd`, `notify_url`, `return_url`, `sign_type`, `seller`, `sub_app_id`, `sub_mch_id`, `input_charset`, `is_test`, `updater`, `creator`, `create_time`, `update_time`, `deleted`) VALUES ('4', '微信h5支付配置', 'wxPay', 'wxf0713a10bbae8732', '1558500071', '', 'zk7BHJJWThinkSztbI6zye9ZA70uNFtT', NULL, NULL, NULL, 'https://b2c-pro-api-dev.zkthink.com/app-api/order/pay/wxPayNotify', 'https://b2c-pro-ui-h5-dev.zkthink.com/#/pages/payStatus/index?type=1', 'MD5', NULL, NULL, NULL, 'utf-8', 0, '1', '1', '2023-09-20 09:58:03', '2023-11-14 14:20:58', b'0');
|
||||
COMMIT;
|
||||
|
||||
|
@ -41,5 +41,7 @@ public interface ErrorCodeConstants {
|
||||
|
||||
ErrorCode STORE_ORDER_REFUND_ERROR = new ErrorCode(1008011002, "退款失败!");
|
||||
|
||||
ErrorCode ORDER_QUERY_NO_MERCHANT = new ErrorCode(1008012001, "未查到商户配置信息id=4!");
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,8 @@ import java.util.stream.Stream;
|
||||
public enum PayTypeEnum {
|
||||
|
||||
ALI("alipay","支付宝支付","1"),
|
||||
ALI_APP("alipay_app","支付宝APP支付","1"),
|
||||
ALI_H5("alipay_h5","支付宝H5支付","1"),
|
||||
WEIXIN("weixin","微信支付","6"),
|
||||
WEIXIN_H5("weixin_h5","微信H5支付","4"),
|
||||
WEIXIN_APPLET("weixin_applet","微信小程序支付","3"),
|
||||
|
@ -2,11 +2,7 @@ package co.yixiang.yshop.module.order.controller.admin.storeaftersales.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 售后记录 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
|
@ -18,71 +18,71 @@ import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@Data
|
||||
public class StoreOrderBaseVO {
|
||||
|
||||
@Schema(description = "订单号", required = true, example = "20527")
|
||||
@Schema(description = "订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20527")
|
||||
@NotNull(message = "订单号不能为空")
|
||||
private String orderId;
|
||||
|
||||
@Schema(description = "额外订单号", example = "12452")
|
||||
private String extendOrderId;
|
||||
|
||||
@Schema(description = "用户id", required = true, example = "8323")
|
||||
@Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "8323")
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description = "用户姓名", required = true, example = "张三")
|
||||
@Schema(description = "用户姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotNull(message = "用户姓名不能为空")
|
||||
private String realName;
|
||||
|
||||
@MobileDesensitize
|
||||
@Schema(description = "用户电话", required = true)
|
||||
@Schema(description = "用户电话", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "用户电话不能为空")
|
||||
private String userPhone;
|
||||
|
||||
@Schema(description = "详细地址", required = true)
|
||||
@Schema(description = "详细地址", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "详细地址不能为空")
|
||||
private String userAddress;
|
||||
|
||||
@Schema(description = "购物车id", required = true, example = "23301")
|
||||
@Schema(description = "购物车id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23301")
|
||||
@NotNull(message = "购物车id不能为空")
|
||||
private String cartId;
|
||||
|
||||
@Schema(description = "运费金额", required = true, example = "637")
|
||||
@Schema(description = "运费金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "637")
|
||||
@NotNull(message = "运费金额不能为空")
|
||||
private BigDecimal freightPrice;
|
||||
|
||||
@Schema(description = "订单商品总数", required = true)
|
||||
@Schema(description = "订单商品总数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "订单商品总数不能为空")
|
||||
private Integer totalNum;
|
||||
|
||||
@Schema(description = "订单总价", required = true, example = "31659")
|
||||
@Schema(description = "订单总价", requiredMode = Schema.RequiredMode.REQUIRED, example = "31659")
|
||||
@NotNull(message = "订单总价不能为空")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@Schema(description = "邮费", required = true)
|
||||
@Schema(description = "邮费", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "邮费不能为空")
|
||||
private BigDecimal totalPostage;
|
||||
|
||||
@Schema(description = "实际支付金额", required = true, example = "19682")
|
||||
@Schema(description = "实际支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "19682")
|
||||
@NotNull(message = "实际支付金额不能为空")
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@Schema(description = "支付邮费", required = true)
|
||||
@Schema(description = "支付邮费", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "支付邮费不能为空")
|
||||
private BigDecimal payPostage;
|
||||
|
||||
@Schema(description = "抵扣金额", required = true, example = "16463")
|
||||
@Schema(description = "抵扣金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "16463")
|
||||
@NotNull(message = "抵扣金额不能为空")
|
||||
private BigDecimal deductionPrice;
|
||||
|
||||
@Schema(description = "优惠券id", required = true, example = "3299")
|
||||
@Schema(description = "优惠券id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3299")
|
||||
// @NotNull(message = "优惠券id不能为空")
|
||||
private Long couponId;
|
||||
|
||||
@Schema(description = "优惠券金额", required = true, example = "22157")
|
||||
@Schema(description = "优惠券金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "22157")
|
||||
@NotNull(message = "优惠券金额不能为空")
|
||||
private BigDecimal couponPrice;
|
||||
|
||||
@Schema(description = "支付状态", required = true, example = "11728")
|
||||
@Schema(description = "支付状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "11728")
|
||||
@NotNull(message = "支付状态不能为空")
|
||||
private Integer paid;
|
||||
|
||||
@ -90,15 +90,15 @@ public class StoreOrderBaseVO {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime payTime;
|
||||
|
||||
@Schema(description = "支付方式", required = true, example = "2")
|
||||
@Schema(description = "支付方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "支付方式不能为空")
|
||||
private String payType;
|
||||
|
||||
@Schema(description = "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)", required = true, example = "1")
|
||||
@Schema(description = "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:已完成;-1:已退款)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "0 未退款 1 申请中 2 已退款", required = true, example = "2")
|
||||
@Schema(description = "0 未退款 1 申请中 2 已退款", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "0 未退款 1 申请中 2 已退款不能为空")
|
||||
private Integer refundStatus;
|
||||
|
||||
@ -118,7 +118,7 @@ public class StoreOrderBaseVO {
|
||||
@Schema(description = "不退款的理由", example = "不喜欢")
|
||||
private String refundReason;
|
||||
|
||||
@Schema(description = "退款金额", required = true, example = "7547")
|
||||
@Schema(description = "退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "7547")
|
||||
@NotNull(message = "退款金额不能为空")
|
||||
private BigDecimal refundPrice;
|
||||
|
||||
@ -134,63 +134,63 @@ public class StoreOrderBaseVO {
|
||||
@Schema(description = "快递单号/手机号", example = "24798")
|
||||
private String deliveryId;
|
||||
|
||||
@Schema(description = "消费赚取积分", required = true)
|
||||
@Schema(description = "消费赚取积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "消费赚取积分不能为空")
|
||||
private BigDecimal gainIntegral;
|
||||
|
||||
@Schema(description = "使用积分", required = true)
|
||||
@Schema(description = "使用积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "使用积分不能为空")
|
||||
private BigDecimal useIntegral;
|
||||
|
||||
@Schema(description = "实际支付积分", required = true)
|
||||
@Schema(description = "实际支付积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "实际支付积分不能为空")
|
||||
private BigDecimal payIntegral;
|
||||
|
||||
@Schema(description = "给用户退了多少积分")
|
||||
private BigDecimal backIntegral;
|
||||
|
||||
@Schema(description = "备注", required = true)
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "备注不能为空")
|
||||
private String mark;
|
||||
|
||||
@Schema(description = "唯一id(md5加密)类似id", required = true)
|
||||
@Schema(description = "唯一id(md5加密)类似id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "唯一id(md5加密)类似id不能为空")
|
||||
private String unique;
|
||||
|
||||
@Schema(description = "管理员备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "商户ID", required = true, example = "8499")
|
||||
@Schema(description = "商户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "8499")
|
||||
@NotNull(message = "商户ID不能为空")
|
||||
private Integer merId;
|
||||
|
||||
@Schema(description = "拼团产品id0一般产品", example = "3865")
|
||||
private Long combinationId;
|
||||
|
||||
@Schema(description = "拼团id 0没有拼团", required = true, example = "8463")
|
||||
@Schema(description = "拼团id 0没有拼团", requiredMode = Schema.RequiredMode.REQUIRED, example = "8463")
|
||||
@NotNull(message = "拼团id 0没有拼团不能为空")
|
||||
private Long pinkId;
|
||||
|
||||
@Schema(description = "成本价", required = true)
|
||||
@Schema(description = "成本价", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "成本价不能为空")
|
||||
private BigDecimal cost;
|
||||
|
||||
@Schema(description = "秒杀产品ID", required = true, example = "21525")
|
||||
@Schema(description = "秒杀产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21525")
|
||||
@NotNull(message = "秒杀产品ID不能为空")
|
||||
private Long seckillId;
|
||||
|
||||
@Schema(description = "砍价id", example = "5132")
|
||||
private Integer bargainId;
|
||||
|
||||
@Schema(description = "核销码", required = true)
|
||||
@Schema(description = "核销码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "核销码不能为空")
|
||||
private String verifyCode;
|
||||
|
||||
@Schema(description = "门店id", required = true, example = "12064")
|
||||
@Schema(description = "门店id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12064")
|
||||
@NotNull(message = "门店id不能为空")
|
||||
private Integer storeId;
|
||||
|
||||
@Schema(description = "配送方式 1=快递 ,2=门店自提", required = true, example = "2")
|
||||
@Schema(description = "配送方式 1=快递 ,2=门店自提", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "配送方式 1=快递 ,2=门店自提不能为空")
|
||||
private Integer shippingType;
|
||||
|
||||
|
@ -35,8 +35,8 @@ public class AppReturnLogisticsParam {
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@NotBlank(message="订单编号不能为空")
|
||||
private String orderCode;
|
||||
/*@NotBlank(message="订单编号不能为空")
|
||||
private String orderCode;*/
|
||||
|
||||
/**
|
||||
* 售后订单id
|
||||
|
@ -7,7 +7,6 @@ import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -2,7 +2,6 @@ package co.yixiang.yshop.module.order.controller.app.afterorder.vo;
|
||||
|
||||
|
||||
import co.yixiang.yshop.module.product.controller.app.cart.vo.AppStoreCartQueryVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@ -12,7 +11,6 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -158,6 +158,7 @@ public class AppOrderController {
|
||||
*/
|
||||
@RequestMapping(value = "payBack{detailsId}.json")
|
||||
public String payBack(HttpServletRequest request, @PathVariable String detailsId) {
|
||||
//底层通过调用pay模块的handler接受回调信息
|
||||
return manager.payBack(detailsId, new HttpRequestNoticeParams(request));
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class AppPayParam implements Serializable {
|
||||
@Schema(description = "来源", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String from;
|
||||
|
||||
@NotBlank(message = "选择支付类型 PayTypeEnum类型(alipay weixin yue)")
|
||||
@NotBlank(message = "选择支付类型 PayTypeEnum类型(weixin_h5|weixin_applet|weixin_app)")
|
||||
@Schema(description = "支付类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String paytype;
|
||||
|
||||
|
@ -6,12 +6,10 @@ import co.yixiang.yshop.module.product.controller.app.cart.vo.AppStoreCartQueryV
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
@ -186,6 +186,7 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
.oid(yxStoreOrder.getId()).changeType(APPLY_AFTER_SALES.getValue())
|
||||
.changeMessage(APPLY_AFTER_SALES.getDesc()).changeTime(LocalDateTime.now()).build();
|
||||
// 记录订单操作
|
||||
|
||||
storeOrderStatusMapper.insert(orderStatusDO);
|
||||
//操作记录
|
||||
storeAfterSalesStatusService.create(storeAfterSales.getUserId(), storeAfterSales.getId(),
|
||||
@ -208,7 +209,6 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
.eq(StoreOrderDO::getOrderId, afterSales.getOrderCode()));
|
||||
|
||||
// 查询售后信息子项
|
||||
|
||||
List<StoreAfterSalesItemDO> afterSalesItemDOS =
|
||||
storeAfterSalesItemMapper.selectList(new LambdaUpdateWrapper<StoreAfterSalesItemDO>()
|
||||
.eq(StoreAfterSalesItemDO::getStoreAfterSalesId, afterSales.getId()));
|
||||
@ -217,6 +217,11 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
afterSalesItemDOS.stream().map(cart -> JSON.parseObject(cart.getCartInfo(), AppStoreCartQueryVo.class))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
BigDecimal totalPrice = BigDecimal.ZERO;
|
||||
for (AppStoreCartQueryVo cart : cartInfo) {
|
||||
totalPrice = totalPrice.add(cart.getTruePrice().multiply(BigDecimal.valueOf(cart.getCartNum())));
|
||||
}
|
||||
|
||||
// 查询是否发货
|
||||
StoreOrderStatusDO orderStatusDO =
|
||||
storeOrderStatusMapper.selectOne(new LambdaQueryWrapper<StoreOrderStatusDO>()
|
||||
@ -227,6 +232,7 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
AppStoreOrderAfterSalesDetailVo result =
|
||||
AppStoreOrderAfterSalesDetailVo.builder()
|
||||
// 售后信息
|
||||
.id(afterSales.getId())
|
||||
.refundAmount(afterSales.getRefundAmount()).reasons(afterSales.getReasons())
|
||||
.explains(afterSales.getExplains()).explainImg(afterSales.getExplainImg())
|
||||
.state(afterSales.getState()).salesState(afterSales.getSalesState())
|
||||
@ -236,9 +242,9 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
.receivingStatus(afterSales.getReceivingStatus())
|
||||
.serviceType(afterSales.getServiceType())
|
||||
// 订单信息
|
||||
.id(storeOrderDO.getId()).orderId(storeOrderDO.getOrderId()).uid(storeOrderDO.getUid())
|
||||
.orderId(storeOrderDO.getOrderId()).uid(storeOrderDO.getUid())
|
||||
.createTime(storeOrderDO.getCreateTime())
|
||||
.payPrice(storeOrderDO.getPayPrice()).totalPrice(storeOrderDO.getTotalPrice())
|
||||
.payPrice(storeOrderDO.getPayPrice()).totalPrice(totalPrice)
|
||||
.totalPostage(storeOrderDO.getTotalPostage()).deductionPrice(storeOrderDO.getDeductionPrice())
|
||||
.deliveryTime(orderStatusDO == null ? null : orderStatusDO.getChangeTime())
|
||||
.payTime(storeOrderDO.getPayTime())
|
||||
@ -454,9 +460,8 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public Boolean addLogisticsInformation(AppReturnLogisticsParam param) {
|
||||
StoreAfterSalesDO storeAfterSales = this.baseMapper.selectOne(Wrappers.<StoreAfterSalesDO>lambdaQuery()
|
||||
.eq(StoreAfterSalesDO::getId, param.getId())
|
||||
.eq(StoreAfterSalesDO::getOrderCode, param.getOrderCode()));
|
||||
StoreAfterSalesDO storeAfterSales = getById(param.getId());
|
||||
// .eq(StoreAfterSalesDO::getOrderCode, param.getOrderCode()));
|
||||
if (!storeAfterSales.getState().equals(AfterSalesStatusEnum.AUDITED.getValue())) {
|
||||
throw exception(ORDER_STATUS_NOT_EXPRESS_);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package co.yixiang.yshop.module.order.service.storeaftersalesstatus;
|
||||
|
||||
import co.yixiang.yshop.module.order.dal.dataobject.storeaftersalesstatus.StoreAfterSalesStatusDO;
|
||||
import co.yixiang.yshop.module.order.dal.mysql.storeaftersalesstatus.StoreAfterSalesStatusMapper;
|
||||
import co.yixiang.yshop.module.order.service.storeorder.AsyncStoreOrderService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -22,6 +23,9 @@ import static co.yixiang.yshop.framework.security.core.util.SecurityFrameworkUti
|
||||
@Validated
|
||||
public class StoreAfterSalesStatusServiceImpl implements StoreAfterSalesStatusService {
|
||||
|
||||
|
||||
// @Resource
|
||||
// private AsyncStoreOrderService asyncStoreOrderService;
|
||||
@Resource
|
||||
private StoreAfterSalesStatusMapper storeAfterSalesStatusMapper;
|
||||
|
||||
@ -43,6 +47,9 @@ public class StoreAfterSalesStatusServiceImpl implements StoreAfterSalesStatusSe
|
||||
storeAfterSalesStatus.setChangeTime(LocalDateTime.now());
|
||||
storeAfterSalesStatus.setOperator(Objects.requireNonNull(getLoginUserId()).toString());
|
||||
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
|
||||
|
||||
//异步统计
|
||||
// asyncStoreOrderService.orderData(uid);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ import co.yixiang.yshop.module.pay.PayContext;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo.PayParam;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchantdetails.MerchantDetailsDO;
|
||||
import co.yixiang.yshop.module.pay.service.merchantdetails.MerchantDetailsService;
|
||||
import co.yixiang.yshop.module.pay.strategy.PayEnum;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.service.WxPayService;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.service.WxPayServiceUtils;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.skd.HttpKit;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.skd.PaymentApi;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.skd.PaymentKit;
|
||||
@ -72,6 +72,8 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.egzosn.pay.spring.boot.core.PayServiceManager;
|
||||
import com.egzosn.pay.spring.boot.core.bean.MerchantPayOrder;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
@ -150,15 +152,12 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
@Resource
|
||||
private StoreOrderStatusMapper storeOrderStatusMapper;
|
||||
|
||||
@Resource
|
||||
private WxPayService wxPayService;
|
||||
|
||||
@Resource
|
||||
private ProductCouponService couponService;
|
||||
|
||||
@Resource
|
||||
private AppCouponRelationService appCouponRelationService;
|
||||
|
||||
@Resource
|
||||
private PayServiceManager manager;
|
||||
|
||||
private static final String LOCK_KEY = "cart:check:stock:lock";
|
||||
private static final String STOCK_LOCK_KEY = "cart:do:stock:lock";
|
||||
|
||||
@ -371,7 +370,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
storeOrder.setTotalPrice(computeVo.getTotalPrice());
|
||||
storeOrder.setTotalPostage(computeVo.getPayPostage());
|
||||
|
||||
storeOrder.setCouponId(param.getCouponId());
|
||||
storeOrder.setCouponId(param.getCouponId() != null && param.getCouponId().compareTo(0l) > 0 ? param.getCouponId() : null);
|
||||
storeOrder.setCouponPrice(computeVo.getCouponPrice());
|
||||
storeOrder.setPayPrice(computeVo.getPayPrice());
|
||||
storeOrder.setPayPostage(computeVo.getPayPostage());
|
||||
@ -396,7 +395,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
// 减库存加销量
|
||||
this.deStockIncSale(cartInfo);
|
||||
|
||||
if (param.getCouponId() != null && param.getCouponId() != 0) {
|
||||
if (param.getCouponId() != null && param.getCouponId() != 0 && param.getCouponId() != -1) {
|
||||
// 使用优惠券
|
||||
appCouponRelationService.verificationCoupon(param.getCouponId());
|
||||
}
|
||||
@ -454,9 +453,11 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
if (orderInfo.getPayInfo() == null) {
|
||||
return false;
|
||||
}
|
||||
if (PayTypeEnum.WEIXIN.getValue().equals(param.getPaytype())) {
|
||||
//paytype含有weixin就查微信订单
|
||||
if (param.getPaytype().contains(PayTypeEnum.WEIXIN.getValue())) {
|
||||
//微信查单
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails("4");
|
||||
if (merchantDetailsDO == null) throw exception(ORDER_QUERY_NO_MERCHANT);
|
||||
PayInfo payInfo = JsonUtils.parseObject(orderInfo.getPayInfo(), PayInfo.class);
|
||||
if (payInfo == null) return false;
|
||||
if (payInfo.getTransaction_id() == null) return false;
|
||||
@ -492,12 +493,27 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
//小程序支付需要openid
|
||||
if (Objects.isNull(userDO.getRoutineOpenid())) throw exception(USER_NOT_BINDING_WX_APPLET);
|
||||
}
|
||||
//微信h5支付商户配置
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails(PayTypeEnum.toType(param.getPaytype()).getCode());
|
||||
//根据type得到支付商户配置
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails(PayTypeEnum.toType(param.getPaytype()).getCode());
|
||||
PayContext payContext = new PayContext();
|
||||
Map<String, String> packageParams = payContext.selectPayWay(PayEnum.WEIXIN.getCode(),
|
||||
new PayParam(orderInfo.getOrderId(), orderInfo.getPayPrice(), userDO.getRoutineOpenid(), ServletUtils.getClientIP(),
|
||||
param.getPaytype(), "Yshop商城", merchantDetailsDO));
|
||||
Map<String, String> packageParams = new HashMap<>();
|
||||
if (param.getPaytype().contains(PayTypeEnum.ALI.getValue())) {
|
||||
aliPay(orderInfo, param, packageParams);
|
||||
updatePayInfo(orderInfo,packageParams);
|
||||
}else if(param.getPaytype().contains(PayTypeEnum.WEIXIN.getValue())){
|
||||
packageParams = payContext.selectPayWay(PayTypeEnum.WEIXIN.getValue(),
|
||||
new PayParam(orderInfo.getOrderId(), orderInfo.getPayPrice(), userDO.getRoutineOpenid(), ServletUtils.getClientIP(),
|
||||
param.getPaytype(), "Yshop商城", merchantDetailsDO));
|
||||
updatePayInfo(orderInfo,packageParams);
|
||||
}else if(param.getPaytype().contains(PayTypeEnum.YUE.getValue())){
|
||||
yuePay(param.getUni(),uid);
|
||||
}
|
||||
// 异步统计
|
||||
asyncStoreOrderService.orderData(uid);
|
||||
return packageParams;
|
||||
}
|
||||
|
||||
private void updatePayInfo(AppStoreOrderQueryVo orderInfo, Map<String, String> packageParams){
|
||||
PayInfo payInfo = new PayInfo();
|
||||
payInfo.setOrderId(orderInfo.getOrderId());
|
||||
payInfo.setOut_trade_no(packageParams.get("out_trade_no"));
|
||||
@ -508,10 +524,22 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
StoreOrderDO storeOrder = new StoreOrderDO();
|
||||
storeOrder.setPayInfo(JsonUtils.toJsonString(payInfo));
|
||||
this.update(storeOrder, wrapper);
|
||||
// 异步统计
|
||||
asyncStoreOrderService.orderData(uid);
|
||||
return packageParams;
|
||||
}
|
||||
|
||||
private void aliPay(AppStoreOrderQueryVo orderInfo, AppPayParam param, Map<String, String> packageParams ){
|
||||
if(PayTypeEnum.ALI_H5.getValue().equals(param.getPaytype())){
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("1", "WAP", "支付宝H5商品购买",
|
||||
"h5商品购买", orderInfo.getPayPrice(), param.getUni()+"-"+ RandomStringUtil.getRandomCode(3,0)+"H5");
|
||||
String str = manager.toPay(payOrder);
|
||||
log.info(str);
|
||||
// packageParams.put("data",manager.toPay(payOrder));
|
||||
}else if(PayTypeEnum.ALI_APP.getValue().equals(param.getFrom())){
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("1", "APP", "支付宝APP商品购买",
|
||||
"支付宝APP5商品购买", orderInfo.getPayPrice(), param.getUni()+"-"+ RandomStringUtil.getRandomCode(3,0)+"APP");
|
||||
// packageParams.put("data",manager.app(payOrder));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public void wxPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
@ -563,7 +591,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
// throw exception(STORE_ORDER_PAY_FEE_ERROR);
|
||||
//最简单做法 不一致退还支付金额,订单装态不变
|
||||
assert payInfo != null;
|
||||
Map map = wxPayService.refund(resultMap.get("transaction_id"), payInfo.getOut_refund_no(), orderInfo.getTotalPrice(), totalFee, merchantDetailsDO);
|
||||
Map map = new WxPayServiceUtils().refund(resultMap.get("transaction_id"), payInfo.getOut_refund_no(), orderInfo.getTotalPrice(), totalFee, merchantDetailsDO);
|
||||
log.info("退款详情:" + map);
|
||||
String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||
response.getWriter().write(result);
|
||||
@ -928,7 +956,8 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
|
||||
long count = appStoreProductReplyService.count(Wrappers.<StoreProductReplyDO>lambdaQuery()
|
||||
.eq(StoreProductReplyDO::getOid, orderCartInfo.getOid())
|
||||
.eq(StoreProductReplyDO::getProductId, orderCartInfo.getProductId()));
|
||||
.eq(StoreProductReplyDO::getProductId, orderCartInfo.getProductId())
|
||||
.eq(StoreProductReplyDO::getUnique, unique));
|
||||
if (count > 0) {
|
||||
throw exception(COMMENT_PRODUCT_IN_EXISTS);
|
||||
}
|
||||
@ -1009,13 +1038,16 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails("4");
|
||||
PayInfo payInfo = JsonUtils.parseObject(order.getPayInfo(), PayInfo.class);
|
||||
//取消之前要查询微信端是否支付完成如若由于网络原因造成两端不一致以微信端支付装态为准,已支付则不能取消,走退款逻辑
|
||||
if (payInfo == null) throw exception(ORDER_PAYINFO_ERROR);
|
||||
Map<String, String> map = PaymentApi.queryByOutTradeNo(merchantDetailsDO.getAppid(), merchantDetailsDO.getMchId(), merchantDetailsDO.getKeyPrivate(), payInfo.getOut_trade_no());
|
||||
log.info("查询微信订单状态:{}", map);
|
||||
//支付方也需要调用关闭订单接口
|
||||
if (Objects.equals(map.get(WxOrderResultEnum.TRADE_STATE.getValue()), WxOrderResultEnum.NOT_PAY.getValue())) {
|
||||
Map<String, String> closeOrderMap = PaymentApi.closeOrder(merchantDetailsDO.getAppid(), merchantDetailsDO.getMchId(), merchantDetailsDO.getKeyPrivate(), payInfo.getOut_trade_no());
|
||||
log.info("微信关闭订单:{}", closeOrderMap);
|
||||
// if (payInfo == null) throw exception(ORDER_PAYINFO_ERROR);
|
||||
// 有微信订单的数据关闭微信订单
|
||||
if (payInfo != null) {
|
||||
Map<String, String> map = PaymentApi.queryByOutTradeNo(merchantDetailsDO.getAppid(), merchantDetailsDO.getMchId(), merchantDetailsDO.getKeyPrivate(), payInfo.getOut_trade_no());
|
||||
log.info("查询微信订单状态:{}", map);
|
||||
//支付方也需要调用关闭订单接口
|
||||
if (Objects.equals(map.get(WxOrderResultEnum.TRADE_STATE.getValue()), WxOrderResultEnum.NOT_PAY.getValue())) {
|
||||
Map<String, String> closeOrderMap = PaymentApi.closeOrder(merchantDetailsDO.getAppid(), merchantDetailsDO.getMchId(), merchantDetailsDO.getKeyPrivate(), payInfo.getOut_trade_no());
|
||||
log.info("微信关闭订单:{}", closeOrderMap);
|
||||
}
|
||||
}
|
||||
|
||||
this.regressionIntegral(order, 0);
|
||||
@ -1077,7 +1109,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
} else if (PayTypeEnum.WEIXIN.getValue().equals(orderQueryVo.getPayType())) {
|
||||
// 微信
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails("4");
|
||||
packageParams = wxPayService.refund(payInfo.getTransaction_id(), payInfo.getOut_refund_no(), orderQueryVo.getTotalPrice(), price, merchantDetailsDO);
|
||||
packageParams = new WxPayServiceUtils().refund(payInfo.getTransaction_id(), payInfo.getOut_refund_no(), orderQueryVo.getTotalPrice(), price, merchantDetailsDO);
|
||||
|
||||
log.info("退款信息:{}", packageParams);
|
||||
//退款成功操作 应该在回调url中
|
||||
@ -1410,7 +1442,11 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
|
||||
//是否是固定邮费,没设置运费模板走固定
|
||||
if (tempId == 0) {
|
||||
return storeCartVO.getProductInfo().getPostage();
|
||||
storePostage =
|
||||
storePostage.add(storeCartVO.getProductInfo().getPostage()
|
||||
.multiply(BigDecimal.valueOf(storeCartVO.getCartNum())));
|
||||
continue;
|
||||
// return storeCartVO.getProductInfo().getPostage();
|
||||
}
|
||||
|
||||
//根据模板类型获取相应的数量
|
||||
@ -1467,7 +1503,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, Stor
|
||||
}
|
||||
|
||||
//处理区域邮费
|
||||
boolean isFirst = true; //用来是否多个产品的标识 false表示数量大于1
|
||||
boolean isFirst = false; //用来是否多个产品的标识 false表示数量大于1
|
||||
for (TemplateDto templateDTO : templateDTOMap.values()) {
|
||||
if (isFirst) {//首件
|
||||
//只满足首件
|
||||
|
@ -1,229 +0,0 @@
|
||||
package co.yixiang.yshop.module.order.service.storeorder;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import co.yixiang.yshop.framework.common.enums.OrderInfoEnum;
|
||||
import co.yixiang.yshop.module.member.controller.app.user.vo.AppUserOrderCountVo;
|
||||
import co.yixiang.yshop.module.member.service.user.MemberUserService;
|
||||
import co.yixiang.yshop.module.order.controller.admin.storeorder.vo.ShoperOrderTimeDataVo;
|
||||
import co.yixiang.yshop.module.order.dal.dataobject.storeaftersales.StoreAfterSalesDO;
|
||||
import co.yixiang.yshop.module.order.dal.dataobject.storeorder.StoreOrderDO;
|
||||
import co.yixiang.yshop.module.order.dal.mysql.storeorder.StoreOrderMapper;
|
||||
import co.yixiang.yshop.module.order.dal.redis.order.AsyncCountRedisDAO;
|
||||
import co.yixiang.yshop.module.order.dal.redis.order.AsyncOrderRedisDAO;
|
||||
import co.yixiang.yshop.module.order.service.storeaftersales.AppStoreAfterSalesService;
|
||||
import co.yixiang.yshop.module.order.service.storeorder.dto.OrderTimeDataDto;
|
||||
import co.yixiang.yshop.module.product.service.storeproduct.StoreProductService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 异步订单 Service 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class AsynStoreOrderServiceImpl implements AsyncStoreOrderService {
|
||||
|
||||
@Resource
|
||||
private StoreOrderMapper storeOrderMapper;
|
||||
@Resource
|
||||
private AppStoreAfterSalesService appStoreAfterSalesService;
|
||||
@Resource
|
||||
private AsyncOrderRedisDAO asyncOrderRedisDAO;
|
||||
@Resource
|
||||
private AsyncCountRedisDAO asyncCountRedisDAO;
|
||||
@Resource
|
||||
private MemberUserService userService;
|
||||
@Resource
|
||||
private StoreProductService productService;
|
||||
|
||||
/**
|
||||
* 获取某个用户的订单统计数据
|
||||
*
|
||||
* @param uid uid>0 取用户 否则取所有
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
public void orderData(Long uid) {
|
||||
log.info("========获取某个用户的订单统计数据=========");
|
||||
//订单支付没有退款 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperOne = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperOne.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperOne.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue());
|
||||
Long orderCount = storeOrderMapper.selectCount(wrapperOne);
|
||||
|
||||
//订单支付没有退款 支付总金额
|
||||
double sumPrice = storeOrderMapper.sumPrice(uid);
|
||||
|
||||
//订单待支付 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperTwo = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperTwo.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperTwo.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_0.getValue());
|
||||
Long unpaidCount = storeOrderMapper.selectCount(wrapperTwo);
|
||||
|
||||
//订单待发货 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperThree = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperThree.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperThree.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_0.getValue());
|
||||
Long unshippedCount = storeOrderMapper.selectCount(wrapperThree);
|
||||
|
||||
//订单待收货 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperFour = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperFour.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperFour.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_1.getValue());
|
||||
Long receivedCount = storeOrderMapper.selectCount(wrapperFour);
|
||||
|
||||
//订单待评价 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperFive = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperFive.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperFive.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_2.getValue());
|
||||
Long evaluatedCount = storeOrderMapper.selectCount(wrapperFive);
|
||||
|
||||
//订单已完成 数量
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperSix = new LambdaQueryWrapper<>();
|
||||
if (uid != null) {
|
||||
wrapperSix.eq(StoreOrderDO::getUid, uid);
|
||||
}
|
||||
wrapperSix.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_3.getValue());
|
||||
Long completeCount = storeOrderMapper.selectCount(wrapperSix);
|
||||
|
||||
//售后退款
|
||||
Long salesCount = appStoreAfterSalesService.lambdaQuery()
|
||||
.eq(Objects.nonNull(uid), StoreAfterSalesDO::getUserId, uid)
|
||||
.count();
|
||||
|
||||
AppUserOrderCountVo appUserOrderCountVo = AppUserOrderCountVo.builder()
|
||||
.orderCount(orderCount)
|
||||
.sumPrice(sumPrice)
|
||||
.unpaidCount(unpaidCount)
|
||||
.unshippedCount(unshippedCount)
|
||||
.receivedCount(receivedCount)
|
||||
.evaluatedCount(evaluatedCount)
|
||||
.completeCount(completeCount)
|
||||
.refundCount(salesCount)
|
||||
.build();
|
||||
|
||||
//存redis
|
||||
asyncOrderRedisDAO.set(appUserOrderCountVo,uid);
|
||||
|
||||
this.getOrderTimeData();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 首页订单/用户等统计
|
||||
*
|
||||
* @return OrderTimeDataDto
|
||||
*/
|
||||
@Async
|
||||
@Override
|
||||
public void getOrderTimeData() {
|
||||
OrderTimeDataDto orderTimeDataDto = new OrderTimeDataDto();
|
||||
|
||||
ShoperOrderTimeDataVo shoperOrderTimeData = this.getShoperOrderTimeData();
|
||||
|
||||
BeanUtil.copyProperties(shoperOrderTimeData, orderTimeDataDto);
|
||||
|
||||
|
||||
orderTimeDataDto.setUserCount(userService.count());
|
||||
orderTimeDataDto.setOrderCount(storeOrderMapper.selectCount());
|
||||
orderTimeDataDto.setPriceCount(storeOrderMapper.sumTotalPrice());
|
||||
orderTimeDataDto.setGoodsCount(productService.count());
|
||||
|
||||
asyncCountRedisDAO.set(orderTimeDataDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步后台统计
|
||||
*/
|
||||
public ShoperOrderTimeDataVo getShoperOrderTimeData() {
|
||||
|
||||
Date today = DateUtil.beginOfDay(new Date());
|
||||
Date yesterday = DateUtil.beginOfDay(DateUtil.yesterday());
|
||||
Date nowMonth = DateUtil.beginOfMonth(new Date());
|
||||
Date lastWeek = DateUtil.beginOfDay(DateUtil.lastWeek());
|
||||
|
||||
ShoperOrderTimeDataVo orderTimeDataVo = new ShoperOrderTimeDataVo();
|
||||
|
||||
//今日成交额
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperOne = new LambdaQueryWrapper<>();
|
||||
wrapperOne
|
||||
.ge(StoreOrderDO::getPayTime, today)
|
||||
.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue());
|
||||
orderTimeDataVo.setTodayPrice(storeOrderMapper.todayPrice(wrapperOne));
|
||||
//今日订单数
|
||||
orderTimeDataVo.setTodayCount(storeOrderMapper.selectCount(wrapperOne));
|
||||
|
||||
//昨日成交额
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperTwo = new LambdaQueryWrapper<>();
|
||||
wrapperTwo
|
||||
.lt(StoreOrderDO::getPayTime, today)
|
||||
.ge(StoreOrderDO::getPayTime, yesterday)
|
||||
.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue());
|
||||
orderTimeDataVo.setProPrice(storeOrderMapper.todayPrice(wrapperTwo));
|
||||
//昨日订单数
|
||||
orderTimeDataVo.setProCount(storeOrderMapper.selectCount(wrapperTwo));
|
||||
|
||||
//本月成交额
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperThree = new LambdaQueryWrapper<>();
|
||||
wrapperThree
|
||||
.ge(StoreOrderDO::getPayTime, nowMonth)
|
||||
.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue());
|
||||
orderTimeDataVo.setMonthPrice(storeOrderMapper.todayPrice(wrapperThree));
|
||||
//本月订单数
|
||||
orderTimeDataVo.setMonthCount(storeOrderMapper.selectCount(wrapperThree));
|
||||
|
||||
//上周成交额
|
||||
LambdaQueryWrapper<StoreOrderDO> wrapperLastWeek = new LambdaQueryWrapper<>();
|
||||
wrapperLastWeek
|
||||
.lt(StoreOrderDO::getPayTime, today)
|
||||
.ge(StoreOrderDO::getPayTime, lastWeek)
|
||||
.eq(StoreOrderDO::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue());
|
||||
orderTimeDataVo.setLastWeekPrice(storeOrderMapper.todayPrice(wrapperLastWeek));
|
||||
//上周订单数
|
||||
orderTimeDataVo.setLastWeekCount(storeOrderMapper.selectCount(wrapperLastWeek));
|
||||
|
||||
|
||||
return orderTimeDataVo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -125,7 +125,7 @@ public class AsyncStoreOrderServiceImpl implements AsyncStoreOrderService {
|
||||
.eq(StoreOrderDO::getRefundStatus, OrderInfoEnum.REFUND_STATUS_NORMAL.getValue())
|
||||
.eq(StoreOrderDO::getStatus, OrderInfoEnum.STATUS_DEFAULT.getValue());
|
||||
Long unpaidCount = storeOrderMapper.selectCount(wrapperTwo);
|
||||
AppUserOrderCountVo appUserOrderCountVo = AppUserOrderCountVo.builder()
|
||||
AppUserOrderCountVo appUserOrderCountVo = AppUserOrderCountVo.builder()
|
||||
.orderCount(orderCount)
|
||||
.sumPrice(sumPrice)
|
||||
.unpaidCount(unpaidCount)
|
||||
@ -136,7 +136,7 @@ public class AsyncStoreOrderServiceImpl implements AsyncStoreOrderService {
|
||||
.refundCount(salesCount)
|
||||
.build();
|
||||
|
||||
//先删除再存redis
|
||||
//先删除再存redis
|
||||
asyncOrderRedisDAO.delete(uid);
|
||||
asyncOrderRedisDAO.set(appUserOrderCountVo,uid);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package co.yixiang.yshop.module.order.service.storeorder.dto;
|
||||
|
||||
import co.yixiang.yshop.framework.common.serializer.BigDecimalSerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
@ -20,8 +20,6 @@ import javax.annotation.Resource;
|
||||
@Validated
|
||||
public class StoreOrderStatusServiceImpl extends ServiceImpl<StoreOrderStatusMapper, StoreOrderStatusDO> implements StoreOrderStatusService {
|
||||
|
||||
@Resource
|
||||
private StoreOrderStatusMapper storeOrderStatusMapper;
|
||||
@Resource
|
||||
private AsyncStoreOrderService asyncStoreOrderService;
|
||||
/**
|
||||
|
@ -34,6 +34,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode STORE_PRODUCT_SLIDER_ERROR = new ErrorCode(1008003008, "请上传轮播图");
|
||||
ErrorCode STORE_PRODUCT_ATTR_NEED = new ErrorCode(1008003009, "请设置至少一个属性");
|
||||
|
||||
ErrorCode STORE_PRODUCT_PRICE_ERROR = new ErrorCode(1008003010, "商品规格价格必须大于0");
|
||||
|
||||
// ========== 运费模板 1008004000 ==========
|
||||
ErrorCode SHIPPING_TEMPLATES_NOT_EXISTS = new ErrorCode(1008004000, "运费模板不存在");
|
||||
ErrorCode SHIPPING_TEMPLATES_FREE_NOT_EXISTS = new ErrorCode(1008004001, "请添加包邮区域");
|
||||
|
@ -36,4 +36,7 @@ public class AppStoreProductQueryParam extends QueryParam {
|
||||
|
||||
@Schema(description = "按照销量排序,不为空表示查询,为空不查询", required = true)
|
||||
private String sales;
|
||||
|
||||
@Schema(description = "优惠券id", required = true)
|
||||
private Long couponId;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class ProductCouponDO extends BaseDO {
|
||||
*/
|
||||
private BigDecimal discount;
|
||||
/**
|
||||
* 优惠券范围:1、所有商品,2、选中类型,3、选中商品
|
||||
* 优惠券范围:1、所有商品,2、选中商品
|
||||
*/
|
||||
private Integer couponScope;
|
||||
/**
|
||||
|
@ -17,9 +17,18 @@ public interface AppCouponService extends IService<ProductCouponDO> {
|
||||
|
||||
/**
|
||||
* 获取商品可领优惠券列表
|
||||
*
|
||||
* @param productId 商品id
|
||||
* @return
|
||||
*/
|
||||
List<AppCouponDetailRespVO> receiveList(Long productId);
|
||||
|
||||
/**
|
||||
* 获取优惠券可用商品列表
|
||||
*
|
||||
* @param id 优惠券id
|
||||
* @return
|
||||
*/
|
||||
List<Long> getCouponProductList(Long id);
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import co.yixiang.yshop.module.product.controller.app.coupon.vo.AppCouponDetailR
|
||||
import co.yixiang.yshop.module.product.convert.storeproductcoupon.StoreProductCouponConvert;
|
||||
import co.yixiang.yshop.module.product.dal.dataobject.productcoupon.ProductCouponDO;
|
||||
import co.yixiang.yshop.module.product.dal.mysql.productcoupon.ProductCouponMapper;
|
||||
import co.yixiang.yshop.module.product.enums.coupon.CouponScopeEnum;
|
||||
import co.yixiang.yshop.module.product.service.storeproduct.StoreProductService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -11,6 +12,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -31,7 +33,7 @@ public class AppCouponServiceImpl extends ServiceImpl<ProductCouponMapper, Produ
|
||||
@Override
|
||||
public List<AppCouponDetailRespVO> receiveList(Long productId) {
|
||||
List<ProductCouponDO> couponDOS = this.baseMapper.receiveList(productId);
|
||||
if(CollectionUtils.isEmpty(couponDOS)) return null;
|
||||
if (CollectionUtils.isEmpty(couponDOS)) return null;
|
||||
List<AppCouponDetailRespVO> couponDetailList = StoreProductCouponConvert.INSTANCE.convertList(couponDOS);
|
||||
couponDetailList = couponDetailList.stream()
|
||||
.sorted(Comparator.comparing(AppCouponDetailRespVO::getCouponType, Comparator.reverseOrder())
|
||||
@ -40,4 +42,15 @@ public class AppCouponServiceImpl extends ServiceImpl<ProductCouponMapper, Produ
|
||||
).collect(Collectors.toList());
|
||||
return couponDetailList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getCouponProductList(Long id) {
|
||||
List<Long> productIdList = new ArrayList<>();
|
||||
ProductCouponDO couponDO = getById(id);
|
||||
if (CouponScopeEnum.PRODUCT.getValue().equals(couponDO.getCouponScope())) {
|
||||
String[] productIdArr = couponDO.getScopeValues().split(",");
|
||||
for (String s : productIdArr) productIdList.add(Long.parseLong(s));
|
||||
}
|
||||
return productIdList;
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class AppStoreProductServiceImpl extends ServiceImpl<StoreProductMapper,
|
||||
/**
|
||||
* 最近历史搜索的大小
|
||||
*/
|
||||
public static final Integer CURRENT_SEARCH_SIZE = 5;
|
||||
public static final Integer CURRENT_SEARCH_SIZE = 10;
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
@ -159,6 +159,11 @@ public class AppStoreProductServiceImpl extends ServiceImpl<StoreProductMapper,
|
||||
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getSid())) {
|
||||
wrapper.eq(StoreProductDO::getCateId, productQueryParam.getSid());
|
||||
}
|
||||
// 查询优惠券可用商品
|
||||
if (productQueryParam.getCouponId() != null && productQueryParam.getCouponId() != 0) {
|
||||
List<Long> productIdList = appCouponService.getCouponProductList(productQueryParam.getCouponId());
|
||||
wrapper.in(CollectionUtils.isNotEmpty(productIdList), StoreProductDO::getId, productIdList);
|
||||
}
|
||||
//关键字搜索
|
||||
if (StrUtil.isNotEmpty(productQueryParam.getKeyword())) {
|
||||
wrapper.and(wrapper1 -> {
|
||||
@ -245,7 +250,7 @@ public class AppStoreProductServiceImpl extends ServiceImpl<StoreProductMapper,
|
||||
|
||||
//获取运费模板名称
|
||||
String tempName = "";
|
||||
if(storeProduct.getPostage().compareTo(BigDecimal.ZERO) == 0 && storeProduct.getTempId() == 0) {
|
||||
if (storeProduct.getPostage().compareTo(BigDecimal.ZERO) == 0 && storeProduct.getTempId() == 0) {
|
||||
tempName = ProductConstants.FREE_POSTAGE;
|
||||
} else {
|
||||
ShippingTemplatesDO shippingTemplates = shippingTemplatesService.getById(storeProduct.getTempId());
|
||||
@ -278,10 +283,10 @@ public class AppStoreProductServiceImpl extends ServiceImpl<StoreProductMapper,
|
||||
storeProductRelationMapper.insert(storeProductRelationDO);
|
||||
|
||||
// 设置优惠券信息
|
||||
List<AppCouponDetailRespVO> couponDetailList = appCouponService.receiveList(id);
|
||||
if(CollectionUtils.isNotEmpty(couponDetailList)){
|
||||
List<AppCouponDetailRespVO> couponDetailList = appCouponService.receiveList(id);
|
||||
if (CollectionUtils.isNotEmpty(couponDetailList)) {
|
||||
AppCouponDetailRespVO couponDetail = couponDetailList.get(0);
|
||||
if(CouponTypeEnum.FULL_REDUCTION.getValue().equals(couponDetail.getCouponType())){
|
||||
if (CouponTypeEnum.FULL_REDUCTION.getValue().equals(couponDetail.getCouponType())) {
|
||||
productVo.setCouponSplicing("满" + couponDetail.getThreshold() + "元减" + couponDetail.getCouponValue());
|
||||
} else {
|
||||
productVo.setCouponSplicing("满" + couponDetail.getThreshold() + "元" + couponDetail.getDiscount() + "折");
|
||||
@ -389,7 +394,7 @@ public class AppStoreProductServiceImpl extends ServiceImpl<StoreProductMapper,
|
||||
|
||||
if (userRecentSearches.size() > CURRENT_SEARCH_SIZE) {
|
||||
//获取到最开始浏览的第一条
|
||||
String firstSearch = userRecentSearches.stream().reduce((first, second) -> second).orElse(null);
|
||||
String firstSearch = userRecentSearches.stream().reduce((first, second) -> second).orElse(null);
|
||||
//删除最开始浏览的第一条
|
||||
zSet.remove(key, firstSearch);
|
||||
}
|
||||
@ -429,6 +434,7 @@ public class AppStoreProductServiceImpl extends ServiceImpl<StoreProductMapper,
|
||||
|
||||
/**
|
||||
* 缓存搜索记录
|
||||
*
|
||||
* @param keyWord 搜索关键字
|
||||
*/
|
||||
private void addSearchPopular(String keyWord) {
|
||||
|
@ -465,7 +465,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductMapper, Sto
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertAndEditYxStoreProduct(StoreProductDto storeProductDto) {
|
||||
ProductResultDto resultDTO = this.computedProduct(storeProductDto.getAttrs());
|
||||
|
||||
validPrice(storeProductDto);
|
||||
//添加商品
|
||||
StoreProductDO yxStoreProduct = new StoreProductDO();
|
||||
BeanUtil.copyProperties(storeProductDto, yxStoreProduct, "sliderImage");
|
||||
@ -513,6 +513,12 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductMapper, Sto
|
||||
|
||||
}
|
||||
|
||||
private void validPrice(StoreProductDto storeProductDto){
|
||||
for (ProductFormatDto dto : storeProductDto.getAttrs()){
|
||||
if(dto.getPrice()<=0) throw exception(STORE_PRODUCT_PRICE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProductInfo(Long id) {
|
||||
Map<String, Object> map = new LinkedHashMap<>(3);
|
||||
|
@ -81,11 +81,11 @@ public class StoreProductAttrServiceImpl extends ServiceImpl<StoreProductAttrMap
|
||||
Long productId)
|
||||
{
|
||||
List<StoreProductAttrDO> attrGroup = new ArrayList<>();
|
||||
for (FormatDetailDto fromatDetailDto : items) {
|
||||
for (FormatDetailDto formatDetailDto : items) {
|
||||
StoreProductAttrDO storeProductAttr = StoreProductAttrDO.builder()
|
||||
.productId(productId)
|
||||
.attrName(fromatDetailDto.getValue())
|
||||
.attrValues(StrUtil.join(",",fromatDetailDto.getDetail()))
|
||||
.attrName(formatDetailDto.getValue())
|
||||
.attrValues(StrUtil.join(",",formatDetailDto.getDetail()))
|
||||
.build();
|
||||
|
||||
attrGroup.add(storeProductAttr);
|
||||
@ -103,7 +103,7 @@ public class StoreProductAttrServiceImpl extends ServiceImpl<StoreProductAttrMap
|
||||
// throw new BadRequestException("活动商品库存不能大于原有商品库存");
|
||||
// }
|
||||
List<String> stringList = new ArrayList<>(productFormatDto.getDetail().values());
|
||||
Collections.sort(stringList);
|
||||
// Collections.sort(stringList);
|
||||
StoreProductAttrValueDO oldAttrValue = storeProductAttrValueService.getOne(new LambdaQueryWrapper<StoreProductAttrValueDO>()
|
||||
.eq(StoreProductAttrValueDO::getSku, productFormatDto.getSku())
|
||||
.eq(StoreProductAttrValueDO::getProductId, productId));
|
||||
|
@ -15,7 +15,7 @@
|
||||
where
|
||||
((taking_effect_time < now() and expiration_time > now())or expiration_type = 2)
|
||||
and ( coupon_scope = 1 or FIND_IN_SET(#{productId}, scope_values) != 0)
|
||||
and deleted = 0
|
||||
and deleted = 0 and number > 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -1,5 +1,6 @@
|
||||
package co.yixiang.yshop.module.member.controller.admin.user.vo;
|
||||
|
||||
import co.yixiang.yshop.framework.desensitize.core.slider.annotation.MobileDesensitize;
|
||||
import co.yixiang.yshop.module.member.api.user.dto.WechatUserDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
@ -31,6 +32,7 @@ public class UserBaseVO {
|
||||
@Schema(description = "用户头像")
|
||||
private String avatar;
|
||||
|
||||
@MobileDesensitize
|
||||
@Schema(description = "手机号码")
|
||||
private String mobile;
|
||||
|
||||
|
@ -43,13 +43,17 @@ public class AliPayMessageHandler implements PayMessageHandler<AliPayMessage, Al
|
||||
//交易完成
|
||||
if ("TRADE_SUCCESS".equals(trade_status) || "TRADE_FINISHED".equals(trade_status)) {
|
||||
|
||||
String orderId = (String) payMessage.getPayMessage().get("out_trade_no");
|
||||
log.info("支付宝回调消息处理,发送处理消息orderId={}",orderId);
|
||||
//消息队列处理
|
||||
payNoticeProducer.sendPayNoticeMessage(orderId, PayTypeEnum.ALI.getValue());
|
||||
log.info("支付宝回调消息发送完毕");
|
||||
return payService.getPayOutMessage("success", "成功");
|
||||
|
||||
String orderNo = (String) payMessage.getPayMessage().get("out_trade_no");
|
||||
//截取订单编号
|
||||
String[] split = orderNo.split("-");
|
||||
if (split.length > 0) {
|
||||
String orderId = split[0];
|
||||
log.info("支付宝回调消息处理,发送处理消息orderId={}", split[0]);
|
||||
//消息队列处理
|
||||
payNoticeProducer.sendPayNoticeMessage(orderId, PayTypeEnum.ALI.getValue());
|
||||
log.info("支付宝回调消息发送完毕");
|
||||
return payService.getPayOutMessage("success", "成功");
|
||||
}
|
||||
}
|
||||
|
||||
return payService.getPayOutMessage("fail", "失败");
|
||||
|
@ -19,6 +19,8 @@ import java.util.stream.Stream;
|
||||
public enum PayTypeEnum {
|
||||
|
||||
ALI("alipay","支付宝支付"),
|
||||
ALI_H5("alipay_h5","微信支付"),
|
||||
ALI_APP("alipay_app","微信支付"),
|
||||
WEIXIN("weixin","微信支付"),
|
||||
WEIXIN_H5("weixin_h5","微信H5支付"),
|
||||
WEIXIN_APPLET("weixin_applet","微信小程序支付"),
|
||||
|
@ -6,6 +6,8 @@ import lombok.Getter;
|
||||
public enum PayEnum {
|
||||
|
||||
ALI("alipay","支付宝支付"),
|
||||
ALI_APP("alipay_app","支付宝APP支付"),
|
||||
ALI_H5("alipay_h5","支付宝H5支付"),
|
||||
WEIXIN("weixin","微信支付"),
|
||||
WEIXIN_H5("weixin_h5","微信H5支付"),
|
||||
WEIXIN_APPLET("weixin_applet","微信小程序支付"),
|
||||
|
@ -1,7 +1,10 @@
|
||||
package co.yixiang.yshop.module.pay.strategy.type;
|
||||
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo.PayParam;
|
||||
import co.yixiang.yshop.module.pay.enums.PayTypeEnum;
|
||||
import co.yixiang.yshop.module.pay.strategy.Pay;
|
||||
import co.yixiang.yshop.module.pay.strategy.weixin.skd.RandomStringUtil;
|
||||
import com.egzosn.pay.spring.boot.core.bean.MerchantPayOrder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
@ -9,9 +12,11 @@ import java.util.Map;
|
||||
|
||||
public class AliPay implements Pay {
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String,String> selectPayWay(String payCode, PayParam param) throws Exception{
|
||||
//do something
|
||||
|
||||
return Collections.emptyMap();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -178,8 +178,9 @@ public class WxPayServiceUtils {
|
||||
params.put("sign", sign);
|
||||
String xml = PaymentKit.toXml(params);
|
||||
log.info(xml);
|
||||
String cert_url = "/yshop-server/apiclient_cert.p12";
|
||||
log.info("certUrl:{}",cert_url);
|
||||
String xmlStr = WXPayUtil.doRefund("https://api.mch.weixin.qq.com/secapi/pay/refund", xml,cert_url,mch_id);
|
||||
log.info(xmlStr);
|
||||
//加入微信支付日志
|
||||
return PaymentKit.xmlToMap(xmlStr);
|
||||
}
|
||||
|
Reference in New Issue
Block a user