提交 1ac3bc13 authored 作者: jacksmith1988's avatar jacksmith1988

//add code

上级 425a771c
package me.zohar.runscore.config.security; package me.zohar.runscore.config.security;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
...@@ -9,12 +10,13 @@ import javax.servlet.FilterChain; ...@@ -9,12 +10,13 @@ import javax.servlet.FilterChain;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@Slf4j @WebFilter(filterName = "CorsFilter")
@Component @Configuration
public class CorsFilter implements Filter { public class CorsFilter implements Filter {
@Override @Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
......
...@@ -8,7 +8,6 @@ import lombok.Getter; ...@@ -8,7 +8,6 @@ import lombok.Getter;
* *
* @author zohar * @author zohar
* @date 2019年1月7日 * @date 2019年1月7日
*
*/ */
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
...@@ -64,6 +63,8 @@ public enum BizError { ...@@ -64,6 +63,8 @@ public enum BizError {
商户未接入("1015", "商户未接入"), 商户未接入("1015", "商户未接入"),
系统无可用商户("1015", "系统无可用商户"),
商户订单不存在("1015", "商户订单不存在"), 商户订单不存在("1015", "商户订单不存在"),
不支持该支付类型("1015", "不支持该支付类型"), 不支持该支付类型("1015", "不支持该支付类型"),
...@@ -168,7 +169,8 @@ public enum BizError { ...@@ -168,7 +169,8 @@ public enum BizError {
不是上级账号无权查看该账号及下级的充值记录("1014", "不是上级账号无权查看该账号及下级的充值记录"), 不是上级账号无权查看该账号及下级的充值记录("1014", "不是上级账号无权查看该账号及下级的充值记录"),
不是上级账号无权查看该账号及下级的提现记录("1014", "不是上级账号无权查看该账号及下级的提现记录"),; 不是上级账号无权查看该账号及下级的提现记录("1014", "不是上级账号无权查看该账号及下级的提现记录"),
;
private String code; private String code;
......
...@@ -124,6 +124,8 @@ public class Constant { ...@@ -124,6 +124,8 @@ public class Constant {
public static final String 账变日志类型_奖励金返点 = "12"; public static final String 账变日志类型_奖励金返点 = "12";
public static final String 账变日志类型_订单结算 = "13";
public static final String 充提日志订单类型_充值 = "1"; public static final String 充提日志订单类型_充值 = "1";
public static final String 充提日志订单类型_提现 = "2"; public static final String 充提日志订单类型_提现 = "2";
......
package me.zohar.runscore.merchant.domain; package me.zohar.runscore.merchant.domain;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import javax.persistence.Column; import javax.persistence.Column;
...@@ -77,4 +78,10 @@ public class Merchant { ...@@ -77,4 +78,10 @@ public class Merchant {
@JoinColumn(name = "relevance_account_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT)) @JoinColumn(name = "relevance_account_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
private UserAccount relevanceAccount; private UserAccount relevanceAccount;
private BigDecimal alipayRate;
private BigDecimal wechatRate;
private BigDecimal bankcardRate;
} }
...@@ -110,6 +110,11 @@ public class MerchantOrder { ...@@ -110,6 +110,11 @@ public class MerchantOrder {
*/ */
private Double bounty; private Double bounty;
/**
* 扣除手续费的金额
*/
private Double settleAmount;
/** /**
* 乐观锁版本号 * 乐观锁版本号
*/ */
...@@ -134,6 +139,11 @@ public class MerchantOrder { ...@@ -134,6 +139,11 @@ public class MerchantOrder {
@JoinColumn(name = "pay_info_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT)) @JoinColumn(name = "pay_info_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
private MerchantOrderPayInfo payInfo; private MerchantOrderPayInfo payInfo;
public void updateSettleAmount(Double settleAmount) {
this.setSettleAmount(settleAmount);
}
public void updateBounty(Double bounty) { public void updateBounty(Double bounty) {
this.setBounty(bounty); this.setBounty(bounty);
} }
......
package me.zohar.runscore.merchant.service; package me.zohar.runscore.merchant.service;
import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -28,6 +22,7 @@ import org.springframework.data.jpa.domain.Specification; ...@@ -28,6 +22,7 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import com.zengtengpeng.annotation.Lock; import com.zengtengpeng.annotation.Lock;
...@@ -113,7 +108,6 @@ public class MerchantOrderService { ...@@ -113,7 +108,6 @@ public class MerchantOrderService {
private OrderRebateRepo orderRebateRepo; private OrderRebateRepo orderRebateRepo;
@Transactional(readOnly = true) @Transactional(readOnly = true)
public MerchantOrderDetailsVO findMerchantOrderDetailsById(@NotBlank String orderId) { public MerchantOrderDetailsVO findMerchantOrderDetailsById(@NotBlank String orderId) {
MerchantOrderDetailsVO vo = MerchantOrderDetailsVO.convertFor(merchantOrderRepo.getOne(orderId)); MerchantOrderDetailsVO vo = MerchantOrderDetailsVO.convertFor(merchantOrderRepo.getOne(orderId));
...@@ -219,7 +213,7 @@ public class MerchantOrderService { ...@@ -219,7 +213,7 @@ public class MerchantOrderService {
return gatheringCode; return gatheringCode;
} }
} }
return null; return new GatheringCode();
} }
@Transactional @Transactional
...@@ -234,7 +228,8 @@ public class MerchantOrderService { ...@@ -234,7 +228,8 @@ public class MerchantOrderService {
} }
platformOrder.confirmToPaid(null); platformOrder.confirmToPaid(null);
merchantOrderRepo.save(platformOrder); merchantOrderRepo.save(platformOrder);
receiveOrderBountySettlement(platformOrder); merchantSettlement(platformOrder);
// receiveOrderBountySettlement(platformOrder);
} }
/** /**
...@@ -251,7 +246,51 @@ public class MerchantOrderService { ...@@ -251,7 +246,51 @@ public class MerchantOrderService {
} }
platformOrder.confirmToPaid(note); platformOrder.confirmToPaid(note);
merchantOrderRepo.save(platformOrder); merchantOrderRepo.save(platformOrder);
receiveOrderBountySettlement(platformOrder); merchantSettlement(platformOrder);
// receiveOrderBountySettlement(platformOrder);
}
/**
* 商户加钱
*/
@Transactional
public void merchantSettlement(MerchantOrder merchantOrder) {
UserAccount userAccount = merchantOrder.getReceivedAccount();
Merchant merchant = merchantOrder.getMerchant();
BigDecimal rate = new BigDecimal(0);
switch (merchantOrder.getGatheringChannelCode()) {
case Constant.支付渠道_微信码:
rate = Optional.ofNullable(merchant.getWechatRate()).orElse(new BigDecimal(0));
break;
case Constant.支付渠道_支付宝码:
rate = Optional.ofNullable(merchant.getAlipayRate()).orElse(new BigDecimal(0));
break;
case Constant.支付渠道_银行卡:
rate = Optional.ofNullable(merchant.getBankcardRate()).orElse(new BigDecimal(0));
break;
default:
break;
}
double rateFee = NumberUtil.round(merchantOrder.getGatheringAmount() * rate.doubleValue(), 4)
.doubleValue();
double merchantSettleAmount = merchantOrder.getGatheringAmount() - rateFee;
merchantOrder.updateSettleAmount(merchantSettleAmount);
//商户结算
UserAccount merchantAccount = merchant.getRelevanceAccount();
double cashDeposit = merchantAccount.getCashDeposit() + merchantSettleAmount;
merchantAccount.setCashDeposit(NumberUtil.round(cashDeposit, 4).doubleValue());
userAccountRepo.save(merchantAccount);
accountChangeLogRepo.save(AccountChangeLog.buildWithMerchantSettle(userAccount, merchantOrder));
} }
/** /**
...@@ -419,8 +458,9 @@ public class MerchantOrderService { ...@@ -419,8 +458,9 @@ public class MerchantOrderService {
merchantOrderPayInfoRepo.save(payInfo); merchantOrderPayInfoRepo.save(payInfo);
//todo this is temporary code 这里要匹配有资源的用户接单 //todo this is temporary code 这里要匹配有资源的用户接单
List<UserAccount> userAccounts = userAccountRepo.findAllByAccountType(Constant.账号类型_会员); List<UserAccount> userAccounts = userAccountRepo.findAllByAccountTypeAndState(Constant.账号类型_会员, Constant.账号状态_启用).orElseThrow(() -> new BizException(BizError.系统无可用商户));
;
this.receiveOrder(userAccounts.get(RandomUtil.randomInt(0, userAccounts.size())).getId(), merchantOrder.getId()); this.receiveOrder(userAccounts.get(RandomUtil.randomInt(0, userAccounts.size())).getId(), merchantOrder.getId());
return MerchantOrderVO.convertFor(merchantOrder); return MerchantOrderVO.convertFor(merchantOrder);
...@@ -446,7 +486,7 @@ public class MerchantOrderService { ...@@ -446,7 +486,7 @@ public class MerchantOrderService {
String gatheringCodeStorageId = getGatheringCodeStorageId(userAccountId, String gatheringCodeStorageId = getGatheringCodeStorageId(userAccountId,
platformOrder.getGatheringChannelCode(), platformOrder.getGatheringAmount()); platformOrder.getGatheringChannelCode(), platformOrder.getGatheringAmount());
//支付宝和微信才有收款码 //支付宝和微信才有收款码
if (StrUtil.isBlank(gatheringCodeStorageId) && !platformOrder.getGatheringChannelCode().equals(Constant.支付渠道_银行卡) ) { if (StrUtil.isBlank(gatheringCodeStorageId) && !platformOrder.getGatheringChannelCode().equals(Constant.支付渠道_银行卡)) {
throw new BizException(BizError.无法接单找不到对应金额的收款码); throw new BizException(BizError.无法接单找不到对应金额的收款码);
} }
// 校验用户是否达到接单上限,若达到上限,则不能接单 // 校验用户是否达到接单上限,若达到上限,则不能接单
......
...@@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; ...@@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import lombok.Data; import lombok.Data;
import me.zohar.runscore.constants.Constant;
import me.zohar.runscore.dictconfig.ConfigHolder; import me.zohar.runscore.dictconfig.ConfigHolder;
import me.zohar.runscore.dictconfig.DictHolder; import me.zohar.runscore.dictconfig.DictHolder;
import me.zohar.runscore.merchant.domain.MerchantOrder; import me.zohar.runscore.merchant.domain.MerchantOrder;
...@@ -136,7 +137,14 @@ public class MerchantOrderVO { ...@@ -136,7 +137,14 @@ public class MerchantOrderVO {
if (StrUtil.isNotBlank(merchantOrder.getReceivedAccountId()) && merchantOrder.getReceivedAccount() != null) { if (StrUtil.isNotBlank(merchantOrder.getReceivedAccountId()) && merchantOrder.getReceivedAccount() != null) {
vo.setReceiverUserName(merchantOrder.getReceivedAccount().getUserName()); vo.setReceiverUserName(merchantOrder.getReceivedAccount().getUserName());
} }
if(merchantOrder.getGatheringChannelCode().equals(Constant.支付渠道_银行卡))
{
vo.setPayUrl(ConfigHolder.getConfigValue("merchantOrderPayUrlForCard") + vo.getOrderNo());
}else
{
vo.setPayUrl(ConfigHolder.getConfigValue("merchantOrderPayUrl") + vo.getOrderNo()); vo.setPayUrl(ConfigHolder.getConfigValue("merchantOrderPayUrl") + vo.getOrderNo());
}
vo.setPayInfo(MerchantOrderPayInfoVO.convertFor(merchantOrder.getPayInfo())); vo.setPayInfo(MerchantOrderPayInfoVO.convertFor(merchantOrder.getPayInfo()));
return vo; return vo;
} }
......
...@@ -35,6 +35,6 @@ public class TotalAccountReceiveOrderSituation { ...@@ -35,6 +35,6 @@ public class TotalAccountReceiveOrderSituation {
private Long paidOrderNum; private Long paidOrderNum;
private Double rebateAmount; //private Double rebateAmount;
} }
...@@ -302,4 +302,24 @@ public class AccountChangeLog { ...@@ -302,4 +302,24 @@ public class AccountChangeLog {
return log; return log;
} }
/**
* 构建商户结算账变日志
*
* @param userAccount
* @param merchantOrder
* @return
*/
public static AccountChangeLog buildWithMerchantSettle(UserAccount userAccount, MerchantOrder merchantOrder) {
AccountChangeLog log = new AccountChangeLog();
log.setId(IdUtils.getId());
log.setOrderNo(merchantOrder.getId());
log.setAccountChangeTime(new Date());
log.setAccountChangeTypeCode(Constant.账变日志类型_订单结算);
log.setAccountChangeAmount(NumberUtil.round(merchantOrder.getSettleAmount(), 4).doubleValue());
log.setCashDeposit(userAccount.getCashDeposit());
log.setUserAccountId(userAccount.getId());
return log;
}
} }
...@@ -4,6 +4,7 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -4,6 +4,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List; import java.util.List;
import java.util.Optional;
import me.zohar.runscore.useraccount.domain.UserAccount; import me.zohar.runscore.useraccount.domain.UserAccount;
...@@ -15,4 +16,6 @@ public interface UserAccountRepo extends JpaRepository<UserAccount, String>, Jpa ...@@ -15,4 +16,6 @@ public interface UserAccountRepo extends JpaRepository<UserAccount, String>, Jpa
Long countByInviterId(String inviterId); Long countByInviterId(String inviterId);
List<UserAccount> findAllByAccountType(String accountType); List<UserAccount> findAllByAccountType(String accountType);
Optional<List<UserAccount>> findAllByAccountTypeAndState(String accountType, String state);
} }
...@@ -86,4 +86,9 @@ public class PageController { ...@@ -86,4 +86,9 @@ public class PageController {
return "pay"; return "pay";
} }
@GetMapping("/bankpay")
public String bankpay() {
return "bankpay";
}
} }
package me.zohar.runscore.config.security; package me.zohar.runscore.config.security;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
...@@ -9,12 +10,13 @@ import javax.servlet.FilterChain; ...@@ -9,12 +10,13 @@ import javax.servlet.FilterChain;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@Slf4j @WebFilter(filterName = "CorsFilter")
@Component @Configuration
public class CorsFilter implements Filter { public class CorsFilter implements Filter {
@Override @Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
......
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta name="renderer" content="webkit">
<title>支付</title>
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
<script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
<script src="https://cdn.bootcss.com/dayjs/1.7.8/dayjs.min.js"></script>
<script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>
<style type="text/css">
@charset "UTF-8";
[v-cloak] {
display: none;
}
html, body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial,
sans-serif;
font-weight: 400;
overflow-x: hidden;
overflow-y: auto;
background: #f4f6f8;
font-size: 14px;
color: #616161;
}
.container {
max-width: 650px;
margin: 0 auto;
}
.header {
background: #fff;
border-bottom: 1px solid #eee;
height: 130px;
padding-top: 1px;
text-align: center;
margin-bottom: 15px;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
}
.header .logo {
width: 123px;
height: 130px;
margin: 0 auto;
background: url(union.png) no-repeat;
background-size: cover;
}
.header .logo.union {
background-image: url(union.png);
}
.mainbody {
margin: 0 auto;
margin-top: 15px;
padding-bottom: 10px;
text-align: center;
color: #333;
padding-top: 6px;
background: #fff;
background-size: auto 6px;
min-height: 400px;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
}
.realprice {
font-size: 26px;
margin-top: 5px;
margin-bottom: 5px;
}
.discountprice {
color: #ff6600;
margin-bottom: 10px;
}
.qrcode {
width: 200px;
height: 200px;
margin: 20px auto;
position: relative;
}
.qrcode img {
width: 100%;
height: 100%;
}
.qrcode .logo {
position: absolute;
top: 50%;
left: 50%;
height: 30px;
width: 30px;
margin-left: -15px;
margin-top: -15px;
background: #fff url("wechat.png") no-repeat center center;
background-size: cover;
border-radius: 3px;
}
.qrcode .logo.logo-alipay {
background-image: url("alipay.png");
}
.qrcode .expired {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
opacity: .95;
background: #fff url("expired.png") center center no-repeat;
}
.qrcode .paid {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
opacity: .95;
background: #fff url("paid.png") center center no-repeat;
}
.warning {
color: #f00;
}
.success {
color: #05af19;
}
.remainseconds {
width: 200px;
margin: 0 auto;
text-align: center;
}
.remainseconds .time {
width: 55px;
height: 90px;
}
.remainseconds .time b {
font-size: 40px;
font-weight: 300;
}
.remainseconds .time b, .remainseconds .time em {
display: block;
}
.remainseconds .time em {
font-style: normal;
color: #888;
}
@media ( max-width : 375px) {
.container {
padding: 0;
}
.remainseconds {
padding: 0 35px 10px 35px;
height: 80px;
}
.remainseconds .time {
height: 100%;
}
.remainseconds .time b {
font-size: 36px;
}
}
@media ( max-width : 320px) {
.remainseconds {
padding: 0 35px 10px 35px;
height: 87px;
}
.remainseconds .time {
height: 100%;
}
.remainseconds .time b {
font-size: 36px;
}
.container {
padding: 0;
}
.qrcode {
width: 200px;
height: 200px;
}
.realprice {
font-size: 36px;
}
}
.minutes {
float: left;
}
.seconds {
float: left;
}
.colon {
float: left;
width: 20px;
font-size: 30px;
line-height: 50px;
font-family: Vernada, 'Microsoft Yahei';
}
.tips {
background: #fff;
padding: 5px 0;
line-height: 25px;
overflow: hidden;
display: block;
clear: both;
}
.help {
line-height: 25px;
text-align: center;
font-size: 14px;
}
.footer {
height: 60px;
line-height: 60px;
text-align: center;
font-size: 12px;
}
.overdue {
position: absolute;
width: 100%;
margin: 0 auto;
top: 260px;
display: none;
}
</style>
</head>
<body>
<div id="pay" class="container" v-cloak>
<div class="mainbody">
<div class="realprice">
<span>{{orderInfo.gatheringAmount}}</span>
</div>
<h1 class="text-center text-success" style="color: #468847;" v-show="paySuccessFlag">
<strong>支付成功</strong>
</h1>
<div class="qrcode" v-show="!paySuccessFlag">
<div v-show="!overdueFlag">
银行:<b>{{orderInfo.gatheringCode.bankAddress}}</b><br>
户主:<span id="username"><b>{{orderInfo.gatheringCode.bankUsername}}</b></span>
<button class="app_btn" data-clipboard-action="copy" data-clipboard-target="#username" id="copy_btn1">复制</button>
<br>
卡号:<span id="bankcode"><b>{{orderInfo.gatheringCode.bankCode}}</b></span>
<button class="app_btn" data-clipboard-action="copy" data-clipboard-target="#bankcode" id="copy_btn2">复制</button>
<br>
</div>
<!-- <img class="image" :src="orderInfo.gatheringCodeStorageId != null ? '/storage/fetch/' + orderInfo.gatheringCodeStorageId : 'images/pay/loading.gif'" style="width: 200px; height: 200px;" v-show="!overdueFlag">-->
<img class="image" src="images/pay/overdue.png" style="width: 200px; height: 200px;" v-show="overdueFlag">
</div>
<div class="remainseconds">
<p>
有效时间: <span id="leftTime" style="color: red;">{{countdownMinute}}:{{countdownSecond}}</span><br>过期请重新发起支付
</p>
</div>
<div class="tips">
<p style="color: red; font-weight: bold;">卡信息仅当次有效,请勿重复支付</p>
<!-- <p>请使用{{orderInfo.gatheringChannelName}}扫一扫</p>-->
<!-- <p>或</p>-->
<!-- <p>截屏后打开{{orderInfo.gatheringChannelName}}扫一扫,从相册中选择图片</p>-->
</div>
<div class="help">
任何问题请联系客服<br> 订单号:<span>{{orderNo}}</span>
</div>
</div>
</div>
<script type="text/javascript">
// 在点击复制按钮上new一个 Clipboard 对象
let clipboard1 = new Clipboard('.app_btn');
//然后设置复制成功的回调监听
clipboard1.on('success', function (e) {
// 复制成功时
// 清除选中的文字的选择状态
e.clearSelection();
alert('复制成功')
});
/*let clipboard2 = new Clipboard('#copy_btn2');
//然后设置复制成功的回调监听
clipboard2.on('success', function (e) {
// 复制成功时
// 清除选中的文字的选择状态
e.clearSelection();
alert('复制成功')
});*/
Vue.http.interceptors.push(function(request) {
return function(response) {
if (response.body.code != 200) {
response.ok = false;
layer.alert(response.body.msg, {
title : '提示',
icon : 7,
time : 3000
});
}
};
});
var payVM = new Vue({
el : '#pay',
data : {
orderNo : '',
overdueFlag : false,
residueSecond : '',
countdownHour : '',
countdownMinute : '--',
countdownSecond : '--',
countdownInterval : null,
paySuccessFlag : false,
checkPaySuccessInterval : null,
orderInfo : {},
},
computed : {},
created : function() {
var orderNo = this.getQueryString('orderNo');
if (orderNo == null || orderNo == '') {
layer.alert('无效的订单号', {
title : '提示',
icon : 7,
time : 3000
});
return;
}
this.orderNo = orderNo;
this.firstLoadGatheringCode();
},
methods : {
firstLoadGatheringCode : function() {
var that = this;
that.$http.get('/api/getOrderGatheringCode', {
params : {
orderNo : that.orderNo
}
}).then(function(res) {
that.orderInfo = res.body.data;
if (that.orderInfo.orderState == '4') {
that.paySuccessFlag = true;
that.toReturnUrl();
return;
}
that.overdueFlag = !dayjs(that.orderInfo.usefulTime).isAfter(dayjs());
if (!that.overdueFlag) {
that.residueSecond = dayjs(that.orderInfo.usefulTime).diff(dayjs(res.body.timestamp), 'second');
that.countdown();
if (that.orderInfo.orderState == '1') {
that.loadGatheringCode();
}
}
});
},
toReturnUrl : function() {
var that = this;
setTimeout(function() {
window.location.href = that.orderInfo.returnUrl;
}, 2000);
},
loadGatheringCode : function() {
var that = this;
that.loadGatheringCodeInterval = window.setInterval(function() {
if (that.orderInfo.orderState == '2' || that.orderInfo.orderState == '4') {
if (that.loadGatheringCodeInterval != null) {
window.clearInterval(that.loadGatheringCodeInterval);
that.loadGatheringCodeInterval = null;
}
return;
}
that.loadGatheringCodeInner();
}, 3000);
},
loadGatheringCodeInner : function() {
var that = this;
that.$http.get('/api/getOrderGatheringCode', {
params : {
orderNo : that.orderNo
}
}).then(function(res) {
that.orderInfo = res.body.data;
if (that.orderInfo.orderState == '2' || that.orderInfo.orderState == '4') {
that.residueSecond = dayjs(that.orderInfo.usefulTime).diff(dayjs(res.body.timestamp), 'second');
that.checkPaySuccess();
}
});
},
checkPaySuccess : function() {
var that = this;
that.checkPaySuccessInterval = window.setInterval(function() {
if (that.orderInfo.orderState == '4') {
that.paySuccessFlag = true;
that.toReturnUrl();
if (that.checkPaySuccessInterval != null) {
window.clearInterval(that.checkPaySuccessInterval);
that.checkPaySuccessInterval = null;
}
if (that.countdownInterval != null) {
window.clearInterval(that.countdownInterval);
that.countdownInterval = null;
}
return;
}
that.checkPaySuccessInner();
}, 3000);
},
checkPaySuccessInner : function() {
var that = this;
that.$http.get('/api/getOrderGatheringCode', {
params : {
orderNo : that.orderNo
}
}).then(function(res) {
that.orderInfo = res.body.data;
});
},
countdown : function() {
var that = this;
that.countdownInterval = window.setInterval(function() {
var residueSecond = that.residueSecond;
that.updateCountdownClock(residueSecond);
residueSecond--;
that.residueSecond = residueSecond;
if (residueSecond < 0) {
window.clearInterval(that.countdownInterval);
that.countdownInterval = null;
if (that.loadGatheringCodeInterval != null) {
window.clearInterval(that.loadGatheringCodeInterval);
that.loadGatheringCodeInterval = null;
}
that.overdueFlag = true;
}
}, 1000);
},
/**
* 更新倒计时
*/
updateCountdownClock : function(residueSecond) {
var that = this;
var countdownHour = 0;
var countdownMinute = 0;
var countdownSecond = 0;
if (residueSecond > 0) {
countdownHour = parseInt(residueSecond / (60 * 60) % 24);
countdownMinute = parseInt(residueSecond / 60 % 60);
countdownSecond = parseInt(residueSecond % 60);
}
if (countdownHour < 10) {
countdownHour = '0' + countdownHour;
}
if (countdownMinute < 10) {
countdownMinute = '0' + countdownMinute;
}
if (countdownSecond < 10) {
countdownSecond = '0' + countdownSecond;
}
that.countdownHour = countdownHour;
that.countdownMinute = countdownMinute;
that.countdownSecond = countdownSecond;
console.log(that.countdownSecond);
},
getQueryString : function(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
if (r != null)
return unescape(r[2]);
return null;
}
}
});
</script>
</body>
</html>
\ No newline at end of file
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<li class="nav-item" v-bind:class="{'active': currentPathName == '/appeal-record'}" v-on:click="navTo('/appeal-record')"><a class="nav-link">申诉记录</a></li> <li class="nav-item" v-bind:class="{'active': currentPathName == '/appeal-record'}" v-on:click="navTo('/appeal-record')"><a class="nav-link">申诉记录</a></li>
</ul> </ul>
<form class="form-inline" style="float: right;"> <form class="form-inline" style="float: right;">
<span style="padding-right: 20px;">商户端:{{userName}}</span> <span style="padding-right: 20px;">商户端:{{userName}} 当前余额:{{cashDeposit}}</span>
<button type="button" class="btn btn-light btn-sm" v-on:click="logout">退出登录</button> <button type="button" class="btn btn-light btn-sm" v-on:click="logout">退出登录</button>
</form> </form>
</nav> </nav>
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
el : '#header', el : '#header',
data : { data : {
userName : '', userName : '',
currentPathName : '' currentPathName : '',
cashDeposit:''
}, },
computed : {}, computed : {},
created : function() { created : function() {
...@@ -63,6 +64,7 @@ ...@@ -63,6 +64,7 @@
that.isLoggedInFlag = false; that.isLoggedInFlag = false;
} else { } else {
that.userName = res.body.data.userName; that.userName = res.body.data.userName;
that.cashDeposit = res.body.data.cashDeposit;
} }
}); });
}, },
......
package me.zohar.runscore.config.security; package me.zohar.runscore.config.security;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
...@@ -9,12 +10,13 @@ import javax.servlet.FilterChain; ...@@ -9,12 +10,13 @@ import javax.servlet.FilterChain;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@Slf4j @WebFilter(filterName = "CorsFilter")
@Component @Configuration
public class CorsFilter implements Filter { public class CorsFilter implements Filter {
@Override @Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
......
...@@ -866,7 +866,7 @@ CREATE TABLE `v_merchant_everyday_statistical` ( ...@@ -866,7 +866,7 @@ CREATE TABLE `v_merchant_everyday_statistical` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ---------------------------- /*-- ----------------------------
-- Table structure for v_merchant_month_statistical -- Table structure for v_merchant_month_statistical
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `v_merchant_month_statistical`; DROP TABLE IF EXISTS `v_merchant_month_statistical`;
...@@ -901,7 +901,7 @@ CREATE TABLE `v_merchant_total_statistical` ( ...@@ -901,7 +901,7 @@ CREATE TABLE `v_merchant_total_statistical` (
`trade_amount` double DEFAULT NULL, `trade_amount` double DEFAULT NULL,
PRIMARY KEY (`merchant_id`) PRIMARY KEY (`merchant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
*/
-- ---------------------------- -- ----------------------------
-- Table structure for v_rebate_situation -- Table structure for v_rebate_situation
-- ---------------------------- -- ----------------------------
......
/*
MySQL Backup
Database: runscore
Backup Time: 2021-11-13 10:39:45
*/
SET FOREIGN_KEY_CHECKS=0;
DROP VIEW IF EXISTS `runscore`.`v_merchant_month_statistical`;
DROP VIEW IF EXISTS `runscore`.`v_merchant_today_statistical`;
DROP VIEW IF EXISTS `runscore`.`v_merchant_total_statistical`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_merchant_month_statistical` AS select `po`.`merchant_id` AS `merchant_id`,round(sum(`po`.`gathering_amount`),4) AS `gathering_amount`,count(1) AS `order_num`,round(sum((case when (`po`.`order_state` = '4') then `po`.`gathering_amount` else 0 end)),4) AS `trade_amount`,sum((case when (`po`.`order_state` = '4') then 1 else 0 end)) AS `paid_order_num` from (`merchant_order` `po` left join `merchant` `ua` on((`po`.`merchant_id` = `ua`.`id`))) where ((`po`.`received_account_id` is not null) and (`po`.`submit_time` >= str_to_date(date_format(curdate(),'%Y-%m-01 00:00:00'),'%Y-%m-%d %H:%i:%s')) and (`po`.`submit_time` < (str_to_date(date_format(curdate(),'%Y-%m-01 00:00:00'),'%Y-%m-%d %H:%i:%s') + interval 1 month))) group by `po`.`merchant_id`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_merchant_today_statistical` AS select `po`.`merchant_id` AS `merchant_id`,round(sum(`po`.`gathering_amount`),4) AS `gathering_amount`,count(1) AS `order_num`,round(sum((case when (`po`.`order_state` = '4') then `po`.`gathering_amount` else 0 end)),4) AS `trade_amount`,sum((case when (`po`.`order_state` = '4') then 1 else 0 end)) AS `paid_order_num` from (`merchant_order` `po` left join `merchant` `ua` on((`po`.`merchant_id` = `ua`.`id`))) where ((`po`.`received_account_id` is not null) and (`po`.`received_time` >= str_to_date(date_format(now(),'%Y-%m-%d'),'%Y-%m-%d %H:%i:%s')) and (`po`.`received_time` < (str_to_date(date_format(now(),'%Y-%m-%d'),'%Y-%m-%d %H:%i:%s') + interval 1 day))) group by `po`.`merchant_id`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_merchant_total_statistical` AS select `po`.`merchant_id` AS `merchant_id`,round(sum(`po`.`gathering_amount`),4) AS `gathering_amount`,count(1) AS `order_num`,round(sum((case when (`po`.`order_state` = '4') then `po`.`gathering_amount` else 0 end)),4) AS `trade_amount`,sum((case when (`po`.`order_state` = '4') then 1 else 0 end)) AS `paid_order_num` from (`merchant_order` `po` left join `merchant` `ua` on((`po`.`merchant_id` = `ua`.`id`))) where (`po`.`received_account_id` is not null) group by `po`.`merchant_id`;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论