提交 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 {
......
...@@ -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;
} }
...@@ -32,139 +32,149 @@ import me.zohar.runscore.useraccount.domain.UserAccount; ...@@ -32,139 +32,149 @@ import me.zohar.runscore.useraccount.domain.UserAccount;
@DynamicUpdate(true) @DynamicUpdate(true)
public class MerchantOrder { public class MerchantOrder {
/** /**
* 主键id * 主键id
*/ */
@Id @Id
@Column(name = "id", length = 32) @Column(name = "id", length = 32)
private String id; private String id;
/** /**
* 订单号 * 订单号
*/ */
private String orderNo; private String orderNo;
/** /**
* 收款渠道 * 收款渠道
*/ */
private String gatheringChannelCode; private String gatheringChannelCode;
/** /**
* 收款金额 * 收款金额
*/ */
private Double gatheringAmount; private Double gatheringAmount;
/** /**
* 提交时间 * 提交时间
*/ */
private Date submitTime; private Date submitTime;
/** /**
* 有效时间 * 有效时间
*/ */
private Date usefulTime; private Date usefulTime;
/** /**
* 订单状态 * 订单状态
*/ */
private String orderState; private String orderState;
/** /**
* 备注 * 备注
*/ */
private String note; private String note;
@Column(name = "merchant_id", length = 32) @Column(name = "merchant_id", length = 32)
private String merchantId; private String merchantId;
/** /**
* 接单人账号id * 接单人账号id
*/ */
@Column(name = "received_account_id", length = 32) @Column(name = "received_account_id", length = 32)
private String receivedAccountId; private String receivedAccountId;
/** /**
* 接单时间 * 接单时间
*/ */
private Date receivedTime; private Date receivedTime;
private String gatheringCodeStorageId; private String gatheringCodeStorageId;
/** /**
* 商户确认时间 * 商户确认时间
*/ */
private Date platformConfirmTime; private Date platformConfirmTime;
/** /**
* 处理时间 * 处理时间
*/ */
private Date dealTime; private Date dealTime;
/** /**
* 确认时间 * 确认时间
*/ */
private Date confirmTime; private Date confirmTime;
/** /**
* 奖励金 * 奖励金
*/ */
private Double bounty; private Double bounty;
/** /**
* 乐观锁版本号 * 扣除手续费的金额
*/ */
@Version private Double settleAmount;
private Long version;
/**
@NotFound(action = NotFoundAction.IGNORE) * 乐观锁版本号
@ManyToOne(fetch = FetchType.LAZY) */
@JoinColumn(name = "merchant_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT)) @Version
private Merchant merchant; private Long version;
@NotFound(action = NotFoundAction.IGNORE) @NotFound(action = NotFoundAction.IGNORE)
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "received_account_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT)) @JoinColumn(name = "merchant_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
private UserAccount receivedAccount; private Merchant merchant;
@Column(name = "pay_info_id", length = 32) @NotFound(action = NotFoundAction.IGNORE)
private String payInfoId; @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "received_account_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
@NotFound(action = NotFoundAction.IGNORE) private UserAccount receivedAccount;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "pay_info_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT)) @Column(name = "pay_info_id", length = 32)
private MerchantOrderPayInfo payInfo; private String payInfoId;
public void updateBounty(Double bounty) { @NotFound(action = NotFoundAction.IGNORE)
this.setBounty(bounty); @OneToOne(fetch = FetchType.LAZY)
} @JoinColumn(name = "pay_info_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
private MerchantOrderPayInfo payInfo;
public void merchantConfirmToPaid() {
this.setOrderState(Constant.商户订单状态_商户已确认支付);
this.setPlatformConfirmTime(new Date()); public void updateSettleAmount(Double settleAmount) {
} this.setSettleAmount(settleAmount);
}
public void confirmToPaid(String note) {
this.setOrderState(Constant.商户订单状态_已支付); public void updateBounty(Double bounty) {
this.setConfirmTime(new Date()); this.setBounty(bounty);
this.setDealTime(this.getConfirmTime()); }
this.setNote(note);
} public void merchantConfirmToPaid() {
this.setOrderState(Constant.商户订单状态_商户已确认支付);
public void updateReceived(String receivedAccountId, String gatheringCodeStorageId) { this.setPlatformConfirmTime(new Date());
this.setReceivedAccountId(receivedAccountId); }
this.setGatheringCodeStorageId(gatheringCodeStorageId);
this.setOrderState(Constant.商户订单状态_已接单); public void confirmToPaid(String note) {
this.setReceivedTime(new Date()); this.setOrderState(Constant.商户订单状态_已支付);
} this.setConfirmTime(new Date());
this.setDealTime(this.getConfirmTime());
public void customerCancelOrderRefund() { this.setNote(note);
this.setOrderState(Constant.商户订单状态_客服取消订单退款); }
this.setConfirmTime(new Date());
this.setDealTime(this.getConfirmTime()); public void updateReceived(String receivedAccountId, String gatheringCodeStorageId) {
} this.setReceivedAccountId(receivedAccountId);
this.setGatheringCodeStorageId(gatheringCodeStorageId);
public void updateUsefulTime(Date usefulTime) { this.setOrderState(Constant.商户订单状态_已接单);
this.setUsefulTime(usefulTime); this.setReceivedTime(new Date());
} }
public void customerCancelOrderRefund() {
this.setOrderState(Constant.商户订单状态_客服取消订单退款);
this.setConfirmTime(new Date());
this.setDealTime(this.getConfirmTime());
}
public void updateUsefulTime(Date usefulTime) {
this.setUsefulTime(usefulTime);
}
} }
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));
...@@ -202,7 +196,7 @@ public class MerchantOrderService { ...@@ -202,7 +196,7 @@ public class MerchantOrderService {
@Transactional(readOnly = true) @Transactional(readOnly = true)
public GatheringCode getGatheringCode(String receivedAccountId, String gatheringChannelCode, public GatheringCode getGatheringCode(String receivedAccountId, String gatheringChannelCode,
Double gatheringAmount) { Double gatheringAmount) {
ReceiveOrderSetting merchantOrderSetting = platformOrderSettingRepo.findTopByOrderByLatelyUpdateTime(); ReceiveOrderSetting merchantOrderSetting = platformOrderSettingRepo.findTopByOrderByLatelyUpdateTime();
if (merchantOrderSetting.getUnfixedGatheringCodeReceiveOrder()) { if (merchantOrderSetting.getUnfixedGatheringCodeReceiveOrder()) {
GatheringCode gatheringCode = gatheringCodeRepo GatheringCode gatheringCode = gatheringCodeRepo
...@@ -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());
} }
vo.setPayUrl(ConfigHolder.getConfigValue("merchantOrderPayUrl") + vo.getOrderNo()); if(merchantOrder.getGatheringChannelCode().equals(Constant.支付渠道_银行卡))
{
vo.setPayUrl(ConfigHolder.getConfigValue("merchantOrderPayUrlForCard") + vo.getOrderNo());
}else
{
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,15 +4,18 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -4,15 +4,18 @@ 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;
public interface UserAccountRepo extends JpaRepository<UserAccount, String>, JpaSpecificationExecutor<UserAccount> { public interface UserAccountRepo extends JpaRepository<UserAccount, String>, JpaSpecificationExecutor<UserAccount> {
UserAccount findByUserName(String userName);
Long countByInviterId(String inviterId);
List<UserAccount> findAllByAccountType(String accountType); UserAccount findByUserName(String userName);
Long countByInviterId(String inviterId);
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 {
......
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论