From 2cb9bebd60800698956a06f6674db13625bb7db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BA=AA=E5=AF=92?= <2533659732@qq.com> Date: Tue, 28 Nov 2023 14:01:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=9F=B9=E8=AE=AD=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 11 ++++++ .../common/config/NurseAppletChatConfig.java | 38 +++++++++++++++++++ .../impl/WeChatPaymentServiceImpl.java | 14 ++++--- 3 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 xinelu-common/src/main/java/com/xinelu/common/config/NurseAppletChatConfig.java diff --git a/xinelu-admin/src/main/resources/application.yml b/xinelu-admin/src/main/resources/application.yml index 231f574..91dfc3d 100644 --- a/xinelu-admin/src/main/resources/application.yml +++ b/xinelu-admin/src/main/resources/application.yml @@ -337,3 +337,14 @@ dzsCode: useCityCode: 371400 # 业务场景 businessStepCode: 302 + +# 医护助手微信小程序参数配置信息 +nurse-applet-chat-config: + # 微信小程序id,wxa4f2b43d2ccb9908 + applet-id: wxa4f2b43d2ccb9908 + # 微信小程序密钥, + secret: faeba9fc043cfdcb088f43be1747e054 + # 微信小程序返回国家语言 + lang: zh_CN + # 微信小程序授权类型 + grant-type: authorization_code diff --git a/xinelu-common/src/main/java/com/xinelu/common/config/NurseAppletChatConfig.java b/xinelu-common/src/main/java/com/xinelu/common/config/NurseAppletChatConfig.java new file mode 100644 index 0000000..0d826d7 --- /dev/null +++ b/xinelu-common/src/main/java/com/xinelu/common/config/NurseAppletChatConfig.java @@ -0,0 +1,38 @@ +package com.xinelu.common.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 护理员小程序配置类 + * + * @author ljh + * @version 1.0 + * Create by 2023/3/29 15:40 + */ +@Data +@Component +@ConfigurationProperties(prefix = "nurse-applet-chat-config") +public class NurseAppletChatConfig { + + /** + * 小程序id + */ + private String appletId; + + /** + * 小程序secret + */ + private String secret; + + /** + * 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语 + */ + private String lang; + + /** + * 授权类型 + */ + private String grantType; +} diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/wechatpaymentinfo/impl/WeChatPaymentServiceImpl.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/wechatpaymentinfo/impl/WeChatPaymentServiceImpl.java index 5d8e487..0ed99cf 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/wechatpaymentinfo/impl/WeChatPaymentServiceImpl.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/wechatpaymentinfo/impl/WeChatPaymentServiceImpl.java @@ -9,6 +9,7 @@ import com.xinelu.applet.vo.wechatpaymentinfo.vo.OrderStatusInfoVO; import com.xinelu.applet.vo.wechatpaymentinfo.vo.WeChatAppletSignVO; import com.xinelu.applet.vo.wechatpaymentinfo.vo.WeChatQueryOrderVO; import com.xinelu.common.config.AppletChatConfig; +import com.xinelu.common.config.NurseAppletChatConfig; import com.xinelu.common.config.WeChatPaymentUrlConfig; import com.xinelu.common.config.XylWeChatPaymentConfig; import com.xinelu.common.constant.Constants; @@ -72,6 +73,8 @@ public class WeChatPaymentServiceImpl implements WeChatPaymentService { private RedisTemplate redisTemplate; @Resource private WeChatUtil weChatUtil; + @Resource + private NurseAppletChatConfig nurseAppletChatConfig; /** * 新医路支付商品描述 @@ -298,7 +301,6 @@ public class WeChatPaymentServiceImpl implements WeChatPaymentService { prepayId = redisTemplate.opsForValue().get(Constants.PREPAY_ID_KEY + paymentDTO.getOrderNo()); } //构建小程序调起支付参数信息 - // return AjaxResult.success(getSignInfo(prepayId, paymentDTO.getBuySource())); return AjaxResult.success(getSignInfo(prepayId)); } @@ -427,13 +429,13 @@ public class WeChatPaymentServiceImpl implements WeChatPaymentService { */ private String buildTrainingOrderJsApiParams(PaymentDTO paymentDTO, TrainingOrder trainingOrder) { Map paramMap = new LinkedHashMap<>(); - //泉医助手学习培训订单使用医路优品账户进行支付,无需根据进购买来源进行判断 - /* paramMap.put("mchid", ylypWeChatPaymentConfig.getYlypMchId()); + //医护助手学习培训订单使用医路优品账户进行支付,无需根据进购买来源进行判断 + paramMap.put("mchid", xylWeChatPaymentConfig.getXylMchId()); paramMap.put("out_trade_no", trainingOrder.getTrainingOrderNo()); - //应用id,此处为泉医助手小程序id + //应用id,此处为医护助手小程序id paramMap.put("appid", nurseAppletChatConfig.getAppletId()); - paramMap.put("description", YI_LU_YOU_PIN_DESCRIPTION); - paramMap.put("notify_url", ylypWeChatPaymentConfig.getYlypWeChatNotifyUrl() + YINLUYOUPIN_WE_CHAT_NOTIFY_URL);*/ + paramMap.put("description", XIN_YI_LU_DESCRIPTION); + paramMap.put("notify_url", xylWeChatPaymentConfig.getXylWeChatNotifyUrl() + XINYILU_WE_CHAT_NOTIFY_URL); Map amountParamMap = new LinkedHashMap<>(); //总金额 int totalPrice = paymentDTO.getPaymentPrice().multiply(BigDecimal.valueOf(100)).intValue();