Skip to content

Commit f00a719

Browse files
authored
🎨 修改微信医保支付模块的规范性问题,主要涉及字段命名标准化、数据类型调整和 API 方法签名优化
1 parent c2d0cf8 commit f00a719

File tree

6 files changed

+51
-44
lines changed

6 files changed

+51
-44
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/mipay/MedInsOrdersRequest.java

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import lombok.Builder;
1313
import lombok.Data;
1414
import lombok.NoArgsConstructor;
15+
import lombok.experimental.Accessors;
1516

1617
/**
1718
* 医保自费混合收款下单请求
@@ -25,6 +26,7 @@
2526
@Builder(builderMethodName = "newBuilder")
2627
@NoArgsConstructor
2728
@AllArgsConstructor
29+
@Accessors(chain = true)
2830
public class MedInsOrdersRequest {
2931

3032
/**
@@ -282,72 +284,72 @@ public class MedInsOrdersRequest {
282284
* 字段名:总金额
283285
* 变量名:total_fee
284286
* 必填:否
285-
* 类型:long
287+
* 类型:Integer
286288
* 描述:总金额
287289
* </pre>
288290
*/
289291
@SerializedName("total_fee")
290-
public Long totalFee;
292+
public Integer totalFee;
291293

292294
/**
293295
* <pre>
294296
* 字段名:医保统筹基金支付金额
295297
* 变量名:med_ins_gov_fee
296298
* 必填:否
297-
* 类型:long
299+
* 类型:Integer
298300
* 描述:医保统筹基金支付金额
299301
* </pre>
300302
*/
301303
@SerializedName("med_ins_gov_fee")
302-
public Long medInsGovFee;
304+
public Integer medInsGovFee;
303305

304306
/**
305307
* <pre>
306308
* 字段名:医保个人账户支付金额
307309
* 变量名:med_ins_self_fee
308310
* 必填:否
309-
* 类型:long
311+
* 类型:Integer
310312
* 描述:医保个人账户支付金额
311313
* </pre>
312314
*/
313315
@SerializedName("med_ins_self_fee")
314-
public Long medInsSelfFee;
316+
public Integer medInsSelfFee;
315317

316318
/**
317319
* <pre>
318320
* 字段名:医保其他基金支付金额
319321
* 变量名:med_ins_other_fee
320322
* 必填:否
321-
* 类型:long
323+
* 类型:Integer
322324
* 描述:医保其他基金支付金额
323325
* </pre>
324326
*/
325327
@SerializedName("med_ins_other_fee")
326-
public Long medInsOtherFee;
328+
public Integer medInsOtherFee;
327329

328330
/**
329331
* <pre>
330332
* 字段名:医保现金支付金额
331333
* 变量名:med_ins_cash_fee
332334
* 必填:否
333-
* 类型:long
335+
* 类型:Integer
334336
* 描述:医保现金支付金额
335337
* </pre>
336338
*/
337339
@SerializedName("med_ins_cash_fee")
338-
public Long medInsCashFee;
340+
public Integer medInsCashFee;
339341

340342
/**
341343
* <pre>
342344
* 字段名:微信支付现金支付金额
343345
* 变量名:wechat_pay_cash_fee
344346
* 必填:否
345-
* 类型:long
347+
* 类型:Integer
346348
* 描述:微信支付现金支付金额
347349
* </pre>
348350
*/
349351
@SerializedName("wechat_pay_cash_fee")
350-
public Long wechatPayCashFee;
352+
public Integer wechatPayCashFee;
351353

