Browse Source

付款修改

weifanli 3 years ago
parent
commit
21a04586fd
37 changed files with 899 additions and 197 deletions
  1. 5 75
      cooleshow-common/src/main/java/com/yonge/cooleshow/common/entity/HttpResponseResult.java
  2. 5 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/UserOrderRefundBillDao.java
  3. 4 4
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/UserOrderRefundBillDto.java
  4. 7 7
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserOrderPayment.java
  5. 10 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserOrderRefund.java
  6. 14 14
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserOrderRefundBill.java
  7. 29 18
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/sdk/PaymentSdk.java
  8. 2 4
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderPaymentService.java
  9. 5 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderRefundPaymentService.java
  10. 0 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderService.java
  11. 5 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderPaymentServiceImpl.java
  12. 6 6
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderRefundPaymentServiceImpl.java
  13. 27 4
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderRefundServiceImpl.java
  14. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java
  15. 24 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/UserOrderRefundBillVo.java
  16. 0 24
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/UserOrderRefundPaymentVo.java
  17. 2 2
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderPaymentMapper.xml
  18. 6 6
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderRefundBillMapper.xml
  19. 2 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderRefundMapper.xml
  20. 0 15
      cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/PaymentController.java
  21. 1 0
      toolset/pom.xml
  22. 131 0
      toolset/toolset-base/src/main/java/com/yonge/toolset/base/result/BaseResult.java
  23. 23 0
      toolset/toolset-payment/payment-core/pom.xml
  24. 44 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/PaymentTemplate.java
  25. 14 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/config/PaymentConfiguration.java
  26. 8 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/constant/PaymentConstant.java
  27. 38 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/enums/OpenEnum.java
  28. 41 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/enums/PayChannelEnum.java
  29. 42 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/enums/TradeStatusEnum.java
  30. 83 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/ClosePayment.java
  31. 112 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/Payment.java
  32. 97 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/RefundBill.java
  33. 21 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/res/ClosePaymentRes.java
  34. 36 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/res/PaymentRes.java
  35. 20 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/res/RefundBillRes.java
  36. 8 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/props/PaymentProperties.java
  37. 26 0
      toolset/toolset-payment/pom.xml

+ 5 - 75
cooleshow-common/src/main/java/com/yonge/cooleshow/common/entity/HttpResponseResult.java

@@ -1,96 +1,26 @@
 package com.yonge.cooleshow.common.entity;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.yonge.toolset.base.exception.BizException;
-import com.yonge.toolset.base.exception.ThirdpartyException;
-import com.yonge.toolset.utils.http.HttpUtil;
+import com.yonge.toolset.base.result.BaseResult;
 import com.yonge.toolset.utils.json.JsonUtil;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.springframework.context.support.DefaultMessageSourceResolvable;
 import org.springframework.http.HttpStatus;
-import java.util.Date;
 
 /**
  * HttpResponse 返回结果
  */
