From 23375c4149cd9fb62cd6c0018987b60f24ee65ed Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Sat, 27 May 2023 11:20:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?update=20=E6=B1=87=E4=BB=98=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/SpringBootTestController.java | 17 +++++++++++ .../pile/domain/AdapayCallbackRecord.java | 30 ++++++++++++++++++- .../pile/AdapayCallbackRecordMapper.xml | 4 +-- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index e03679bb7..b51467294 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -1,6 +1,9 @@ import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.google.common.collect.ImmutableMap; import com.jsowell.JsowellApplication; import com.jsowell.common.constant.CacheConstants; @@ -137,6 +140,20 @@ public class SpringBootTestController { static final String ALGORITHM_MAC = "HmacMD5"; + @Autowired + private AdapayCallbackRecordService adapayCallbackRecordService; + + @Test + public void testSaveCallback() throws JsonProcessingException { + String data = "{\"app_id\":\"app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa\",\"created_time\":\"20230527100758\",\"description\":\"{\\\"type\\\":\\\"balance\\\",\\\"memberId\\\":\\\"29336349\\\"}\",\"end_time\":\"20230527100810\",\"expend\":{\"bank_type\":\"OTHERS\",\"open_id\":\"o8jhot6PJF93EPhNISsXi28dKdS8\",\"sub_open_id\":\"o4REX5MprZfTaLnVNxfdOY-wnwGI\"},\"fee_amt\":\"0.00\",\"id\":\"002212023052710075810508353847861903360\",\"order_no\":\"4c457bd474334d5eaf82f4795265b6ad\",\"out_trans_id\":\"4200001864202305270647556621\",\"party_order_id\":\"02212305273647819807712\",\"pay_amt\":\"0.01\",\"pay_channel\":\"wx_lite\",\"real_amt\":\"0.01\",\"share_eq\":\"Y\",\"status\":\"succeeded\",\"wx_user_id\":\"\"}"; + JSONObject jsonObject = JSON.parseObject(data); + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); + AdapayCallbackRecord adapayCallbackRecord = mapper.readValue(jsonObject.toJSONString(), AdapayCallbackRecord.class); + adapayCallbackRecord.setExpend(jsonObject.getString("expend")); + adapayCallbackRecordService.saveAdapayCallbackRecord(adapayCallbackRecord); + } + @Test public void testGenerateLianlianToken() throws UnsupportedEncodingException { String OperatorID = "425010765"; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/AdapayCallbackRecord.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/AdapayCallbackRecord.java index 43424e889..4c3a70bcc 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/AdapayCallbackRecord.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/AdapayCallbackRecord.java @@ -1,6 +1,10 @@ package com.jsowell.pile.domain; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import java.io.Serializable; import java.math.BigDecimal; @@ -11,6 +15,9 @@ import java.util.Date; * @author */ @Data +@NoArgsConstructor +@AllArgsConstructor +@Builder public class AdapayCallbackRecord implements Serializable { /** * 主键id @@ -37,7 +44,8 @@ public class AdapayCallbackRecord implements Serializable { */ private String endTime; - private Object expend; + @JsonIgnore + private String expend; private BigDecimal feeAmt; @@ -73,4 +81,24 @@ public class AdapayCallbackRecord implements Serializable { private String delFlag; private static final long serialVersionUID = 1L; + + public AdapayCallbackRecord(String id, String appId, String description, String createdTime, String endTime, BigDecimal feeAmt, String orderNo, String outTransId, String partyOrderId, BigDecimal payAmt, String payChannel, BigDecimal realAmt, String shareEq, String status, String wxUserId, Date createTime, String delFlag) { + this.id = id; + this.appId = appId; + this.description = description; + this.createdTime = createdTime; + this.endTime = endTime; + this.feeAmt = feeAmt; + this.orderNo = orderNo; + this.outTransId = outTransId; + this.partyOrderId = partyOrderId; + this.payAmt = payAmt; + this.payChannel = payChannel; + this.realAmt = realAmt; + this.shareEq = shareEq; + this.status = status; + this.wxUserId = wxUserId; + this.createTime = createTime; + this.delFlag = delFlag; + } } \ No newline at end of file diff --git a/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml index d8135e678..b54c2d6e5 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml @@ -37,13 +37,13 @@ where id = #{id,jdbcType=VARCHAR} - insert into adapay_callback_record (app_id, description, created_time, + insert into adapay_callback_record (id, app_id, description, created_time, end_time, expend, fee_amt, order_no, out_trans_id, party_order_id, pay_amt, pay_channel, real_amt, share_eq, `status`, wx_user_id, create_time, del_flag) - values (#{appId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createdTime,jdbcType=VARCHAR}, + values (#{id},#{appId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createdTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{expend,jdbcType=OTHER}, #{feeAmt,jdbcType=DECIMAL}, #{orderNo,jdbcType=VARCHAR}, #{outTransId,jdbcType=VARCHAR}, #{partyOrderId,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL}, #{payChannel,jdbcType=VARCHAR}, #{realAmt,jdbcType=DECIMAL}, From 458687951ebac409cb0be24f85366bbe77508e07 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Sat, 27 May 2023 11:30:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?update=20=E6=B1=87=E4=BB=98=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/pile/AdapayCallbackRecordMapper.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml index b54c2d6e5..043393343 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml @@ -41,14 +41,12 @@ end_time, expend, fee_amt, order_no, out_trans_id, party_order_id, pay_amt, pay_channel, real_amt, - share_eq, `status`, wx_user_id, - create_time, del_flag) + share_eq, `status`, wx_user_id) values (#{id},#{appId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createdTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{expend,jdbcType=OTHER}, #{feeAmt,jdbcType=DECIMAL}, #{orderNo,jdbcType=VARCHAR}, #{outTransId,jdbcType=VARCHAR}, #{partyOrderId,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL}, #{payChannel,jdbcType=VARCHAR}, #{realAmt,jdbcType=DECIMAL}, - #{shareEq,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, - #{createTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=VARCHAR}) + #{shareEq,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}) insert into adapay_callback_record From 59efb253e4e6778c1abb16e2ec4abb486cb94d60 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Sat, 27 May 2023 11:44:44 +0800 Subject: [PATCH 3/3] update --- .../com/jsowell/api/uniapp/PayController.java | 8 +++++++ .../pile/domain/AdapayCallbackRecord.java | 23 +++---------------- .../pile/AdapayCallbackRecordMapper.xml | 21 +++++++++++++---- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/PayController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/PayController.java index 82af8b6ed..17adf8724 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/PayController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/PayController.java @@ -309,6 +309,14 @@ public class PayController extends BaseController { return response; } + /** + * 汇付支付退款 + */ + public RestApiResponse adapayRefund(HttpServletRequest request, @RequestBody WeChatRefundDTO dto) { + + return null; + } + /** * 汇付支付回调 * ... diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/AdapayCallbackRecord.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/AdapayCallbackRecord.java index 4c3a70bcc..d4cffbd70 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/AdapayCallbackRecord.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/AdapayCallbackRecord.java @@ -22,7 +22,9 @@ public class AdapayCallbackRecord implements Serializable { /** * 主键id */ - private String id; + private Integer id; + + private String paymentId; /** * 汇付商户appId @@ -82,23 +84,4 @@ public class AdapayCallbackRecord implements Serializable { private static final long serialVersionUID = 1L; - public AdapayCallbackRecord(String id, String appId, String description, String createdTime, String endTime, BigDecimal feeAmt, String orderNo, String outTransId, String partyOrderId, BigDecimal payAmt, String payChannel, BigDecimal realAmt, String shareEq, String status, String wxUserId, Date createTime, String delFlag) { - this.id = id; - this.appId = appId; - this.description = description; - this.createdTime = createdTime; - this.endTime = endTime; - this.feeAmt = feeAmt; - this.orderNo = orderNo; - this.outTransId = outTransId; - this.partyOrderId = partyOrderId; - this.payAmt = payAmt; - this.payChannel = payChannel; - this.realAmt = realAmt; - this.shareEq = shareEq; - this.status = status; - this.wxUserId = wxUserId; - this.createTime = createTime; - this.delFlag = delFlag; - } } \ No newline at end of file diff --git a/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml index 043393343..8b73bedcb 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/AdapayCallbackRecordMapper.xml @@ -2,7 +2,8 @@ - + + @@ -22,7 +23,7 @@ - id, app_id, description, created_time, end_time, expend, fee_amt, order_no, out_trans_id, + id, payment_id, app_id, description, created_time, end_time, expend, fee_amt, order_no, out_trans_id, party_order_id, pay_amt, pay_channel, real_amt, share_eq, `status`, wx_user_id, create_time, del_flag @@ -37,12 +38,12 @@ where id = #{id,jdbcType=VARCHAR} - insert into adapay_callback_record (id, app_id, description, created_time, + insert into adapay_callback_record (payment_id, app_id, description, created_time, end_time, expend, fee_amt, order_no, out_trans_id, party_order_id, pay_amt, pay_channel, real_amt, share_eq, `status`, wx_user_id) - values (#{id},#{appId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createdTime,jdbcType=VARCHAR}, + values (#{paymentId,jdbcType=VARCHAR},#{appId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createdTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{expend,jdbcType=OTHER}, #{feeAmt,jdbcType=DECIMAL}, #{orderNo,jdbcType=VARCHAR}, #{outTransId,jdbcType=VARCHAR}, #{partyOrderId,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL}, #{payChannel,jdbcType=VARCHAR}, #{realAmt,jdbcType=DECIMAL}, @@ -51,6 +52,9 @@ insert into adapay_callback_record + + payment_id, + app_id, @@ -104,6 +108,9 @@ + + #{paymentId,jdbcType=VARCHAR}, + #{appId,jdbcType=VARCHAR}, @@ -160,6 +167,9 @@ update adapay_callback_record + + payment_id = #{paymentId,jdbcType=VARCHAR}, + app_id = #{appId,jdbcType=VARCHAR}, @@ -216,7 +226,8 @@ update adapay_callback_record - set app_id = #{appId,jdbcType=VARCHAR}, + set payment_id = #{paymentId,jdbcType=VARCHAR}, + app_id = #{appId,jdbcType=VARCHAR}, description = #{description,jdbcType=VARCHAR}, created_time = #{createdTime,jdbcType=VARCHAR}, end_time = #{endTime,jdbcType=VARCHAR},