1
0
mirror of synced 2026-04-04 20:38:41 +08:00

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

This commit is contained in:
Charon-张同学
2025-12-24 15:47:54 +08:00
committed by GitHub
parent c2d0cf8d4e
commit f00a71965a
6 changed files with 51 additions and 44 deletions

View File

@@ -12,6 +12,7 @@ import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/** /**
* 医保自费混合收款下单请求 * 医保自费混合收款下单请求
@@ -25,6 +26,7 @@ import lombok.NoArgsConstructor;
@Builder(builderMethodName = "newBuilder") @Builder(builderMethodName = "newBuilder")
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Accessors(chain = true)
public class MedInsOrdersRequest { public class MedInsOrdersRequest {
/** /**
@@ -282,72 +284,72 @@ public class MedInsOrdersRequest {
* 字段名:总金额 * 字段名:总金额
* 变量名total_fee * 变量名total_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:总金额 * 描述:总金额
* </pre> * </pre>
*/ */
@SerializedName("total_fee") @SerializedName("total_fee")
public Long totalFee; public Integer totalFee;
/** /**
* <pre> * <pre>
* 字段名:医保统筹基金支付金额 * 字段名:医保统筹基金支付金额
* 变量名med_ins_gov_fee * 变量名med_ins_gov_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:医保统筹基金支付金额 * 描述:医保统筹基金支付金额
* </pre> * </pre>
*/ */
@SerializedName("med_ins_gov_fee") @SerializedName("med_ins_gov_fee")
public Long medInsGovFee; public Integer medInsGovFee;
/** /**
* <pre> * <pre>
* 字段名:医保个人账户支付金额 * 字段名:医保个人账户支付金额
* 变量名med_ins_self_fee * 变量名med_ins_self_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:医保个人账户支付金额 * 描述:医保个人账户支付金额
* </pre> * </pre>
*/ */
@SerializedName("med_ins_self_fee") @SerializedName("med_ins_self_fee")
public Long medInsSelfFee; public Integer medInsSelfFee;
/** /**
* <pre> * <pre>
* 字段名:医保其他基金支付金额 * 字段名:医保其他基金支付金额
* 变量名med_ins_other_fee * 变量名med_ins_other_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:医保其他基金支付金额 * 描述:医保其他基金支付金额
* </pre> * </pre>
*/ */
@SerializedName("med_ins_other_fee") @SerializedName("med_ins_other_fee")
public Long medInsOtherFee; public Integer medInsOtherFee;
/** /**
* <pre> * <pre>
* 字段名:医保现金支付金额 * 字段名:医保现金支付金额
* 变量名med_ins_cash_fee * 变量名med_ins_cash_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:医保现金支付金额 * 描述:医保现金支付金额
* </pre> * </pre>
*/ */
@SerializedName("med_ins_cash_fee") @SerializedName("med_ins_cash_fee")
public Long medInsCashFee; public Integer medInsCashFee;
/** /**
* <pre> * <pre>
* 字段名:微信支付现金支付金额 * 字段名:微信支付现金支付金额
* 变量名wechat_pay_cash_fee * 变量名wechat_pay_cash_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:微信支付现金支付金额 * 描述:微信支付现金支付金额
* </pre> * </pre>
*/ */
@SerializedName("wechat_pay_cash_fee") @SerializedName("wechat_pay_cash_fee")
public Long wechatPayCashFee; public Integer wechatPayCashFee;
/** /**
* <pre> * <pre>
@@ -462,6 +464,11 @@ public class MedInsOrdersRequest {
* 支付人身份信息 * 支付人身份信息
* </pre> * </pre>
*/ */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public static class PersonIdentification { public static class PersonIdentification {
/** /**
* <pre> * <pre>
@@ -507,18 +514,23 @@ public class MedInsOrdersRequest {
* 现金增加明细实体 * 现金增加明细实体
* </pre> * </pre>
*/ */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public static class CashAddEntity { public static class CashAddEntity {
/** /**
* <pre> * <pre>
* 字段名:现金增加金额 * 字段名:现金增加金额
* 变量名cash_add_fee * 变量名cash_add_fee
* 必填:是 * 必填:是
* 类型:long * 类型:Integer
* 描述:现金增加金额 * 描述:现金增加金额
* </pre> * </pre>
*/ */
@SerializedName("cash_add_fee") @SerializedName("cash_add_fee")
public Long cashAddFee; public Integer cashAddFee;
/** /**
* <pre> * <pre>
@@ -538,18 +550,23 @@ public class MedInsOrdersRequest {
* 现金减少明细实体 * 现金减少明细实体
* </pre> * </pre>
*/ */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public static class CashReduceEntity { public static class CashReduceEntity {
/** /**
* <pre> * <pre>
* 字段名:现金减少金额 * 字段名:现金减少金额
* 变量名cash_reduce_fee * 变量名cash_reduce_fee
* 必填:是 * 必填:是
* 类型:long * 类型:Integer
* 描述:现金减少金额 * 描述:现金减少金额
* </pre> * </pre>
*/ */
@SerializedName("cash_reduce_fee") @SerializedName("cash_reduce_fee")
public Long cashReduceFee; public Integer cashReduceFee;
/** /**
* <pre> * <pre>

View File

@@ -65,7 +65,7 @@ public class MedInsOrdersResult {
* </pre> * </pre>
*/ */
@SerializedName("med_ins_pay_status") @SerializedName("med_ins_pay_status")
public MedInsPayStatusEnum medInsPayStatusEnum; public MedInsPayStatusEnum medInsPayStatus;
/** /**
* <pre> * <pre>
@@ -320,72 +320,72 @@ public class MedInsOrdersResult {
* 字段名:总金额 * 字段名:总金额
* 变量名total_fee * 变量名total_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:总金额 * 描述:总金额
* </pre> * </pre>
*/ */
@SerializedName("total_fee") @SerializedName("total_fee")
public Long totalFee; public Integer totalFee;
/** /**
* <pre> * <pre>
* 字段名:医保统筹基金支付金额 * 字段名:医保统筹基金支付金额
* 变量名med_ins_gov_fee * 变量名med_ins_gov_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:医保统筹基金支付金额 * 描述:医保统筹基金支付金额
* </pre> * </pre>
*/ */
@SerializedName("med_ins_gov_fee") @SerializedName("med_ins_gov_fee")
public Long medInsGovFee; public Integer medInsGovFee;
/** /**
* <pre> * <pre>
* 字段名:医保个人账户支付金额 * 字段名:医保个人账户支付金额
* 变量名med_ins_self_fee * 变量名med_ins_self_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:医保个人账户支付金额 * 描述:医保个人账户支付金额
* </pre> * </pre>
*/ */
@SerializedName("med_ins_self_fee") @SerializedName("med_ins_self_fee")
public Long medInsSelfFee; public Integer medInsSelfFee;
/** /**
* <pre> * <pre>
* 字段名:医保其他基金支付金额 * 字段名:医保其他基金支付金额
* 变量名med_ins_other_fee * 变量名med_ins_other_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:医保其他基金支付金额 * 描述:医保其他基金支付金额
* </pre> * </pre>
*/ */
@SerializedName("med_ins_other_fee") @SerializedName("med_ins_other_fee")
public Long medInsOtherFee; public Integer medInsOtherFee;
/** /**
* <pre> * <pre>
* 字段名:医保现金支付金额 * 字段名:医保现金支付金额
* 变量名med_ins_cash_fee * 变量名med_ins_cash_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:医保现金支付金额 * 描述:医保现金支付金额
* </pre> * </pre>
*/ */
@SerializedName("med_ins_cash_fee") @SerializedName("med_ins_cash_fee")
public Long medInsCashFee; public Integer medInsCashFee;
/** /**
* <pre> * <pre>
* 字段名:微信支付现金支付金额 * 字段名:微信支付现金支付金额
* 变量名wechat_pay_cash_fee * 变量名wechat_pay_cash_fee
* 必填:否 * 必填:否
* 类型:long * 类型:Integer
* 描述:微信支付现金支付金额 * 描述:微信支付现金支付金额
* </pre> * </pre>
*/ */
@SerializedName("wechat_pay_cash_fee") @SerializedName("wechat_pay_cash_fee")
public Long wechatPayCashFee; public Integer wechatPayCashFee;
/** /**
* <pre> * <pre>

View File

@@ -20,16 +20,6 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class MedInsRefundNotifyRequest { public class MedInsRefundNotifyRequest {
/**
* <pre>
* 字段名:医保自费混合订单号
* 必填:是
* 类型string(32)
* 描述:医保自费混合订单号
* </pre>
*/
private String mixTradeNo;
/** /**
* <pre> * <pre>
* 字段名:医疗机构的商户号 * 字段名:医疗机构的商户号

View File

@@ -87,8 +87,9 @@ public interface MiPayService {
* </pre> * </pre>
* *
* @param request 医保退款通知请求参数 * @param request 医保退款通知请求参数
* @param mixTradeNo 【医保自费混合订单号】 医保自费混合订单号
* @throws WxPayException the wx pay exception * @throws WxPayException the wx pay exception
*/ */
void medInsRefundNotify(MedInsRefundNotifyRequest request) throws WxPayException; void medInsRefundNotify(MedInsRefundNotifyRequest request, String mixTradeNo) throws WxPayException;
} }

View File

@@ -59,8 +59,8 @@ public class MiPayServiceImpl implements MiPayService {
} }
@Override @Override
public void medInsRefundNotify(MedInsRefundNotifyRequest request) throws WxPayException { public void medInsRefundNotify(MedInsRefundNotifyRequest request, String mixTradeNo) throws WxPayException {
String url = String.format("%s/v3/med-ins/refunds/notify?mix_trade_no=%s", this.payService.getPayBaseUrl(), request.getMixTradeNo()); String url = String.format("%s/v3/med-ins/refunds/notify?mix_trade_no=%s", this.payService.getPayBaseUrl(), mixTradeNo);
this.payService.postV3(url, GSON.toJson(request)); this.payService.postV3(url, GSON.toJson(request));
} }

View File

@@ -131,13 +131,12 @@ public class MiPayServiceImplTest {
// 解析请求参数 // 解析请求参数
MedInsRefundNotifyRequest request = GSON.fromJson(requestParamStr, MedInsRefundNotifyRequest.class); MedInsRefundNotifyRequest request = GSON.fromJson(requestParamStr, MedInsRefundNotifyRequest.class);
request.setMixTradeNo(mixTradeNo);
MiPayService miPayService = wxPayService.getMiPayService(); MiPayService miPayService = wxPayService.getMiPayService();
try { try {
// 调用医保退款通知方法,预期会失败,因为是模拟数据 // 调用医保退款通知方法,预期会失败,因为是模拟数据
miPayService.medInsRefundNotify(request); miPayService.medInsRefundNotify(request,mixTradeNo);
log.info("医保退款通知调用成功"); log.info("医保退款通知调用成功");
} catch (WxPayException e) { } catch (WxPayException e) {
// 预期会抛出异常,因为是模拟数据 // 预期会抛出异常,因为是模拟数据