提交 f3e415a8 authored 作者: jacksmith1988's avatar jacksmith1988

//add code

上级 1ac3bc13
......@@ -84,7 +84,10 @@ var platformVM = new Vue({
merchantNum : '',
name : '',
secretKey : '',
relevanceAccountUserName : ''
relevanceAccountUserName : '',
alipayRate:'0',
alipayRate:'0',
alipayRate:'0'
}
},
......
......@@ -47,23 +47,44 @@
<div class="modal-body">
<form>
<div class="form-group row">
<div class="col-sm-12">
<div class="col-sm-12 form-inline">
<label>商户号:</label> <input type="text" class="form-control" v-model="editPlatform.merchantNum">
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="col-sm-12 form-inline">
<label>商户名称:</label> <input type="text" class="form-control" v-model="editPlatform.name">
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="col-sm-12 form-inline">
<label>接入密钥:</label>
<textarea class="form-control" rows="" cols="" v-model="editPlatform.secretKey"></textarea>
</div>
</div>
<div class="form-group row">
<div class="col-sm-12 form-inline">
<label>支付宝扫码费率(如果配置0.05 以100为例,收取5元费用):</label>
<input class="form-control" rows="" cols="" v-model="editPlatform.alipayRate"></input>
</div>
</div>
<div class="form-group row">
<div class="col-sm-12 form-inline">
<label>微信扫码费率(如果配置0.05 以100为例,收取5元费用):</label>
<input class="form-control" rows="" cols="" v-model="editPlatform.wechatRate"></input>
</div>
</div>
<div class="form-group row">
<div class="col-sm-12 form-inline">
<label>银行卡费率(如果配置0.05 以100为例,收取5元费用):</label>
<input class="form-control" rows="" cols="" v-model="editPlatform.bankcardRate"></input>
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="col-sm-12 form-inline">
<label>关联账号:</label> <input type="text" class="form-control" v-model="editPlatform.relevanceAccountUserName">
</div>
</div>
......
......@@ -60,6 +60,10 @@
<div class="col-sm-5 table-detail-item-label">通知时间:</div>
<div class="col-sm-7 table-detail-item-value">{{platformOrderInfo.payInfo.noticeTime }}</div>
</div>
<div class="row">
<div class="col-sm-5 table-detail-item-label">卡信息:</div>
<div class="col-sm-7 table-detail-item-value">{{platformOrderInfo.remark }}</div>
</div>
</div>
</script>
<style type="text/css">
......
......@@ -41,6 +41,8 @@ public enum BizError {
银行卡未绑定无法进行提现("1014", "银行卡未绑定无法进行提现"),
无可用资源进行匹配("1014", "无可用资源进行匹配"),
只有状态为发起提现的记录才能审核通过("1014", "只有状态为发起提现的记录才能审核通过"),
只有状态为发起提现或审核通过的记录才能进行审核不通过操作("1014", "只有状态为发起提现或审核通过的记录才能进行审核不通过操作"),
......@@ -66,6 +68,7 @@ public enum BizError {
系统无可用商户("1015", "系统无可用商户"),
商户订单不存在("1015", "商户订单不存在"),
通道费率异常("1015", "通道费率异常"),
不支持该支付类型("1015", "不支持该支付类型"),
......
......@@ -13,6 +13,9 @@ public interface GatheringCodeRepo
GatheringCode findTopByUserAccountIdAndGatheringChannelCodeAndGatheringAmount(String userAccountId,
String gatheringChannelCode, Double gatheringAmount);
List<GatheringCode> findAllByUserAccountIdAndGatheringChannelCodeAndGatheringAmountGreaterThanEqualAndStateEquals(String userAccountId,
String gatheringChannelCode, Double gatheringAmount,String normalState);
List<GatheringCode> findByUserAccountId(String userAccountId);
GatheringCode findTopByUserAccountIdAndGatheringChannelCodeAndFixedGatheringAmountIsFalse(String userAccountId,
......
......@@ -44,6 +44,19 @@ public class GatheringCodeVO implements Serializable {
private Boolean fixedGatheringAmount;
/**
* 开户行
*/
private String bankAddress;
/**
* 卡号
*/
private String bankCode;
/**
* 卡户主
*/
private String bankUsername;
/**
* 收款金额
*/
......
......@@ -22,6 +22,7 @@ import org.hibernate.annotations.NotFoundAction;
import lombok.Getter;
import lombok.Setter;
import me.zohar.runscore.constants.Constant;
import me.zohar.runscore.gatheringcode.domain.GatheringCode;
import me.zohar.runscore.useraccount.domain.UserAccount;
@Getter
......@@ -140,6 +141,15 @@ public class MerchantOrder {
private MerchantOrderPayInfo payInfo;
@NotFound(action = NotFoundAction.IGNORE)
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "gathering_id", updatable = false, insertable = false, foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
private GatheringCode gatheringCode;
// private String gatheringId;
private String remark;
public void updateSettleAmount(Double settleAmount) {
this.setSettleAmount(settleAmount);
}
......@@ -160,11 +170,17 @@ public class MerchantOrder {
this.setNote(note);
}
public void updateReceived(String receivedAccountId, String gatheringCodeStorageId) {
//记录匹配的收款卡
public void updateRemark(String remark) {
setRemark(remark);
}
public void updateReceived(String receivedAccountId, String gatheringCodeStorageId,String gatheringId) {
this.setReceivedAccountId(receivedAccountId);
this.setGatheringCodeStorageId(gatheringCodeStorageId);
this.setOrderState(Constant.商户订单状态_已接单);
this.setReceivedTime(new Date());
}
public void customerCancelOrderRefund() {
......
package me.zohar.runscore.merchant.param;
import java.math.BigDecimal;
import java.util.Date;
import javax.validation.constraints.NotBlank;
......@@ -13,26 +14,30 @@ import me.zohar.runscore.merchant.domain.Merchant;
@Data
public class AddOrUpdateMerchantParam {
private String id;
@NotBlank
private String merchantNum;
@NotBlank
private String name;
@NotBlank
private String secretKey;
@NotBlank
private String relevanceAccountUserName;
public Merchant convertToPo() {
Merchant po = new Merchant();
BeanUtils.copyProperties(this, po);
po.setId(IdUtils.getId());
po.setCreateTime(new Date());
return po;
}
private String id;
@NotBlank
private String merchantNum;
@NotBlank
private String name;
@NotBlank
private String secretKey;
@NotBlank
private String relevanceAccountUserName;
private BigDecimal alipayRate;
private BigDecimal wechatRate;
private BigDecimal bankcardRate;
public Merchant convertToPo() {
Merchant po = new Merchant();
BeanUtils.copyProperties(this, po);
po.setId(IdUtils.getId());
po.setCreateTime(new Date());
return po;
}
}
......@@ -163,10 +163,20 @@ public class MerchantOrderService {
log.error("商户订单不存在;orderNo:{}", orderNo);
throw new BizException(BizError.商户订单不存在);
}
GatheringCode gatheringCode = getGatheringCode(order.getReceivedAccountId(),
order.getGatheringChannelCode(), order.getGatheringAmount());
GatheringCode gatheringCode = null;
String storageId ="";
if (order.getGatheringChannelCode().equals(Constant.支付渠道_银行卡)) {
gatheringCode = order.getGatheringCode();
}
else
{
storageId = order.getGatheringCodeStorageId();
}
/*GatheringCode gatheringCode = getGatheringCode(order.getReceivedAccountId(),
order.getGatheringChannelCode(), order.getGatheringAmount());*/
OrderGatheringCodeVO vo = OrderGatheringCodeVO.convertFor(order);
vo.setGatheringCodeStorageId(gatheringCode.getStorageId());
vo.setGatheringCodeStorageId(storageId);
vo.setGatheringCode(gatheringCode);
return vo;
......@@ -195,6 +205,24 @@ public class MerchantOrderService {
}
@Transactional(readOnly = true)
public GatheringCode matchGatheringCode(String receivedAccountId, String gatheringChannelCode,
Double gatheringAmount) {
ReceiveOrderSetting merchantOrderSetting = platformOrderSettingRepo.findTopByOrderByLatelyUpdateTime();
List<GatheringCode> gatheringCodes = gatheringCodeRepo
.findAllByUserAccountIdAndGatheringChannelCodeAndGatheringAmountGreaterThanEqualAndStateEquals(receivedAccountId,
gatheringChannelCode, gatheringAmount, Constant.账号状态_启用);
if (CollectionUtils.isEmpty(gatheringCodes)) {
throw new BizException(BizError.无可用资源进行匹配);
}
Collections.shuffle(gatheringCodes);
return gatheringCodes.get(0);
}
/*@Transactional(readOnly = true)
public GatheringCode getGatheringCode(String receivedAccountId, String gatheringChannelCode,
Double gatheringAmount) {
ReceiveOrderSetting merchantOrderSetting = platformOrderSettingRepo.findTopByOrderByLatelyUpdateTime();
......@@ -214,7 +242,7 @@ public class MerchantOrderService {
}
}
return new GatheringCode();
}
}*/
@Transactional
public void userConfirmToPaid(@NotBlank String userAccountId, @NotBlank String orderId) {
......@@ -276,7 +304,9 @@ public class MerchantOrderService {
}
if (rate.intValue() < 0 || rate.intValue() > 1) {
throw new BizException(BizError.通道费率异常);
}
double rateFee = NumberUtil.round(merchantOrder.getGatheringAmount() * rate.doubleValue(), 4)
.doubleValue();
......@@ -289,7 +319,7 @@ public class MerchantOrderService {
double cashDeposit = merchantAccount.getCashDeposit() + merchantSettleAmount;
merchantAccount.setCashDeposit(NumberUtil.round(cashDeposit, 4).doubleValue());
userAccountRepo.save(merchantAccount);
accountChangeLogRepo.save(AccountChangeLog.buildWithMerchantSettle(userAccount, merchantOrder));
accountChangeLogRepo.save(AccountChangeLog.buildWithMerchantSettle(merchantAccount, merchantOrder));
}
......@@ -483,12 +513,12 @@ public class MerchantOrderService {
if (!Constant.商户订单状态_等待接单.equals(platformOrder.getOrderState())) {
throw new BizException(BizError.订单已被接或已取消);
}
String gatheringCodeStorageId = getGatheringCodeStorageId(userAccountId,
GatheringCode gatheringCode = matchGatheringCode(userAccountId,
platformOrder.getGatheringChannelCode(), platformOrder.getGatheringAmount());
//支付宝和微信才有收款码
if (StrUtil.isBlank(gatheringCodeStorageId) && !platformOrder.getGatheringChannelCode().equals(Constant.支付渠道_银行卡)) {
/*if (StrUtil.isBlank(gatheringCodeStorageId) && !platformOrder.getGatheringChannelCode().equals(Constant.支付渠道_银行卡)) {
throw new BizException(BizError.无法接单找不到对应金额的收款码);
}
}*/
// 校验用户是否达到接单上限,若达到上限,则不能接单
ReceiveOrderSetting setting = platformOrderSettingRepo.findTopByOrderByLatelyUpdateTime();
if (setting != null && setting.getReceiveOrderUpperLimit() != null) {
......@@ -516,7 +546,8 @@ public class MerchantOrderService {
if (setting != null && setting.getOrderPayEffectiveDuration() != null) {
orderEffectiveDuration = setting.getOrderPayEffectiveDuration();
}
platformOrder.updateReceived(userAccount.getId(), gatheringCodeStorageId);
platformOrder.updateReceived(userAccount.getId(), gatheringCode.getStorageId(), gatheringCode.getId());
platformOrder.updateRemark(gatheringCode.getBankCode() + "_" + gatheringCode.getBankUsername() + "_" + gatheringCode.getBankAddress());
platformOrder.updateUsefulTime(
DateUtil.offset(platformOrder.getReceivedTime(), DateField.MINUTE, orderEffectiveDuration));
merchantOrderRepo.save(platformOrder);
......
......@@ -104,6 +104,8 @@ public class MerchantOrderDetailsVO {
* 奖励金
*/
private Double bounty;
private String remark;
public static MerchantOrderDetailsVO convertFor(MerchantOrder merchantOrder) {
if (merchantOrder == null) {
......
......@@ -112,6 +112,8 @@ public class MerchantOrderVO {
private MerchantOrderPayInfoVO payInfo;
private String remark;
public static List<MerchantOrderVO> convertFor(List<MerchantOrder> platformOrders) {
if (CollectionUtil.isEmpty(platformOrders)) {
return new ArrayList<>();
......
package me.zohar.runscore.merchant.vo;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -32,6 +33,10 @@ public class MerchantVO {
*/
private String secretKey;
private BigDecimal alipayRate;
private BigDecimal wechatRate;
private BigDecimal bankcardRate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
......
......@@ -34,4 +34,10 @@ public class AccountChangeLogQueryCondParam extends PageParam {
*/
private String userAccountId;
/**
* 用户账号
*/
private String userName;
}
......@@ -6,6 +6,7 @@ import java.util.List;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
......@@ -290,6 +291,13 @@ public class UserAccountService {
if (StrUtil.isNotEmpty(param.getUserAccountId())) {
predicates.add(builder.equal(root.get("userAccountId"), param.getUserAccountId()));
}
if (StrUtil.isNotEmpty(param.getUserName())) {
Join<UserAccount, AccountChangeLog> join = root.join("userAccount", JoinType.LEFT);
predicates.add(builder.equal(join.get("userName"), param.getUserName()));
//predicates.add(builder.equal(root.get("userName"), param.getUserName()));
}
return predicates.size() > 0 ? builder.and(predicates.toArray(new Predicate[predicates.size()])) : null;
}
};
......
......@@ -62,6 +62,8 @@
<div class="col-sm-5 table-detail-item-label">通知时间:</div>
<div class="col-sm-7 table-detail-item-value">{{platformOrderInfo.payInfo.noticeTime }}</div>
</div>
</div>
</script>
<style type="text/css">
......@@ -269,6 +271,7 @@
<div class="col-sm-4 details-item" v-show="selectedOrderDetails.note != null">
<label>备注:</label><span>{{selectedOrderDetails.note}}</span>
</div>
</div>
<div class="gathering-code-pic">
<div style="color: red; font-weight: bold; font-size: 22px;" v-if="selectedOrderDetails.orderState == '1'">等待接单中...</div>
......
......@@ -33,7 +33,7 @@
<div id="footer" v-cloak>
<nav class="navbar fixed-bottom bg-light footer-navbar" v-show="showFooterFlag">
<a class="navbar-brand footer-navbar-brand" v-on:click="goTo('/')" v-bind:class="{'selected-footer-navbar-brand': currentPathName == '/'}"><i class="fa fa-home" aria-hidden="true"></i> <span>首页</span> </a>
<a class="navbar-brand footer-navbar-brand" v-on:click="goTo('/receive-order')" v-bind:class="{'selected-footer-navbar-brand': currentPathName == '/receive-order'}"><i class="fa fa-shopping-cart" aria-hidden="true"></i><span>接单</span></a>
<!-- <a class="navbar-brand footer-navbar-brand" v-on:click="goTo('/receive-order')" v-bind:class="{'selected-footer-navbar-brand': currentPathName == '/receive-order'}"><i class="fa fa-shopping-cart" aria-hidden="true"></i><span>接单</span></a> -->
<a class="navbar-brand footer-navbar-brand" v-on:click="goTo('/audit-order')" v-bind:class="{'selected-footer-navbar-brand': currentPathName == '/audit-order'}"><i class="fa fa-hourglass" aria-hidden="true"></i><span>审核</span></a>
<a class="navbar-brand footer-navbar-brand" v-on:click="goTo('/my-home-page')" v-bind:class="{'selected-footer-navbar-brand': currentPathName == '/my-home-page'}"><i class="fa fa-user" aria-hidden="true"></i><span>我的</span></a>
</nav>
......
......@@ -156,7 +156,7 @@
v-show="editGatheringCode.gatheringChannelCode == 'bankcard'" style="">
<label>银行卡号:</label>
<input type="text" class="form-control" v-model="editGatheringCode.bankCode">
<label>开户行:</label>
<label>银行名称(例如:工商银行):</label>
<input type="text" class="form-control" v-model="editGatheringCode.bankAddress">
<label>卡户主:</label>
<input type="text" class="form-control" v-model="editGatheringCode.bankUsername">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论