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

//init

上级 ed53a40a
...@@ -160,4 +160,8 @@ public class Constant { ...@@ -160,4 +160,8 @@ public class Constant {
public static final String 下级账号查询范围_指定账号及直接下级 = "20"; public static final String 下级账号查询范围_指定账号及直接下级 = "20";
public static final String 支付渠道_银行卡 = "bankcard";
public static final String 支付渠道_微信码 = "wechat";
public static final String 支付渠道_支付宝码 = "alipay";
} }
...@@ -58,6 +58,18 @@ public class GatheringCode { ...@@ -58,6 +58,18 @@ public class GatheringCode {
*/ */
private String payee; private String payee;
/**
* 开户行
*/
private String bankAddress;
/**
* 卡号
*/
private String bankCode;
/**
* 卡户主
*/
private String bankUsername;
/** /**
* 创建时间 * 创建时间
*/ */
......
...@@ -54,6 +54,19 @@ public class GatheringCodeParam { ...@@ -54,6 +54,19 @@ public class GatheringCodeParam {
private String storageId; private String storageId;
/**
* 开户行
*/
private String bankAddress;
/**
* 卡号
*/
private String bankCode;
/**
* 卡户主
*/
private String bankUsername;
public GatheringCode convertToPo(String userAccountId) { public GatheringCode convertToPo(String userAccountId) {
GatheringCode po = new GatheringCode(); GatheringCode po = new GatheringCode();
BeanUtils.copyProperties(this, po); BeanUtils.copyProperties(this, po);
......
...@@ -157,18 +157,21 @@ public class GatheringCodeService { ...@@ -157,18 +157,21 @@ public class GatheringCodeService {
@ParamValid @ParamValid
@Transactional @Transactional
public void addOrUpdateGatheringCode(GatheringCodeParam param, String userAccountId) { public void addOrUpdateGatheringCode(GatheringCodeParam param, String userAccountId) {
if (param.getFixedGatheringAmount()) { /*if (param.getFixedGatheringAmount()) {
if (param.getGatheringAmount() == null) { if (param.getGatheringAmount() == null) {
throw new BizException(BizError.参数异常); throw new BizException(BizError.参数异常);
} }
if (param.getGatheringAmount() <= 0) { if (param.getGatheringAmount() <= 0) {
throw new BizException(BizError.参数异常); throw new BizException(BizError.参数异常);
} }
} }*/
// 新增 // 新增
if (StrUtil.isBlank(param.getId())) { if (StrUtil.isBlank(param.getId())) {
GatheringCode gatheringCode = param.convertToPo(userAccountId); GatheringCode gatheringCode = param.convertToPo(userAccountId);
gatheringCodeRepo.save(gatheringCode); gatheringCodeRepo.save(gatheringCode);
if (param.getGatheringChannelCode().equals("bankcard")) {
return;
}
associateGatheringCodeStorage(param.getStorageId(), gatheringCode.getId()); associateGatheringCodeStorage(param.getStorageId(), gatheringCode.getId());
} }
// 修改 // 修改
...@@ -180,6 +183,9 @@ public class GatheringCodeService { ...@@ -180,6 +183,9 @@ public class GatheringCodeService {
} }
BeanUtils.copyProperties(param, gatheringCode); BeanUtils.copyProperties(param, gatheringCode);
gatheringCodeRepo.save(gatheringCode); gatheringCodeRepo.save(gatheringCode);
if (param.getGatheringChannelCode().equals("bankcard")) {
return;
}
associateGatheringCodeStorage(param.getStorageId(), gatheringCode.getId()); associateGatheringCodeStorage(param.getStorageId(), gatheringCode.getId());
} }
} }
......
...@@ -37,6 +37,7 @@ import cn.hutool.core.date.DateField; ...@@ -37,6 +37,7 @@ import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.DigestAlgorithm; import cn.hutool.crypto.digest.DigestAlgorithm;
import cn.hutool.crypto.digest.Digester; import cn.hutool.crypto.digest.Digester;
...@@ -111,6 +112,8 @@ public class MerchantOrderService { ...@@ -111,6 +112,8 @@ public class MerchantOrderService {
@Autowired @Autowired
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));
...@@ -119,8 +122,6 @@ public class MerchantOrderService { ...@@ -119,8 +122,6 @@ public class MerchantOrderService {
/** /**
* 客服取消订单退款 * 客服取消订单退款
*
* @param orderId
*/ */
@Transactional @Transactional
public void customerServiceCancelOrderRefund(@NotBlank String orderId) { public void customerServiceCancelOrderRefund(@NotBlank String orderId) {
...@@ -168,10 +169,12 @@ public class MerchantOrderService { ...@@ -168,10 +169,12 @@ public class MerchantOrderService {
log.error("商户订单不存在;orderNo:{}", orderNo); log.error("商户订单不存在;orderNo:{}", orderNo);
throw new BizException(BizError.商户订单不存在); throw new BizException(BizError.商户订单不存在);
} }
String gatheringCodeStorageId = getGatheringCodeStorageId(order.getReceivedAccountId(), GatheringCode gatheringCode = getGatheringCode(order.getReceivedAccountId(),
order.getGatheringChannelCode(), order.getGatheringAmount()); order.getGatheringChannelCode(), order.getGatheringAmount());
OrderGatheringCodeVO vo = OrderGatheringCodeVO.convertFor(order); OrderGatheringCodeVO vo = OrderGatheringCodeVO.convertFor(order);
vo.setGatheringCodeStorageId(gatheringCodeStorageId); vo.setGatheringCodeStorageId(gatheringCode.getStorageId());
vo.setGatheringCode(gatheringCode);
return vo; return vo;
} }
...@@ -197,6 +200,28 @@ public class MerchantOrderService { ...@@ -197,6 +200,28 @@ public class MerchantOrderService {
return null; return null;
} }
@Transactional(readOnly = true)
public GatheringCode getGatheringCode(String receivedAccountId, String gatheringChannelCode,
Double gatheringAmount) {
ReceiveOrderSetting merchantOrderSetting = platformOrderSettingRepo.findTopByOrderByLatelyUpdateTime();
if (merchantOrderSetting.getUnfixedGatheringCodeReceiveOrder()) {
GatheringCode gatheringCode = gatheringCodeRepo
.findTopByUserAccountIdAndGatheringChannelCodeAndFixedGatheringAmountIsFalse(receivedAccountId,
gatheringChannelCode);
if (gatheringCode != null) {
return gatheringCode;
}
} else {
GatheringCode gatheringCode = gatheringCodeRepo
.findTopByUserAccountIdAndGatheringChannelCodeAndGatheringAmount(receivedAccountId,
gatheringChannelCode, gatheringAmount);
if (gatheringCode != null) {
return gatheringCode;
}
}
return null;
}
@Transactional @Transactional
public void userConfirmToPaid(@NotBlank String userAccountId, @NotBlank String orderId) { public void userConfirmToPaid(@NotBlank String userAccountId, @NotBlank String orderId) {
MerchantOrder platformOrder = merchantOrderRepo.findByIdAndReceivedAccountId(orderId, userAccountId); MerchantOrder platformOrder = merchantOrderRepo.findByIdAndReceivedAccountId(orderId, userAccountId);
...@@ -214,8 +239,6 @@ public class MerchantOrderService { ...@@ -214,8 +239,6 @@ public class MerchantOrderService {
/** /**
* 客服确认已支付 * 客服确认已支付
*
* @param orderId
*/ */
@Transactional @Transactional
public void customerServiceConfirmToPaid(@NotBlank String orderId, String note) { public void customerServiceConfirmToPaid(@NotBlank String orderId, String note) {
...@@ -253,8 +276,6 @@ public class MerchantOrderService { ...@@ -253,8 +276,6 @@ public class MerchantOrderService {
/** /**
* 生成订单返点 * 生成订单返点
*
* @param bettingOrder
*/ */
public void generateOrderRebate(MerchantOrder merchantOrder) { public void generateOrderRebate(MerchantOrder merchantOrder) {
UserAccount userAccount = merchantOrder.getReceivedAccount(); UserAccount userAccount = merchantOrder.getReceivedAccount();
...@@ -283,8 +304,6 @@ public class MerchantOrderService { ...@@ -283,8 +304,6 @@ public class MerchantOrderService {
/** /**
* 通知指定的订单进行返点结算 * 通知指定的订单进行返点结算
*
* @param issueId
*/ */
@Transactional(readOnly = true) @Transactional(readOnly = true)
public void noticeOrderRebateSettlement(@NotBlank String orderId) { public void noticeOrderRebateSettlement(@NotBlank String orderId) {
...@@ -398,14 +417,17 @@ public class MerchantOrderService { ...@@ -398,14 +417,17 @@ public class MerchantOrderService {
merchantOrder.setPayInfoId(payInfo.getId()); merchantOrder.setPayInfoId(payInfo.getId());
merchantOrderRepo.save(merchantOrder); merchantOrderRepo.save(merchantOrder);
merchantOrderPayInfoRepo.save(payInfo); merchantOrderPayInfoRepo.save(payInfo);
//todo this is temporary code 这里要匹配有资源的用户接单
List<UserAccount> userAccounts = userAccountRepo.findAllByAccountType(Constant.账号类型_会员);
;
this.receiveOrder(userAccounts.get(RandomUtil.randomInt(0, userAccounts.size())).getId(), merchantOrder.getId());
return MerchantOrderVO.convertFor(merchantOrder); return MerchantOrderVO.convertFor(merchantOrder);
} }
/** /**
* 接单 * 接单
*
* @param param
* @return
*/ */
@Lock(keys = "'receiveOrder_' + #orderId") @Lock(keys = "'receiveOrder_' + #orderId")
@Transactional @Transactional
...@@ -423,7 +445,8 @@ public class MerchantOrderService { ...@@ -423,7 +445,8 @@ public class MerchantOrderService {
} }
String gatheringCodeStorageId = getGatheringCodeStorageId(userAccountId, String gatheringCodeStorageId = getGatheringCodeStorageId(userAccountId,
platformOrder.getGatheringChannelCode(), platformOrder.getGatheringAmount()); platformOrder.getGatheringChannelCode(), platformOrder.getGatheringAmount());
if (StrUtil.isBlank(gatheringCodeStorageId)) { //支付宝和微信才有收款码
if (StrUtil.isBlank(gatheringCodeStorageId) && !platformOrder.getGatheringChannelCode().equals(Constant.支付渠道_银行卡) ) {
throw new BizException(BizError.无法接单找不到对应金额的收款码); throw new BizException(BizError.无法接单找不到对应金额的收款码);
} }
// 校验用户是否达到接单上限,若达到上限,则不能接单 // 校验用户是否达到接单上限,若达到上限,则不能接单
...@@ -550,8 +573,6 @@ public class MerchantOrderService { ...@@ -550,8 +573,6 @@ public class MerchantOrderService {
/** /**
* 取消订单 * 取消订单
*
* @param id
*/ */
@Transactional @Transactional
public void cancelOrder(@NotBlank String id) { public void cancelOrder(@NotBlank String id) {
...@@ -566,8 +587,6 @@ public class MerchantOrderService { ...@@ -566,8 +587,6 @@ public class MerchantOrderService {
/** /**
* 商户取消订单 * 商户取消订单
*
* @param id
*/ */
@Transactional @Transactional
public void merchatCancelOrder(@NotBlank String merchantId, @NotBlank String id) { public void merchatCancelOrder(@NotBlank String merchantId, @NotBlank String id) {
...@@ -628,13 +647,18 @@ public class MerchantOrderService { ...@@ -628,13 +647,18 @@ public class MerchantOrderService {
merchantOrder.setPayInfoId(payInfo.getId()); merchantOrder.setPayInfoId(payInfo.getId());
merchantOrderRepo.save(merchantOrder); merchantOrderRepo.save(merchantOrder);
merchantOrderPayInfoRepo.save(payInfo); merchantOrderPayInfoRepo.save(payInfo);
//todo this is temporary code 这里要匹配有资源的用户接单
List<UserAccount> userAccounts = userAccountRepo.findAllByAccountType(Constant.账号类型_会员);
;
this.receiveOrder(userAccounts.get(RandomUtil.randomInt(0, userAccounts.size())).getId(), merchantOrder.getId());
return StartOrderSuccessVO.convertFor(merchantOrder.getOrderNo()); return StartOrderSuccessVO.convertFor(merchantOrder.getOrderNo());
} }
/** /**
* 支付成功异步通知 * 支付成功异步通知
*
* @param merchantOrderId
*/ */
@Transactional @Transactional
public String paySuccessAsynNotice(@NotBlank String merchantOrderId) { public String paySuccessAsynNotice(@NotBlank String merchantOrderId) {
......
...@@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; ...@@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import me.zohar.runscore.dictconfig.DictHolder; import me.zohar.runscore.dictconfig.DictHolder;
import me.zohar.runscore.gatheringcode.domain.GatheringCode;
import me.zohar.runscore.merchant.domain.MerchantOrder; import me.zohar.runscore.merchant.domain.MerchantOrder;
@Data @Data
...@@ -58,6 +59,8 @@ public class OrderGatheringCodeVO { ...@@ -58,6 +59,8 @@ public class OrderGatheringCodeVO {
private String gatheringCodeUrl; private String gatheringCodeUrl;
private GatheringCode gatheringCode;
/** /**
* 同步通知地址 * 同步通知地址
*/ */
...@@ -75,4 +78,5 @@ public class OrderGatheringCodeVO { ...@@ -75,4 +78,5 @@ public class OrderGatheringCodeVO {
return vo; return vo;
} }
} }
...@@ -32,6 +32,7 @@ public class LoginLog { ...@@ -32,6 +32,7 @@ public class LoginLog {
/** /**
* 登录系统 * 登录系统
*/ */
@Column(name="`system`")
private String system; private String system;
/** /**
......
...@@ -3,6 +3,8 @@ package me.zohar.runscore.useraccount.repo; ...@@ -3,6 +3,8 @@ package me.zohar.runscore.useraccount.repo;
import org.springframework.data.jpa.repository.JpaRepository; 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 me.zohar.runscore.useraccount.domain.UserAccount; import me.zohar.runscore.useraccount.domain.UserAccount;
...@@ -12,4 +14,5 @@ public interface UserAccountRepo extends JpaRepository<UserAccount, String>, Jpa ...@@ -12,4 +14,5 @@ public interface UserAccountRepo extends JpaRepository<UserAccount, String>, Jpa
Long countByInviterId(String inviterId); Long countByInviterId(String inviterId);
List<UserAccount> findAllByAccountType(String accountType);
} }
...@@ -19,6 +19,11 @@ public class ApiController { ...@@ -19,6 +19,11 @@ public class ApiController {
@Autowired @Autowired
private MerchantOrderService platformOrderService; private MerchantOrderService platformOrderService;
/**
* 商户开单,获取支付方式,返回银行卡信息或者支付码信息
* @param param
* @return
*/
@PostMapping("/startOrder") @PostMapping("/startOrder")
@ResponseBody @ResponseBody
public Result startOrder(StartOrderParam param) { public Result startOrder(StartOrderParam param) {
......
...@@ -15,11 +15,12 @@ public class StartOrderTest { ...@@ -15,11 +15,12 @@ public class StartOrderTest {
*/ */
public static void main(String[] args) { public static void main(String[] args) {
String merchantNum = "201906001"; String merchantNum = "1001";
String merchantOrderNo = "20190629023134U936283877"; String merchantOrderNo = "20190629023134U936283878";
Double amount = 100d; Double amount = 100d;
String notifyUrl = "http://xhbc10.com/index.php/Pay/Paynotify"; String notifyUrl = "http://xhbc10.com/index.php/Pay/Paynotify";
String secretKey = "l54x9426o68962464"; //String returnUrl = "http://xhbc10.com/index.php/Pay/Paynotify";
String secretKey = "456";
String sign = merchantNum + merchantOrderNo String sign = merchantNum + merchantOrderNo
+ new DecimalFormat("###################.###########").format(amount) + notifyUrl + secretKey; + new DecimalFormat("###################.###########").format(amount) + notifyUrl + secretKey;
System.out.println(sign); System.out.println(sign);
......
...@@ -135,9 +135,12 @@ var gatheringCodeVM = new Vue({ ...@@ -135,9 +135,12 @@ var gatheringCodeVM = new Vue({
that.editGatheringCode = { that.editGatheringCode = {
gatheringChannelCode : '', gatheringChannelCode : '',
state : '', state : '',
fixedGatheringAmount : true, fixedGatheringAmount : false,
gatheringAmount : '', gatheringAmount : '',
payee : '' payee : '',
bankAddress:'',
bankCode:'',
bankUsername:''
}; };
that.showEditGatheringCodePageInner(); that.showEditGatheringCodePageInner();
that.initFileUploadWidget(); that.initFileUploadWidget();
...@@ -187,24 +190,24 @@ var gatheringCodeVM = new Vue({ ...@@ -187,24 +190,24 @@ var gatheringCodeVM = new Vue({
}); });
return; return;
} }
if (editGatheringCode.fixedGatheringAmount == null) { // if (editGatheringCode.fixedGatheringAmount == null) {
layer.alert('请选择是否固定收款金额', { // layer.alert('请选择是否固定收款金额', {
title : '提示', // title : '提示',
icon : 7, // icon : 7,
time : 3000 // time : 3000
}); // });
return; // return;
} // }
if (editGatheringCode.fixedGatheringAmount) { // if (editGatheringCode.fixedGatheringAmount) {
if (editGatheringCode.gatheringAmount == null || editGatheringCode.gatheringAmount == '') { // if (editGatheringCode.gatheringAmount == null || editGatheringCode.gatheringAmount == '') {
layer.alert('请输入收款金额', { // layer.alert('请输入收款金额', {
title : '提示', // title : '提示',
icon : 7, // icon : 7,
time : 3000 // time : 3000
}); // });
return; // return;
} // }
} // }
if (editGatheringCode.payee == null || editGatheringCode.payee == '') { if (editGatheringCode.payee == null || editGatheringCode.payee == '') {
layer.alert('请选择收款人', { layer.alert('请选择收款人', {
title : '提示', title : '提示',
...@@ -214,11 +217,12 @@ var gatheringCodeVM = new Vue({ ...@@ -214,11 +217,12 @@ var gatheringCodeVM = new Vue({
return; return;
} }
if ($('.gathering-code-pic').fileinput('getPreview').content.length != 0) { if ($('.gathering-code-pic').fileinput('getPreview').content.length != 0 || editGatheringCode.gatheringChannelCode =='bankcard') {
that.addOrUpdateGatheringCodeInner(); that.addOrUpdateGatheringCodeInner();
} else { } else {
var filesCount = $('.gathering-code-pic').fileinput('getFilesCount'); var filesCount = $('.gathering-code-pic').fileinput('getFilesCount');
if (filesCount == 0) { console.log(editGatheringCode.gatheringChannelCode);
if (filesCount == 0 ) {
layer.alert('请选择要上传的图片', { layer.alert('请选择要上传的图片', {
title : '提示', title : '提示',
icon : 7, icon : 7,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论