fix:小程序支付密码修改、充值、充值列表、提现接口
This commit is contained in:
@@ -316,6 +316,7 @@ public enum ErrorCodeEnum {
|
|||||||
STORE_NOT_FIND(1610013,"门店不存在",null),
|
STORE_NOT_FIND(1610013,"门店不存在",null),
|
||||||
|
|
||||||
WALLET_OPEN_ACCOUNT_FAIL(1620001,"钱包开通失败",null),
|
WALLET_OPEN_ACCOUNT_FAIL(1620001,"钱包开通失败",null),
|
||||||
|
WALLET_WITH_DRAWER_FAIL(1620002,"提现失败",null),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,13 @@ public class ShopInfoDAO {
|
|||||||
return shopInfo;
|
return shopInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ShopInfoDO getShopInfoByStoreId(String storeId) {
|
||||||
|
ShopInfoDO shopInfoDO = new ShopInfoDO();
|
||||||
|
shopInfoDO.setStoreId(storeId);
|
||||||
|
shopInfoDO.setDeleted(false);
|
||||||
|
return shopInfoMapper.selectOne(shopInfoDO);
|
||||||
|
}
|
||||||
|
|
||||||
public List<ShopInfoDO> getShopList(Long lineId){
|
public List<ShopInfoDO> getShopList(Long lineId){
|
||||||
if(Objects.isNull(lineId)){
|
if(Objects.isNull(lineId)){
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.cool.store.dao.wallet;
|
|
||||||
|
|
||||||
import com.cool.store.mapper.wallet.WalletLargePaymentMapper;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 钱包大额支付DAO
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author wangff
|
|
||||||
* @since 2025/11/18
|
|
||||||
*/
|
|
||||||
@Repository
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class WalletLargePaymentDAO {
|
|
||||||
private final WalletLargePaymentMapper walletLargePaymentMapper;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.cool.store.dao.wallet;
|
||||||
|
|
||||||
|
import com.cool.store.entity.wallet.WalletPaymentOrderDO;
|
||||||
|
import com.cool.store.mapper.wallet.WalletPaymentOrderMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import tk.mybatis.mapper.entity.Example;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 钱包大额支付DAO
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wangff
|
||||||
|
* @since 2025/11/18
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class WalletPaymentOrderDAO {
|
||||||
|
private final WalletPaymentOrderMapper walletPaymentOrderMapper;
|
||||||
|
|
||||||
|
public void insertSelective(WalletPaymentOrderDO walletPaymentOrderDO) {
|
||||||
|
walletPaymentOrderMapper.insertSelective(walletPaymentOrderDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询未支付的充值订单
|
||||||
|
*/
|
||||||
|
public List<WalletPaymentOrderDO> getNonPaymentList(String storeId) {
|
||||||
|
Example example = new Example(WalletPaymentOrderDO.class);
|
||||||
|
example.createCriteria()
|
||||||
|
.andEqualTo("storeId", storeId)
|
||||||
|
.andEqualTo("orderStatus", 3)
|
||||||
|
.andEqualTo("type", 0);
|
||||||
|
example.setOrderByClause("create_time DESC");
|
||||||
|
return walletPaymentOrderMapper.selectByExample(example);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.cool.store.mapper.wallet;
|
|
||||||
|
|
||||||
import com.cool.store.entity.wallet.WalletLargePaymentDO;
|
|
||||||
import tk.mybatis.mapper.common.Mapper;
|
|
||||||
|
|
||||||
public interface WalletLargePaymentMapper extends Mapper<WalletLargePaymentDO> {
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.cool.store.mapper.wallet;
|
||||||
|
|
||||||
|
import com.cool.store.entity.wallet.WalletPaymentOrderDO;
|
||||||
|
import tk.mybatis.mapper.common.Mapper;
|
||||||
|
|
||||||
|
public interface WalletPaymentOrderMapper extends Mapper<WalletPaymentOrderDO> {
|
||||||
|
}
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.cool.store.mapper.wallet.WalletLargePaymentMapper">
|
<mapper namespace="com.cool.store.mapper.wallet.WalletPaymentOrderMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.wallet.WalletLargePaymentDO">
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.wallet.WalletPaymentOrderDO">
|
||||||
<!--
|
<!--
|
||||||
WARNING - @mbg.generated
|
WARNING - @mbg.generated
|
||||||
-->
|
-->
|
||||||
<id column="id" jdbcType="BIGINT" property="id" />
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||||
<result column="payment_id" jdbcType="VARCHAR" property="paymentId" />
|
<result column="payment_id" jdbcType="VARCHAR" property="paymentId" />
|
||||||
|
<result column="type" jdbcType="TINYINT" property="type" />
|
||||||
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
||||||
<result column="expire_time" jdbcType="VARCHAR" property="expireTime" />
|
<result column="expire_time" jdbcType="VARCHAR" property="expireTime" />
|
||||||
<result column="order_status" jdbcType="BIT" property="orderStatus" />
|
<result column="order_status" jdbcType="BIT" property="orderStatus" />
|
||||||
@@ -1,17 +1,23 @@
|
|||||||
package com.cool.store.entity.wallet;
|
package com.cool.store.entity.wallet;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 钱包大额支付订单
|
* 钱包支付订单
|
||||||
*/
|
*/
|
||||||
@Table(name = "zxjp_wallet_large_payment")
|
@Table(name = "zxjp_wallet_payment_order")
|
||||||
@Data
|
@Data
|
||||||
public class WalletLargePaymentDO {
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class WalletPaymentOrderDO {
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@@ -31,6 +37,12 @@ public class WalletLargePaymentDO {
|
|||||||
@Column(name = "payment_id")
|
@Column(name = "payment_id")
|
||||||
private String paymentId;
|
private String paymentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单类型,0充值 1提现
|
||||||
|
*/
|
||||||
|
@Column(name = "type")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 金额
|
* 金额
|
||||||
*/
|
*/
|
||||||
@@ -46,7 +58,7 @@ public class WalletLargePaymentDO {
|
|||||||
* 订单状态:1-成功 2-失败 3-支付中 4-撤销
|
* 订单状态:1-成功 2-失败 3-支付中 4-撤销
|
||||||
*/
|
*/
|
||||||
@Column(name = "order_status")
|
@Column(name = "order_status")
|
||||||
private Boolean orderStatus;
|
private Integer orderStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
@@ -29,6 +29,5 @@ public class AccountPasswordRequest extends StoreShopRequest {
|
|||||||
private String confirmPayPwd;
|
private String confirmPayPwd;
|
||||||
|
|
||||||
@ApiModelProperty("当前使用的支付密码(sm3加密后字符串),维护类型为修改密码时必填")
|
@ApiModelProperty("当前使用的支付密码(sm3加密后字符串),维护类型为修改密码时必填")
|
||||||
@NotNull(message = "当前使用的支付密码不能为空")
|
|
||||||
private String currentPayPwd;
|
private String currentPayPwd;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ package com.cool.store.request.wallet;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Digits;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -16,6 +17,7 @@ import javax.validation.constraints.Pattern;
|
|||||||
@Data
|
@Data
|
||||||
public class AccountPaymentRequest extends StoreShopRequest {
|
public class AccountPaymentRequest extends StoreShopRequest {
|
||||||
@ApiModelProperty(value = "支付金额")
|
@ApiModelProperty(value = "支付金额")
|
||||||
@Pattern(regexp = "^\\d+(\\.\\d{1,2})?$", message = "金额格式不正确")
|
@Digits(integer = 10, fraction = 2, message = "金额整数位最多10位,小数位最多2位")
|
||||||
private String amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.cool.store.request.wallet;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 大额支付订单查询Request
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wangff
|
||||||
|
* @since 2025/11/18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LargePaymentQueryRequest extends StoreShopRequest {
|
||||||
|
@ApiModelProperty("页码")
|
||||||
|
private Integer pageNum = 1;
|
||||||
|
|
||||||
|
@ApiModelProperty("页数量")
|
||||||
|
private Integer pageSize = 10;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.cool.store.request.wallet;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Digits;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 钱包提现Request
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wangff
|
||||||
|
* @since 2025/11/18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WalletWithDrawerRequest extends StoreShopRequest {
|
||||||
|
@ApiModelProperty("提现金额")
|
||||||
|
@Digits(integer = 10, fraction = 2, message = "金额整数位最多10位,小数位最多2位")
|
||||||
|
@NotNull(message = "提现金额不能为空")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ApiModelProperty("支付密码(sm3加密后字符串)")
|
||||||
|
@NotBlank(message = "支付密码不能为空")
|
||||||
|
private String payPwd;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.cool.store.request.wallet;
|
package com.cool.store.request.wallet;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author suzhuhong
|
* @Author suzhuhong
|
||||||
@@ -9,6 +11,8 @@ import lombok.Data;
|
|||||||
* @Version 1.0
|
* @Version 1.0
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class WithDrawerRequest {
|
public class WithDrawerRequest {
|
||||||
|
|
||||||
@ApiModelProperty(value = "门店ID")
|
@ApiModelProperty(value = "门店ID")
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ public class AccountPaymentVO {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "收款银行名称", required = true)
|
@ApiModelProperty(value = "收款银行名称", required = true)
|
||||||
private String payeeBankName;
|
private String payeeBankName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "账号过期时间")
|
|
||||||
private String expireTime;
|
|
||||||
|
|
||||||
@ApiModelProperty("过期倒计时(秒)")
|
@ApiModelProperty("过期倒计时(秒)")
|
||||||
private Long expiryCountdown;
|
private Long expiryCountdown;
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.cool.store.vo.wallet;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 钱包支付订单VO
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wangff
|
||||||
|
* @since 2025/11/18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WalletPaymentOrderVO {
|
||||||
|
@ApiModelProperty("预支付id")
|
||||||
|
private String paymentId;
|
||||||
|
|
||||||
|
@ApiModelProperty("金额")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ApiModelProperty("订单状态:1-成功 2-失败 3-支付中 4-撤销")
|
||||||
|
private Integer orderStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
}
|
||||||
@@ -85,4 +85,25 @@ public interface WalletService {
|
|||||||
* @return 账户充值VO
|
* @return 账户充值VO
|
||||||
*/
|
*/
|
||||||
AccountPaymentVO payment(AccountPaymentRequest request);
|
AccountPaymentVO payment(AccountPaymentRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未完成充值订单查询
|
||||||
|
* @param request 查询request
|
||||||
|
* @return 钱包支付订单VO列表
|
||||||
|
*/
|
||||||
|
PageInfo<WalletPaymentOrderVO> nonPaymentOrderPage(LargePaymentQueryRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据预支付id查询收款账户详情
|
||||||
|
* @param paymentId 预支付id
|
||||||
|
* @return 账户充值VO
|
||||||
|
*/
|
||||||
|
AccountPaymentVO paymentDetail(String paymentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提现
|
||||||
|
* @param request 钱包提现Request
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
Boolean withDrawer(WalletWithDrawerRequest request);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,14 @@ package com.cool.store.service.wallet.impl;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.dao.LineInfoDAO;
|
||||||
import com.cool.store.dao.RegionDao;
|
import com.cool.store.dao.RegionDao;
|
||||||
import com.cool.store.dao.ShopInfoDAO;
|
import com.cool.store.dao.ShopInfoDAO;
|
||||||
import com.cool.store.dao.ShopStageInfoDAO;
|
import com.cool.store.dao.ShopStageInfoDAO;
|
||||||
import com.cool.store.dao.wallet.WalletLargePaymentDAO;
|
import com.cool.store.dao.wallet.WalletPaymentOrderDAO;
|
||||||
import com.cool.store.dto.wallet.*;
|
import com.cool.store.dto.wallet.*;
|
||||||
import com.cool.store.entity.LicenseTransactDO;
|
import com.cool.store.entity.*;
|
||||||
import com.cool.store.entity.RegionDO;
|
import com.cool.store.entity.wallet.WalletPaymentOrderDO;
|
||||||
import com.cool.store.entity.ShopInfoDO;
|
|
||||||
import com.cool.store.entity.ShopStageInfoDO;
|
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
import com.cool.store.enums.point.ShopSubStageEnum;
|
import com.cool.store.enums.point.ShopSubStageEnum;
|
||||||
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
||||||
@@ -25,6 +24,7 @@ import com.cool.store.service.wallet.WalletService;
|
|||||||
import com.cool.store.utils.BeanUtil;
|
import com.cool.store.utils.BeanUtil;
|
||||||
import com.cool.store.utils.UUIDUtils;
|
import com.cool.store.utils.UUIDUtils;
|
||||||
import com.cool.store.vo.wallet.*;
|
import com.cool.store.vo.wallet.*;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -32,8 +32,12 @@ import org.apache.commons.collections4.CollectionUtils;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -56,7 +60,10 @@ public class WalletServiceImpl implements WalletService {
|
|||||||
private final ApplyLicenseMapper applyLicenseMapper;
|
private final ApplyLicenseMapper applyLicenseMapper;
|
||||||
private final WalletApiService walletApiService;
|
private final WalletApiService walletApiService;
|
||||||
private final RegionDao regionDao;
|
private final RegionDao regionDao;
|
||||||
private final WalletLargePaymentDAO walletLargePaymentDAO;
|
private final WalletPaymentOrderDAO walletPaymentOrderDAO;
|
||||||
|
private final LineInfoDAO lineInfoDAO;
|
||||||
|
|
||||||
|
private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean accountCreate(AccountCreateRequest request) {
|
public Boolean accountCreate(AccountCreateRequest request) {
|
||||||
@@ -234,11 +241,84 @@ public class WalletServiceImpl implements WalletService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AccountPaymentVO payment(AccountPaymentRequest request) {
|
public AccountPaymentVO payment(AccountPaymentRequest request) {
|
||||||
String storeId = getStoreId(request);
|
ShopInfoDO shopInfo = null;
|
||||||
|
if (Objects.nonNull(request.getShopId())) {
|
||||||
|
shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
|
||||||
|
} else if (StringUtils.isNotBlank(request.getStoreId())) {
|
||||||
|
shopInfo = shopInfoDAO.getShopInfoByStoreId(request.getStoreId());
|
||||||
|
}
|
||||||
|
if (Objects.isNull(shopInfo)) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
|
||||||
|
}
|
||||||
|
String storeId = shopInfo.getStoreId();
|
||||||
|
LineInfoDO lineInfo = lineInfoDAO.getByPartnerId(shopInfo.getPartnerId());
|
||||||
|
if (Objects.isNull(lineInfo)) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
|
||||||
|
}
|
||||||
String paymentId = UUIDUtils.get32UUID();
|
String paymentId = UUIDUtils.get32UUID();
|
||||||
// new LargePaymentRequest(storeId, paymentId, "", request.getAmount());
|
LargePaymentRequest paymentRequest = new LargePaymentRequest(storeId, paymentId, lineInfo.getUsername(), request.getAmount().toString());
|
||||||
|
LargePaymentDTO resultDTO = walletApiService.largePayment(paymentRequest);
|
||||||
|
|
||||||
return null;
|
long expiryCountdown = 0;
|
||||||
|
if (StringUtils.isNotBlank(resultDTO.getExpireTime())) {
|
||||||
|
expiryCountdown = Math.max(0, Duration.between(LocalDateTime.now(), LocalDateTime.parse(resultDTO.getExpireTime(), formatter)).getSeconds());
|
||||||
|
}
|
||||||
|
WalletPaymentOrderDO orderDO = WalletPaymentOrderDO.builder()
|
||||||
|
.storeId(storeId)
|
||||||
|
.paymentId(paymentId)
|
||||||
|
.type(0)
|
||||||
|
.amount(request.getAmount())
|
||||||
|
.expireTime(resultDTO.getExpireTime())
|
||||||
|
.orderStatus(3)
|
||||||
|
.build();
|
||||||
|
walletPaymentOrderDAO.insertSelective(orderDO);
|
||||||
|
AccountPaymentVO result = BeanUtil.toBean(resultDTO, AccountPaymentVO.class);
|
||||||
|
result.setExpiryCountdown(expiryCountdown);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageInfo<WalletPaymentOrderVO> nonPaymentOrderPage(LargePaymentQueryRequest request) {
|
||||||
|
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||||
|
String storeId = getStoreId(request);
|
||||||
|
List<WalletPaymentOrderDO> list = walletPaymentOrderDAO.getNonPaymentList(storeId);
|
||||||
|
PageInfo<WalletPaymentOrderDO> page = new PageInfo<>(list);
|
||||||
|
return BeanUtil.toPage(page, WalletPaymentOrderVO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccountPaymentVO paymentDetail(String paymentId) {
|
||||||
|
PaymentDetailRequest request = new PaymentDetailRequest();
|
||||||
|
request.setPaymentId(paymentId);
|
||||||
|
PaymentDTO resultDTO = walletApiService.largePaymentQuery(request);
|
||||||
|
|
||||||
|
long expiryCountdown = 0;
|
||||||
|
if (StringUtils.isNotBlank(resultDTO.getExpireTime())) {
|
||||||
|
expiryCountdown = Math.max(0, Duration.between(LocalDateTime.now(), LocalDateTime.parse(resultDTO.getExpireTime(), formatter)).getSeconds());
|
||||||
|
}
|
||||||
|
AccountPaymentVO result = BeanUtil.toBean(resultDTO, AccountPaymentVO.class);
|
||||||
|
result.setExpiryCountdown(expiryCountdown);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean withDrawer(WalletWithDrawerRequest request) {
|
||||||
|
String storeId = getStoreId(request);
|
||||||
|
String reqNo = UUIDUtils.get32UUID();
|
||||||
|
WithDrawerRequest withDrawerRequest = new WithDrawerRequest(storeId, request.getPayPwd(), reqNo, request.getAmount().toString(), "提现");
|
||||||
|
WithDrawerDTO withdraw = walletApiService.withdraw(withDrawerRequest);
|
||||||
|
if ("2".equals(withdraw.getTradeStatus())) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.WALLET_WITH_DRAWER_FAIL);
|
||||||
|
}
|
||||||
|
WalletPaymentOrderDO orderDO = WalletPaymentOrderDO.builder()
|
||||||
|
.storeId(storeId)
|
||||||
|
.paymentId(reqNo)
|
||||||
|
.type(1)
|
||||||
|
.amount(request.getAmount())
|
||||||
|
.orderStatus(1)
|
||||||
|
.build();
|
||||||
|
walletPaymentOrderDAO.insertSelective(orderDO);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStoreId(StoreShopRequest request) {
|
public String getStoreId(StoreShopRequest request) {
|
||||||
|
|||||||
@@ -3,10 +3,7 @@ package com.cool.store.controller.webc;
|
|||||||
import com.cool.store.request.wallet.*;
|
import com.cool.store.request.wallet.*;
|
||||||
import com.cool.store.response.ResponseResult;
|
import com.cool.store.response.ResponseResult;
|
||||||
import com.cool.store.service.wallet.WalletService;
|
import com.cool.store.service.wallet.WalletService;
|
||||||
import com.cool.store.vo.wallet.AccountAuthenticationVO;
|
import com.cool.store.vo.wallet.*;
|
||||||
import com.cool.store.vo.wallet.AccountBillListVO;
|
|
||||||
import com.cool.store.vo.wallet.AccountInfoVO;
|
|
||||||
import com.cool.store.vo.wallet.BankVO;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -14,6 +11,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,4 +64,34 @@ public class MiniWalletController {
|
|||||||
public ResponseResult<PageInfo<AccountBillListVO>> getBillPage(@RequestBody AccountBillQueryRequest request) {
|
public ResponseResult<PageInfo<AccountBillListVO>> getBillPage(@RequestBody AccountBillQueryRequest request) {
|
||||||
return ResponseResult.success(walletService.getBillPage(request));
|
return ResponseResult.success(walletService.getBillPage(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("密码维护")
|
||||||
|
@PostMapping("/passwordUpdate")
|
||||||
|
public ResponseResult<Boolean> passwordUpdate(@RequestBody @Validated AccountPasswordRequest request) {
|
||||||
|
return ResponseResult.success(walletService.passwordUpdate(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("账户充值")
|
||||||
|
@PostMapping("/payment")
|
||||||
|
public ResponseResult<AccountPaymentVO> payment(@RequestBody @Validated AccountPaymentRequest request) {
|
||||||
|
return ResponseResult.success(walletService.payment(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("未支付充值订单分页查询")
|
||||||
|
@GetMapping("/nonPaymentPage")
|
||||||
|
public ResponseResult<PageInfo<WalletPaymentOrderVO>> nonPaymentPage(LargePaymentQueryRequest request) {
|
||||||
|
return ResponseResult.success(walletService.nonPaymentOrderPage(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据预支付id查询收款账户详情")
|
||||||
|
@GetMapping("/paymentDetail")
|
||||||
|
public ResponseResult<AccountPaymentVO> paymentDetail(@NotBlank(message = "预支付id不能为空") String paymentId) {
|
||||||
|
return ResponseResult.success(walletService.paymentDetail(paymentId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("提现")
|
||||||
|
@PostMapping("/withDrawer")
|
||||||
|
public ResponseResult<Boolean> withDrawer(@RequestBody @Validated WalletWithDrawerRequest request) {
|
||||||
|
return ResponseResult.success(walletService.withDrawer(request));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user