352354
/**
353355
* <pre>
@@ -462,6 +464,11 @@ public class MedInsOrdersRequest {
462464
* 支付人身份信息
463465
* </pre>
464466
*/
467+
@Data
468+
@Builder
469+
@NoArgsConstructor
470+
@AllArgsConstructor
471+
@Accessors(chain = true)
465472
public static class PersonIdentification {
466473
/**
467474
* <pre>
@@ -507,18 +514,23 @@ public static class PersonIdentification {
507514
* 现金增加明细实体
508515
* </pre>
509516
*/
517+
@Data
518+
@Builder
519+
@NoArgsConstructor
520+
@AllArgsConstructor
521+
@Accessors(chain = true)
510522
public static class CashAddEntity {
511523
/**
512524
* <pre>
513525
* 字段名:现金增加金额
514526
* 变量名:cash_add_fee
515527
* 必填:是
516-
* 类型:long
528+
* 类型:Integer
517529
* 描述:现金增加金额
518530
* </pre>
519531
*/
520532
@SerializedName("cash_add_fee")
521-
public Long cashAddFee;
533+
public Integer cashAddFee;
522534

523535
/**
524536
* <pre>
@@ -538,18 +550,23 @@ public static class CashAddEntity {
538550
* 现金减少明细实体
539551
* </pre>
540552
*/
553+
@Data
554+
@Builder
555+
@NoArgsConstructor
556+
@AllArgsConstructor
557+
@Accessors(chain = true)
541558
public static class CashReduceEntity {
542559
/**
543560
* <pre>
544561
* 字段名:现金减少金额
545562
* 变量名:cash_reduce_fee
546563
* 必填:是
547-
* 类型:long
564+
* 类型:Integer
548565
* 描述:现金减少金额
549566
* </pre>
550567
*/
551568
@SerializedName("cash_reduce_fee")
552-
public Long cashReduceFee;
569+
public Integer cashReduceFee;
553570

554571
/**
555572
* <pre>

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/mipay/MedInsOrdersResult.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class MedInsOrdersResult {
6565
* </pre>
6666
*/
6767
@SerializedName("med_ins_pay_status")
68-
public MedInsPayStatusEnum medInsPayStatusEnum;
68+
public MedInsPayStatusEnum medInsPayStatus;
6969

7070
/**
7171
* <pre>
@@ -320,72 +320,72 @@ public class MedInsOrdersResult {
320320
* 字段名:总金额
321321
* 变量名:total_fee
322322
* 必填:否
323-
* 类型:long
323+
* 类型:Integer
324324
* 描述:总金额
325325
* </pre>
326326
*/
327327
@SerializedName("total_fee")
328-
public Long totalFee;
328+
public Integer totalFee;
329329

330330
/**
331331
* <pre>
332332
* 字段名:医保统筹基金支付金额
333333
* 变量名:med_ins_gov_fee
334334
* 必填:否
335-
* 类型:long
335+
* 类型:Integer
336336
* 描述:医保统筹基金支付金额
337337
* </pre>
338338
*/
339339
@SerializedName("med_ins_gov_fee")
340-
public Long medInsGovFee;
340+
public Integer medInsGovFee;
341341

342342
/**
343343
* <pre>
344344
* 字段名:医保个人账户支付金额
345345
* 变量名:med_ins_self_fee
346346
* 必填:否
347-
* 类型:long
347+
* 类型:Integer
348348
* 描述:医保个人账户支付金额
349349
* </pre>
350350
*/
351351
@SerializedName("med_ins_self_fee")
352-
public Long medInsSelfFee;
352+
public Integer medInsSelfFee;
353353

354354
/**
355355
* <pre>
356356
* 字段名:医保其他基金支付金额
357357
* 变量名:med_ins_other_fee
358358
* 必填:否
359-
* 类型:long
359+
* 类型:Integer
360360
* 描述:医保其他基金支付金额
361361
* </pre>
362362
*/
363363
@SerializedName("med_ins_other_fee")
364-
public Long medInsOtherFee;
364+
public Integer medInsOtherFee;
365365

366366
/**
367367
* <pre>
368368
* 字段名:医保现金支付金额
369369
* 变量名:med_ins_cash_fee
370370
* 必填:否
371-
* 类型:long
371+
* 类型:Integer
372372
* 描述:医保现金支付金额
373373
* </pre>
374374
*/
375375
@SerializedName("med_ins_cash_fee")
376-
public Long medInsCashFee;
376+
public Integer medInsCashFee;
377377

378378
/**
379379
* <pre>
380380
* 字段名:微信支付现金支付金额
381381
* 变量名:wechat_pay_cash_fee
382382
* 必填:否
383-
* 类型:long
383+
* 类型:Integer
384384
* 描述:微信支付现金支付金额
385385
* </pre>
386386
*/
387387
@SerializedName("wechat_pay_cash_fee")
388-
public Long wechatPayCashFee;
388+
public Integer wechatPayCashFee;
389389

390390
/**
391391
* <pre>

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/mipay/MedInsRefundNotifyRequest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020
@AllArgsConstructor
2121
public class MedInsRefundNotifyRequest {
2222

23-
/**
24-
* <pre>
25-
* 字段名:医保自费混合订单号
26-
* 必填:是
27-
* 类型:string(32)
28-
* 描述:医保自费混合订单号
29-
* </pre>
30-
*/
31-
private String mixTradeNo;
32-
3323
/**
3424
* <pre>
3525
* 字段名:医疗机构的商户号

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MiPayService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ public interface MiPayService {
8787
* </pre>
8888
*
8989
* @param request 医保退款通知请求参数
90+
* @param mixTradeNo 【医保自费混合订单号】 医保自费混合订单号
9091
* @throws WxPayException the wx pay exception
9192
*/
92-
void medInsRefundNotify(MedInsRefundNotifyRequest request) throws WxPayException;
93+
void medInsRefundNotify(MedInsRefundNotifyRequest request, String mixTradeNo) throws WxPayException;
9394

9495
}

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MiPayServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public MiPayNotifyV3Result parseMiPayNotifyV3Result(String notifyData, Signature
5959
}
6060

6161
@Override
62-
public void medInsRefundNotify(MedInsRefundNotifyRequest request) throws WxPayException {
63-
String url = String.format("%s/v3/med-ins/refunds/notify?mix_trade_no=%s", this.payService.getPayBaseUrl(), request.getMixTradeNo());
62+
public void medInsRefundNotify(MedInsRefundNotifyRequest request, String mixTradeNo) throws WxPayException {
63+
String url = String.format("%s/v3/med-ins/refunds/notify?mix_trade_no=%s", this.payService.getPayBaseUrl(), mixTradeNo);
6464
this.payService.postV3(url, GSON.toJson(request));
6565
}
6666

weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/MiPayServiceImplTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,12 @@ public void medInsRefundNotify() throws WxPayException {
131131

132132
// 解析请求参数
133133
MedInsRefundNotifyRequest request = GSON.fromJson(requestParamStr, MedInsRefundNotifyRequest.class);
134-
request.setMixTradeNo(mixTradeNo);
135134

136135
MiPayService miPayService = wxPayService.getMiPayService();
137136

138137
try {
139138
// 调用医保退款通知方法,预期会失败,因为是模拟数据
140-
miPayService.medInsRefundNotify(request);
139+
miPayService.medInsRefundNotify(request,mixTradeNo);
141140
log.info("医保退款通知调用成功");
142141
} catch (WxPayException e) {
143142
// 预期会抛出异常,因为是模拟数据

0 commit comments

Comments
 (0)