Commit 3d296470e90915ebe423ce3eaa8d5bf4e58c510f

Authored by 陈威
1 parent 1dc65458
Exists in dev

update

backend/assembly/src/main/resources/application-dev.yml
@@ -5,18 +5,28 @@ spring: @@ -5,18 +5,28 @@ spring:
5 dynamic: 5 dynamic:
6 datasource: 6 datasource:
7 master: 7 master:
8 - #开发环境配置 8 +# #开发环境配置
9 username: root 9 username: root
10 password: Peony2021 10 password: Peony2021
11 driver-class-name: com.mysql.cj.jdbc.Driver 11 driver-class-name: com.mysql.cj.jdbc.Driver
12 url: jdbc:mysql://123.60.140.65:10002/lpg_dev?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true 12 url: jdbc:mysql://123.60.140.65:10002/lpg_dev?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true
13 13
14 - #生产环境配置 14 +# 生产环境配置
15 # username: root 15 # username: root
16 # password: Carbon@2024 16 # password: Carbon@2024
17 # driver-class-name: com.mysql.cj.jdbc.Driver 17 # driver-class-name: com.mysql.cj.jdbc.Driver
18 # url: jdbc:mysql://localhost:13307/lpg?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true 18 # url: jdbc:mysql://localhost:13307/lpg?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true
19 19
  20 +# 生产环境配置2
  21 +# username: root
  22 +# password: Carbon@2024
  23 +# driver-class-name: com.mysql.cj.jdbc.Driver
  24 +# url: jdbc:mysql://localhost:13307/lpg_dev?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true
  25 +
  26 +
  27 +
  28 +
  29 +
20 30
21 druid: 31 druid:
22 filters: stat 32 filters: stat
@@ -201,5 +211,9 @@ jdbcParam: @@ -201,5 +211,9 @@ jdbcParam:
201 jdbcurl: jdbc:mysql://123.60.140.65:10002/lpg_dev 211 jdbcurl: jdbc:mysql://123.60.140.65:10002/lpg_dev
202 username: root 212 username: root
203 password: Peony2021 213 password: Peony2021
  214 +
204 ygxx: 215 ygxx:
205 - ewm: /pages/scanCodeUserInfo/index/  
206 \ No newline at end of file 216 \ No newline at end of file
  217 + ewm: /pages/scanCodeUserInfo/index/
  218 +
  219 +payment:
  220 + hostUrl: https://lpg.ip-server.cn/lpg_test/api
