update 汇付支付回调

This commit is contained in:
2023-05-27 11:20:43 +08:00
parent 21606e8200
commit 23375c4149
3 changed files with 48 additions and 3 deletions

View File

@@ -1,6 +1,9 @@
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException; 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.google.common.collect.ImmutableMap;
import com.jsowell.JsowellApplication; import com.jsowell.JsowellApplication;
import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.constant.CacheConstants;
@@ -137,6 +140,20 @@ public class SpringBootTestController {
static final String ALGORITHM_MAC = "HmacMD5"; 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 @Test
public void testGenerateLianlianToken() throws UnsupportedEncodingException { public void testGenerateLianlianToken() throws UnsupportedEncodingException {
String OperatorID = "425010765"; String OperatorID = "425010765";

View File

@@ -1,6 +1,10 @@
package com.jsowell.pile.domain; package com.jsowell.pile.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -11,6 +15,9 @@ import java.util.Date;
* @author * @author
*/ */
@Data @Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AdapayCallbackRecord implements Serializable { public class AdapayCallbackRecord implements Serializable {
/** /**
* 主键id * 主键id
@@ -37,7 +44,8 @@ public class AdapayCallbackRecord implements Serializable {
*/ */
private String endTime; private String endTime;
private Object expend; @JsonIgnore
private String expend;
private BigDecimal feeAmt; private BigDecimal feeAmt;
@@ -73,4 +81,24 @@ public class AdapayCallbackRecord implements Serializable {
private String delFlag; private String delFlag;
private static final long serialVersionUID = 1L; 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;
}
} }

View File

@@ -37,13 +37,13 @@
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord" useGeneratedKeys="true"> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord" useGeneratedKeys="true">
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, end_time, expend, fee_amt,
order_no, out_trans_id, party_order_id, order_no, out_trans_id, party_order_id,
pay_amt, pay_channel, real_amt, pay_amt, pay_channel, real_amt,
share_eq, `status`, wx_user_id, share_eq, `status`, wx_user_id,
create_time, del_flag) 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}, #{endTime,jdbcType=VARCHAR}, #{expend,jdbcType=OTHER}, #{feeAmt,jdbcType=DECIMAL},
#{orderNo,jdbcType=VARCHAR}, #{outTransId,jdbcType=VARCHAR}, #{partyOrderId,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR}, #{outTransId,jdbcType=VARCHAR}, #{partyOrderId,jdbcType=VARCHAR},
#{payAmt,jdbcType=DECIMAL}, #{payChannel,jdbcType=VARCHAR}, #{realAmt,jdbcType=DECIMAL}, #{payAmt,jdbcType=DECIMAL}, #{payChannel,jdbcType=VARCHAR}, #{realAmt,jdbcType=DECIMAL},