Kaynağa Gözat

代码修改

comtikaweb 4 yıl önce
ebeveyn
işleme
454f036e9f

+ 2 - 2
src/main/java/com/wechat/common/entity/order/KtjRefundOrder.java

@@ -179,8 +179,8 @@ public class KtjRefundOrder {
 		this.refundNo = String.valueOf(map.get("out_refund_no"));
 		this.refundDesc = params.getRefundDesc();
 		this.createTime = System.currentTimeMillis();
-		this.refundStatus = RefundStatus.REFUND_BEFOREHAND.getId();
-		this.refundMessage = "退款";
+		this.refundStatus = RefundStatus.REFUND_PROCESSING.getId();
+		this.refundMessage = "退款处理中...";
 	}
 
 }

+ 36 - 43
src/main/java/com/wechat/common/entity/participation/RefundParticipation.java

@@ -11,9 +11,6 @@ import com.wechat.common.util.StringUtil;
  */
 public class RefundParticipation {
 	
-	//外部订单号
-	private String outOrderNo;
-	
 	//退款金额
 	private Long refundFee;
 	
@@ -23,78 +20,81 @@ public class RefundParticipation {
 	//微信支付单号
 	private String transactionId;
 	
-	//订单号
-	private String orderNo;
-	
 	//外部退款单号
 	private String outRefundNo;
 	
 	private String subMchid;
 	
-	public String getOutRefundNo() {
-		return outRefundNo;
-	}
-
-	public void setOutRefundNo(String outRefundNo) {
-		this.outRefundNo = outRefundNo;
-	}
-
-	public String getOutOrderNo() {
-		return outOrderNo;
-	}
-
-	public void setOutOrderNo(String outOrderNo) {
-		this.outOrderNo = outOrderNo;
-	}
-	
-	public String getOrderNo() {
-		return orderNo;
-	}
-
-	public void setOrderNo(String orderNo) {
-		this.orderNo = orderNo;
-	}
 
 	public Long getRefundFee() {
 		return refundFee;
 	}
 
+
+
 	public void setRefundFee(Long refundFee) {
 		this.refundFee = refundFee;
 	}
 
+
+
 	public String getRefundDesc() {
 		return refundDesc;
 	}
 
+
+
 	public void setRefundDesc(String refundDesc) {
 		this.refundDesc = refundDesc;
 	}
 
+
+
 	public String getTransactionId() {
 		return transactionId;
 	}
 
+
+
 	public void setTransactionId(String transactionId) {
 		this.transactionId = transactionId;
 	}
-	
+
+
+
+	public String getOutRefundNo() {
+		return outRefundNo;
+	}
+
+
+
+	public void setOutRefundNo(String outRefundNo) {
+		this.outRefundNo = outRefundNo;
+	}
+
+
+
 	public String getSubMchid() {
 		return subMchid;
 	}
 
+
+
 	public void setSubMchid(String subMchid) {
 		this.subMchid = subMchid;
 	}
 
+
 	@Override
 	public String toString() {
-		return "RefundParticipation [outOrderNo=" + outOrderNo + ", refundFee="
-				+ refundFee + ", refundDesc=" + refundDesc + ", transactionId="
-				+ transactionId + ", orderNo=" + orderNo + ", outRefundNo="
-				+ outRefundNo + ", subMchid=" + subMchid + "]";
+		return "RefundParticipation [refundFee=" + refundFee + ", refundDesc="
+				+ refundDesc + ", transactionId=" + transactionId
+				+ ", outRefundNo=" + outRefundNo + ", subMchid=" + subMchid
+				+ "]";
 	}
 
+
+
 	public RespWrapper<Object> paramsInfo(KtjJsapiOrder order) {
 System.out.println("入参为:" + this.toString());
 		if( null == this.refundFee || this.refundFee < 1){
@@ -103,20 +103,13 @@ System.out.println("入参为:" + this.toString());
 		if( null == this.subMchid){
 			return RespWrapper.makeFailResp("商户号不能为空!");
 		}
-		if(StringUtil.isEmpty(this.transactionId) && 
-				StringUtil.isEmpty(this.outOrderNo) && StringUtil.isEmpty(this.orderNo)){
+		if(StringUtil.isEmpty(this.transactionId) ){
 			return RespWrapper.makeFailResp("订单编号不能为空!");
 		}
 		if(StringUtil.isEmpty(this.outRefundNo)){
 			return RespWrapper.makeFailResp("退款申请单号不能为空!");
 		}
-		if(!StringUtil.isEmpty(this.transactionId)){
-			order.setTransactionId(this.transactionId.trim());
-		}else if(!StringUtil.isEmpty(this.orderNo)){
-			order.setOrderNo(this.orderNo.trim());
-		}else if(!StringUtil.isEmpty(this.outOrderNo)){
-			order.setOutOrderNo(this.outOrderNo);
-		}
+		order.setTransactionId(this.transactionId.trim());
 		//如果退款原因为空,就加个退款原因
 		if(StringUtil.isEmpty(this.refundDesc)){
 			this.refundDesc = "订单退款";

+ 1 - 9
src/main/java/com/wechat/common/entity/register/KtjRegisterData.java

@@ -1,20 +1,12 @@
 package com.wechat.common.entity.register;
 
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
 
 import com.alibaba.fastjson.JSONObject;
 import com.wechat.common.util.StringUtil;
 
-@Entity
 public class KtjRegisterData {
 
-	@Id
-	@GeneratedValue(strategy = GenerationType.AUTO)
-	@Column(name = "id")
+	
 	private Long id;
 
 	// 业务申请编号

+ 2 - 2
src/main/java/com/wechat/controller/WeChatPayJsapiController.java

@@ -43,11 +43,11 @@ public class WeChatPayJsapiController extends BaseController {
 	}
 	
 	/**
-	 * 根据外部订单号发起微信退款
+	 * 根据微信支付单号发起微信退款
 	 * @param request
 	 * @param response
 	 */
-	@PostMapping(value = "/refundByOutOrderNo")
+	@PostMapping(value = "/refund")
 	public RespWrapper<Object> refundByOutOrderNo(RefundParticipation params) {
 		return weChatPayJsapiService.refundByOutOrderNo(params);
 	}

+ 1 - 11
src/main/java/com/wechat/service/merchant/impl/MerchantServiceImpl.java

@@ -179,7 +179,7 @@ System.out.println("测试调用微信返回结果:" + data);
 			String data = WeChatHttp.weChatGet(url,map);
 			RegisterData registerData = JSONObject.parseObject(data, RegisterData.class);
 			KtjRegisterData sysRegisterData = new KtjRegisterData();
-			//json解析赋值到数据库实体类
+			//json解析赋值
 			sysRegisterData.upInfo(registerData);
 			KtjMerchantDetails merchant = new KtjMerchantDetails();
 			Integer registerStatus = RegisterStatus.getIdByType(sysRegisterData.getApplymentState());
@@ -190,16 +190,6 @@ System.out.println("测试调用微信返回结果:" + data);
 				merchant.setSubMchid(sysRegisterData.getSubMchid());
 			}
 			merchantDetailDao.updateTemplateById(merchant);
-			//如果请求返回的结果不需要存储,可以删除以下代码
-			KtjRegisterData sys = new KtjRegisterData();
-			sys.setBusinessCode(businessCode);
-			sys = sysRegisterDataDao.templateOne(sys);
-			if( null == sys){
-				sysRegisterDataDao.insert(sysRegisterData);
-			}else{
-				sysRegisterData.setId(sys.getId());
-				sysRegisterDataDao.updateTemplateById(sysRegisterData);
-			}
 			return RespWrapper.makeSuccessResp(sysRegisterData);
 		} catch (Exception e) {
 			e.printStackTrace();

Dosya farkı çok büyük olduğundan ihmal edildi
+ 77 - 14
src/main/java/com/wechat/service/pay/impl/WeChatPayJsapiServiceImpl.java


+ 20 - 19
src/main/java/com/wechat/service/sepAccount/impl/SepAccountTest.java

@@ -1,4 +1,4 @@
-package com.wechat.service.sepAccount.impl;
+/*package com.wechat.service.sepAccount.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.wechat.common.enums.SepAccountEnums;
@@ -16,9 +16,9 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-/**
+*//**
  * 分账测试类
- */
+ *//*
 public class SepAccountTest {
     // 删除分账
     private static final String DEL_SEP_ACCOUNT_USER = "{\"type\":\"%s\",\"account\":\"%s\"}";
@@ -39,12 +39,12 @@ public class SepAccountTest {
 
     }
 
-    /**
+    *//**
      *  分账接收方与原请求不一致
      *  多次分账后完结分账时,out_order_no 需要注意
      *  第一次是系统内部生成的,第二、第三次 是上次分账返回的order_id
      * @throws Exception
-     */
+     *//*
     private static void noSepAccount()throws Exception {
         Map<String,Object> condition = new HashMap<>();
         condition.put("mch_id", ProjectConstant.merchantId);//商户id
@@ -62,13 +62,13 @@ public class SepAccountTest {
 
     }
 
-    /**
+    *//**
      * 包括商户号,签名类型、随机数
      * @param enums
      * @param condition
      * @param isSSL
      * @return
-     */
+     *//*
     private RespWrapper<Map<String,Object>> doWxRequest(SepAccountEnums enums, Map<String,Object> condition, boolean isSSL){
         Assert.notNull(condition,"微信请求参数不能为空");
         condition.put("mch_id", ProjectConstant.merchantId);//商户id
@@ -93,9 +93,9 @@ public class SepAccountTest {
 
 
 
-    /**
+    *//**
      * {nonce_str=ed95b1c7fbd32fe8, receiver={"type":"PERSONAL_WECHATID","account":"wxid_haxp101y5saj21"}, appid=wxec504e0378010e16, sign=961EA0F51E9AC69229769F041DB5C05E86693F973F71B6DC0EF71D18709340D8, result_code=SUCCESS, mch_id=1503800091, sub_mch_id=1584278251, return_code=SUCCESS}
-     */
+     *//*
     private static void delSepAccountUser() {
         Map<String,Object> condition = new HashMap<>();
         condition.put("mch_id", ProjectConstant.merchantId);//商户id
@@ -114,11 +114,11 @@ public class SepAccountTest {
 
     }
 
-    /**
+    *//**
      * 查询分账结果
      *
      *
-     */
+     *//*
     private static void findSepAccountResult() {
         Map<String,Object> condition = new HashMap<>();
         condition.put("mch_id", ProjectConstant.merchantId);//商户id
@@ -136,14 +136,14 @@ public class SepAccountTest {
         System.out.println(resultMap);
         System.out.println(checkNoticeSign(resultMap));
     }
-    /**
+    *//**
      *   {
      *          "type": "MERCHANT_ID",
      *          "account":"190001001",
      *          "amount":100,
      *          "description": "分到商户"
      * },
-     */
+     *//*
     static class SepUser{
         String type;
         String account;
@@ -187,12 +187,12 @@ public class SepAccountTest {
             this.description = description;
         }
     }
-    /**
+    *//**
      * 单个分账操作
-     */
+     *//*
     private static final String outOrderNo = "ktjSep20200418001";
 
-    /**
+    *//**
      * <xml>
      * <return_code><![CDATA[SUCCESS]]></return_code>
      * <result_code><![CDATA[SUCCESS]]></result_code>
@@ -206,7 +206,7 @@ public class SepAccountTest {
      * <order_id><![CDATA[30000110062020041800341490392]]></order_id>
      * </xml>
      * @throws Exception
-     */
+     *//*
     private static void singleSepAccount() throws Exception{
         Map<String,Object> condition = new HashMap<>();
         condition.put("mch_id", ProjectConstant.merchantId);//商户id
@@ -231,9 +231,9 @@ public class SepAccountTest {
 
     }
 
-    /**
+    *//**
      * 校验微信响应数据
-     */
+     *//*
     private static boolean checkNoticeSign(Map<String,Object> params){
         String sign = (String) params.get("sign");
         if(sign == null) return false;
@@ -271,3 +271,4 @@ public class SepAccountTest {
 
     }
 }
+*/

+ 1 - 1
src/main/resources/SQL config/merchant/merchantDetails.md

@@ -4,7 +4,7 @@ SELECT
   register_status,
   register_message
 FROM
-  merchant_details 
+  ktj_merchant_details 
 WHERE 1 = 1
 @if(!isEmpty(businessCode)){
 	AND business_code = #businessCode#

+ 13 - 11
src/main/resources/SQL config/pay/weChatPayRefund.md

@@ -1,17 +1,19 @@
 queryRefundOrder
 ===
 SELECT 
-    kro.refund_status,
-    kro.refund_message,
-    kro.sub_mchid,
-    kro.refund_id,
-    kmd.mini_program_sub_appid
-  FROM
-    (SELECT 
-      refund_status,
-      refund_message,
-      sub_mchid,
-      refund_id 
+  kro.id,
+  kro.refund_status,
+  kro.refund_message,
+  kro.sub_mchid,
+  kro.refund_id,
+  kmd.mini_program_sub_appid 
+FROM
+  (SELECT 
+    id,
+    refund_status,
+    refund_message,
+    sub_mchid,
+    refund_id 
     FROM
       ktj_refund_order WHERE refund_id = #refundId#) kro 
     LEFT JOIN ktj_merchant_details kmd