-public class HttpResponseResult<T> {
-
-	private boolean status = true;
-	private String msg;
-	private T data;
-	private int code;
-	private Date nowTime = new Date();
+public class HttpResponseResult<T> extends BaseResult<T> {
 
 	public HttpResponseResult(boolean status, int code, T data, String message) {
-		this.status = status;
-		this.msg = message;
-		this.data = data;
-		this.code = code;
+		super(status,code,data,message);
 	}
 
 	public HttpResponseResult(boolean status, HttpStatus resultCode, T data, String message) {
-		this.status = status;
-		this.msg = message;
-		this.data = data;
-		this.code = resultCode.value();
-	}
-
-	public HttpResponseResult() {
-	}
-
-	public int getCode() {
-		return code;
-	}
-
-	public void setCode(int code) {
-		this.code = code;
-	}
-
-	public boolean getStatus() {
-		return status;
-	}
-
-	public void setStatus(boolean status) {
-		this.status = status;
-	}
-
-	public String getMsg() {
-		return msg;
-	}
-
-	public void setMsg(String msg) {
-		this.msg = msg;
-	}
-
-	public T getData() {
-		return data;
-	}
-
-	public void setData(T data) {
-		this.data = data;
-	}
+		super(status,resultCode,data,message);
 
-	public void success() {
-		this.status = true;
 	}
-
-	public void fail() {
-		this.status = false;
-	}
-
-	public Date getNowTime() {
-		return nowTime;
-	}
-
-	public void setNowTime(Date nowTime) {
-		this.nowTime = nowTime;
+	public HttpResponseResult() {
 	}
 
-
 	public static <T> HttpResponseResult<T> succeed(T object) {
 		return getResponseData(true, HttpStatus.OK, object, "");
 	}

+ 5 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/UserOrderRefundPaymentDao.java → cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/UserOrderRefundBillDao.java

@@ -5,19 +5,19 @@ import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
-import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundPayment;
-import com.yonge.cooleshow.biz.dal.vo.UserOrderRefundPaymentVo;
+import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundBill;
+import com.yonge.cooleshow.biz.dal.vo.UserOrderRefundBillVo;
 import com.yonge.cooleshow.biz.dal.dto.search.UserOrderRefundPaymentSearch;
 
 
-public interface UserOrderRefundPaymentDao extends BaseMapper<UserOrderRefundPayment>{
+public interface UserOrderRefundBillDao extends BaseMapper<UserOrderRefundBill>{
 	/**
 	 * 查询详情
      * @author liweifan
      * @date 2022-05-09 17:14:30
      * @return: com.yonge.cooleshow.biz.dal.vo.UserOrderRefundPaymentVo
 	 */
-	UserOrderRefundPaymentVo detail(@Param("id") Long id);
+	UserOrderRefundBillVo detail(@Param("id") Long id);
 
 	/**
 	 * 分页查询
@@ -25,6 +25,6 @@ public interface UserOrderRefundPaymentDao extends BaseMapper<UserOrderRefundPay
      * @date 2022-05-09 17:14:30
      * @return: com.yonge.cooleshow.biz.dal.vo.UserOrderRefundPaymentVo
 	 */
-	List<UserOrderRefundPaymentVo> selectPage(@Param("page") IPage page, @Param("param") UserOrderRefundPaymentSearch userOrderRefundPayment);
+	List<UserOrderRefundBillVo> selectPage(@Param("page") IPage page, @Param("param") UserOrderRefundPaymentSearch userOrderRefundPayment);
 	
 }

+ 4 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/UserOrderRefundPaymentDto.java → cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/UserOrderRefundBillDto.java

@@ -1,6 +1,6 @@
 package com.yonge.cooleshow.biz.dal.dto;
 
-import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundPayment;
+import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundBill;
 import io.swagger.annotations.ApiModel;
 import org.apache.commons.beanutils.BeanUtils;
 
@@ -9,12 +9,12 @@ import org.apache.commons.beanutils.BeanUtils;
  * @Data: 2022-05-09 17:14:30
  */
 @ApiModel(value = "UserOrderRefundPaymentDto对象", description = "退款单表数据传输对象")
-public class UserOrderRefundPaymentDto extends UserOrderRefundPayment{
+public class UserOrderRefundBillDto extends UserOrderRefundBill {
 	private static final long serialVersionUID = 1L;
     
-    public UserOrderRefundPaymentDto buildDto(UserOrderRefundPayment userOrderRefundPayment){
+    public UserOrderRefundBillDto buildDto(UserOrderRefundBill userOrderRefundBill){
         try {
-            BeanUtils.copyProperties(this,userOrderRefundPayment);
+            BeanUtils.copyProperties(this, userOrderRefundBill);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 7 - 7
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserOrderPayment.java

@@ -27,9 +27,9 @@ public class UserOrderPayment implements Serializable {
     @ApiModelProperty("订单号 ")
 	@TableField(value = "order_no_")
     private String orderNo;
-    @ApiModelProperty("汇付支付订单号(一个订单对应多个支付订单,新发起一个支付订单会关闭其他交易) ")
-    @TableField(value = "adapay_no_")
-    private String adapayNo;
+    @ApiModelProperty("支付订单号(一个订单对应多个支付订单,新发起一个支付订单会关闭其他交易) ")
+    @TableField(value = "payment_no_")
+    private String paymentNo;
     @ApiModelProperty("交易流水号 ")
 	@TableField(value = "trans_no_")
     private String transNo;
@@ -196,11 +196,11 @@ public class UserOrderPayment implements Serializable {
         this.backPayAmt = backPayAmt;
     }
 
-    public String getAdapayNo() {
-        return adapayNo;
+    public String getPaymentNo() {
+        return paymentNo;
     }
 
-    public void setAdapayNo(String adapayNo) {
-        this.adapayNo = adapayNo;
+    public void setPaymentNo(String paymentNo) {
+        this.paymentNo = paymentNo;
     }
 }

+ 10 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserOrderRefund.java

@@ -31,6 +31,9 @@ public class UserOrderRefund implements Serializable {
     @ApiModelProperty("订单id")
     @TableField(value = "order_id_")
     private Long orderId;
+    @ApiModelProperty("订单号")
+    @TableField(value = "order_no_")
+    private String orderNo;
     @ApiModelProperty("订单详情id(多个详情,分割) ")
     @TableField(value = "oredr_detil_ids_")
     private String oredrDetilIds;
@@ -157,4 +160,11 @@ public class UserOrderRefund implements Serializable {
         this.updateTime = updateTime;
     }
 
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
 }

+ 14 - 14
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserOrderRefundPayment.java → cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserOrderRefundBill.java

@@ -16,18 +16,18 @@ import java.math.BigDecimal;
 /**
  * 退款单表
  */
-@TableName("user_order_refund_payment")
-@ApiModel(value = "UserOrderRefundPayment对象", description = "退款单表")
-public class UserOrderRefundPayment implements Serializable {
+@TableName("user_order_refund_bill")
+@ApiModel(value = "UserOrderRefundBill对象", description = "退款单表")
+public class UserOrderRefundBill implements Serializable {
 	private static final long serialVersionUID = 1L;
     @TableId(value = "id_", type = IdType.AUTO)
     private Long id;
     @ApiModelProperty("退款申请单号 ")
 	@TableField(value = "refund_id_")
     private String refundId;
-    @ApiModelProperty("汇付退款订单号 ")
-	@TableField(value = "adapay_no_")
-    private String adapayNo;
+    @ApiModelProperty("退款订单号 ")
+	@TableField(value = "bill_no_")
+    private String billNo;
     @ApiModelProperty("交易流水号(支付对象id) ")
 	@TableField(value = "trans_no_")
     private String transNo;
@@ -37,7 +37,7 @@ public class UserOrderRefundPayment implements Serializable {
     @ApiModelProperty("回调交易金额 ")
 	@TableField(value = "back_refund_amt_")
     private BigDecimal backRefundAmt;
-    @ApiModelProperty("汇付收取的服务费 ")
+    @ApiModelProperty("收取的服务费 ")
 	@TableField(value = "fee_amt_")
     private BigDecimal feeAmt;
     @ApiModelProperty("交易状态 pending 交易处理中 succeeded 交易成功 failed 交易失败 close 交易关闭 ")
@@ -70,16 +70,16 @@ public class UserOrderRefundPayment implements Serializable {
     public void setRefundId(String refundId) {
         this.refundId = refundId;
     }
-    
-	public String getAdapayNo() {
-        return adapayNo;
+
+    public String getBillNo() {
+        return billNo;
     }
 
-    public void setAdapayNo(String adapayNo) {
-        this.adapayNo = adapayNo;
+    public void setBillNo(String billNo) {
+        this.billNo = billNo;
     }
-    
-	public String getTransNo() {
+
+    public String getTransNo() {
         return transNo;
     }
 

+ 29 - 18
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/sdk/PaymentSdk.java

@@ -10,7 +10,9 @@ import com.alipay.api.response.AlipaySystemOauthTokenResponse;
 import com.huifu.adapay.core.exception.BaseAdaPayException;
 import com.huifu.adapay.model.Payment;
 import com.huifu.adapay.model.PaymentConfirm;
+import com.huifu.adapay.model.Refund;
 import com.yonge.cooleshow.biz.dal.config.HuifuConfiguration;
+import com.yonge.cooleshow.biz.dal.entity.UserOrderRefund;
 import com.yonge.cooleshow.biz.dal.sdk.req.PaymentReq;
 import com.yonge.cooleshow.biz.dal.service.impl.ImGroupMemberServiceImpl;
 import com.yonge.cooleshow.common.constant.CommonConstants;
@@ -26,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
 import java.util.*;
 
 @Component
@@ -72,24 +75,6 @@ public class PaymentSdk {
     }
 
     /**
-     * 创建确认对象
-     * 创建支付确认对象适用于延时分账的场景
-     *
-     * @return 查询的支付对象
-     * @throws Exception 异常
-     */
-    public Map<String, Object> createConfirm(Map<String, Object> confirm) throws Exception {
-        confirm = PaymentConfirm.create(confirm);
-
-        String error_code = (String) confirm.get("error_code");
-        if (null != error_code) {
-            String errorMsg = (String) confirm.get("error_msg");
-            throw new ThirdpartyException(errorMsg);
-        }
-        return confirm;
-    }
-
-    /**
      * 关闭一个支付交易
      *
      * @param paymentId 要关闭的支付id
@@ -121,6 +106,30 @@ public class PaymentSdk {
         return HttpResponseResult.succeed(res);
     }
 
+    public HttpResponseResult<Map<String, Object>> refundPayment(String transNo, String refundOrderNo, BigDecimal refundAmt) {
+        Map<String, Object> refundParams = new HashMap<>(10);
+        refundParams.put("refund_amt", refundAmt.toString());
+        refundParams.put("refund_order_no", refundOrderNo);
+        refundParams.put("notify_url", HuifuConfiguration.getHuifuProperties().getNotifyUrl());
+
+        Map<String, Object> res;
+        try {
+            res = Refund.create(transNo,refundParams);
+        } catch (BaseAdaPayException e) {
+            return HttpResponseResult.failed(e.getMessage());
+        }
+        if (CollectionUtils.isEmpty(res)) {
+            return HttpResponseResult.failed("请求失败");
+        }
+        log.info("汇付[创建退款对象] Resp:{}", res);
+        String errorCode = (String) res.get("error_code");
+        if (null != errorCode) {
+            String errorMsg = (String) res.get("error_msg");
+            return HttpResponseResult.failed(errorMsg);
+        }
+        return HttpResponseResult.succeed(res);
+    }
+
     /**
      * 查询一个支付交易
      *
@@ -203,6 +212,8 @@ public class PaymentSdk {
         }
     }
 
+
+
 /*
     public static Map<String, Object> queryList(Integer pageIndex, Long createdGte, Long createdLte) throws Exception {
         Map<String, Object> paymentParams = new HashMap<>();

+ 2 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderPaymentService.java

@@ -45,7 +45,7 @@ public interface UserOrderPaymentService extends IService<UserOrderPayment> {
      * @updateTime 2022/4/13 16:09
      * @return: com.yonge.cooleshow.biz.dal.entity.UserOrderPayment
      */
-    UserOrderPayment detailByAdapayNo(String transNo);
+    UserOrderPayment detailByPaymentNo(String paymentNo);
     /***
      * 关闭付款单
      * @author liweifan
@@ -55,7 +55,6 @@ public interface UserOrderPaymentService extends IService<UserOrderPayment> {
      * @return: com.yonge.cooleshow.biz.dal.entity.UserOrderPayment
      */
     UserOrderPayment closePayment(String orderNo, String reason);
-
     /***
      * 支付关单成功
      * @author liweifan
@@ -63,7 +62,6 @@ public interface UserOrderPaymentService extends IService<UserOrderPayment> {
      * @updateTime 2022/4/27 15:33
      */
     void paymentCloseSucceededHandle(JSONObject hfRes);
-
     /***
      * 支付关单失败
      * @author liweifan
@@ -71,7 +69,6 @@ public interface UserOrderPaymentService extends IService<UserOrderPayment> {
      * @updateTime 2022/4/27 15:33
      */
     void paymentCloseFailedHandle(JSONObject hfRes);
-
     /***
      * 创建付款单
      * @author liweifan
@@ -80,4 +77,5 @@ public interface UserOrderPaymentService extends IService<UserOrderPayment> {
      * @updateTime 2022/5/7 13:56
      */
     HttpResponseResult<OrderPayRes> createOrderPayment(OrderPayReq payReq, UserOrderVo detail);
+
 }

+ 5 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderRefundPaymentService.java

@@ -2,28 +2,28 @@ package com.yonge.cooleshow.biz.dal.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.yonge.cooleshow.biz.dal.vo.UserOrderRefundPaymentVo;
+import com.yonge.cooleshow.biz.dal.vo.UserOrderRefundBillVo;
 import com.yonge.cooleshow.biz.dal.dto.search.UserOrderRefundPaymentSearch;
-import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundPayment;
+import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundBill;
 
 /**
  * 退款单表 服务类
  * @author liweifan
  * @date 2022-05-09
  */
-public interface UserOrderRefundPaymentService extends IService<UserOrderRefundPayment>  {
+public interface UserOrderRefundPaymentService extends IService<UserOrderRefundBill>  {
 
 	/**
      * 查询详情
      * @author liweifan
  	 * @date 2022-05-09
      */
-	UserOrderRefundPaymentVo detail(Long id);
+	UserOrderRefundBillVo detail(Long id);
 
     /**
      * 分页查询
      * @author liweifan
  	 * @date 2022-05-09
      */
-    IPage<UserOrderRefundPaymentVo> selectPage(IPage<UserOrderRefundPaymentVo> page, UserOrderRefundPaymentSearch query);
+    IPage<UserOrderRefundBillVo> selectPage(IPage<UserOrderRefundBillVo> page, UserOrderRefundPaymentSearch query);
 }

+ 0 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserOrderService.java

@@ -116,8 +116,6 @@ public interface UserOrderService extends IService<UserOrder> {
      */
     HttpResponseResult<Boolean> orderCancel(OrderPayReq payReq);
 
-
-
     /***
      * 取消订单(未判断付款单状态)
      * @author liweifan

+ 5 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderPaymentServiceImpl.java

@@ -55,9 +55,9 @@ public class UserOrderPaymentServiceImpl extends ServiceImpl<UserOrderPaymentDao
     }
 
     @Override
-    public UserOrderPayment detailByAdapayNo(String adapayNo) {
+    public UserOrderPayment detailByPaymentNo(String paymentNo) {
         return baseMapper.selectOne(Wrappers.<UserOrderPayment>lambdaQuery()
-                .eq(UserOrderPayment::getAdapayNo, adapayNo));
+                .eq(UserOrderPayment::getPaymentNo, paymentNo));
     }
 
     /***
@@ -65,14 +65,14 @@ public class UserOrderPaymentServiceImpl extends ServiceImpl<UserOrderPaymentDao
      * @author liweifan
      * @param: responseResult
      * @param: payReq
-     * @param: adapayNo
+     * @param: paymentNo
      * @updateTime 2022/5/7 14:19
      * @return: com.yonge.cooleshow.biz.dal.entity.UserOrderPayment
      */
-    private UserOrderPayment insertOrderPayment(HttpResponseResult<Map<String, Object>> responseResult, OrderPayReq payReq, Long adapayNo) {
+    private UserOrderPayment insertOrderPayment(HttpResponseResult<Map<String, Object>> responseResult, OrderPayReq payReq, Long paymentNo) {
         UserOrderPayment orderPayment = new UserOrderPayment();
         orderPayment.setOrderNo(payReq.getOrderNo());
-        orderPayment.setAdapayNo(adapayNo.toString());
+        orderPayment.setPaymentNo(paymentNo.toString());
         orderPayment.setPayChannel(payReq.getPayChannel());
         if (responseResult.getStatus()) {
             Map<String, Object> res = responseResult.getData();

+ 6 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderRefundPaymentServiceImpl.java

@@ -5,24 +5,24 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundPayment;
-import com.yonge.cooleshow.biz.dal.vo.UserOrderRefundPaymentVo;
+import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundBill;
+import com.yonge.cooleshow.biz.dal.vo.UserOrderRefundBillVo;
 import com.yonge.cooleshow.biz.dal.dto.search.UserOrderRefundPaymentSearch;
-import com.yonge.cooleshow.biz.dal.dao.UserOrderRefundPaymentDao;
+import com.yonge.cooleshow.biz.dal.dao.UserOrderRefundBillDao;
 import com.yonge.cooleshow.biz.dal.service.UserOrderRefundPaymentService;
 
 
 @Service
-public class UserOrderRefundPaymentServiceImpl extends ServiceImpl<UserOrderRefundPaymentDao, UserOrderRefundPayment> implements UserOrderRefundPaymentService {
+public class UserOrderRefundPaymentServiceImpl extends ServiceImpl<UserOrderRefundBillDao, UserOrderRefundBill> implements UserOrderRefundPaymentService {
     private final static Logger log = LoggerFactory.getLogger(UserOrderRefundPaymentServiceImpl.class);
 
 	@Override
-    public UserOrderRefundPaymentVo detail(Long id) {
+    public UserOrderRefundBillVo detail(Long id) {
         return baseMapper.detail(id);
     }
     
      @Override
-    public IPage<UserOrderRefundPaymentVo> selectPage(IPage<UserOrderRefundPaymentVo> page, UserOrderRefundPaymentSearch query){
+    public IPage<UserOrderRefundBillVo> selectPage(IPage<UserOrderRefundBillVo> page, UserOrderRefundPaymentSearch query){
         return page.setRecords(baseMapper.selectPage(page, query));
     }
 	

+ 27 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderRefundServiceImpl.java

@@ -2,6 +2,7 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dao.UserOrderRefundDao;
@@ -15,12 +16,14 @@ import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import com.yonge.cooleshow.biz.dal.enums.GoodTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.OrderStatusEnum;
 import com.yonge.cooleshow.biz.dal.enums.TradeStatusEnum;
+import com.yonge.cooleshow.biz.dal.sdk.PaymentSdk;
 import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
 import com.yonge.cooleshow.biz.dal.vo.UserOrderRefundVo;
 import com.yonge.cooleshow.biz.dal.vo.UserOrderVo;
 import com.yonge.cooleshow.biz.dal.vo.res.RefundCreateRes;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.service.IdGeneratorService;
 import com.yonge.toolset.utils.string.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -46,6 +49,12 @@ public class UserOrderRefundServiceImpl extends ServiceImpl<UserOrderRefundDao,
     private UserOrderDetailService orderDetailService;
     @Autowired
     private CourseGroupService courseGroupService;
+    @Autowired
+    private PaymentSdk paymentSdk;
+    @Autowired
+    private IdGeneratorService idGeneratorService;
+    @Autowired
+    private UserOrderRefundPaymentService refundPaymentService;
 
     //验证是否可以退款,获取退款金额信息
     private static final Map<GoodTypeEnum, Function<OrderRefundReq, HttpResponseResult<RefundCreateRes>>> refundCreate = new HashMap<>();
@@ -124,8 +133,9 @@ public class UserOrderRefundServiceImpl extends ServiceImpl<UserOrderRefundDao,
         String join = StringUtil.join(detilIds, ",");
 
         UserOrderRefund orderRefunds = new UserOrderRefund();
-        orderRefunds.setUserId(refundReq.getUserId());
-        orderRefunds.setOrderId(refundReq.getOrderId());
+        orderRefunds.setUserId(detail.getUserId());
+        orderRefunds.setOrderId(detail.getId());
+        orderRefunds.setOrderNo(detail.getOrderNo());
         orderRefunds.setOredrDetilIds(join);
         orderRefunds.setStatus(AuthStatusEnum.DOING);
         orderRefunds.setApplyAmount(actualPrice);
@@ -164,8 +174,8 @@ public class UserOrderRefundServiceImpl extends ServiceImpl<UserOrderRefundDao,
         updateById(orderRefund);
 
         if (authOperaReq.getPass()) {
-            //通过调用
-
+            //通过调用退款接口
+            return doOrderRefund(orderRefund);
         } else {
             List<String> detilIds = Arrays.asList(oredrDetilIds.split(","));
             for (String id : detilIds) {
@@ -183,4 +193,17 @@ public class UserOrderRefundServiceImpl extends ServiceImpl<UserOrderRefundDao,
         return HttpResponseResult.succeed(true);
     }
 
+    private HttpResponseResult<Boolean> doOrderRefund(UserOrderRefund orderRefund) {
+        UserOrderPayment successPayment = orderPaymentService.getOne(Wrappers.<UserOrderPayment>lambdaQuery()
+                .eq(UserOrderPayment::getOrderNo, orderRefund.getOrderNo())
+                .eq(UserOrderPayment::getStatus, TradeStatusEnum.succeeded)
+        );
+
+        //单号生成
+        Long refundOrderNo = idGeneratorService.generatorId("userOrder");
+
+        HttpResponseResult<Map<String, Object>> responseResult = paymentSdk.refundPayment(successPayment.getTransNo(), refundOrderNo.toString(), orderRefund.getActualAmount());
+
+        return HttpResponseResult.succeed(true);
+    }
 }

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java

@@ -341,7 +341,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
      * @updateTime 2022/4/27 15:09
      */
     private void paymentSucceededHandle(JSONObject hfRes) {
-        UserOrderPayment orderPayment = orderPaymentService.detailByAdapayNo(hfRes.getString("order_no"));
+        UserOrderPayment orderPayment = orderPaymentService.detailByPaymentNo(hfRes.getString("order_no"));
         if (null == orderPayment) {
             return;
         }

+ 24 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/UserOrderRefundBillVo.java

@@ -0,0 +1,24 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundBill;
+import io.swagger.annotations.ApiModel;
+import org.apache.commons.beanutils.BeanUtils;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022-05-09 17:14:30
+ */
+@ApiModel(value = "UserOrderRefundBillVo对象", description = "退款单表查询视图对象")
+public class UserOrderRefundBillVo extends UserOrderRefundBill {
+	private static final long serialVersionUID = 1L;
+    
+    public UserOrderRefundBillVo buildVo(UserOrderRefundBill userOrderRefundBill){
+        try {
+            BeanUtils.copyProperties(this, userOrderRefundBill);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return this;
+    }
+
+}

+ 0 - 24
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/UserOrderRefundPaymentVo.java

@@ -1,24 +0,0 @@
-package com.yonge.cooleshow.biz.dal.vo;
-
-import com.yonge.cooleshow.biz.dal.entity.UserOrderRefundPayment;
-import io.swagger.annotations.ApiModel;
-import org.apache.commons.beanutils.BeanUtils;
-
-/**
- * @Author: liweifan
- * @Data: 2022-05-09 17:14:30
- */
-@ApiModel(value = "UserOrderRefundPaymentVo对象", description = "退款单表查询视图对象")
-public class UserOrderRefundPaymentVo extends UserOrderRefundPayment{
-	private static final long serialVersionUID = 1L;
-    
-    public UserOrderRefundPaymentVo buildVo(UserOrderRefundPayment userOrderRefundPayment){
-        try {
-            BeanUtils.copyProperties(this,userOrderRefundPayment);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return this;
-    }
-
-}

+ 2 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderPaymentMapper.xml

@@ -4,7 +4,7 @@
     <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.UserOrderPayment">
         <result column="id_" property="id" />
         <result column="order_no_" property="orderNo" />
-        <result column="adapay_no_" property="adapayNo" />
+        <result column="payment_no_" property="paymentNo" />
         <result column="trans_no_" property="transNo" />
         <result column="pay_channel_" property="payChannel" />
         <result column="pay_amt_" property="payAmt" />
@@ -24,7 +24,7 @@
     <sql id="baseColumns">
          t.id_ as id
         , t.order_no_ as orderNo
-        , t.adapay_no_ as adapayNo
+        , t.payment_no_ as paymentNo
         , t.trans_no_ as transNo
         , t.pay_channel_ as payChannel
         , t.pay_amt_ as payAmt

+ 6 - 6
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderRefundPaymentMapper.xml → cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderRefundBillMapper.xml

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE  mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.yonge.cooleshow.biz.dal.dao.UserOrderRefundPaymentDao">
-    <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.UserOrderRefundPayment">
+<mapper namespace="com.yonge.cooleshow.biz.dal.dao.UserOrderRefundBillDao">
+    <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.UserOrderRefundBill">
         <result column="id_" property="id" />
         <result column="refund_id_" property="refundId" />
-        <result column="adapay_no_" property="adapayNo" />
+        <result column="bill_no_" property="billNo" />
         <result column="trans_no_" property="transNo" />
         <result column="refund_amt_" property="refundAmt" />
         <result column="back_refund_amt_" property="backRefundAmt" />
@@ -19,7 +19,7 @@
     <sql id="baseColumns">
          t.id_ as id
         , t.refund_id_ as refundId
-        , t.adapay_no_ as adapayNo
+        , t.bill_no_ as billNo
         , t.trans_no_ as transNo
         , t.refund_amt_ as refundAmt
         , t.back_refund_amt_ as backRefundAmt
@@ -30,14 +30,14 @@
         , t.update_time_ as updateTime
         </sql>
 
-    <select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderRefundPaymentVo">
+    <select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderRefundBillVo">
         SELECT
         <include refid="baseColumns"/>
         FROM user_order_refund_payment t
         where t.id_ = #{id}
     </select>
 
-    <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderRefundPaymentVo">
+    <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderRefundBillVo">
         SELECT
         <include refid="baseColumns" />
         FROM user_order_refund_payment t

+ 2 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderRefundDao.xml → cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderRefundMapper.xml

@@ -5,6 +5,7 @@
         <result column="id_" property="id" />
         <result column="user_id_" property="userId" />
         <result column="order_id_" property="orderId" />
+        <result column="order_no_" property="orderNo" />
         <result column="oredr_detil_ids_" property="oredrDetilIds" />
         <result column="status_" property="status" />
         <result column="apply_amount_" property="applyAmount" />
@@ -21,6 +22,7 @@
          t.id_ as id
         , t.user_id_ as userId
         , t.order_id_ as orderId
+        , t.order_no_ as orderNo
         , t.oredr_detil_ids_ as oredrDetilIds
         , t.status_ as status
         , t.apply_amount_ as applyAmount

+ 0 - 15
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/PaymentController.java

@@ -19,7 +19,6 @@ import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -52,13 +51,6 @@ public class PaymentController extends BaseController {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
         HttpResponseResult<Map<String, String>> responseResult = paymentSdk.getOpenId(js_code);
-        /*if (responseResult.getStatus()) {
-            Map<String, String> data = responseResult.getData();
-            //绑定到用户表
-            user.setWxOpenid(data.get("openid"));
-            log.info("绑定用户openid,param is {}", JSONObject.toJSONString(user));
-            sysUserFeignService.bindOpenId(user);
-        }*/
         return responseResult;
     }
 
@@ -70,13 +62,6 @@ public class PaymentController extends BaseController {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
         HttpResponseResult<AlipaySystemOauthTokenResponse> aliToken = paymentSdk.getAliToken(authorization_code);
-        /*if (responseResult.getStatus()) {
-            Map<String, String> data = responseResult.getData();
-            //绑定到用户表
-            user.setWxOpenid(data.get("openid"));
-            log.info("绑定用户openid,param is {}", JSONObject.toJSONString(user));
-            sysUserFeignService.bindOpenId(user);
-        }*/
         return aliToken;
     }
 

+ 1 - 0
toolset/pom.xml

@@ -35,5 +35,6 @@
 		<module>toolset-mybatis</module>
 		<module>utils</module>
 		<module>mongo-db</module>
+        <module>toolset-payment</module>
     </modules>
 </project>

+ 131 - 0
toolset/toolset-base/src/main/java/com/yonge/toolset/base/result/BaseResult.java

@@ -0,0 +1,131 @@
+package com.yonge.toolset.base.result;
+
+import org.springframework.http.HttpStatus;
+
+import java.util.Date;
+
+/**
+ * HttpResponse 返回结果
+ */
+public class BaseResult<T> {
+
+	private boolean status = true;
+	private String msg;
+	private T data;
+	private int code;
+	private Date nowTime = new Date();
+
+	public BaseResult(boolean status, int code, T data, String message) {
+		this.status = status;
+		this.msg = message;
+		this.data = data;
+		this.code = code;
+	}
+
+	public BaseResult(boolean status, HttpStatus resultCode, T data, String message) {
+		this.status = status;
+		this.msg = message;
+		this.data = data;
+		this.code = resultCode.value();
+	}
+
+	public BaseResult() {
+	}
+
+	public int getCode() {
+		return code;
+	}
+
+	public void setCode(int code) {
+		this.code = code;
+	}
+
+	public boolean getStatus() {
+		return status;
+	}
+
+	public void setStatus(boolean status) {
+		this.status = status;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	public T getData() {
+		return data;
+	}
+
+	public void setData(T data) {
+		this.data = data;
+	}
+
+	public void success() {
+		this.status = true;
+	}
+
+	public void fail() {
+		this.status = false;
+	}
+
+	public Date getNowTime() {
+		return nowTime;
+	}
+
+	public void setNowTime(Date nowTime) {
+		this.nowTime = nowTime;
+	}
+
+
+	public static <T> BaseResult<T> succeed(T object) {
+		return getResponseData(true, HttpStatus.OK, object, "");
+	}
+
+	public static <T> BaseResult<T> succeed() {
+		return getResponseData(true, HttpStatus.OK, null, "");
+	}
+
+	public static <T> BaseResult<T> succeedData(T obj) {
+		return getResponseData(true, HttpStatus.OK, obj, "操作成功");
+	}
+
+	public static <T> BaseResult<T> warned(String message) {
+		return failed(HttpStatus.MULTI_STATUS, message);
+	}
+
+	public static <T> BaseResult<T> failed() {
+		return failed("");
+	}
+
+	public static <T> BaseResult<T> failed(String msg) {
+		return failed(HttpStatus.INTERNAL_SERVER_ERROR, msg);
+	}
+
+	public static <T> BaseResult<T> failed(HttpStatus statusCode, String msg) {
+		return getResponseData(false, statusCode, null, msg);
+	}
+
+	public static <T> BaseResult<T> status(boolean flag) {
+		return flag ? succeed() : failed("操作失败");
+	}
+
+	public static <T> BaseResult<T> failed(HttpStatus statusCode, T data, String msg) {
+		return getResponseData(false, statusCode, data, msg);
+	}
+	public static <T> BaseResult<T> failed(int code, T data, String msg) {
+		return new BaseResult<>(false, code, data, msg);
+	}
+
+	private static <T> BaseResult<T> getResponseData(boolean status, HttpStatus statusCode, T data, String message) {
+		BaseResult<T> obj = new BaseResult<T>();
+		obj.setStatus(status);
+		obj.setCode(statusCode.value());
+		obj.setData(data);
+		obj.setMsg(message);
+		return obj;
+	}
+}

+ 23 - 0
toolset/toolset-payment/payment-core/pom.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>toolset-payment</artifactId>
+        <groupId>com.yonge.toolset</groupId>
+        <version>1.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>payment-core</artifactId>
+
+    <dependencies>
+        <!-- mybatis-plus -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.0.7.1</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>

+ 44 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/PaymentTemplate.java

@@ -0,0 +1,44 @@
+package com.yonge.toolset.payment;
+
+import com.yonge.toolset.base.result.BaseResult;
+import com.yonge.toolset.payment.model.ClosePayment;
+import com.yonge.toolset.payment.model.Payment;
+import com.yonge.toolset.payment.model.RefundBill;
+import com.yonge.toolset.payment.model.res.ClosePaymentRes;
+import com.yonge.toolset.payment.model.res.PaymentRes;
+import com.yonge.toolset.payment.model.res.RefundBillRes;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/5/10 15:00
+ */
+public interface PaymentTemplate {
+    /***
+     * 统一下单接口
+     * @author liweifan
+     * @param: product 订单对象
+     * @updateTime 2022/3/4 15:12
+     * @return: com.daya.payment.model.AbstractRS
+     */
+    BaseResult<PaymentRes> executePayment(Payment payment) throws Exception;
+    /***
+     * 统一关单接口
+     * @author liweifan
+     * @param: closePayment
+     * @updateTime 2022/5/10 15:34
+     * @return: com.yonge.toolset.base.result.BaseResult<com.yonge.toolset.payment.model.res.ClosePaymentRes>
+     */
+    BaseResult<ClosePaymentRes> closePayment(ClosePayment closePayment) throws Exception;
+
+    /***
+     * 统一退款接口
+     * @author liweifan
+     * @param: closePayment
+     * @updateTime 2022/5/10 15:34
+     * @return: com.yonge.toolset.base.result.BaseResult<com.yonge.toolset.payment.model.res.ClosePaymentRes>
+     */
+    BaseResult<RefundBillRes> refundPayment(RefundBill refundBill) throws Exception;
+
+
+
+}

+ 14 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/config/PaymentConfiguration.java

@@ -0,0 +1,14 @@
+package com.yonge.toolset.payment.config;
+
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Sms配置类
+ *
+ * @author Chill
+ */
+@Configuration
+@EnableConfigurationProperties(PaymentConfiguration.class)
+public class PaymentConfiguration {
+}

+ 8 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/constant/PaymentConstant.java

@@ -0,0 +1,8 @@
+package com.yonge.toolset.payment.constant;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/5/10 15:00
+ */
+public interface PaymentConstant {
+}

+ 38 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/enums/OpenEnum.java

@@ -0,0 +1,38 @@
+package com.yonge.toolset.payment.enums;
+
+import com.yonge.toolset.base.enums.BaseEnum;
+
+/**
+ * 支付服务提供方
+ * @Author: liweifan
+ * @Data: 2022/3/31 14:59
+ */
+public enum OpenEnum implements BaseEnum<String, OpenEnum> {
+    ORIGINAL("ORIGINAL","微信支付宝"),
+    adapay("ADAPAY","汇付")
+    ;
+    private String code;
+    private String msg;
+
+    OpenEnum(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    @Override
+    public String getCode() {
+        return this.code;
+    }
+}

+ 41 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/enums/PayChannelEnum.java

@@ -0,0 +1,41 @@
+package com.yonge.toolset.payment.enums;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.yonge.toolset.base.enums.BaseEnum;
+
+/**
+ * 支付渠道
+ * @author liweifan
+ * @updateTime 2022/3/31 11:30
+ */
+public enum PayChannelEnum implements BaseEnum<String, PayChannelEnum> {
+    alipay("alipay","支付宝扫码"),
+    alipay_lite("alipay_lite","支付宝小程序支付"),
+    wx_lite("wx_lite","微信小程序支付")
+    ;
+    @EnumValue
+    private String code;
+    private String msg;
+
+    PayChannelEnum(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    @Override
+    public String getCode() {
+        return this.code;
+    }
+}

+ 42 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/enums/TradeStatusEnum.java

@@ -0,0 +1,42 @@
+package com.yonge.toolset.payment.enums;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.yonge.toolset.base.enums.BaseEnum;
+
+/**
+ * 交易状态 pending 交易处理中 succeeded 交易成功 failed 交易失败
+ * @Author: liweifan
+ * @Data: 2022/3/31 14:59
+ */
+public enum TradeStatusEnum implements BaseEnum<String, TradeStatusEnum> {
+    pending("pending","交易处理中"),
+    succeeded("succeeded","交易成功"),
+    failed("failed","交易失败"),
+    close("close","交易关闭")
+    ;
+    @EnumValue
+    private String code;
+    private String msg;
+
+    TradeStatusEnum(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    @Override
+    public String getCode() {
+        return this.code;
+    }
+}

+ 83 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/ClosePayment.java

@@ -0,0 +1,83 @@
+package com.yonge.toolset.payment.model;
+
+import com.yonge.toolset.payment.enums.PayChannelEnum;
+
+import java.io.Serializable;
+
+/**
+ * 统一支付对象
+ * @Author: liweifan
+ * @Data: 2022/5/10 15:06
+ */
+public class ClosePayment implements Serializable {
+    /***
+     * 付款单id
+     * @author liweifan
+     * @updateTime 2022/5/10 15:30
+     */
+    String paymentId;
+    /***
+     * 支付渠道
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private PayChannelEnum payChannel;
+    /***
+     * 关闭原因
+     * @author liweifan
+     * @updateTime 2022/5/10 15:30
+     */
+    String reason;
+    /***
+     * 回调url
+     * @author liweifan
+     * @updateTime 2022/5/10 15:30
+     */
+    String notifyUrl;
+    /***
+     * 扩展域
+     * @author liweifan
+     * @updateTime 2022/5/10 15:30
+     */
+    String expend;
+
+    public String getPaymentId() {
+        return paymentId;
+    }
+
+    public void setPaymentId(String paymentId) {
+        this.paymentId = paymentId;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public String getNotifyUrl() {
+        return notifyUrl;
+    }
+
+    public void setNotifyUrl(String notifyUrl) {
+        this.notifyUrl = notifyUrl;
+    }
+
+    public String getExpend() {
+        return expend;
+    }
+
+    public void setExpend(String expend) {
+        this.expend = expend;
+    }
+
+    public PayChannelEnum getPayChannel() {
+        return payChannel;
+    }
+
+    public void setPayChannel(PayChannelEnum payChannel) {
+        this.payChannel = payChannel;
+    }
+}

+ 112 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/Payment.java

@@ -0,0 +1,112 @@
+package com.yonge.toolset.payment.model;
+
+import com.yonge.toolset.payment.enums.PayChannelEnum;
+
+import java.io.Serializable;
+
+/**
+ * 统一支付对象
+ * @Author: liweifan
+ * @Data: 2022/5/10 15:06
+ */
+public class Payment implements Serializable {
+    /***
+     * 请求订单号
+     * @author liweifan
+     * @updateTime 2022/3/31 11:00
+     */
+    private String orderNo;
+    /***
+     * 支付渠道
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private PayChannelEnum payChannel;
+    /***
+     * 商品标题
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String orderTitle;
+    /***
+     * 商品描述信息,微信小程序和微信公众号该字段最大长度42个字符
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String orderDesc;
+    /***
+     * 交易金额,必须大于0,保留两位小数点,如0.10、100.05等
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String payAmt;
+    /***
+     * 订单附加说明
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String description;
+    /***
+     * 异步通知地址,url为http/https路径,服务器POST回调,URL 上请勿附带参数
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String notifyUrl;
+
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getOrderTitle() {
+        return orderTitle;
+    }
+
+    public void setOrderTitle(String orderTitle) {
+        this.orderTitle = orderTitle;
+    }
+
+    public String getOrderDesc() {
+        return orderDesc;
+    }
+
+    public void setOrderDesc(String orderDesc) {
+        this.orderDesc = orderDesc;
+    }
+
+    public String getPayAmt() {
+        return payAmt;
+    }
+
+    public void setPayAmt(String payAmt) {
+        this.payAmt = payAmt;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getNotifyUrl() {
+        return notifyUrl;
+    }
+
+    public void setNotifyUrl(String notifyUrl) {
+        this.notifyUrl = notifyUrl;
+    }
+
+    public PayChannelEnum getPayChannel() {
+        return payChannel;
+    }
+
+    public void setPayChannel(PayChannelEnum payChannel) {
+        this.payChannel = payChannel;
+    }
+}

+ 97 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/RefundBill.java

@@ -0,0 +1,97 @@
+package com.yonge.toolset.payment.model;
+
+import com.yonge.toolset.payment.enums.PayChannelEnum;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/5/10 15:36
+ */
+public class RefundBill implements Serializable {
+    /***
+     * 三方支付流水号
+     * @author liweifan
+     * @updateTime 2022/3/31 11:00
+     */
+    private String paymentId;
+    /***
+     * 支付渠道
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private PayChannelEnum payChannel;
+    /***
+     * 退款订单号
+     * @author liweifan
+     * @updateTime 2022/3/31 11:00
+     */
+    private String refundNo;
+    /***
+     * 退款金额,必须大于0,保留两位小数点,如0.10、100.05等
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private BigDecimal refundAmt;
+    /***
+     * 异步通知地址,url为http/https路径,服务器POST回调,URL 上请勿附带参数
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String notifyUrl;
+    /***
+     * 退款描述
+     * @author liweifan
+     * @updateTime 2022/3/31 11:00
+     */
+    private String reason;
+
+    public String getPaymentId() {
+        return paymentId;
+    }
+
+    public void setPaymentId(String paymentId) {
+        this.paymentId = paymentId;
+    }
+
+    public PayChannelEnum getPayChannel() {
+        return payChannel;
+    }
+
+    public void setPayChannel(PayChannelEnum payChannel) {
+        this.payChannel = payChannel;
+    }
+
+    public String getRefundNo() {
+        return refundNo;
+    }
+
+    public void setRefundNo(String refundNo) {
+        this.refundNo = refundNo;
+    }
+
+    public BigDecimal getRefundAmt() {
+        return refundAmt;
+    }
+
+    public void setRefundAmt(BigDecimal refundAmt) {
+        this.refundAmt = refundAmt;
+    }
+
+    public String getNotifyUrl() {
+        return notifyUrl;
+    }
+
+    public void setNotifyUrl(String notifyUrl) {
+        this.notifyUrl = notifyUrl;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+}

+ 21 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/res/ClosePaymentRes.java

@@ -0,0 +1,21 @@
+package com.yonge.toolset.payment.model.res;
+
+import com.yonge.toolset.payment.enums.TradeStatusEnum;
+import com.yonge.toolset.payment.model.ClosePayment;
+
+/**
+ * 支付关单返回对象
+ * @Author: liweifan
+ * @Data: 2022/5/10 15:34
+ */
+public class ClosePaymentRes extends ClosePayment {
+    private TradeStatusEnum status;
+
+    public TradeStatusEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(TradeStatusEnum status) {
+        this.status = status;
+    }
+}

+ 36 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/res/PaymentRes.java

@@ -0,0 +1,36 @@
+package com.yonge.toolset.payment.model.res;
+
+import com.yonge.toolset.payment.enums.TradeStatusEnum;
+import com.yonge.toolset.payment.model.Payment;
+
+/**
+ * 支付返回对象
+ * @Author: liweifan
+ * @Data: 2022/5/10 15:33
+ */
+public class PaymentRes extends Payment {
+    /***
+     * 三方支付流水号,创建付款单后才有
+     * @author liweifan
+     * @updateTime 2022/3/31 11:00
+     */
+    private String id;
+
+    private TradeStatusEnum status;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public TradeStatusEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(TradeStatusEnum status) {
+        this.status = status;
+    }
+}

+ 20 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/res/RefundBillRes.java

@@ -0,0 +1,20 @@
+package com.yonge.toolset.payment.model.res;
+
+import com.yonge.toolset.payment.enums.TradeStatusEnum;
+import com.yonge.toolset.payment.model.RefundBill;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/5/10 15:44
+ */
+public class RefundBillRes extends RefundBill {
+    private TradeStatusEnum status;
+
+    public TradeStatusEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(TradeStatusEnum status) {
+        this.status = status;
+    }
+}

+ 8 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/props/PaymentProperties.java

@@ -0,0 +1,8 @@
+package com.yonge.toolset.payment.props;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+@ConfigurationProperties(prefix = "sms")
+public class PaymentProperties {
+
+}

+ 26 - 0
toolset/toolset-payment/pom.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>toolset</artifactId>
+        <groupId>com.yonge.toolset</groupId>
+        <version>1.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>toolset-payment</artifactId>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>payment-core</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.yonge.toolset</groupId>
+            <artifactId>toolset-base</artifactId>
+            <version>1.0</version>
+        </dependency>
+    </dependencies>
+</project>