backend/auth-server/src/main/java/com/hotent/auth/server/service/impl/AuthenticationServiceImpl.java
@@ -412,7 +412,8 @@ public class AuthenticationServiceImpl implements AuthenticationService { @@ -412,7 +412,8 @@ public class AuthenticationServiceImpl implements AuthenticationService {
412 //处理单用户登录 412 //处理单用户登录
413 handleSingleLogin(isMobile, tenantId, account, token); 413 handleSingleLogin(isMobile, tenantId, account, token);
414 // Return the token 414 // Return the token
415 - return ResponseEntity.ok(new JwtAuthenticationResponse(token, userName, account, userId)); 415 + JwtAuthenticationResponse jwtAuthenticationResponse = new JwtAuthenticationResponse(token, userName, account, userId,openid);
  416 + return ResponseEntity.ok(jwtAuthenticationResponse);
416 }else { 417 }else {
417 if(StringUtil.isNotEmpty(openid)) { 418 if(StringUtil.isNotEmpty(openid)) {
418 return ResponseEntity.ok(new JwtAuthenticationResponse(openid)); 419 return ResponseEntity.ok(new JwtAuthenticationResponse(openid));
backend/base/src/main/java/com/hotent/base/jwt/JwtAuthenticationResponse.java
@@ -15,9 +15,18 @@ public class JwtAuthenticationResponse implements Serializable { @@ -15,9 +15,18 @@ public class JwtAuthenticationResponse implements Serializable {
15 private String openid; 15 private String openid;
16 private Long expiration; 16 private Long expiration;
17 private boolean loginStatus = true; 17 private boolean loginStatus = true;
18 - 18 +
19 private Map<String,Object> userAttrs = new HashMap<String, Object>(); 19 private Map<String,Object> userAttrs = new HashMap<String, Object>();
20 20
  21 + public JwtAuthenticationResponse(String token, String username,String account,String userId,String openid) {
  22 + this.token = token;
  23 + this.username = username;
  24 + this.account = account;
  25 + this.userId = userId;
  26 + this.openid = openid;
  27 + }
  28 +
  29 +
21 public JwtAuthenticationResponse(String token, String username,String account,String userId) { 30 public JwtAuthenticationResponse(String token, String username,String account,String userId) {
22 this.token = token; 31 this.token = token;
23 this.username = username; 32 this.username = username;
@@ -56,7 +65,7 @@ public class JwtAuthenticationResponse implements Serializable { @@ -56,7 +65,7 @@ public class JwtAuthenticationResponse implements Serializable {
56 public String getToken() { 65 public String getToken() {
57 return this.token; 66 return this.token;
58 } 67 }
59 - 68 +
60 public String getUsername() { 69 public String getUsername() {
61 return this.username; 70 return this.username;
62 } 71 }
@@ -84,5 +93,5 @@ public class JwtAuthenticationResponse implements Serializable { @@ -84,5 +93,5 @@ public class JwtAuthenticationResponse implements Serializable {
84 public void setUserAttrs(Map<String,Object> userAttrs) { 93 public void setUserAttrs(Map<String,Object> userAttrs) {
85 this.userAttrs = userAttrs; 94 this.userAttrs = userAttrs;
86 } 95 }
87 - 96 +
88 } 97 }
backend/lpg-user/src/main/java/com/hotent/lpg/user/manager/impl/WxPayManagerImpl.java
@@ -26,12 +26,14 @@ import com.hotent.lpg.user.util.LocalDateTimeUtils; @@ -26,12 +26,14 @@ import com.hotent.lpg.user.util.LocalDateTimeUtils;
26 import com.hotent.lpg.user.util.WxPayConfiguration; 26 import com.hotent.lpg.user.util.WxPayConfiguration;
27 import lombok.AllArgsConstructor; 27 import lombok.AllArgsConstructor;
28 import lombok.extern.slf4j.Slf4j; 28 import lombok.extern.slf4j.Slf4j;
  29 +import org.springframework.beans.factory.annotation.Value;
29 import org.springframework.stereotype.Service; 30 import org.springframework.stereotype.Service;
30 import org.w3c.dom.Document; 31 import org.w3c.dom.Document;
31 import org.w3c.dom.Element; 32 import org.w3c.dom.Element;
32 import org.w3c.dom.Node; 33 import org.w3c.dom.Node;
33 import org.xml.sax.InputSource; 34 import org.xml.sax.InputSource;
34 35
  36 +import javax.annotation.Resource;
35 import javax.xml.bind.JAXBContext; 37 import javax.xml.bind.JAXBContext;
36 import javax.xml.parsers.DocumentBuilder; 38 import javax.xml.parsers.DocumentBuilder;
37 import javax.xml.parsers.DocumentBuilderFactory; 39 import javax.xml.parsers.DocumentBuilderFactory;
@@ -49,12 +51,18 @@ import java.time.LocalDateTime; @@ -49,12 +51,18 @@ import java.time.LocalDateTime;
49 import java.util.HashMap; 51 import java.util.HashMap;
50 52
51 @Service 53 @Service
52 -@AllArgsConstructor  
53 @Slf4j 54 @Slf4j
54 public class WxPayManagerImpl implements WxPayManager { 55 public class WxPayManagerImpl implements WxPayManager {
55 56
56 - private final DdDao ddDao;  
57 - private final CzzfpzDao czzfpzDao; 57 +
  58 + @Value("${payment.hostUrl}")
  59 + private String hostUrl;
  60 +
  61 + @Resource
  62 + private DdDao ddDao;
  63 +
  64 + @Resource
  65 + private CzzfpzDao czzfpzDao;
58 66
59 /** 67 /**
60 * 发起退款请求 68 * 发起退款请求
@@ -91,7 +99,7 @@ public class WxPayManagerImpl implements WxPayManager { @@ -91,7 +99,7 @@ public class WxPayManagerImpl implements WxPayManager {
91 refundRequest.setOutRefundNo(RandomUtil.randomString(32)); // 退款单号 99 refundRequest.setOutRefundNo(RandomUtil.randomString(32)); // 退款单号
92 refundRequest.setTotalFee(wDd.getFDdje().multiply(new BigDecimal(100)).intValue()); // 订单总金额 100 refundRequest.setTotalFee(wDd.getFDdje().multiply(new BigDecimal(100)).intValue()); // 订单总金额
93 refundRequest.setRefundFee(wDd.getFDdje().multiply(new BigDecimal(100)).intValue()); // 退款金额 101 refundRequest.setRefundFee(wDd.getFDdje().multiply(new BigDecimal(100)).intValue()); // 退款金额
94 - refundRequest.setNotifyUrl(WxPayConfiguration.hostUrl + "/user/wxPay/handleRefundSuccessCallback"); 102 + refundRequest.setNotifyUrl(hostUrl + "/user/wxPay/handleRefundSuccessCallback");
95 // 发起退款请求 103 // 发起退款请求
96 Object payment = wxPayService.refund(refundRequest); 104 Object payment = wxPayService.refund(refundRequest);
97 // 返回结果 105 // 返回结果
@@ -236,7 +244,7 @@ public class WxPayManagerImpl implements WxPayManager { @@ -236,7 +244,7 @@ public class WxPayManagerImpl implements WxPayManager {
236 scene_info.put("id", "LPG"); 244 scene_info.put("id", "LPG");
237 scene_info.put("name", "燃气"); 245 scene_info.put("name", "燃气");
238 wxPayUnifiedOrderRequest.setSceneInfo(scene_info.toString()); 246 wxPayUnifiedOrderRequest.setSceneInfo(scene_info.toString());
239 - wxPayUnifiedOrderRequest.setNotifyUrl(WxPayConfiguration.hostUrl + "/user/wxPay/handlePaySuccessCallback"); // 支付回调地址,开放不用登录 247 + wxPayUnifiedOrderRequest.setNotifyUrl(hostUrl + "/user/wxPay/handlePaySuccessCallback"); // 支付回调地址,开放不用登录
240 wxPayUnifiedOrderRequest.setSpbillCreateIp("127.0.0.1"); 248 wxPayUnifiedOrderRequest.setSpbillCreateIp("127.0.0.1");
241 // trade_type=APP时 移动应用内的支付场景 249 // trade_type=APP时 移动应用内的支付场景
242 if ("APP".equals(wxPayUnifiedOrderRequest.getTradeType())) { 250 if ("APP".equals(wxPayUnifiedOrderRequest.getTradeType())) {
backend/lpg-user/src/main/java/com/hotent/lpg/user/util/WxPayConfiguration.java
@@ -4,11 +4,10 @@ import com.github.binarywang.wxpay.config.WxPayConfig; @@ -4,11 +4,10 @@ import com.github.binarywang.wxpay.config.WxPayConfig;
4 import com.github.binarywang.wxpay.service.WxPayService; 4 import com.github.binarywang.wxpay.service.WxPayService;
5 import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; 5 import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
6 import com.hotent.lpg.common.model.WCzzfpz; 6 import com.hotent.lpg.common.model.WCzzfpz;
  7 +import org.springframework.beans.factory.annotation.Value;
7 8
8 public class WxPayConfiguration { 9 public class WxPayConfiguration {
9 10
10 -  
11 - public static final String hostUrl = "https://lpg.ip-server.cn/api";  
12 public static WxPayService getPayService(WCzzfpz wCzzfpz) { 11 public static WxPayService getPayService(WCzzfpz wCzzfpz) {
13 WxPayConfig wxPayConfig = new WxPayConfig(); 12 WxPayConfig wxPayConfig = new WxPayConfig();
14 wxPayConfig.setAppId(wCzzfpz.getFAppid()); // appId(应用id)(微信支付商户平台获取) 13 wxPayConfig.setAppId(wCzzfpz.getFAppid()); // appId(应用id)(微信支付商户平台获取)