Merge remote-tracking branch 'yudao/feature/mall_product' into feature/mall_product
# Conflicts: # yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.javaplp
commit
a73e078593
@ -0,0 +1,54 @@
|
||||
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.notify.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 回调通知的明细 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayNotifyTaskDetailRespVO extends PayNotifyTaskBaseVO {
|
||||
|
||||
@Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3380")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "应用名称", example = "wx_pay")
|
||||
private String appName;
|
||||
|
||||
@Schema(description = "回调日志列表")
|
||||
private List<Log> logs;
|
||||
|
||||
@Schema(description = "管理后台 - 回调日志")
|
||||
@Data
|
||||
public static class Log {
|
||||
|
||||
@Schema(description = "日志编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8848")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "通知状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Byte status;
|
||||
|
||||
@Schema(description = "当前通知次数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Byte notifyTimes;
|
||||
|
||||
@Schema(description = "HTTP 响应结果", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String response;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.notify.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 回调通知分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayNotifyTaskPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "应用编号", example = "10636")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "通知类型", example = "2")
|
||||
private Byte type;
|
||||
|
||||
@Schema(description = "数据编号", example = "6722")
|
||||
private Long dataId;
|
||||
|
||||
@Schema(description = "通知状态", example = "1")
|
||||
private Byte status;
|
||||
|
||||
@Schema(description = "商户订单编号", example = "26697")
|
||||
private String merchantOrderId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.notify.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 回调通知 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayNotifyTaskRespVO extends PayNotifyTaskBaseVO {
|
||||
|
||||
@Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3380")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "应用名称", example = "wx_pay")
|
||||
private String appName;
|
||||
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.refund.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 退款订单创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayRefundCreateReqVO extends PayRefundBaseVO {
|
||||
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.refund.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 退款订单 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayRefundRespVO extends PayRefundBaseVO {
|
||||
|
||||
@Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.refund.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 退款订单更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayRefundUpdateReqVO extends PayRefundBaseVO {
|
||||
|
||||
@Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "支付退款编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.pay.convert.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.notify.vo.PayNotifyTaskDetailRespVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.notify.vo.PayNotifyTaskRespVO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyTaskDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 支付通知 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayNotifyTaskConvert {
|
||||
|
||||
PayNotifyTaskConvert INSTANCE = Mappers.getMapper(PayNotifyTaskConvert.class);
|
||||
|
||||
PayNotifyTaskRespVO convert(PayNotifyTaskDO bean);
|
||||
|
||||
default PageResult<PayNotifyTaskRespVO> convertPage(PageResult<PayNotifyTaskDO> page, Map<Long, PayAppDO> appMap){
|
||||
PageResult<PayNotifyTaskRespVO> result = convertPage(page);
|
||||
result.getList().forEach(order -> MapUtils.findAndThen(appMap, order.getAppId(), app -> order.setAppName(app.getName())));
|
||||
return result;
|
||||
}
|
||||
PageResult<PayNotifyTaskRespVO> convertPage(PageResult<PayNotifyTaskDO> page);
|
||||
|
||||
default PayNotifyTaskDetailRespVO convert(PayNotifyTaskDO task, PayAppDO app, List<PayNotifyLogDO> logs) {
|
||||
PayNotifyTaskDetailRespVO respVO = convert(task, logs);
|
||||
if (app != null) {
|
||||
respVO.setAppName(app.getName());
|
||||
}
|
||||
return respVO;
|
||||
}
|
||||
PayNotifyTaskDetailRespVO convert(PayNotifyTaskDO task, List<PayNotifyLogDO> logs);
|
||||
}
|
||||
@ -1,87 +1,56 @@
|
||||
package cn.iocoder.yudao.module.pay.convert.refund;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundRespDTO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundDetailsRespVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExcelVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageItemRespVO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface PayRefundConvert {
|
||||
|
||||
PayRefundConvert INSTANCE = Mappers.getMapper(PayRefundConvert.class);
|
||||
|
||||
PayRefundDO convert(PayRefundCreateReqVO bean);
|
||||
|
||||
PayRefundDO convert(PayRefundUpdateReqVO bean);
|
||||
|
||||
PayRefundRespVO convert(PayRefundDO bean);
|
||||
|
||||
/**
|
||||
* 退款订单 DO 转 退款详情订单 VO
|
||||
*
|
||||
* @param bean 退款订单 DO
|
||||
* @return 退款详情订单 VO
|
||||
*/
|
||||
PayRefundDetailsRespVO refundDetailConvert(PayRefundDO bean);
|
||||
|
||||
/**
|
||||
* 退款订单DO 转 分页退款条目VO
|
||||
*
|
||||
* @param bean 退款订单DO
|
||||
* @return 分页退款条目VO
|
||||
*/
|
||||
PayRefundPageItemRespVO pageItemConvert(PayRefundDO bean);
|
||||
|
||||
List<PayRefundRespVO> convertList(List<PayRefundDO> list);
|
||||
|
||||
PageResult<PayRefundRespVO> convertPage(PageResult<PayRefundDO> page);
|
||||
|
||||
/**
|
||||
* 退款订单DO 转 导出excel VO
|
||||
*
|
||||
* @param bean 退款订单DO
|
||||
* @return 导出 excel VO
|
||||
*/
|
||||
default PayRefundExcelVO excelConvert(PayRefundDO bean) {
|
||||
if (bean == null) {
|
||||
return null;
|
||||
default PayRefundDetailsRespVO convert(PayRefundDO refund, PayAppDO app) {
|
||||
PayRefundDetailsRespVO respVO = convert(refund);
|
||||
if (app != null) {
|
||||
respVO.setAppName(app.getName());
|
||||
}
|
||||
return respVO;
|
||||
}
|
||||
PayRefundDetailsRespVO convert(PayRefundDO bean);
|
||||
PayRefundDetailsRespVO.Order convert(PayOrderDO bean);
|
||||
|
||||
PayRefundExcelVO payRefundExcelVO = new PayRefundExcelVO();
|
||||
|
||||
payRefundExcelVO.setId(bean.getId());
|
||||
payRefundExcelVO.setTradeNo(bean.getNo());
|
||||
payRefundExcelVO.setMerchantOrderId(bean.getMerchantOrderId());
|
||||
// TODO 芋艿:晚点在改
|
||||
// payRefundExcelVO.setMerchantRefundNo(bean.getMerchantRefundNo());
|
||||
payRefundExcelVO.setNotifyUrl(bean.getNotifyUrl());
|
||||
payRefundExcelVO.setNotifyStatus(bean.getNotifyStatus());
|
||||
payRefundExcelVO.setStatus(bean.getStatus());
|
||||
payRefundExcelVO.setReason(bean.getReason());
|
||||
payRefundExcelVO.setUserIp(bean.getUserIp());
|
||||
payRefundExcelVO.setChannelOrderNo(bean.getChannelOrderNo());
|
||||
payRefundExcelVO.setChannelRefundNo(bean.getChannelRefundNo());
|
||||
payRefundExcelVO.setSuccessTime(bean.getSuccessTime());
|
||||
payRefundExcelVO.setCreateTime(bean.getCreateTime());
|
||||
|
||||
BigDecimal multiple = new BigDecimal(100);
|
||||
payRefundExcelVO.setPayPrice(BigDecimal.valueOf(bean.getPayPrice())
|
||||
.divide(multiple, 2, RoundingMode.HALF_UP).toString());
|
||||
payRefundExcelVO.setRefundPrice(BigDecimal.valueOf(bean.getRefundPrice())
|
||||
.divide(multiple, 2, RoundingMode.HALF_UP).toString());
|
||||
|
||||
return payRefundExcelVO;
|
||||
default PageResult<PayRefundPageItemRespVO> convertPage(PageResult<PayRefundDO> page, Map<Long, PayAppDO> appMap) {
|
||||
PageResult<PayRefundPageItemRespVO> result = convertPage(page);
|
||||
result.getList().forEach(order -> MapUtils.findAndThen(appMap, order.getAppId(), app -> order.setAppName(app.getName())));
|
||||
return result;
|
||||
}
|
||||
PageResult<PayRefundPageItemRespVO> convertPage(PageResult<PayRefundDO> page);
|
||||
|
||||
PayRefundDO convert(PayRefundCreateReqDTO bean);
|
||||
|
||||
PayRefundRespDTO convert02(PayRefundDO bean);
|
||||
|
||||
default List<PayRefundExcelVO> convertList(List<PayRefundDO> list, Map<Long, PayAppDO> appMap) {
|
||||
return CollectionUtils.convertList(list, order -> {
|
||||
PayRefundExcelVO excelVO = convertExcel(order);
|
||||
MapUtils.findAndThen(appMap, order.getAppId(), app -> excelVO.setAppName(app.getName()));
|
||||
return excelVO;
|
||||
});
|
||||
}
|
||||
PayRefundExcelVO convertExcel(PayRefundDO bean);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.pay.dal.redis.no;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;import cn.hutool.core.date.DateUtil;import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付序号的 Redis DAO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Repository
|
||||
public class PayNoRedisDAO {
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
/**
|
||||
* 生成序号
|
||||
*
|
||||
* @param prefix 前缀
|
||||
* @return 序号
|
||||
*/
|
||||
public String generate(String prefix) {
|
||||
String noPrefix = prefix + DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_PATTERN);
|
||||
Long no = stringRedisTemplate.opsForValue().increment(noPrefix);
|
||||
return noPrefix + no;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.pay.enums.order;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 支付订单的通知状态枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PayOrderNotifyStatusEnum implements IntArrayValuable {
|
||||
|
||||
NO(0, "未通知"),
|
||||
SUCCESS(10, "通知成功"),
|
||||
FAILURE(20, "通知失败")
|
||||
;
|
||||
|
||||
private final Integer status;
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.pay.enums.order;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 支付订单的退款状态枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PayOrderRefundStatusEnum implements IntArrayValuable {
|
||||
|
||||
NO(0, "未退款"),
|
||||
PART(10, "部分退款"),
|
||||
ALL(20, "全部退款")
|
||||
;
|
||||
|
||||
private final Integer status;
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.pay.framework.pay.config;
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties(PayProperties.class)
|
||||
public class PayConfiguration {
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
package cn.iocoder.yudao.module.pay.service.order;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
// TODO 芋艿:合并到 PayOrder 里;
|
||||
/**
|
||||
* 支付订单 Service 接口
|
||||
*
|
||||
* @author aquan
|
||||
*/
|
||||
public interface PayOrderExtensionService {
|
||||
|
||||
/**
|
||||
* 获得支付订单
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 支付订单
|
||||
*/
|
||||
PayOrderExtensionDO getOrderExtension(Long id);
|
||||
|
||||
/**
|
||||
* 获得支付订单
|
||||
* 列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 支付订单
|
||||
* 列表
|
||||
*/
|
||||
List<PayOrderExtensionDO> getOrderExtensionList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据订单成功的 扩展订单ID 查询所有的扩展订单转 成 map 返回
|
||||
*
|
||||
* @param successExtensionIdList 订单 ID 集合
|
||||
* @return 订单扩展 map 集合
|
||||
*/
|
||||
default Map<Long, PayOrderExtensionDO> getOrderExtensionMap(Collection<Long> successExtensionIdList) {
|
||||
List<PayOrderExtensionDO> list = getOrderExtensionList(successExtensionIdList);
|
||||
return CollectionUtils.convertMap(list, PayOrderExtensionDO::getId);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.pay.service.order;
|
||||
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
|
||||
import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderExtensionMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 支付订单 Service 实现类
|
||||
*
|
||||
* @author aquan
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PayOrderExtensionServiceImpl implements PayOrderExtensionService {
|
||||
|
||||
@Resource
|
||||
private PayOrderExtensionMapper orderExtensionMapper;
|
||||
|
||||
@Override
|
||||
public PayOrderExtensionDO getOrderExtension(Long id) {
|
||||
return orderExtensionMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PayOrderExtensionDO> getOrderExtensionList(Collection<Long> ids) {
|
||||
return orderExtensionMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
DELETE FROM pay_app;
|
||||
DELETE FROM pay_channel;
|
||||
DELETE FROM pay_order;
|
||||
DELETE FROM pay_order_extension;
|
||||
DELETE FROM pay_refund;
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 获得支付通知明细
|
||||
export function getNotifyTaskDetail(id) {
|
||||
return request({
|
||||
url: '/pay/notify/get-detail?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得支付通知分页
|
||||
export function getNotifyTaskPage(query) {
|
||||
return request({
|
||||
url: '/pay/notify/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
@ -1,349 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog :visible.sync="transferParam.aliPayOpen" :title="title" @closed="close" append-to-body width="800px">
|
||||
<el-form ref="aliPayForm" :model="form" :rules="rules" size="medium" label-width="100px"
|
||||
v-loading="transferParam.loading">
|
||||
<el-form-item label-width="180px" label="渠道费率" prop="feeRate">
|
||||
<el-input v-model="form.feeRate" placeholder="请输入渠道费率" clearable :style="{width: '100%'}">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="开放平台APPID" prop="aliPayConfig.appId">
|
||||
<el-input v-model="form.aliPayConfig.appId" placeholder="请输入开放平台APPID" clearable :style="{width: '100%'}">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="渠道状态" prop="status">
|
||||
<el-radio-group v-model="form.status" size="medium">
|
||||
<el-radio v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)">
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="网关地址" prop="aliPayConfig.serverUrl">
|
||||
<el-radio-group v-model="form.aliPayConfig.serverUrl" size="medium">
|
||||
<el-radio v-for="dict in aliPayServerDatas" :key="dict.value" :label="dict.value">
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="算法类型" prop="aliPayConfig.signType">
|
||||
<el-radio-group v-model="form.aliPayConfig.signType" size="medium">
|
||||
<el-radio v-for="dict in aliPaySignTypeDatas" :key="dict.value" :label="dict.value">
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="公钥类型" prop="aliPayConfig.mode">
|
||||
<el-radio-group v-model="form.aliPayConfig.mode" size="medium">
|
||||
<el-radio v-for="dict in aliPayModeDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)">
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div v-if="form.aliPayConfig.mode === 1">
|
||||
<el-form-item label-width="180px" label="应用私钥" prop="aliPayConfig.privateKey">
|
||||
<el-input type="textarea" :autosize="{minRows: 8, maxRows: 8}" v-model="form.aliPayConfig.privateKey"
|
||||
placeholder="请输入应用私钥" clearable :style="{width: '100%'}">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="支付宝公钥" prop="aliPayConfig.alipayPublicKey">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:autosize="{minRows: 8, maxRows: 8}"
|
||||
v-model="form.aliPayConfig.alipayPublicKey"
|
||||
placeholder="请输入支付宝公钥" clearable
|
||||
:style="{width: '100%'}">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div v-if="form.aliPayConfig.mode === 2">
|
||||
<el-form-item label-width="180px" label="商户公钥应用证书" prop="aliPayConfig.appCertContent">
|
||||
<el-input v-model="form.aliPayConfig.appCertContent" type="textarea"
|
||||
placeholder="请上传商户公钥应用证书"
|
||||
readonly :autosize="{minRows: 8, maxRows: 8}" :style="{width: '100%'}"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="">
|
||||
<el-upload
|
||||
action=""
|
||||
ref="privateKeyContentFile"
|
||||
:limit="1"
|
||||
:accept="fileAccept"
|
||||
:http-request="appCertUpload"
|
||||
:before-upload="fileBeforeUpload">
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="支付宝公钥证书" prop="aliPayConfig.alipayPublicCertContent">
|
||||
<el-input v-model="form.aliPayConfig.alipayPublicCertContent" type="textarea"
|
||||
placeholder="请上传支付宝公钥证书"
|
||||
readonly :autosize="{minRows: 8, maxRows: 8}" :style="{width: '100%'}"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="">
|
||||
<el-upload
|
||||
ref="privateCertContentFile"
|
||||
action=""
|
||||
:limit="1"
|
||||
:accept="fileAccept"
|
||||
:before-upload="fileBeforeUpload"
|
||||
:http-request="alipayPublicCertUpload">
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="根证书" prop="aliPayConfig.rootCertContent">
|
||||
<el-input
|
||||
v-model="form.aliPayConfig.rootCertContent"
|
||||
type="textarea"
|
||||
placeholder="请上传根证书"
|
||||
readonly :autosize="{minRows: 8, maxRows: 8}"
|
||||
:style="{width: '100%'}">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="">
|
||||
<el-upload
|
||||
ref="privateCertContentFile"
|
||||
:limit="1"
|
||||
:accept="fileAccept"
|
||||
action=""
|
||||
:before-upload="fileBeforeUpload"
|
||||
:http-request="rootCertUpload">
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label-width="180px" label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" :style="{width: '100%'}"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="handleConfirm">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
|
||||
import {createChannel, getChannel, updateChannel} from "@/api/pay/channel";
|
||||
|
||||
const defaultForm = {
|
||||
code: '',
|
||||
status: null,
|
||||
remark: '',
|
||||
feeRate: null,
|
||||
appId: '',
|
||||
aliPayConfig: {
|
||||
appId: '',
|
||||
serverUrl: null,
|
||||
signType: '',
|
||||
mode: null,
|
||||
privateKey: '',
|
||||
alipayPublicKey: '',
|
||||
appCertContent: '',
|
||||
alipayPublicCertContent: '',
|
||||
rootCertContent: ''
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
name: "aliPayChannelForm",
|
||||
components: {},
|
||||
props: {
|
||||
// 传输的参数
|
||||
transferParam: {
|
||||
// 加载动画
|
||||
"loading": false,
|
||||
// 是否修改
|
||||
"edit": false,
|
||||
// 是否显示
|
||||
"aliPayOpen": false,
|
||||
// 应用ID
|
||||
"appId": null,
|
||||
// 渠道编码
|
||||
"payCode": null,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title:'',
|
||||
form: JSON.parse(JSON.stringify(defaultForm)),
|
||||
rules: {
|
||||
feeRate: [{
|
||||
required: true,
|
||||
message: '请输入渠道费率',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
'aliPayConfig.appId': [{
|
||||
required: true,
|
||||
message: '请输入开放平台上创建的应用的 ID',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
status: [{
|
||||
required: true,
|
||||
message: '渠道状态不能为空',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
'aliPayConfig.serverUrl': [{
|
||||
required: true,
|
||||
message: '请传入网关地址',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
'aliPayConfig.signType': [{
|
||||
required: true,
|
||||
message: '请传入签名算法类型',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
'aliPayConfig.mode': [{
|
||||
required: true,
|
||||
message: '公钥类型不能为空',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
'aliPayConfig.privateKey': [{
|
||||
required: true,
|
||||
message: '请输入商户私钥',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
'aliPayConfig.alipayPublicKey': [{
|
||||
required: true,
|
||||
message: '请输入支付宝公钥字符串',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
'aliPayConfig.appCertContent': [{
|
||||
required: true,
|
||||
message: '请上传商户公钥应用证书',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
'aliPayConfig.alipayPublicCertContent': [{
|
||||
required: true,
|
||||
message: '请上传支付宝公钥证书',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
'aliPayConfig.rootCertContent': [{
|
||||
required: true,
|
||||
message: '请上传指定根证书',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
},
|
||||
fileAccept: ".crt",
|
||||
// 渠道状态 数据字典
|
||||
statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS),
|
||||
// 支付宝加密方式
|
||||
aliPaySignTypeDatas: getDictDatas(DICT_TYPE.PAY_CHANNEL_ALIPAY_SIGN_TYPE),
|
||||
// 版本状态 数据字典
|
||||
aliPayModeDatas: getDictDatas(DICT_TYPE.PAY_CHANNEL_ALIPAY_MODE),
|
||||
// 支付宝网关地址
|
||||
aliPayServerDatas: getDictDatas(DICT_TYPE.PAY_CHANNEL_ALIPAY_SERVER_TYPE),
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
transferParam: {
|
||||
deep: true, // 深度监听
|
||||
handler(newVal) {
|
||||
if (newVal.aliPayOpen) {
|
||||
this.form.code = newVal.payCode;
|
||||
this.form.appId = newVal.appId;
|
||||
// 只有在初次进来为编辑 并且为加载中的时候才回去请求数据
|
||||
if (newVal.edit === true && newVal.loading) {
|
||||
this.title = "编辑支付渠道";
|
||||
this.init();
|
||||
} else {
|
||||
this.title = "创建支付渠道";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
init() {
|
||||
getChannel(this.transferParam.appId, this.transferParam.payCode)
|
||||
.then(response => {
|
||||
this.form.id = response.data.id;
|
||||
this.form.feeRate = response.data.feeRate;
|
||||
this.form.status = response.data.status;
|
||||
this.form.remark = response.data.remark;
|
||||
|
||||
let config = JSON.parse(response.data.config);
|
||||
this.form.aliPayConfig.appId = config.appId;
|
||||
this.form.aliPayConfig.serverUrl = config.serverUrl;
|
||||
this.form.aliPayConfig.signType = config.signType;
|
||||
this.form.aliPayConfig.mode = config.mode;
|
||||
this.form.aliPayConfig.privateKey = config.privateKey;
|
||||
this.form.aliPayConfig.alipayPublicKey = config.alipayPublicKey;
|
||||
this.form.aliPayConfig.appCertContent = config.appCertContent;
|
||||
this.form.aliPayConfig.alipayPublicCertContent = config.alipayPublicCertContent;
|
||||
this.form.aliPayConfig.rootCertContent = config.rootCertContent;
|
||||
this.transferParam.loading = false;
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.transferParam.aliPayOpen = false;
|
||||
this.form = JSON.parse(JSON.stringify(defaultForm));
|
||||
},
|
||||
handleConfirm() {
|
||||
this.$refs['aliPayForm'].validate(valid => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
let data = this.form;
|
||||
data.config = JSON.stringify(this.form.aliPayConfig);
|
||||
if (this.transferParam.edit) {
|
||||
updateChannel(data).then(response => {
|
||||
if (response.code === 0) {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.close();
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
|
||||
createChannel(data).then(response => {
|
||||
if (response.code === 0) {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.$parent.refreshTable();
|
||||
this.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
fileBeforeUpload(file) {
|
||||
let format = '.' + file.name.split(".")[1];
|
||||
if (format !== this.fileAccept) {
|
||||
this.$message.error('请上传指定格式"' + this.fileAccept + '"文件');
|
||||
return false;
|
||||
}
|
||||
let isRightSize = file.size / 1024 / 1024 < 2
|
||||
if (!isRightSize) {
|
||||
this.$message.error('文件大小超过 2MB')
|
||||
}
|
||||
return isRightSize
|
||||
},
|
||||
appCertUpload(event) {
|
||||
const readFile = new FileReader()
|
||||
readFile.onload = (e) => {
|
||||
this.form.aliPayConfig.appCertContent = e.target.result
|
||||
}
|
||||
readFile.readAsText(event.file);
|
||||
},
|
||||
alipayPublicCertUpload(event) {
|
||||
const readFile = new FileReader()
|
||||
readFile.onload = (e) => {
|
||||
this.form.aliPayConfig.alipayPublicCertContent = e.target.result
|
||||
}
|
||||
readFile.readAsText(event.file);
|
||||
},
|
||||
rootCertUpload(event) {
|
||||
const readFile = new FileReader()
|
||||
readFile.onload = (e) => {
|
||||
this.form.aliPayConfig.rootCertContent = e.target.result
|
||||
}
|
||||
readFile.readAsText(event.file);
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog :visible.sync="dialogVisible" :title="title" @closed="close" append-to-body width="800px">
|
||||
<el-form ref="form" :model="formData" :rules="rules" size="medium" label-width="100px" v-loading="formLoading">
|
||||
<el-form-item label-width="180px" label="渠道费率" prop="feeRate">
|
||||
<el-input v-model="formData.feeRate" placeholder="请输入渠道费率" clearable :style="{width: '100%'}">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="开放平台 APPID" prop="config.appId">
|
||||
<el-input v-model="formData.config.appId" placeholder="请输入开放平台 APPID" clearable :style="{width: '100%'}">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="渠道状态" prop="status">
|
||||
<el-radio-group v-model="formData.status" size="medium">
|
||||
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" :key="parseInt(dict.value)"
|
||||
:label="parseInt(dict.value)">
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="网关地址" prop="config.serverUrl">
|
||||
<el-radio-group v-model="formData.config.serverUrl" size="medium">
|
||||
<el-radio label="https://openapi.alipay.com/gateway.do">线上环境</el-radio>
|
||||
<el-radio label="https://openapi-sandbox.dl.alipaydev.com/gateway.do">沙箱环境</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="算法类型" prop="config.signType">
|
||||
<el-radio-group v-model="formData.config.signType" size="medium">
|
||||
<el-radio key="RSA2" label="RSA2">RSA2</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="公钥类型" prop="config.mode">
|
||||
<el-radio-group v-model="formData.config.mode" size="medium">
|
||||
<el-radio key="公钥模式" :label="1">公钥模式</el-radio>
|
||||
<el-radio key="证书模式" :label="2">证书模式</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div v-if="formData.config.mode === 1">
|
||||
<el-form-item label-width="180px" label="应用私钥" prop="config.privateKey">
|
||||
<el-input type="textarea" :autosize="{minRows: 8, maxRows: 8}" v-model="formData.config.privateKey"
|
||||
placeholder="请输入应用私钥" clearable :style="{width: '100%'}">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="支付宝公钥" prop="config.alipayPublicKey">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:autosize="{minRows: 8, maxRows: 8}"
|
||||
v-model="formData.config.alipayPublicKey"
|
||||
placeholder="请输入支付宝公钥" clearable
|
||||
:style="{width: '100%'}">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div v-if="formData.config.mode === 2">
|
||||
<el-form-item label-width="180px" label="商户公钥应用证书" prop="config.appCertContent">
|
||||
<el-input v-model="formData.config.appCertContent" type="textarea"
|
||||
placeholder="请上传商户公钥应用证书"
|
||||
readonly :autosize="{minRows: 8, maxRows: 8}" :style="{width: '100%'}"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="">
|
||||
<el-upload
|
||||
action=""
|
||||
ref="privateKeyContentFile"
|
||||
:limit="1"
|
||||
:accept="fileAccept"
|
||||
:http-request="appCertUpload"
|
||||
:before-upload="fileBeforeUpload">
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="支付宝公钥证书" prop="config.alipayPublicCertContent">
|
||||
<el-input v-model="formData.config.alipayPublicCertContent" type="textarea"
|
||||
placeholder="请上传支付宝公钥证书"
|
||||
readonly :autosize="{minRows: 8, maxRows: 8}" :style="{width: '100%'}"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="">
|
||||
<el-upload
|
||||
ref="privateCertContentFile"
|
||||
action=""
|
||||
:limit="1"
|
||||
:accept="fileAccept"
|
||||
:before-upload="fileBeforeUpload"
|
||||
:http-request="alipayPublicCertUpload">
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="根证书" prop="config.rootCertContent">
|
||||
<el-input
|
||||
v-model="formData.config.rootCertContent"
|
||||
type="textarea"
|
||||
placeholder="请上传根证书"
|
||||
readonly :autosize="{minRows: 8, maxRows: 8}"
|
||||
:style="{width: '100%'}">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="180px" label="">
|
||||
<el-upload
|
||||
ref="privateCertContentFile"
|
||||
:limit="1"
|
||||
:accept="fileAccept"
|
||||
action=""
|
||||
:before-upload="fileBeforeUpload"
|
||||
:http-request="rootCertUpload">
|
||||
<el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label-width="180px" label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" :style="{width: '100%'}"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { createChannel, getChannel, updateChannel } from "@/api/pay/channel";
|
||||
import { CommonStatusEnum } from "@/utils/constants";
|
||||
|
||||
export default {
|
||||
name: "alipayChannelForm",
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
formLoading: false,
|
||||
title:'',
|
||||
formData: {
|
||||
appId: '',
|
||||
code: '',
|
||||
status: undefined,
|
||||
feeRate: undefined,
|
||||
remark: '',
|
||||
config: {
|
||||
appId: '',
|
||||
serverUrl: null,
|
||||
signType: '',
|
||||
mode: null,
|
||||
privateKey: '',
|
||||
alipayPublicKey: '',
|
||||
appCertContent: '',
|
||||
alipayPublicCertContent: '',
|
||||
rootCertContent: ''
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
feeRate: [{ required: true, message: '请输入渠道费率', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '渠道状态不能为空', trigger: 'blur' }],
|
||||
'config.appId': [{ required: true, message: '请输入开放平台上创建的应用的 ID', trigger: 'blur' }],
|
||||
'config.serverUrl': [{ required: true, message: '请传入网关地址', trigger: 'blur' }],
|
||||
'config.signType': [{ required: true, message: '请传入签名算法类型', trigger: 'blur' }],
|
||||
'config.mode': [{ required: true, message: '公钥类型不能为空', trigger: 'blur'}],
|
||||
'config.privateKey': [{ required: true, message: '请输入商户私钥', trigger: 'blur' }],
|
||||
'config.alipayPublicKey': [{ required: true, message: '请输入支付宝公钥字符串', trigger: 'blur' }],
|
||||
'config.appCertContent': [{ required: true, message: '请上传商户公钥应用证书', trigger: 'blur' }],
|
||||
'config.alipayPublicCertContent': [{ required: true, message: '请上传支付宝公钥证书', trigger: 'blur'}],
|
||||
'config.rootCertContent': [{ required: true, message: '请上传指定根证书', trigger: 'blur' }],
|
||||
},
|
||||
fileAccept: ".crt",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(appId, code) {
|
||||
this.dialogVisible = true;
|
||||
this.formLoading = true;
|
||||
this.reset(appId, code);
|
||||
getChannel(appId, code).then(response => {
|
||||
if (response.data && response.data.id) {
|
||||
this.formData = response.data;
|
||||
this.formData.config = JSON.parse(response.data.config);
|
||||
}
|
||||
this.title = this.formData.id ? '创建支付渠道' : '编辑支付渠道'
|
||||
}).finally(() => {
|
||||
this.formLoading = false;
|
||||
});
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false;
|
||||
this.reset(undefined, undefined);
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
const data = { ...this.formData };
|
||||
data.config = JSON.stringify(this.formData.config);
|
||||
if (!data.id) {
|
||||
createChannel(data).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.$emit('success')
|
||||
this.close();
|
||||
});
|
||||
} else {
|
||||
updateChannel(data).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.$emit('success')
|
||||
this.close();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 重置表单 */
|
||||
reset(appId, code) {
|
||||
this.formData = {
|
||||
appId: appId,
|
||||
code: code,
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
remark: '',
|
||||
feeRate: null,
|
||||
config: {
|
||||
appId: '',
|
||||
serverUrl: null,
|
||||
signType: 'RSA2',
|
||||
mode: null,
|
||||
privateKey: '',
|
||||
alipayPublicKey: '',
|
||||
appCertContent: '',
|
||||
alipayPublicCertContent: '',
|
||||
rootCertContent: ''
|
||||
}
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
fileBeforeUpload(file) {
|
||||
let format = '.' + file.name.split(".")[1];
|
||||
if (format !== this.fileAccept) {
|
||||
this.$message.error('请上传指定格式"' + this.fileAccept + '"文件');
|
||||
return false;
|
||||
}
|
||||
let isRightSize = file.size / 1024 / 1024 < 2
|
||||
if (!isRightSize) {
|
||||
this.$message.error('文件大小超过 2MB')
|
||||
}
|
||||
return isRightSize
|
||||
},
|
||||
appCertUpload(event) {
|
||||
const readFile = new FileReader()
|
||||
readFile.onload = (e) => {
|
||||
this.formData.config.appCertContent = e.target.result
|
||||
}
|
||||
readFile.readAsText(event.file);
|
||||
},
|
||||
alipayPublicCertUpload(event) {
|
||||
const readFile = new FileReader()
|
||||
readFile.onload = (e) => {
|
||||
this.formData.config.alipayPublicCertContent = e.target.result
|
||||
}
|
||||
readFile.readAsText(event.file);
|
||||
},
|
||||
rootCertUpload(event) {
|
||||
const readFile = new FileReader()
|
||||
readFile.onload = (e) => {
|
||||
this.formData.config.rootCertContent = e.target.result
|
||||
}
|
||||
readFile.readAsText(event.file);
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@ -0,0 +1,221 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="应用编号" prop="appId">
|
||||
<el-select clearable v-model="queryParams.appId" filterable placeholder="请选择应用信息">
|
||||
<el-option v-for="item in appList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="通知类型" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择通知类型" clearable size="small">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.PAY_NOTIFY_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联编号" prop="dataId">
|
||||
<el-input v-model="queryParams.dataId" placeholder="请输入关联编号" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="通知状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择通知状态" clearable size="small">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.PAY_NOTIFY_STATUS)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户订单编号" prop="merchantOrderId">
|
||||
<el-input v-model="queryParams.merchantOrderId" placeholder="请输入商户订单编号" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="任务编号" align="center" prop="id" />
|
||||
<el-table-column label="应用编号" align="center" prop="appName" />
|
||||
<el-table-column label="商户订单编号" align="center" prop="merchantOrderId" />
|
||||
<el-table-column label="通知类型" align="center" prop="type">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.PAY_NOTIFY_TYPE" :value="scope.row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="关联编号" align="center" prop="dataId" />
|
||||
<el-table-column label="通知状态" align="center" prop="status">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.PAY_NOTIFY_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="最后通知时间" align="center" prop="lastExecuteTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.lastExecuteTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下次通知时间" align="center" prop="nextNotifyTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.nextNotifyTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="通知次数" align="center" prop="notifyTimes">
|
||||
<template v-slot="scope">
|
||||
<el-tag size="mini" type="success">
|
||||
{{ scope.row.notifyTimes }} / {{ scope.row.maxNotifyTimes }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-search" @click="handleDetail(scope.row)"
|
||||
v-hasPermi="['pay:notify:query']">查看详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<!-- 对话框(详情) -->
|
||||
<el-dialog title="通知详情" :visible.sync="open" width="700px" v-dialogDrag append-to-body>
|
||||
<el-descriptions :column="2" label-class-name="desc-label">
|
||||
<el-descriptions-item label="商户订单编号">
|
||||
<el-tag size="small">{{ notifyDetail.merchantOrderId }}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="通知状态">
|
||||
<dict-tag :type="DICT_TYPE.PAY_NOTIFY_STATUS" :value="notifyDetail.status" size="small" />
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="2" label-class-name="desc-label">
|
||||
<el-descriptions-item label="应用编号">{{ notifyDetail.appId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="应用名称">{{ notifyDetail.appName }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="2" label-class-name="desc-label">
|
||||
<el-descriptions-item label="关联编号">{{ notifyDetail.dataId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="通知类型">
|
||||
<dict-tag :type="DICT_TYPE.PAY_NOTIFY_TYPE" :value="notifyDetail.type" />
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="2" label-class-name="desc-label">
|
||||
<el-descriptions-item label="通知次数">{{ notifyDetail.notifyTimes }}</el-descriptions-item>
|
||||
<el-descriptions-item label="最大通知次数">{{ notifyDetail.maxNotifyTimes }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="2" label-class-name="desc-label">
|
||||
<el-descriptions-item label="最后通知时间">{{ parseTime(notifyDetail.lastExecuteTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="下次通知时间">{{ parseTime(notifyDetail.nextNotifyTime) }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="2" label-class-name="desc-label">
|
||||
<el-descriptions-item label="创建时间">{{ parseTime(notifyDetail.createTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">{{ parseTime(notifyDetail.updateTime) }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<!-- 分割线 -->
|
||||
<el-divider />
|
||||
<el-descriptions :column="1" label-class-name="desc-label" direction="vertical" border>
|
||||
<el-descriptions-item label="回调日志">
|
||||
<el-table :data="notifyDetail.logs">
|
||||
<el-table-column label="日志编号" align="center" prop="id" />
|
||||
<el-table-column label="通知状态" align="center" prop="status">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.PAY_NOTIFY_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="通知次数" align="center" prop="notifyTimes" />
|
||||
<el-table-column label="通知时间" align="center" prop="lastExecuteTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="响应结果" align="center" prop="response" />
|
||||
</el-table>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getNotifyTaskPage, getNotifyTaskDetail } from "@/api/pay/notify";
|
||||
import { getAppList } from "@/api/pay/app";
|
||||
|
||||
export default {
|
||||
name: "PayNotify",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 支付通知列表
|
||||
list: [],
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
appId: null,
|
||||
type: null,
|
||||
dataId: null,
|
||||
status: null,
|
||||
merchantOrderId: null,
|
||||
createTime: [],
|
||||
},
|
||||
|
||||
// 支付应用列表集合
|
||||
appList: [],
|
||||
// 通知详情
|
||||
notifyDetail: {
|
||||
logs: []
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
// 获得筛选项
|
||||
getAppList().then(response => {
|
||||
this.appList = response.data;
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getNotifyTaskPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 详情按钮操作 */
|
||||
handleDetail(row) {
|
||||
this.notifyDetail = {};
|
||||
getNotifyTaskDetail(row.id).then(response => {
|
||||
// 设置值
|
||||
this.notifyDetail = response.data;
|
||||
// 弹窗打开
|
||||
this.open = true;
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Loading…
Reference in New Issue