feat: 增加微信和支付包配置
This commit is contained in:
parent
455a7ada28
commit
a9c7252b41
@ -90,8 +90,11 @@ public class SystemUserRouteController extends DefaultBaseController {
|
|||||||
ModelAndView mv = new ModelAndView();
|
ModelAndView mv = new ModelAndView();
|
||||||
Map<String, String> pageParams = oAuthService.getPageParams(request);
|
Map<String, String> pageParams = oAuthService.getPageParams(request);
|
||||||
pageParams.put("loginPhoneAction", "oauth/phone");
|
pageParams.put("loginPhoneAction", "oauth/phone");
|
||||||
pageParams.put("wxAppid", wxOauth2Properties.getAppid());
|
pageParams.put("wxOauth", wxOauth2Properties.getActivate() ? ISystemConstant.IS_TRUE : ISystemConstant.IS_FALSE);
|
||||||
pageParams.put("wxRedirectUri", wxOauth2Properties.getRedirectUri());
|
if (wxOauth2Properties.getActivate()) {
|
||||||
|
pageParams.put("wxAppid", wxOauth2Properties.getAppid());
|
||||||
|
pageParams.put("wxRedirectUri", wxOauth2Properties.getRedirectUri());
|
||||||
|
}
|
||||||
mv.addObject(IUserCenterConst.PAGE_PARAMS, pageParams);
|
mv.addObject(IUserCenterConst.PAGE_PARAMS, pageParams);
|
||||||
mv.addObject(IUserCenterConst.CUSTOM_LOGIN_FORM, loginFormService.getActive());
|
mv.addObject(IUserCenterConst.CUSTOM_LOGIN_FORM, loginFormService.getActive());
|
||||||
mv.addObject("HomeServerUrl", ProjectConfigUtil.getText("HomeServerUrl"));
|
mv.addObject("HomeServerUrl", ProjectConfigUtil.getText("HomeServerUrl"));
|
||||||
|
@ -7,9 +7,18 @@ import org.springframework.stereotype.Component;
|
|||||||
@ConfigurationProperties(prefix = "wx-miniapp")
|
@ConfigurationProperties(prefix = "wx-miniapp")
|
||||||
public class WxMiniappProperties {
|
public class WxMiniappProperties {
|
||||||
|
|
||||||
|
private Boolean activate;
|
||||||
private String appid;
|
private String appid;
|
||||||
private String appsecret;
|
private String appsecret;
|
||||||
|
|
||||||
|
public Boolean getActivate() {
|
||||||
|
return !(activate == null) && activate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivate(Boolean activate) {
|
||||||
|
this.activate = activate;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAppid() {
|
public String getAppid() {
|
||||||
return appid == null ? "" : appid.trim();
|
return appid == null ? "" : appid.trim();
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,18 @@ import org.springframework.stereotype.Component;
|
|||||||
@ConfigurationProperties(prefix = "wx-oauth2")
|
@ConfigurationProperties(prefix = "wx-oauth2")
|
||||||
public class WxOauth2Properties {
|
public class WxOauth2Properties {
|
||||||
|
|
||||||
|
private Boolean activate;
|
||||||
private String appid;
|
private String appid;
|
||||||
private String appsecret;
|
private String appsecret;
|
||||||
private String redirectUri;
|
private String redirectUri;
|
||||||
|
|
||||||
|
public Boolean getActivate() {
|
||||||
|
return !(activate == null) && activate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivate(Boolean activate) {
|
||||||
|
this.activate = activate;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAppid() {
|
public String getAppid() {
|
||||||
return appid == null ? "" : appid.trim();
|
return appid == null ? "" : appid.trim();
|
||||||
|
@ -63,6 +63,10 @@ public class UserWxMiniappService {
|
|||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void refreshAccessToken() {
|
public void refreshAccessToken() {
|
||||||
|
if(!wxMiniappProperties.getActivate()) {
|
||||||
|
LOG.debug("小程序未激活");
|
||||||
|
return;
|
||||||
|
}
|
||||||
long currentTimeMillis = System.currentTimeMillis();
|
long currentTimeMillis = System.currentTimeMillis();
|
||||||
if (miniappAccessToken != null && (currentTimeMillis - miniappAccessToken.getUpdateTime() < 5400000)) {
|
if (miniappAccessToken != null && (currentTimeMillis - miniappAccessToken.getUpdateTime() < 5400000)) {
|
||||||
LOG.debug("小程序 access_token 不需要刷新, 刷新时间: {}", LocalDateTime.fromDateFields(new Date(miniappAccessToken.getUpdateTime() + 5400000)));
|
LOG.debug("小程序 access_token 不需要刷新, 刷新时间: {}", LocalDateTime.fromDateFields(new Date(miniappAccessToken.getUpdateTime() + 5400000)));
|
||||||
|
@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@ConfigurationProperties(prefix = "pay.ali-pay")
|
@ConfigurationProperties(prefix = "pay.ali-pay")
|
||||||
public class AliPayProperties {
|
public class AliPayProperties {
|
||||||
|
private Boolean activate;
|
||||||
// 应用ID
|
// 应用ID
|
||||||
private String appId;
|
private String appId;
|
||||||
|
|
||||||
@ -36,6 +36,14 @@ public class AliPayProperties {
|
|||||||
// 单笔最小金额
|
// 单笔最小金额
|
||||||
private Double minMoney;
|
private Double minMoney;
|
||||||
|
|
||||||
|
public Boolean getActivate() {
|
||||||
|
return !(activate == null) && activate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivate(Boolean activate) {
|
||||||
|
this.activate = activate;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAppId() {
|
public String getAppId() {
|
||||||
return appId == null ? "" : appId.trim();
|
return appId == null ? "" : appId.trim();
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@ConfigurationProperties(prefix = "pay.wx-pay")
|
@ConfigurationProperties(prefix = "pay.wx-pay")
|
||||||
public class WxPayProperties {
|
public class WxPayProperties {
|
||||||
|
private Boolean activate;
|
||||||
// 商户号
|
// 商户号
|
||||||
private String mchId;
|
private String mchId;
|
||||||
|
|
||||||
@ -70,6 +70,14 @@ public class WxPayProperties {
|
|||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getActivate() {
|
||||||
|
return !(activate == null) && activate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivate(Boolean activate) {
|
||||||
|
this.activate = activate;
|
||||||
|
}
|
||||||
|
|
||||||
public String getMchId() {
|
public String getMchId() {
|
||||||
return mchId == null ? "" : mchId.trim();
|
return mchId == null ? "" : mchId.trim();
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,7 @@ import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargeDTO;
|
|||||||
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayResultDTO;
|
import cn.com.tenlion.operator.pojo.dtos.accountrecharge.AccountRechargePayResultDTO;
|
||||||
import cn.com.tenlion.operator.pojo.pos.accountrecharge.AccountRechargePO;
|
import cn.com.tenlion.operator.pojo.pos.accountrecharge.AccountRechargePO;
|
||||||
import cn.com.tenlion.operator.service.accountrecharge.IAccountRechargeService;
|
import cn.com.tenlion.operator.service.accountrecharge.IAccountRechargeService;
|
||||||
import cn.com.tenlion.operator.util.pay.ALiPay;
|
import cn.com.tenlion.operator.util.pay.*;
|
||||||
import cn.com.tenlion.operator.util.pay.PayResultDTO;
|
|
||||||
import cn.com.tenlion.operator.util.pay.PayUtil;
|
|
||||||
import cn.com.tenlion.operator.util.pay.WXPay;
|
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.quartz.DisallowConcurrentExecution;
|
import org.quartz.DisallowConcurrentExecution;
|
||||||
@ -31,9 +28,14 @@ public class WxPayResultCheckTask {
|
|||||||
private static final Logger LOG = LoggerFactory.getLogger(WxPayResultCheckTask.class);
|
private static final Logger LOG = LoggerFactory.getLogger(WxPayResultCheckTask.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAccountRechargeService iAccountRechargeService;
|
private IAccountRechargeService iAccountRechargeService;
|
||||||
|
@Autowired
|
||||||
|
private AliPayProperties aliPayProperties;
|
||||||
|
@Autowired
|
||||||
|
private WxPayProperties wxPayProperties;
|
||||||
|
|
||||||
private static IAccountRechargeService iAccountRechargeStaticService;
|
private static IAccountRechargeService iAccountRechargeStaticService;
|
||||||
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
iAccountRechargeStaticService = this.iAccountRechargeService;
|
iAccountRechargeStaticService = this.iAccountRechargeService;
|
||||||
@ -90,7 +92,7 @@ public class WxPayResultCheckTask {
|
|||||||
accountRechargePOS.forEach(po -> {
|
accountRechargePOS.forEach(po -> {
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
LocalDateTime gmtCreateDateTime = LocalDateTime.parse(po.getGmtCreate(), DateTimeFormatter.ofPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
LocalDateTime gmtCreateDateTime = LocalDateTime.parse(po.getGmtCreate(), DateTimeFormatter.ofPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||||
if (StringUtils.equals(po.getThirdParty(), ThirdPartyEnum.WX.getValue())) {
|
if (StringUtils.equals(po.getThirdParty(), ThirdPartyEnum.WX.getValue()) && wxPayProperties.getActivate()) {
|
||||||
PayResultDTO payResultDTO = WXPay.queryPay(po.getAccountRechargeId());
|
PayResultDTO payResultDTO = WXPay.queryPay(po.getAccountRechargeId());
|
||||||
// 成功
|
// 成功
|
||||||
if (payResultDTO.getOrderStatus().equals("1") && payResultDTO.getMoney().equals(PayUtil.buiderMoney(po.getRechargeMoney()))) {
|
if (payResultDTO.getOrderStatus().equals("1") && payResultDTO.getMoney().equals(PayUtil.buiderMoney(po.getRechargeMoney()))) {
|
||||||
@ -100,7 +102,7 @@ public class WxPayResultCheckTask {
|
|||||||
iAccountRechargeStaticService.updateClose(po.getAccountRechargeId());
|
iAccountRechargeStaticService.updateClose(po.getAccountRechargeId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (StringUtils.equals(po.getThirdParty(), ThirdPartyEnum.ZFB.getValue())) {
|
} else if (StringUtils.equals(po.getThirdParty(), ThirdPartyEnum.ZFB.getValue()) && aliPayProperties.getActivate()) {
|
||||||
PayResultDTO payResultDTO = ALiPay.queryPay(po.getAccountRechargeId());
|
PayResultDTO payResultDTO = ALiPay.queryPay(po.getAccountRechargeId());
|
||||||
// 成功
|
// 成功
|
||||||
if (payResultDTO.getOrderStatus().equals("1") &&
|
if (payResultDTO.getOrderStatus().equals("1") &&
|
||||||
|
@ -160,6 +160,7 @@ sms:
|
|||||||
|
|
||||||
pay:
|
pay:
|
||||||
wx-pay:
|
wx-pay:
|
||||||
|
activate: false
|
||||||
# 商户号
|
# 商户号
|
||||||
mch-id: 1609461201
|
mch-id: 1609461201
|
||||||
# 商户API证书序列号
|
# 商户API证书序列号
|
||||||
@ -181,6 +182,7 @@ pay:
|
|||||||
# 单笔最小金额
|
# 单笔最小金额
|
||||||
min-money: 0.01
|
min-money: 0.01
|
||||||
ali-pay:
|
ali-pay:
|
||||||
|
activate: false
|
||||||
# 应用ID
|
# 应用ID
|
||||||
# 西藏 app-id: 2021004137636507
|
# 西藏 app-id: 2021004137636507
|
||||||
app-id: 2021004138650351
|
app-id: 2021004138650351
|
||||||
@ -205,9 +207,11 @@ app-token:
|
|||||||
has-role: true
|
has-role: true
|
||||||
|
|
||||||
wx-miniapp:
|
wx-miniapp:
|
||||||
|
activate: false
|
||||||
appid: wxe17874894f7ff27b
|
appid: wxe17874894f7ff27b
|
||||||
appsecret: 0c2b1371e4fb32514030233da4ef094d
|
appsecret: 0c2b1371e4fb32514030233da4ef094d
|
||||||
wx-oauth2:
|
wx-oauth2:
|
||||||
|
activate: false
|
||||||
appid: wxb6296ee6223aafa0
|
appid: wxb6296ee6223aafa0
|
||||||
appsecret: 09c423893098cd5566aead093ea5c25c
|
appsecret: 09c423893098cd5566aead093ea5c25c
|
||||||
# redirect-uri: https://www.aimzhu.com/operator/oauth/wx/qrcode
|
# redirect-uri: https://www.aimzhu.com/operator/oauth/wx/qrcode
|
||||||
|
@ -185,7 +185,7 @@
|
|||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="login-type">
|
<div class="login-type">
|
||||||
<div class="third-login">
|
<div class="third-login">
|
||||||
<a href="javascript:void(0);" class="wx-login logo" @click="onLoginTypeClick('wx')" v-if="loginType !== 'wx'">
|
<a href="javascript:void(0);" class="wx-login logo" @click="onLoginTypeClick('wx')" v-if="pageParams.wxOauth === 'true' && loginType !== 'wx'">
|
||||||
<img src="assets/images/wx-login.png" alt="加载失败"/>
|
<img src="assets/images/wx-login.png" alt="加载失败"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -428,6 +428,9 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
initWxQrcode: function() {
|
initWxQrcode: function() {
|
||||||
|
if(this.pageParams.wxOauth === 'false') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// var layIndex = layer.msg('正在加载二维码,请稍后...', {icon: 16, shade: 0.1, time: 0});
|
// var layIndex = layer.msg('正在加载二维码,请稍后...', {icon: 16, shade: 0.1, time: 0});
|
||||||
var obj = new WxLogin({
|
var obj = new WxLogin({
|
||||||
self_redirect: false,
|
self_redirect: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user