diff --git a/pom.xml b/pom.xml index f56f07ddb..e5294f7d8 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,7 @@ yudao-module-system yudao-module-infra yudao-module-tool + yudao-module-pay ${artifactId} diff --git a/yudao-admin-server/pom.xml b/yudao-admin-server/pom.xml index dd73b5178..4eaef38c2 100644 --- a/yudao-admin-server/pom.xml +++ b/yudao-admin-server/pom.xml @@ -37,6 +37,11 @@ yudao-module-infra-impl ${revision} + + cn.iocoder.boot + yudao-module-pay-impl + ${revision} + @@ -71,11 +76,7 @@ - - - cn.iocoder.boot - yudao-spring-boot-starter-web - + org.springframework.boot @@ -83,34 +84,6 @@ true - - cn.iocoder.boot - yudao-spring-boot-starter-security - - - - - cn.iocoder.boot - yudao-spring-boot-starter-mybatis - - - - cn.iocoder.boot - yudao-spring-boot-starter-redis - - - - - cn.iocoder.boot - yudao-spring-boot-starter-job - - - - - cn.iocoder.boot - yudao-spring-boot-starter-mq - - cn.iocoder.boot @@ -128,24 +101,6 @@ spring-boot-admin-starter-server - - - cn.iocoder.boot - yudao-spring-boot-starter-test - test - - - - - cn.iocoder.boot - yudao-spring-boot-starter-excel - - - - org.apache.velocity - velocity-engine-core - - diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/package-info.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/package-info.java deleted file mode 100644 index da3973390..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * 提供 POJO 类的实体转换 - * - * 目前使用 MapStruct 框架 - */ -package cn.iocoder.yudao.adminserver.modules.pay.convert; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayOrderExtensionMapper.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayOrderExtensionMapper.java deleted file mode 100755 index 47baabb31..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayOrderExtensionMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import org.apache.ibatis.annotations.Mapper; - -/** - * 支付订单 Mapper - * - * @author aquan - */ -@Mapper -public interface PayOrderExtensionMapper extends BaseMapperX { - - -} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/enums/PayErrorCodeConstants.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/enums/PayErrorCodeConstants.java deleted file mode 100644 index df39d9efc..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/enums/PayErrorCodeConstants.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.pay.enums; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/job/package-info.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/job/package-info.java deleted file mode 100644 index 3db569789..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/job/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.pay.job; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/package-info.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/package-info.java deleted file mode 100644 index a113b9beb..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * pay 包下,我们放支付业务,提供业务的支付能力。 - * 例如说:商户、应用、支付、退款等等 - * - * 缩写:pay - */ -package cn.iocoder.yudao.adminserver.modules.pay; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/impl/PayChannelServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/impl/PayChannelServiceImpl.java deleted file mode 100644 index 6ba21f8c3..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/impl/PayChannelServiceImpl.java +++ /dev/null @@ -1,161 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.channel.impl; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.json.JSONUtil; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelUpdateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.convert.channel.PayChannelConvert; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.channel.PayChannelMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.channel.PayChannelService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; -import javax.validation.Validator; -import java.util.Collection; -import java.util.List; - -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.CHANNEL_EXIST_SAME_CHANNEL_ERROR; -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.CHANNEL_NOT_EXISTS; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - -/** - * 支付渠道 Service 实现类 - * - * @author aquan - */ -@Service -@Slf4j -@Validated -public class PayChannelServiceImpl implements PayChannelService { - - @Resource - private PayChannelMapper channelMapper; - - @Resource - private Validator validator; - - @Override - public Long createChannel(PayChannelCreateReqVO reqVO) { - // 断言是否有重复的 - PayChannelDO channelDO = this.getChannelByConditions(reqVO.getMerchantId(), reqVO.getAppId(), reqVO.getCode()); - if (ObjectUtil.isNotNull(channelDO)) { - throw exception(CHANNEL_EXIST_SAME_CHANNEL_ERROR); - } - - // 新增渠道 - PayChannelDO channel = PayChannelConvert.INSTANCE.convert(reqVO); - settingConfigAndCheckParam(channel, reqVO.getConfig()); - channelMapper.insert(channel); - return channel.getId(); - } - - @Override - public void updateChannel(PayChannelUpdateReqVO updateReqVO) { - // 校验存在 - this.validateChannelExists(updateReqVO.getId()); - // 更新 - PayChannelDO channel = PayChannelConvert.INSTANCE.convert(updateReqVO); - settingConfigAndCheckParam(channel, updateReqVO.getConfig()); - channelMapper.updateById(channel); - } - - @Override - public void deleteChannel(Long id) { - // 校验存在 - this.validateChannelExists(id); - // 删除 - channelMapper.deleteById(id); - } - - private void validateChannelExists(Long id) { - if (channelMapper.selectById(id) == null) { - throw exception(CHANNEL_NOT_EXISTS); - } - } - - @Override - public PayChannelDO getChannel(Long id) { - return channelMapper.selectById(id); - } - - @Override - public List getChannelList(Collection ids) { - return channelMapper.selectBatchIds(ids); - } - - @Override - public PageResult getChannelPage(PayChannelPageReqVO pageReqVO) { - return channelMapper.selectPage(pageReqVO); - } - - @Override - public List getChannelList(PayChannelExportReqVO exportReqVO) { - return channelMapper.selectList(exportReqVO); - } - - /** - * 根据支付应用ID集合获得支付渠道列表 - * - * @param appIds 应用编号集合 - * @return 支付渠道列表 - */ - @Override - public List getChannelListByAppIds(Collection appIds) { - return channelMapper.getChannelListByAppIds(appIds); - } - - - /** - * 根据条件获取通道数量 - * - * @param merchantId 商户编号 - * @param appid 应用编号 - * @param code 通道编码 - * @return 数量 - */ - @Override - public Integer getChannelCountByConditions(Long merchantId, Long appid, String code) { - return this.channelMapper.selectCount(merchantId, appid, code); - } - - /** - * 根据条件获取通道 - * - * @param merchantId 商户编号 - * @param appid 应用编号 - * @param code 通道编码 - * @return 数量 - */ - @Override - public PayChannelDO getChannelByConditions(Long merchantId, Long appid, String code) { - return this.channelMapper.selectOne(merchantId, appid, code); - } - - /** - * 设置渠道配置以及参数校验 - * - * @param channel 渠道 - * @param configStr 配置 - */ - private void settingConfigAndCheckParam(PayChannelDO channel, String configStr) { - // 得到这个渠道是微信的还是支付宝的 - Class payClass = PayChannelEnum.getByCode(channel.getCode()).getConfigClass(); - if (ObjectUtil.isNull(payClass)) { - throw exception(CHANNEL_NOT_EXISTS); - } - PayClientConfig config = JSONUtil.toBean(configStr, payClass); - - // 验证参数 - config.validate(validator); - channel.setConfig(config); - } - -} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayRefundService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayRefundService.java deleted file mode 100755 index 1412bdefe..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayRefundService.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.order; - -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundPageReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import java.util.List; - -/** - * 退款订单 Service 接口 - * - * @author aquan - */ -public interface PayRefundService { - - /** - * 获得退款订单 - * - * @param id 编号 - * @return 退款订单 - */ - PayRefundDO getRefund(Long id); - - /** - * 获得退款订单分页 - * - * @param pageReqVO 分页查询 - * @return 退款订单分页 - */ - PageResult getRefundPage(PayRefundPageReqVO pageReqVO); - - /** - * 获得退款订单列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 退款订单列表 - */ - List getRefundList(PayRefundExportReqVO exportReqVO); - -} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayOrderServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayOrderServiceImpl.java deleted file mode 100755 index dd6d0a8bd..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayOrderServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.order.impl; - -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayOrderMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -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 PayOrderServiceImpl implements PayOrderService { - - @Resource - private PayOrderMapper orderMapper; - - @Override - public PayOrderDO getOrder(Long id) { - return orderMapper.selectById(id); - } - - @Override - public PageResult getOrderPage(PayOrderPageReqVO pageReqVO) { - return orderMapper.selectPage(pageReqVO); - } - - @Override - public List getOrderList(PayOrderExportReqVO exportReqVO) { - return orderMapper.selectList(exportReqVO); - } - - /** - * 根据 ID 集合获取只包含商品名称的订单集合 - * - * @param idList 订单 ID 集合 - * @return 只包含商品名称的订单集合 - */ - @Override - public List getOrderSubjectList(Collection idList) { - return orderMapper.findByIdListQueryOrderSubject(idList); - } - -} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayRefundServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayRefundServiceImpl.java deleted file mode 100755 index 00f42ebcd..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayRefundServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.order.impl; - -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayRefundMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayRefundService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 退款订单 Service 实现类 - * - * @author aquan - */ -@Service -@Validated -public class PayRefundServiceImpl implements PayRefundService { - - @Resource - private PayRefundMapper refundMapper; - - @Override - public PayRefundDO getRefund(Long id) { - return refundMapper.selectById(id); - } - - @Override - public PageResult getRefundPage(PayRefundPageReqVO pageReqVO) { - return refundMapper.selectPage(pageReqVO); - } - - @Override - public List getRefundList(PayRefundExportReqVO exportReqVO) { - return refundMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/PayChannelConfig.java b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/PayChannelConfig.java deleted file mode 100644 index bff90e6e0..000000000 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/PayChannelConfig.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.channel; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import javax.validation.Validation; -import javax.validation.Validator; - -/** - * 用于初始化 validator Bean 对象 - * @author aquan - */ -@Configuration -public class PayChannelConfig { - - @Bean - public Validator validator(){ - return Validation.buildDefaultValidatorFactory().getValidator(); - } -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/order/PayOrderCoreConvert.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/order/PayOrderCoreConvert.java deleted file mode 100644 index 3e5215cd8..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/order/PayOrderCoreConvert.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.convert.order; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitReqDTO; -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface PayOrderCoreConvert { - - PayOrderCoreConvert INSTANCE = Mappers.getMapper(PayOrderCoreConvert.class); - - PayOrderDO convert(PayOrderCreateReqDTO bean); - - PayOrderExtensionDO convert(PayOrderSubmitReqDTO bean); - - PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqDTO bean); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/order/PayRefundCoreConvert.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/order/PayRefundCoreConvert.java deleted file mode 100644 index 4a4ada555..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/order/PayRefundCoreConvert.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.convert.order; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface PayRefundCoreConvert { - - PayRefundCoreConvert INSTANCE = Mappers.getMapper(PayRefundCoreConvert.class); - - //TODO 太多需要处理了, 暂时不用 - @Mappings(value = { - @Mapping(source = "amount", target = "payAmount"), - @Mapping(source = "id", target = "orderId"), - @Mapping(target = "status",ignore = true) - }) - PayRefundDO convert(PayOrderDO orderDO); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/package-info.java deleted file mode 100644 index b10c09029..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * 提供 POJO 类的实体转换 - * - * 目前使用 MapStruct 框架 - */ -package cn.iocoder.yudao.coreservice.modules.pay.convert; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md deleted file mode 100644 index 8153487b7..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/merchant/PayAppCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/merchant/PayAppCoreMapper.java deleted file mode 100644 index 603ff4609..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/merchant/PayAppCoreMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.merchant; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface PayAppCoreMapper extends BaseMapperX { -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/merchant/PayChannelCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/merchant/PayChannelCoreMapper.java deleted file mode 100644 index 767a16b24..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/merchant/PayChannelCoreMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.merchant; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Select; - -import java.util.Date; - -@Mapper -public interface PayChannelCoreMapper extends BaseMapperX { - - default PayChannelDO selectByAppIdAndCode(Long appId, String code) { - return selectOne(PayChannelDO::getAppId, appId, PayChannelDO::getCode, code); - } - - @Select("SELECT id FROM pay_channel WHERE update_time > #{maxUpdateTime} LIMIT 1") - Long selectExistsByUpdateTimeAfter(Date maxUpdateTime); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayOrderCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayOrderCoreMapper.java deleted file mode 100644 index 1ed34d549..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayOrderCoreMapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface PayOrderCoreMapper extends BaseMapperX { - - default PayOrderDO selectByAppIdAndMerchantOrderId(Long appId, String merchantOrderId) { - return selectOne(new QueryWrapper().eq("app_id", appId) - .eq("merchant_order_id", merchantOrderId)); - } - - default int updateByIdAndStatus(Long id, Integer status, PayOrderDO update) { - return update(update, new QueryWrapper() - .eq("id", id).eq("status", status)); - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayRefundCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayRefundCoreMapper.java deleted file mode 100644 index 8de1396dd..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayRefundCoreMapper.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import org.apache.ibatis.annotations.Mapper; - - -/** - * 退款订单 Mapper - * - */ -@Mapper -public interface PayRefundCoreMapper extends BaseMapperX { - - default PayRefundDO selectByReqNo(String reqNo) { - return selectOne("req_no", reqNo); - } - - default PayRefundDO selectByTradeNoAndMerchantRefundNo(String tradeNo, String merchantRefundNo){ - return selectOne("trade_no", tradeNo, "merchant_refund_no", merchantRefundNo); - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/package-info.java deleted file mode 100644 index 8f5ba6ac3..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * pay 包下,我们放支付业务,提供业务的支付能力。 - * 例如说:商户、应用、支付、退款等等 - * - * 缩写:pay - */ -package cn.iocoder.yudao.coreservice.modules.pay; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/PayAppCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/PayAppCoreService.java deleted file mode 100644 index ab6f3f27f..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/PayAppCoreService.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.merchant; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.framework.common.exception.ServiceException; - -/** - * 支付应用 Core Service 接口 - * - * @author 芋道源码 - */ -public interface PayAppCoreService { - - /** - * 支付应用的合法性 - * - * 如果不合法,抛出 {@link ServiceException} 业务异常 - * - * @param id 应用编号 - * @return 应用信息 - */ - PayAppDO validPayApp(Long id); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/PayChannelCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/PayChannelCoreService.java deleted file mode 100644 index 76d467875..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/PayChannelCoreService.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.merchant; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.framework.common.exception.ServiceException; - -/** - * 支付渠道 Core Service 接口 - * - * @author 芋道源码 - */ -public interface PayChannelCoreService { - - /** - * 初始化支付客户端 - */ - void initPayClients(); - - /** - * 支付渠道的合法性 - * - * 如果不合法,抛出 {@link ServiceException} 业务异常 - * - * @param id 渠道编号 - * @return 渠道信息 - */ - PayChannelDO validPayChannel(Long id); - - /** - * 支付渠道的合法性 - * - * 如果不合法,抛出 {@link ServiceException} 业务异常 - * - * @param appId 应用编号 - * @param code 支付渠道 - * @return 渠道信息 - */ - PayChannelDO validPayChannel(Long appId, String code); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/impl/PayAppCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/impl/PayAppCoreServiceImpl.java deleted file mode 100644 index 916b50137..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/impl/PayAppCoreServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.merchant.impl; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.merchant.PayAppCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayAppCoreService; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import javax.validation.Valid; - -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.*; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - -/** - * 支付应用 Core Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Valid -@Slf4j -public class PayAppCoreServiceImpl implements PayAppCoreService { - - @Resource - private PayAppCoreMapper payAppCoreMapper; - - @Override - public PayAppDO validPayApp(Long id) { - PayAppDO app = payAppCoreMapper.selectById(id); - // 校验是否存在 - if (app == null) { - throw exception(PAY_APP_NOT_FOUND); - } - // 校验是否禁用 - if (CommonStatusEnum.DISABLE.getStatus().equals(app.getStatus())) { - throw exception(PAY_APP_IS_DISABLE); - } - return app; - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/impl/PayChannelCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/impl/PayChannelCoreServiceImpl.java deleted file mode 100644 index 5029b6ebd..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/merchant/impl/PayChannelCoreServiceImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.merchant.impl; - -import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.merchant.PayChannelCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants; -import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayChannelCoreService; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Service; - -import javax.annotation.PostConstruct; -import javax.annotation.Resource; -import javax.validation.Valid; - -import java.util.Comparator; -import java.util.Date; -import java.util.List; - -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.*; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - -/** - * 支付渠道 Core Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Valid -@Slf4j -public class PayChannelCoreServiceImpl implements PayChannelCoreService { - - /** - * 定时执行 {@link #schedulePeriodicRefresh()} 的周期 - * 因为已经通过 Redis Pub/Sub 机制,所以频率不需要高 - */ - private static final long SCHEDULER_PERIOD = 5 * 60 * 1000L; - - /** - * 缓存菜单的最大更新时间,用于后续的增量轮询,判断是否有更新 - */ - private volatile Date maxUpdateTime; - - @Resource - private PayChannelCoreMapper payChannelCoreMapper; - - @Resource - private PayClientFactory payClientFactory; - - @Override - @PostConstruct - public void initPayClients() { - // 获取支付渠道,如果有更新 - List payChannels = this.loadPayChannelIfUpdate(maxUpdateTime); - if (CollUtil.isEmpty(payChannels)) { - return; - } - - // 创建或更新支付 Client - payChannels.forEach(payChannel -> payClientFactory.createOrUpdatePayClient(payChannel.getId(), - payChannel.getCode(), payChannel.getConfig())); - - // 写入缓存 - assert payChannels.size() > 0; // 断言,避免告警 - maxUpdateTime = payChannels.stream().max(Comparator.comparing(BaseDO::getUpdateTime)).get().getUpdateTime(); - log.info("[initPayClients][初始化 PayChannel 数量为 {}]", payChannels.size()); - } - - @Scheduled(fixedDelay = SCHEDULER_PERIOD, initialDelay = SCHEDULER_PERIOD) - public void schedulePeriodicRefresh() { - initPayClients(); - } - - /** - * 如果支付渠道发生变化,从数据库中获取最新的全量支付渠道。 - * 如果未发生变化,则返回空 - * - * @param maxUpdateTime 当前支付渠道的最大更新时间 - * @return 支付渠道列表 - */ - private List loadPayChannelIfUpdate(Date maxUpdateTime) { - // 第一步,判断是否要更新。 - if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据 - log.info("[loadPayChannelIfUpdate][首次加载全量支付渠道]"); - } else { // 判断数据库中是否有更新的支付渠道 - if (payChannelCoreMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) { - return null; - } - log.info("[loadPayChannelIfUpdate][增量加载全量支付渠道]"); - } - // 第二步,如果有更新,则从数据库加载所有支付渠道 - return payChannelCoreMapper.selectList(); - } - - @Override - public PayChannelDO validPayChannel(Long id) { - PayChannelDO channel = payChannelCoreMapper.selectById(id); - this.validPayChannel(channel); - return channel; - } - - @Override - public PayChannelDO validPayChannel(Long appId, String code) { - PayChannelDO channel = payChannelCoreMapper.selectByAppIdAndCode(appId, code); - this.validPayChannel(channel); - return channel; - } - - private void validPayChannel(PayChannelDO channel) { - if (channel == null) { - throw exception(PAY_CHANNEL_NOT_FOUND); - } - if (CommonStatusEnum.DISABLE.getStatus().equals(channel.getStatus())) { - throw exception(PayErrorCodeCoreConstants.PAY_CHANNEL_IS_DISABLE); - } - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/vo/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/vo/package-info.java deleted file mode 100644 index 78667d3ce..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/vo/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * 这里的 VO 包有点特殊,是提供给接入支付模块的业务,提供回调接口时,可以直接使用 VO - * - * 例如说,支付单的回调,使用 - */ -package cn.iocoder.yudao.coreservice.modules.pay.service.notify.vo; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayOrderCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayOrderCoreService.java deleted file mode 100644 index 07e659229..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayOrderCoreService.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.order; - -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; - -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.*; -import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; - -import javax.validation.Valid; - -/** - * 支付订单 Core Service - * - * @author 芋道源码 - */ -public interface PayOrderCoreService { - - /** - * 获得支付单 - * - * @param id 支付单编号 - * @return 支付单 - */ - PayOrderDO getPayOrder(Long id); - - /** - * 创建支付单 - * - * @param reqDTO 创建请求 - * @return 支付单编号 - */ - Long createPayOrder(@Valid PayOrderCreateReqDTO reqDTO); - - /** - * 提交支付 - * 此时,会发起支付渠道的调用 - * - * @param reqDTO 提交请求 - * @return 提交结果 - */ - PayOrderSubmitRespDTO submitPayOrder(@Valid PayOrderSubmitReqDTO reqDTO); - - /** - * 通知支付单成功 - * - * @param channelId 渠道编号 - * @param notifyData 通知数据 - */ - void notifyPayOrder(Long channelId, PayNotifyDataDTO notifyData) throws Exception; - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayRefundCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayRefundCoreService.java deleted file mode 100644 index b56384ed6..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/PayRefundCoreService.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.order; - -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayRefundReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayRefundRespDTO; -import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; - -/** - * 退款单 Core Service - * - * @author jason - */ -public interface PayRefundCoreService { - - /** - * 提交退款申请 - * - * @param reqDTO 退款申请信息 - * @return 退款申请返回信息 - */ - PayRefundRespDTO submitRefundOrder(PayRefundReqDTO reqDTO); - - /** - * 渠道的退款通知 - * - * @param channelId 渠道编号 - * @param notifyData 通知数据 - * @throws Exception 退款通知异常 - */ - void notifyPayRefund(Long channelId, PayNotifyDataDTO notifyData) throws Exception; - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/package-info.java deleted file mode 100644 index 13b4863a5..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayChannelEnum.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayChannelEnum.java index 418676fca..f8a4971a1 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayChannelEnum.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayChannelEnum.java @@ -17,10 +17,7 @@ import lombok.Getter; @AllArgsConstructor public enum PayChannelEnum { - /** - * 公众号网页 - */ - WX_PUB("wx_pub", "微信 JSAPI 支付", WXPayClientConfig.class), + WX_PUB("wx_pub", "微信 JSAPI 支付", WXPayClientConfig.class), // 公众号网页 WX_LITE("wx_lite", "微信小程序支付", WXPayClientConfig.class), WX_APP("wx_app", "微信 App 支付", WXPayClientConfig.class), @@ -34,16 +31,16 @@ public enum PayChannelEnum { *

* 参考 https://www.pingxx.com/api/支付渠道属性值.html */ - private String code; + private final String code; /** * 名字 */ - private String name; + private final String name; /** * 配置类 */ - private Class configClass; + private final Class configClass; /** * 微信支付 @@ -58,6 +55,6 @@ public enum PayChannelEnum { public static PayChannelEnum getByCode(String code) { return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values()); } - + } diff --git a/yudao-module-pay/pom.xml b/yudao-module-pay/pom.xml new file mode 100644 index 000000000..36fd9edb3 --- /dev/null +++ b/yudao-module-pay/pom.xml @@ -0,0 +1,25 @@ + + + + cn.iocoder.boot + yudao + ${revision} + + 4.0.0 + yudao-module-pay + pom + + yudao-module-pay-api + yudao-module-pay-impl + + + ${artifactId} + + pay 模块,我们放支付业务,提供业务的支付能力。 + 例如说:商户、应用、支付、退款等等 + + + + diff --git a/yudao-module-pay/yudao-module-pay-api/pom.xml b/yudao-module-pay/yudao-module-pay-api/pom.xml new file mode 100644 index 000000000..d5ec95176 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-api/pom.xml @@ -0,0 +1,26 @@ + + + + yudao-module-pay + cn.iocoder.boot + 1.4.0-snapshot + + 4.0.0 + yudao-module-pay-api + jar + + ${artifactId} + + pay 模块 API,暴露给其它模块调用 + + + + + cn.iocoder.boot + yudao-common + + + + diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/DictTypeConstants.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/DictTypeConstants.java new file mode 100644 index 000000000..2f40f2df4 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/DictTypeConstants.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.pay.enums; + +/** + * Pay 字典类型的枚举类 + * + * @author 芋道源码 + */ +public interface DictTypeConstants { + + /** + * 支付-订单-订单状态 + */ + String PAY_ORDER_STATUS = "pay_order_status"; + + /** + * 支付-订单-订单回调商户状态 + */ + String PAY_ORDER_NOTIFY_STATUS = "pay_order_notify_status"; + + /** + * 支付-订单-订单退款状态 + */ + String PAY_ORDER_REFUND_STATUS = "pay_order_refund_status"; + + /** + * 支付-退款订单-退款状态 + */ + String PAY_REFUND_ORDER_STATUS = "pay_refund_order_status"; + + /** + * 支付-退款订单-退款类别 + */ + String PAY_REFUND_ORDER_TYPE = "pay_refund_order_type"; + +} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/PayErrorCodeCoreConstants.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java similarity index 97% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/PayErrorCodeCoreConstants.java rename to yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java index f5133ad05..203cb0703 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/PayErrorCodeCoreConstants.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.enums; +package cn.iocoder.yudao.module.pay.enums; import cn.iocoder.yudao.framework.common.exception.ErrorCode; @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; * * pay 系统,使用 1-007-000-000 段 */ -public interface PayErrorCodeCoreConstants { +public interface ErrorCodeConstants { /** * ========== APP 模块 1-007-000-000 ========== diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/package-info.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/package-info.java new file mode 100644 index 000000000..756410aa8 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.pay; diff --git a/yudao-module-pay/yudao-module-pay-impl/pom.xml b/yudao-module-pay/yudao-module-pay-impl/pom.xml new file mode 100644 index 000000000..f8e6da5dc --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-impl/pom.xml @@ -0,0 +1,103 @@ + + + + yudao-module-pay + cn.iocoder.boot + 1.4.0-snapshot + + 4.0.0 + yudao-module-pay-impl + jar + + ${artifactId} + + pay 模块,我们放支付业务,提供业务的支付能力。 + 例如说:商户、应用、支付、退款等等 + + + + + cn.iocoder.boot + yudao-module-pay-api + ${revision} + + + + + cn.iocoder.boot + yudao-spring-boot-starter-biz-operatelog + + + cn.iocoder.boot + yudao-spring-boot-starter-biz-pay + + + + + cn.iocoder.boot + yudao-spring-boot-starter-security + + + + + cn.iocoder.boot + yudao-spring-boot-starter-mybatis + + + + cn.iocoder.boot + yudao-spring-boot-starter-redis + + + + + cn.iocoder.boot + yudao-spring-boot-starter-job + + + + + cn.iocoder.boot + yudao-spring-boot-starter-mq + + + + + cn.iocoder.boot + yudao-spring-boot-starter-test + test + + + + + cn.iocoder.boot + yudao-spring-boot-starter-excel + + + + + + + ${artifactId} + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + repackage + + + + + + + + diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/PayAppController.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayAppController.java similarity index 88% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/PayAppController.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayAppController.java index 344624392..0d06c9e25 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/PayAppController.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayAppController.java @@ -1,20 +1,20 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.app; +package cn.iocoder.yudao.module.pay.controller.admin.merchant; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.*; -import cn.iocoder.yudao.adminserver.modules.pay.convert.app.PayAppConvert; -import cn.iocoder.yudao.adminserver.modules.pay.service.app.PayAppService; -import cn.iocoder.yudao.adminserver.modules.pay.service.channel.PayChannelService; -import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.*; +import cn.iocoder.yudao.module.pay.convert.app.PayAppConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.service.merchant.PayAppService; +import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService; +import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -33,7 +33,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @Slf4j -@Api(tags = "支付应用信息") +@Api(tags = "管理后台 - 支付应用信息") @RestController @RequestMapping("/pay/app") @Validated @@ -106,7 +106,7 @@ public class PayAppController { return success(new PageResult<>(pageResult.getTotal())); } - // 得到所有的应用编号,查出所有的通道 + // 得到所有的应用编号,查出所有的渠道 Collection payAppIds = CollectionUtils.convertList(pageResult.getList(), PayAppDO::getId); List channels = channelService.getChannelListByAppIds(payAppIds); // TODO @aquan:可以基于 appId 简历一个 multiMap。这样下面,直接 get 到之后,CollUtil buildSet 即可 @@ -116,7 +116,7 @@ public class PayAppController { Collection merchantIds = CollectionUtils.convertList(pageResult.getList(), PayAppDO::getMerchantId); Map deptMap = merchantService.getMerchantMap(merchantIds); - // 利用反射将通道数据复制到返回的数据结构中去 + // 利用反射将渠道数据复制到返回的数据结构中去 List appList = new ArrayList<>(pageResult.getList().size()); pageResult.getList().forEach(app -> { // 写入应用信息的数据 diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/PayChannelController.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayChannelController.java similarity index 91% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/PayChannelController.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayChannelController.java index ae83ef9cc..82d3a354e 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/PayChannelController.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayChannelController.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.channel; +package cn.iocoder.yudao.module.pay.controller.admin.merchant; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.*; -import cn.iocoder.yudao.adminserver.modules.pay.convert.channel.PayChannelConvert; -import cn.iocoder.yudao.adminserver.modules.pay.service.channel.PayChannelService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.*; +import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; @@ -26,11 +26,7 @@ import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -/** - * 支付渠道 controller 组件 - * @author aquan - */ -@Api(tags = "支付渠道") +@Api(tags = "管理后台 - 支付渠道") @RestController @RequestMapping("/pay/channel") @Validated @@ -39,7 +35,6 @@ public class PayChannelController { @Resource private PayChannelService channelService; - @PostMapping("/create") @ApiOperation("创建支付渠道 ") @PreAuthorize("@ss.hasPermission('pay:channel:create')") @@ -116,7 +111,6 @@ public class PayChannelController { @PreAuthorize("@ss.hasPermission('pay:channel:query')") public CommonResult getChannel( @RequestParam Long merchantId, @RequestParam Long appId, @RequestParam String code) { - // 獲取渠道 PayChannelDO channel = channelService.getChannelByConditions(merchantId, appId, code); if (channel == null) { @@ -126,4 +120,5 @@ public class PayChannelController { PayChannelRespVO respVo = PayChannelConvert.INSTANCE.convert(channel); return success(respVo); } + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/PayMerchantController.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayMerchantController.java similarity index 92% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/PayMerchantController.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayMerchantController.java index ae0235efc..0882502aa 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/PayMerchantController.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayMerchantController.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.merchant; +package cn.iocoder.yudao.module.pay.controller.admin.merchant; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.*; -import cn.iocoder.yudao.adminserver.modules.pay.convert.merchant.PayMerchantConvert; -import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.*; +import cn.iocoder.yudao.module.pay.convert.merchant.PayMerchantConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppBaseVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppBaseVO.java similarity index 94% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppBaseVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppBaseVO.java index 6ffe565ec..795b3c643 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app; import lombok.*; import io.swagger.annotations.*; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppCreateReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppCreateReqVO.java similarity index 50% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppCreateReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppCreateReqVO.java index 3b0e69b99..a66a71963 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppCreateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppCreateReqVO.java @@ -1,11 +1,9 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app; import lombok.*; -import java.util.*; import io.swagger.annotations.*; -import javax.validation.constraints.*; -@ApiModel("支付应用信息创建 Request VO") +@ApiModel("管理后台 - 支付应用信息创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppExcelVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppExcelVO.java similarity index 83% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppExcelVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppExcelVO.java index f81b53bd0..3fc274a03 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppExcelVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppExcelVO.java @@ -1,10 +1,9 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo; - -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app; import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; /** * 支付应用信息 Excel VO diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppExportReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppExportReqVO.java similarity index 84% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppExportReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppExportReqVO.java index b5d284447..d8b464250 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppExportReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app; import lombok.*; import java.util.*; @@ -8,7 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel(value = "支付应用信息 Excel 导出 Request VO", description = "参数和 PayAppPageReqVO 是一致的") +@ApiModel(value = "管理后台 - 支付应用信息 Excel 导出 Request VO", description = "参数和 PayAppPageReqVO 是一致的") @Data public class PayAppExportReqVO { diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppPageItemRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppPageItemRespVO.java similarity index 78% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppPageItemRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppPageItemRespVO.java index 6d8144afe..e5ad0825f 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppPageItemRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppPageItemRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -9,12 +9,7 @@ import lombok.ToString; import java.util.Date; import java.util.Set; -/** - * 支付应用信息分页查询 Response VO - * - * @author aquan - */ -@ApiModel(value = "支付应用信息分页查询 Response VO", description = "相比于支付信息,还会多出应用渠道的开关信息") +@ApiModel(value = "管理后台 - 支付应用信息分页查询 Response VO", description = "相比于支付信息,还会多出应用渠道的开关信息") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppPageReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppPageReqVO.java similarity index 90% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppPageReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppPageReqVO.java index 62156e993..62af7e19f 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppPageReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app; import lombok.*; import java.util.*; @@ -8,7 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel("支付应用信息分页 Request VO") +@ApiModel("管理后台 - 支付应用信息分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppRespVO.java similarity index 74% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppRespVO.java index 565491f92..e0ac450a2 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppRespVO.java @@ -1,10 +1,10 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app; import lombok.*; import java.util.*; import io.swagger.annotations.*; -@ApiModel("支付应用信息 Response VO") +@ApiModel("管理后台 - 支付应用信息 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppUpdateReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppUpdateReqVO.java similarity index 72% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppUpdateReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppUpdateReqVO.java index 426366fc1..9bdd04254 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppUpdateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppUpdateReqVO.java @@ -1,11 +1,10 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app; import lombok.*; -import java.util.*; import io.swagger.annotations.*; import javax.validation.constraints.*; -@ApiModel("支付应用信息更新 Request VO") +@ApiModel("管理后台 - 支付应用信息更新 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppUpdateStatusReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppUpdateStatusReqVO.java similarity index 81% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppUpdateStatusReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppUpdateStatusReqVO.java index 28a3218ae..2ccce684c 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/app/vo/PayAppUpdateStatusReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppUpdateStatusReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -6,7 +6,7 @@ import lombok.Data; import javax.validation.constraints.NotNull; -@ApiModel("应用更新状态 Request VO") +@ApiModel("管理后台 - 应用更新状态 Request VO") @Data public class PayAppUpdateStatusReqVO { diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelBaseVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelBaseVO.java similarity index 86% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelBaseVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelBaseVO.java index 42a98b972..8b9f53490 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelBaseVO.java @@ -1,13 +1,11 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel; import lombok.*; -import java.util.*; import io.swagger.annotations.*; import javax.validation.constraints.*; /** -* 支付渠道 - Base VO,提供给添加、修改、详细的子 VO 使用 +* 支付渠道 Base VO,提供给添加、修改、详细的子 VO 使用 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelCreateReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelCreateReqVO.java similarity index 60% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelCreateReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelCreateReqVO.java index a814b7b86..5852f9bb1 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelCreateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelCreateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -8,14 +8,14 @@ import lombok.ToString; import javax.validation.constraints.NotBlank; -@ApiModel("支付渠道 创建 Request VO") +@ApiModel("管理后台 - 支付渠道 创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class PayChannelCreateReqVO extends PayChannelBaseVO { - @ApiModelProperty(value = "通道配置的 json 字符串") - @NotBlank(message = "通道配置不能为空") + @ApiModelProperty(value = "渠道配置的 json 字符串") + @NotBlank(message = "渠道配置不能为空") private String config; } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelExcelVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelExcelVO.java similarity index 91% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelExcelVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelExcelVO.java index a4618780a..780abb18f 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelExcelVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelExcelVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel; import lombok.*; import java.util.*; @@ -7,8 +7,7 @@ import io.swagger.annotations.*; import com.alibaba.excel.annotation.ExcelProperty; /** - * 支付渠道 - Excel VO + * 支付渠道 Excel VO * * @author 芋艿 */ diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelExportReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelExportReqVO.java similarity index 85% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelExportReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelExportReqVO.java index 29e3acdaf..d4d6e6653 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelExportReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel; import lombok.*; import java.util.*; @@ -8,7 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel(value = "支付渠道 Excel 导出 Request VO", description = "参数和 PayChannelPageReqVO 是一致的") +@ApiModel(value = "管理后台 - 支付渠道 Excel 导出 Request VO", description = "参数和 PayChannelPageReqVO 是一致的") @Data public class PayChannelExportReqVO { diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelPageReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelPageReqVO.java similarity index 90% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelPageReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelPageReqVO.java index 83851f944..29995d07a 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelPageReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel; import lombok.*; import java.util.*; @@ -8,7 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel("支付渠道 分页 Request VO") +@ApiModel("管理后台 - 支付渠道 分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelRespVO.java similarity index 78% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelRespVO.java index 02873b9f5..b2644f4d0 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelRespVO.java @@ -1,10 +1,10 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel; import lombok.*; import java.util.*; import io.swagger.annotations.*; -@ApiModel("支付渠道 Response VO") +@ApiModel("管理后台 - 支付渠道 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelUpdateReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelUpdateReqVO.java similarity index 60% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelUpdateReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelUpdateReqVO.java index fdefc7bad..c216de9ae 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/channel/vo/PayChannelUpdateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelUpdateReqVO.java @@ -1,11 +1,10 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel; import lombok.*; -import java.util.*; import io.swagger.annotations.*; import javax.validation.constraints.*; -@ApiModel("支付渠道 更新 Request VO") +@ApiModel("管理后台 - 支付渠道 更新 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @@ -15,7 +14,7 @@ public class PayChannelUpdateReqVO extends PayChannelBaseVO { @NotNull(message = "商户编号不能为空") private Long id; - @ApiModelProperty(value = "通道配置的json字符串") - @NotBlank(message = "通道配置不能为空") + @ApiModelProperty(value = "渠道配置的json字符串") + @NotBlank(message = "渠道配置不能为空") private String config; } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantBaseVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantBaseVO.java similarity index 91% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantBaseVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantBaseVO.java index ed7b69a3f..1052fdd03 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantCreateReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantCreateReqVO.java similarity index 51% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantCreateReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantCreateReqVO.java index 2128de88b..018db180b 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantCreateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantCreateReqVO.java @@ -1,11 +1,9 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant; import lombok.*; -import java.util.*; import io.swagger.annotations.*; -import javax.validation.constraints.*; -@ApiModel("支付商户信息创建 Request VO") +@ApiModel("管理后台 - 支付商户信息创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantExcelVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantExcelVO.java similarity index 91% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantExcelVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantExcelVO.java index cb229fb11..b399a111d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantExcelVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantExcelVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantExportReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantExportReqVO.java similarity index 82% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantExportReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantExportReqVO.java index c6c322282..680b04b35 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantExportReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant; import lombok.*; import java.util.*; @@ -8,7 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel(value = "支付商户信息 Excel 导出 Request VO", description = "参数和 PayMerchantPageReqVO 是一致的") +@ApiModel(value = "管理后台 - 支付商户信息 Excel 导出 Request VO", description = "参数和 PayMerchantPageReqVO 是一致的") @Data public class PayMerchantExportReqVO { diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantPageReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantPageReqVO.java similarity index 88% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantPageReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantPageReqVO.java index 8a66ac953..241287c98 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantPageReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant; import lombok.*; import java.util.*; @@ -8,7 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel("支付商户信息分页 Request VO") +@ApiModel("管理后台 - 支付商户信息分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantRespVO.java similarity index 69% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantRespVO.java index d5b194359..a27c591a1 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -8,7 +8,7 @@ import lombok.ToString; import java.util.Date; -@ApiModel("支付商户信息 Response VO") +@ApiModel("管理后台 - 支付商户信息 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @@ -20,11 +20,7 @@ public class PayMerchantRespVO extends PayMerchantBaseVO { @ApiModelProperty(value = "创建时间", required = true) private Date createTime; - /** - * 商户号 - * 例如说,M233666999 - * 只有新增时插入,不允许修改 - */ + @ApiModelProperty(value = "商户号", required = true, example = "M233666999") private String no; } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantUpdateReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantUpdateReqVO.java similarity index 71% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantUpdateReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantUpdateReqVO.java index 031d34fd5..d270a3d84 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantUpdateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantUpdateReqVO.java @@ -1,11 +1,10 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant; import lombok.*; -import java.util.*; import io.swagger.annotations.*; import javax.validation.constraints.*; -@ApiModel("支付商户信息更新 Request VO") +@ApiModel("管理后台 - 支付商户信息更新 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantUpdateStatusReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantUpdateStatusReqVO.java similarity index 80% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantUpdateStatusReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantUpdateStatusReqVO.java index 635876954..39e26b8b7 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/merchant/vo/PayMerchantUpdateStatusReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantUpdateStatusReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo; +package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -6,7 +6,7 @@ import lombok.Data; import javax.validation.constraints.NotNull; -@ApiModel("商户更新状态 Request VO") +@ApiModel("管理后台 - 商户更新状态 Request VO") @Data public class PayMerchantUpdateStatusReqVO { diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayOrderController.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/PayOrderController.java similarity index 85% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayOrderController.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/PayOrderController.java index 2ac44c66e..2219204c4 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayOrderController.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/PayOrderController.java @@ -1,17 +1,17 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order; +package cn.iocoder.yudao.module.pay.controller.admin.order; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.*; -import cn.iocoder.yudao.adminserver.modules.pay.convert.order.PayOrderConvert; -import cn.iocoder.yudao.adminserver.modules.pay.service.app.PayAppService; -import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService; -import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderExtensionService; -import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*; +import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; +import cn.iocoder.yudao.module.pay.service.merchant.PayAppService; +import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService; +import cn.iocoder.yudao.module.pay.service.order.PayOrderExtensionService; +import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; @@ -39,38 +39,18 @@ import java.util.Map; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -/** - * 支付订单 controller 组件 - * - * @author aquan - */ -@Api(tags = "支付订单") +@Api(tags = "管理后台 - 支付订单") @RestController @RequestMapping("/pay/order") @Validated public class PayOrderController { - /** - * 订单 service 组件 - */ @Resource private PayOrderService orderService; - - /** - * 订单扩展 service 组件 - */ @Resource private PayOrderExtensionService orderExtensionService; - - /** - * 商户 service 组件 - */ @Resource private PayMerchantService merchantService; - - /** - * 应用 service 组件 - */ @Resource private PayAppService appService; @@ -88,6 +68,7 @@ public class PayOrderController { PayAppDO appDO = appService.getApp(order.getAppId()); PayChannelEnum channelEnum = PayChannelEnum.getByCode(order.getChannelCode()); + // TODO @aquan:文案,都是前端 format; PayOrderDetailsRespVO respVO = PayOrderConvert.INSTANCE.orderDetailConvert(order); respVO.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户"); respVO.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用"); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderBaseVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java similarity index 95% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderBaseVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java index 320125a40..1064720fb 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; +package cn.iocoder.yudao.module.pay.controller.admin.order.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -10,8 +10,7 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; /** - * 支付订单 - * Base VO,提供给添加、修改、详细的子 VO 使用 + * 支付订单 Base VO,提供给添加、修改、详细的子 VO 使用 * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 * * @author aquan diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderDetailsRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderDetailsRespVO.java similarity index 82% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderDetailsRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderDetailsRespVO.java index d85a9bcb1..6bf7152b5 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderDetailsRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderDetailsRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; +package cn.iocoder.yudao.module.pay.controller.admin.order.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -8,12 +8,7 @@ import lombok.ToString; import java.util.Date; -/** - * 支付订单详细信息,由支付订单和支付订单扩展信息组成 - * - * @author aquan - */ -@ApiModel("支付订单详细信息 Response VO") +@ApiModel("管理后台 - 支付订单详细信息 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExcelVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExcelVO.java similarity index 94% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExcelVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExcelVO.java index f6836bc8c..c620e2d1b 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExcelVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExcelVO.java @@ -1,8 +1,8 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; +package cn.iocoder.yudao.module.pay.controller.admin.order.vo; -import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExportReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java similarity index 92% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExportReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java index 3445c86b9..c079ea144 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExportReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; +package cn.iocoder.yudao.module.pay.controller.admin.order.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -9,11 +9,7 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -/** - * 支付订单 Excel 导出 Request VO - * @author aquan - */ -@ApiModel(value = "支付订单 Excel 导出 Request VO", description = "参数和 PayOrderPageReqVO 是一致的") +@ApiModel(value = "管理后台 - 支付订单 Excel 导出 Request VO", description = "参数和 PayOrderPageReqVO 是一致的") @Data public class PayOrderExportReqVO { diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageItemRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageItemRespVO.java similarity index 82% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageItemRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageItemRespVO.java index b24b27a47..3c0b4e635 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageItemRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageItemRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; +package cn.iocoder.yudao.module.pay.controller.admin.order.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -8,12 +8,7 @@ import lombok.ToString; import java.util.Date; -/** - * 支付订单分页 Request VO - * - * @author aquan - */ -@ApiModel("支付订单分页 Request VO") +@ApiModel("管理后台 - 支付订单分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java similarity index 95% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java index 07fa6a820..5787ba285 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderPageReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; +package cn.iocoder.yudao.module.pay.controller.admin.order.vo; import cn.iocoder.yudao.framework.common.pojo.PageParam; import io.swagger.annotations.ApiModel; @@ -12,12 +12,7 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -/** - * 支付订单分页 Request VO - * - * @author aquan - */ -@ApiModel("支付订单分页 Request VO") +@ApiModel("管理后台 - 支付订单分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderRespVO.java similarity index 74% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderRespVO.java index c46693635..29d0cb611 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; +package cn.iocoder.yudao.module.pay.controller.admin.order.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -8,12 +8,7 @@ import lombok.ToString; import java.util.Date; -/** - * 支付订单 Response VO - * - * @author aquan - */ -@ApiModel("支付订单 Response VO") +@ApiModel("管理后台 - 支付订单 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayRefundController.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/PayRefundController.java similarity index 86% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayRefundController.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/PayRefundController.java index 912d35254..58cb24fa3 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/PayRefundController.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/PayRefundController.java @@ -1,17 +1,17 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order; +package cn.iocoder.yudao.module.pay.controller.admin.refund; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.*; -import cn.iocoder.yudao.adminserver.modules.pay.convert.refund.PayRefundConvert; -import cn.iocoder.yudao.adminserver.modules.pay.service.app.PayAppService; -import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService; -import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderService; -import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayRefundService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*; +import cn.iocoder.yudao.module.pay.convert.refund.PayRefundConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; +import cn.iocoder.yudao.module.pay.service.merchant.PayAppService; +import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService; +import cn.iocoder.yudao.module.pay.service.order.PayOrderService; +import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; @@ -39,12 +39,7 @@ import java.util.Map; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -/** - * 退款订单 Controller 组件 - * - * @author aquan - */ -@Api(tags = "退款订单") +@Api(tags = "管理后台 - 退款订单") @RestController @RequestMapping("/pay/refund") @Validated @@ -52,26 +47,13 @@ public class PayRefundController { @Resource private PayRefundService refundService; - - /** - * 商户 service 组件 - */ @Resource private PayMerchantService merchantService; - - /** - * 应用 service 组件 - */ @Resource private PayAppService appService; - - /** - * 订单 service 组件 - */ @Resource private PayOrderService orderService; - @GetMapping("/get") @ApiOperation("获得退款订单") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundBaseVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundBaseVO.java similarity index 98% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundBaseVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundBaseVO.java index c8421b035..594496c77 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundBaseVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; +package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundCreateReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundCreateReqVO.java similarity index 60% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundCreateReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundCreateReqVO.java index 79b05c625..cc09111ef 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundCreateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundCreateReqVO.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; +package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; import lombok.*; import io.swagger.annotations.*; -@ApiModel("退款订单创建 Request VO") +@ApiModel("管理后台 - 退款订单创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundDetailsRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundDetailsRespVO.java similarity index 83% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundDetailsRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundDetailsRespVO.java index d1d6739ee..e8a70ecd8 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundDetailsRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundDetailsRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; +package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -9,12 +9,7 @@ import lombok.ToString; import javax.validation.constraints.NotNull; import java.util.Date; -/** - * 退款订单详情 Response VO - * - * @author aquan - */ -@ApiModel("退款订单详情 Response VO") +@ApiModel("管理后台 - 退款订单详情 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExcelVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExcelVO.java similarity index 93% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExcelVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExcelVO.java index 793493eaa..75e72c8be 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExcelVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExcelVO.java @@ -1,8 +1,8 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; +package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; -import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExportReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExportReqVO.java similarity index 94% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExportReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExportReqVO.java index 5a0e9c4e0..c0498239f 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExportReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; +package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -9,7 +9,7 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel(value = "退款订单 Excel 导出 Request VO", description = "参数和 PayRefundPageReqVO 是一致的") +@ApiModel(value = "管理后台 - 退款订单 Excel 导出 Request VO", description = "参数和 PayRefundPageReqVO 是一致的") @Data public class PayRefundExportReqVO { diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageItemRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageItemRespVO.java similarity index 79% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageItemRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageItemRespVO.java index 69e881bce..03fe650ee 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageItemRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageItemRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; +package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -8,11 +8,7 @@ import lombok.ToString; import java.util.Date; -/** - * 退款订单分页查询 Response VO - * @author aquan - */ -@ApiModel("退款订单分页查询 Response VO") +@ApiModel("管理后台 - 退款订单分页查询 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageReqVO.java similarity index 96% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageReqVO.java index 103a7a27c..78272009f 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundPageReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; +package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; import cn.iocoder.yudao.framework.common.pojo.PageParam; import io.swagger.annotations.ApiModel; @@ -12,7 +12,7 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel("退款订单分页 Request VO") +@ApiModel("管理后台 - 退款订单分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundRespVO.java similarity index 81% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundRespVO.java index 901a0fe85..97445d77f 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; +package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -8,7 +8,7 @@ import lombok.ToString; import java.util.Date; -@ApiModel("退款订单 Response VO") +@ApiModel("管理后台 - 退款订单 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundUpdateReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundUpdateReqVO.java similarity index 75% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundUpdateReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundUpdateReqVO.java index 8cb2dcf67..b7d555563 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundUpdateReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundUpdateReqVO.java @@ -1,10 +1,10 @@ -package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; +package cn.iocoder.yudao.module.pay.controller.admin.refund.vo; import lombok.*; import io.swagger.annotations.*; import javax.validation.constraints.*; -@ApiModel("退款订单更新 Request VO") +@ApiModel("管理后台 - 退款订单更新 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/AppPayOrderController.java similarity index 69% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/AppPayOrderController.java index fb022b106..e01f7f4f4 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayOrderController.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/AppPayOrderController.java @@ -1,17 +1,17 @@ -package cn.iocoder.yudao.userserver.modules.pay.controller.order; +package cn.iocoder.yudao.module.pay.controller.app.order; import cn.hutool.core.bean.BeanUtil; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayOrderCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayRefundCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitRespDTO; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.pay.core.client.PayClient; import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; -import cn.iocoder.yudao.userserver.modules.pay.controller.order.vo.PayOrderSubmitReqVO; -import cn.iocoder.yudao.userserver.modules.pay.controller.order.vo.PayOrderSubmitRespVO; +import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitReqVO; +import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitRespVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.service.order.PayOrderService; +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderSubmitReqDTO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderSubmitRespDTO; +import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -21,52 +21,52 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Map; -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.PAY_CHANNEL_CLIENT_NOT_FOUND; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; +import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; -@Api(tags = "支付订单") +@Api(tags = "用户 APP - 支付订单") @RestController @RequestMapping("/pay/order") @Validated @Slf4j -public class PayOrderController { +public class AppPayOrderController { @Resource - private PayOrderCoreService payOrderCoreService; + private PayOrderService orderService; @Resource - private PayRefundCoreService payRefundCoreService; + private PayRefundService refundService; @Resource private PayClientFactory payClientFactory; - @PostMapping("/submit") @ApiOperation("提交支付订单") // @PreAuthenticated // TODO 暂时不加登陆验证,前端暂时没做好 - public CommonResult submitPayOrder(@RequestBody PayOrderSubmitReqVO reqVO) { + public CommonResult submitPayOrder(@RequestBody AppPayOrderSubmitReqVO reqVO) { // 获得订单 - PayOrderDO payOrder = payOrderCoreService.getPayOrder(reqVO.getId()); + PayOrderDO payOrder = orderService.getOrder(reqVO.getId()); // 提交支付 PayOrderSubmitReqDTO reqDTO = new PayOrderSubmitReqDTO(); BeanUtil.copyProperties(reqVO, reqDTO, false); reqDTO.setUserIp(getClientIP()); reqDTO.setAppId(payOrder.getAppId()); - PayOrderSubmitRespDTO respDTO = payOrderCoreService.submitPayOrder(reqDTO); + PayOrderSubmitRespDTO respDTO = orderService.submitPayOrder(reqDTO); // 拼接返回 - return success(PayOrderSubmitRespVO.builder().invokeResponse(respDTO.getInvokeResponse()).build()); + return success(AppPayOrderSubmitRespVO.builder().invokeResponse(respDTO.getInvokeResponse()).build()); } // ========== 支付渠道的回调 ========== + // TODO @芋艿:是不是放到 notify 模块更合适 //TODO 芋道源码 换成了统一的地址了 /notify/{channelId},测试通过可以删除 @PostMapping("/notify/wx-pub/{channelId}") @ApiOperation("通知微信公众号支付的结果") public String notifyWxPayOrder(@PathVariable("channelId") Long channelId, @RequestBody String xmlData) throws Exception { - payOrderCoreService.notifyPayOrder(channelId, PayNotifyDataDTO.builder().body(xmlData).build()); + orderService.notifyPayOrder(channelId, PayNotifyDataDTO.builder().body(xmlData).build()); return "success"; } @@ -110,12 +110,12 @@ public class PayOrderController { // 如果是退款,则发起退款通知 if (payClient.isRefundNotify(notifyData)) { - payRefundCoreService.notifyPayRefund(channelId, PayNotifyDataDTO.builder().params(params).body(originData).build()); + refundService.notifyPayRefund(channelId, PayNotifyDataDTO.builder().params(params).body(originData).build()); return "success"; } // 如果非退款,则发起支付通知 - payOrderCoreService.notifyPayOrder(channelId, PayNotifyDataDTO.builder().params(params).body(originData).build()); + orderService.notifyPayOrder(channelId, PayNotifyDataDTO.builder().params(params).body(originData).build()); return "success"; } diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayOrderSubmitReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/vo/AppPayOrderSubmitReqVO.java similarity index 83% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayOrderSubmitReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/vo/AppPayOrderSubmitReqVO.java index 407edb171..6834c3838 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayOrderSubmitReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/vo/AppPayOrderSubmitReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.module.pay.controller.app.order.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -9,10 +9,10 @@ import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.Map; -@ApiModel("支付订单提交 Request VO") +@ApiModel("用户 APP - 支付订单提交 Request VO") @Data @Accessors(chain = true) -public class PayOrderSubmitReqVO { +public class AppPayOrderSubmitReqVO { @ApiModelProperty(value = "支付单编号", required = true, example = "1024") @NotNull(message = "支付单编号不能为空") diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayOrderSubmitRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/vo/AppPayOrderSubmitRespVO.java similarity index 69% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayOrderSubmitRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/vo/AppPayOrderSubmitRespVO.java index 907a97946..7fcffd097 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayOrderSubmitRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/vo/AppPayOrderSubmitRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.module.pay.controller.app.order.vo; import io.swagger.annotations.ApiModel; import lombok.AllArgsConstructor; @@ -7,13 +7,13 @@ import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; -@ApiModel("支付订单提交 Response VO") +@ApiModel("用户 APP - 支付订单提交 Response VO") @Data @Accessors(chain = true) @Builder @NoArgsConstructor @AllArgsConstructor -public class PayOrderSubmitRespVO { +public class AppPayOrderSubmitRespVO { /** * 调用支付渠道的响应结果 diff --git a/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/package-info.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/package-info.java new file mode 100644 index 000000000..333cbe659 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.pay.controller.app; diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayRefundController.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/refund/AppPayRefundController.java similarity index 51% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayRefundController.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/refund/AppPayRefundController.java index ba62bdd8a..42fdc5dcb 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/PayRefundController.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/refund/AppPayRefundController.java @@ -1,13 +1,13 @@ -package cn.iocoder.yudao.userserver.modules.pay.controller.order; +package cn.iocoder.yudao.module.pay.controller.app.refund; import cn.hutool.core.util.StrUtil; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayRefundCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayRefundReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.util.PaySeqUtils; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.userserver.modules.pay.controller.order.vo.PayRefundReqVO; -import cn.iocoder.yudao.userserver.modules.pay.controller.order.vo.PayRefundRespVO; -import cn.iocoder.yudao.userserver.modules.pay.convert.order.PayRefundConvert; +import cn.iocoder.yudao.module.pay.controller.app.refund.vo.AppPayRefundReqVO; +import cn.iocoder.yudao.module.pay.controller.app.refund.vo.AppPayRefundRespVO; +import cn.iocoder.yudao.module.pay.convert.refund.PayRefundConvert; +import cn.iocoder.yudao.module.pay.service.order.dto.PayRefundReqDTO; +import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; +import cn.iocoder.yudao.module.pay.util.PaySeqUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -19,28 +19,29 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; -@Api(tags = "退款订单") +@Api(tags = "用户 APP - 退款订单") @RestController -@RequestMapping("/pay/order") +@RequestMapping("/pay/refund") @Validated @Slf4j -public class PayRefundController { +public class AppPayRefundController { @Resource - private PayRefundCoreService payRefundCoreService; + private PayRefundService refundService; @PostMapping("/refund") @ApiOperation("提交退款订单") - public CommonResult submitRefundOrder(@RequestBody PayRefundReqVO reqVO){ + public CommonResult submitRefundOrder(@RequestBody AppPayRefundReqVO reqVO){ PayRefundReqDTO req = PayRefundConvert.INSTANCE.convert(reqVO); req.setUserIp(getClientIP()); - //TODO 测试暂时模拟生成商户退款订单 + // TODO 测试暂时模拟生成商户退款订单 if(StrUtil.isEmpty(reqVO.getMerchantRefundId())) { req.setMerchantRefundId(PaySeqUtils.genMerchantRefundNo()); } - return CommonResult.success( PayRefundConvert.INSTANCE.convert(payRefundCoreService.submitRefundOrder(req))); + return success(PayRefundConvert.INSTANCE.convert(refundService.submitRefundOrder(req))); } } diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayRefundReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/refund/vo/AppPayRefundReqVO.java similarity index 87% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayRefundReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/refund/vo/AppPayRefundReqVO.java index 8287ba036..c810f3829 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayRefundReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/refund/vo/AppPayRefundReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.userserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.module.pay.controller.app.refund.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -8,11 +8,11 @@ import lombok.NoArgsConstructor; import javax.validation.constraints.NotEmpty; -@ApiModel("退款订单 Req VO") +@ApiModel("用户 APP - 退款订单 Req VO") @Data @NoArgsConstructor @AllArgsConstructor -public class PayRefundReqVO { +public class AppPayRefundReqVO { @ApiModelProperty(value = "支付订单编号自增", required = true, example = "10") @NotEmpty(message = "支付订单编号自增") diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayRefundRespVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/refund/vo/AppPayRefundRespVO.java similarity index 51% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayRefundRespVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/refund/vo/AppPayRefundRespVO.java index 29059ab28..534243281 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/controller/order/vo/PayRefundRespVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/app/refund/vo/AppPayRefundRespVO.java @@ -1,22 +1,22 @@ -package cn.iocoder.yudao.userserver.modules.pay.controller.order.vo; +package cn.iocoder.yudao.module.pay.controller.app.refund.vo; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; -@ApiModel("提交退款订单 Response VO") +@ApiModel("用户 APP - 提交退款订单 Response VO") @Data @Accessors(chain = true) @Builder @NoArgsConstructor @AllArgsConstructor -public class PayRefundRespVO { +public class AppPayRefundRespVO { - /** - * 支付退款单编号, 自增 - */ + @ApiModelProperty(value = "退款订单编号", required = true, example = "10") private Long refundId; + } diff --git a/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/package-info.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/package-info.java new file mode 100644 index 000000000..652122752 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/controller/package-info.java @@ -0,0 +1,6 @@ +/** + * 提供 RESTful API 给前端: + * 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目 + * 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分 + */ +package cn.iocoder.yudao.module.pay.controller; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/app/PayAppConvert.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/app/PayAppConvert.java similarity index 71% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/app/PayAppConvert.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/app/PayAppConvert.java index c7e17467d..432699bc2 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/app/PayAppConvert.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/app/PayAppConvert.java @@ -1,14 +1,14 @@ -package cn.iocoder.yudao.adminserver.modules.pay.convert.app; +package cn.iocoder.yudao.module.pay.convert.app; import java.util.*; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.*; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.*; /** * 支付应用信息 Convert diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/channel/PayChannelConvert.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/channel/PayChannelConvert.java similarity index 64% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/channel/PayChannelConvert.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/channel/PayChannelConvert.java index ee0473c23..2535008ea 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/channel/PayChannelConvert.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/channel/PayChannelConvert.java @@ -1,22 +1,18 @@ -package cn.iocoder.yudao.adminserver.modules.pay.convert.channel; +package cn.iocoder.yudao.module.pay.convert.channel; import java.util.*; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExcelVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelUpdateReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.*; -/** - * 支付渠道 - Convert - * - * @author 芋艿 - */ @Mapper public interface PayChannelConvert { diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/merchant/PayMerchantConvert.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/merchant/PayMerchantConvert.java similarity index 56% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/merchant/PayMerchantConvert.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/merchant/PayMerchantConvert.java index 9483ff120..1cb51a2bb 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/merchant/PayMerchantConvert.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/merchant/PayMerchantConvert.java @@ -1,19 +1,17 @@ -package cn.iocoder.yudao.adminserver.modules.pay.convert.merchant; +package cn.iocoder.yudao.module.pay.convert.merchant; import java.util.*; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantExcelVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantUpdateReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.*; -/** - * 支付商户信息 Convert - * - * @author 芋艿 - */ @Mapper public interface PayMerchantConvert { diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/order/PayOrderConvert.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/order/PayOrderConvert.java similarity index 72% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/order/PayOrderConvert.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/order/PayOrderConvert.java index 308298ac6..49df1ea64 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/order/PayOrderConvert.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/order/PayOrderConvert.java @@ -1,12 +1,15 @@ -package cn.iocoder.yudao.adminserver.modules.pay.convert.order; +package cn.iocoder.yudao.module.pay.convert.order; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderDetailsRespVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExcelVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageItemRespVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderRespVO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; +import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderDetailsRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExcelVO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageItemRespVO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderRespVO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderCreateReqDTO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderSubmitReqDTO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -24,24 +27,10 @@ public interface PayOrderConvert { PayOrderConvert INSTANCE = Mappers.getMapper(PayOrderConvert.class); - - PayOrderRespVO convert(PayOrderDO bean); - /** - * 订单DO 转换为 详细订单 RespVO - * - * @param bean 订单DO - * @return 详细订单 RespVO - */ PayOrderDetailsRespVO orderDetailConvert(PayOrderDO bean); - /** - * 订单扩展DO 转换为 详细订单扩展 RespVO - * - * @param bean 订单扩展DO - * @return 详细订单扩展 RespVO - */ PayOrderDetailsRespVO.PayOrderExtension orderDetailExtensionConvert(PayOrderExtensionDO bean); List convertList(List list); @@ -58,12 +47,6 @@ public interface PayOrderConvert { */ PayOrderPageItemRespVO pageConvertItemPage(PayOrderDO bean); - /** - * 订单DO 转 订单导出excel VO - * - * @param bean 订单 DO - * @return 订单导出excel VO - */ default PayOrderExcelVO excelConvert(PayOrderDO bean) { if (bean == null) { return null; @@ -101,4 +84,12 @@ public interface PayOrderConvert { return payOrderExcelVO; } + + + PayOrderDO convert(PayOrderCreateReqDTO bean); + + PayOrderExtensionDO convert(PayOrderSubmitReqDTO bean); + + PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqDTO bean); + } diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/convert/package-info.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/package-info.java similarity index 57% rename from yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/convert/package-info.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/package-info.java index 3f27f0b4b..df43d5ac3 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/convert/package-info.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/package-info.java @@ -3,4 +3,4 @@ * * 目前使用 MapStruct 框架 */ -package cn.iocoder.yudao.userserver.modules.pay.convert; +package cn.iocoder.yudao.module.pay.convert; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/refund/PayRefundConvert.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/refund/PayRefundConvert.java similarity index 73% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/refund/PayRefundConvert.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/refund/PayRefundConvert.java index 8f5ee66d3..2e034c63e 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/refund/PayRefundConvert.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/refund/PayRefundConvert.java @@ -1,9 +1,16 @@ -package cn.iocoder.yudao.adminserver.modules.pay.convert.refund; +package cn.iocoder.yudao.module.pay.convert.refund; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.*; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*; +import cn.iocoder.yudao.module.pay.controller.app.refund.vo.AppPayRefundReqVO; +import cn.iocoder.yudao.module.pay.controller.app.refund.vo.AppPayRefundRespVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayRefundReqDTO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayRefundRespDTO; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; import org.mapstruct.factory.Mappers; import java.math.BigDecimal; @@ -87,4 +94,16 @@ public interface PayRefundConvert { return payRefundExcelVO; } + //TODO 太多需要处理了, 暂时不用 + @Mappings(value = { + @Mapping(source = "amount", target = "payAmount"), + @Mapping(source = "id", target = "orderId"), + @Mapping(target = "status",ignore = true) + }) + PayRefundDO convert(PayOrderDO orderDO); + + PayRefundReqDTO convert(AppPayRefundReqVO bean); + + AppPayRefundRespVO convert(PayRefundRespDTO bean); + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md similarity index 100% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayAppDO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayAppDO.java similarity index 94% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayAppDO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayAppDO.java index acc849cbc..371a92b39 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayAppDO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayAppDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant; +package cn.iocoder.yudao.module.pay.dal.dataobject.merchant; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayChannelDO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayChannelDO.java similarity index 95% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayChannelDO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayChannelDO.java index 5275dd428..a670db463 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayChannelDO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayChannelDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant; +package cn.iocoder.yudao.module.pay.dal.dataobject.merchant; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayMerchantDO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayMerchantDO.java similarity index 94% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayMerchantDO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayMerchantDO.java index a0c72b9ec..ebd735b03 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/merchant/PayMerchantDO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayMerchantDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant; +package cn.iocoder.yudao.module.pay.dal.dataobject.merchant; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/notify/PayNotifyLogDO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyLogDO.java similarity index 86% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/notify/PayNotifyLogDO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyLogDO.java index 85626006c..92ecc39e6 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/notify/PayNotifyLogDO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyLogDO.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.notify; +package cn.iocoder.yudao.module.pay.dal.dataobject.notify; -import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyStatusEnum; +import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/notify/PayNotifyTaskDO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyTaskDO.java similarity index 78% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/notify/PayNotifyTaskDO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyTaskDO.java index 3d10ac83a..3884f152f 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/notify/PayNotifyTaskDO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyTaskDO.java @@ -1,11 +1,11 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.notify; +package cn.iocoder.yudao.module.pay.dal.dataobject.notify; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; -import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; +import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum; +import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayOrderDO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java similarity index 84% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayOrderDO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java index 65cf94bf2..931b85651 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayOrderDO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java @@ -1,11 +1,11 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order; +package cn.iocoder.yudao.module.pay.dal.dataobject.order; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderNotifyStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundTypeEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderStatusEnum; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum; +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayOrderExtensionDO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderExtensionDO.java similarity index 89% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayOrderExtensionDO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderExtensionDO.java index 5a6b8431a..8606e082b 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayOrderExtensionDO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderExtensionDO.java @@ -1,7 +1,7 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order; +package cn.iocoder.yudao.module.pay.dal.dataobject.order; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderStatusEnum; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayRefundDO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/refund/PayRefundDO.java similarity index 90% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayRefundDO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/refund/PayRefundDO.java index fc897a5e0..f5e3a1f7c 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/dataobject/order/PayRefundDO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/refund/PayRefundDO.java @@ -1,10 +1,11 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order; +package cn.iocoder.yudao.module.pay.dal.dataobject.refund; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundTypeEnum; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum; import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.TableId; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/app/PayAppMapper.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayAppMapper.java similarity index 68% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/app/PayAppMapper.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayAppMapper.java index c6e3b38e9..03cb0439d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/app/PayAppMapper.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayAppMapper.java @@ -1,32 +1,20 @@ -package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.app; +package cn.iocoder.yudao.module.pay.dal.mysql.merchant; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppPageReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppPageReqVO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.apache.ibatis.annotations.Mapper; import java.util.Collection; import java.util.List; -/** - * 支付应用信息 Mapper - * - * @author aquan - */ @Mapper public interface PayAppMapper extends BaseMapperX { - /** - * 分页查询 - * - * @param reqVO 支付应用信息分页查询条件 - * @param merchantIds 商户 ID 集合 - * @return 支付应用信息 - */ default PageResult selectPage(PayAppPageReqVO reqVO, Collection merchantIds) { return selectPage(reqVO, new QueryWrapperX() .likeIfPresent("name", reqVO.getName()) @@ -39,13 +27,6 @@ public interface PayAppMapper extends BaseMapperX { .orderByDesc("id")); } - /** - * 列表查询 - * - * @param reqVO 支付应用信息 Excel 导出查询条件 - * @param merchantIds 商户 ID 集合 - * @return 支付应用信息 - */ default List selectList(PayAppExportReqVO reqVO, Collection merchantIds) { return selectList(new QueryWrapperX() .likeIfPresent("name", reqVO.getName()) @@ -58,24 +39,13 @@ public interface PayAppMapper extends BaseMapperX { .orderByDesc("id")); } - /** - * 根据 商户 ID 查询支付应用信息 - * - * @param merchantId 商户 ID - * @return 支付应用信息列表 - */ default List getListByMerchantId(String merchantId) { return selectList(new LambdaQueryWrapper() .select(PayAppDO::getId, PayAppDO::getName) .eq(PayAppDO::getMerchantId, merchantId)); } - /** - * 根据商户号统计存在的支付应用数量 - * - * @param merchantId 商户 ID - * @return 支付应用数量 - */ + // TODO @aquan:方法名补充 ByMerchantId default Long selectCount(Long merchantId) { return selectCount(new LambdaQueryWrapper().eq(PayAppDO::getMerchantId, merchantId)); } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/channel/PayChannelMapper.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapper.java similarity index 76% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/channel/PayChannelMapper.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapper.java index 54a4829a9..c1871531e 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/channel/PayChannelMapper.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapper.java @@ -1,26 +1,29 @@ -package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.channel; +package cn.iocoder.yudao.module.pay.dal.mysql.merchant; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelPageReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelPageReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; import java.util.Collection; +import java.util.Date; import java.util.List; -/** - * 支付渠道 - Mapper - * - * @author 芋艿 - */ @Mapper public interface PayChannelMapper extends BaseMapperX { + default PayChannelDO selectByAppIdAndCode(Long appId, String code) { + return selectOne(PayChannelDO::getAppId, appId, PayChannelDO::getCode, code); + } + + @Select("SELECT id FROM pay_channel WHERE update_time > #{maxUpdateTime} LIMIT 1") + Long selectExistsByUpdateTimeAfter(Date maxUpdateTime); + default PageResult selectPage(PayChannelPageReqVO reqVO) { return selectPage(reqVO, new QueryWrapperX() .eqIfPresent("code", reqVO.getCode()) @@ -48,11 +51,11 @@ public interface PayChannelMapper extends BaseMapperX { } /** - * 根据条件获取通道数量 + * 根据条件获取渠道数量 * * @param merchantId 商户编号 * @param appid 应用编号 - * @param code 通道编码 + * @param code 渠道编码 * @return 数量 */ default Integer selectCount(Long merchantId, Long appid, String code) { @@ -63,11 +66,11 @@ public interface PayChannelMapper extends BaseMapperX { } /** - * 根据条件获取通道 + * 根据条件获取渠道 * * @param merchantId 商户编号 - * @param appid 应用编号 - * @param code 通道编码 + * @param appid 应用编号 // TODO @aquan:appid =》appId + * @param code 渠道编码 * @return 数量 */ default PayChannelDO selectOne(Long merchantId, Long appid, String code) { @@ -78,6 +81,7 @@ public interface PayChannelMapper extends BaseMapperX { )); } + // TODO @aquan:select 命名 /** * 根据支付应用ID集合获得支付渠道列表 * @@ -88,4 +92,5 @@ public interface PayChannelMapper extends BaseMapperX { return this.selectList(new QueryWrapper().lambda() .in(PayChannelDO::getAppId, appIds)); } + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/merchant/PayMerchantMapper.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayMerchantMapper.java similarity index 82% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/merchant/PayMerchantMapper.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayMerchantMapper.java index f143b1857..050302b4c 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/merchant/PayMerchantMapper.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayMerchantMapper.java @@ -1,20 +1,15 @@ -package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.merchant; +package cn.iocoder.yudao.module.pay.dal.mysql.merchant; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantPageReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantPageReqVO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; import org.apache.ibatis.annotations.Mapper; import java.util.List; -/** - * 支付商户信息 Mapper - * - * @author 芋艿 - */ @Mapper public interface PayMerchantMapper extends BaseMapperX { diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/notify/PayNotifyLogCoreMapper.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/notify/PayNotifyLogCoreMapper.java similarity index 56% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/notify/PayNotifyLogCoreMapper.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/notify/PayNotifyLogCoreMapper.java index e3f90d614..c95621933 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/notify/PayNotifyLogCoreMapper.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/notify/PayNotifyLogCoreMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.notify; +package cn.iocoder.yudao.module.pay.dal.mysql.notify; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.notify.PayNotifyLogDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/notify/PayNotifyTaskCoreMapper.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/notify/PayNotifyTaskCoreMapper.java similarity index 79% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/notify/PayNotifyTaskCoreMapper.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/notify/PayNotifyTaskCoreMapper.java index 276c6710b..1107a19f4 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/notify/PayNotifyTaskCoreMapper.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/notify/PayNotifyTaskCoreMapper.java @@ -1,7 +1,7 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.notify; +package cn.iocoder.yudao.module.pay.dal.mysql.notify; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.notify.PayNotifyTaskDO; -import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyStatusEnum; +import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyTaskDO; +import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayOrderExtensionCoreMapper.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderExtensionMapper.java old mode 100644 new mode 100755 similarity index 70% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayOrderExtensionCoreMapper.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderExtensionMapper.java index 08c95cea6..a8918f441 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/mysql/order/PayOrderExtensionCoreMapper.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderExtensionMapper.java @@ -1,12 +1,12 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order; +package cn.iocoder.yudao.module.pay.dal.mysql.order; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.apache.ibatis.annotations.Mapper; @Mapper -public interface PayOrderExtensionCoreMapper extends BaseMapperX { +public interface PayOrderExtensionMapper extends BaseMapperX { default PayOrderExtensionDO selectByNo(String no) { return selectOne(PayOrderExtensionDO::getNo, no); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayOrderMapper.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java similarity index 78% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayOrderMapper.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java index 1fb9e870a..4ff345dae 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayOrderMapper.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/order/PayOrderMapper.java @@ -1,22 +1,18 @@ -package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order; +package cn.iocoder.yudao.module.pay.dal.mysql.order; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageReqVO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.ibatis.annotations.Mapper; import java.util.Collection; import java.util.List; -/** - * 支付订单 Mapper 组件 - * - * @author aquan - */ @Mapper public interface PayOrderMapper extends BaseMapperX { @@ -50,12 +46,6 @@ public interface PayOrderMapper extends BaseMapperX { .orderByDesc("id")); } - /** - * 根据订单 ID 集合查询订单商品名称 - * - * @param idList 订单 ID 集合 - * @return 只包含商品名称和标题的订单集合对象 - */ default List findByIdListQueryOrderSubject(Collection idList) { return selectList(new LambdaQueryWrapper() .select(PayOrderDO::getId, PayOrderDO::getSubject) @@ -70,10 +60,19 @@ public interface PayOrderMapper extends BaseMapperX { * @return 条数 */ default Long selectCount(Long appId, Integer status) { - return selectCount(new LambdaQueryWrapper() .eq(PayOrderDO::getAppId, appId) .in(PayOrderDO::getStatus, status)); } + default PayOrderDO selectByAppIdAndMerchantOrderId(Long appId, String merchantOrderId) { + return selectOne(new QueryWrapper().eq("app_id", appId) + .eq("merchant_order_id", merchantOrderId)); + } + + default int updateByIdAndStatus(Long id, Integer status, PayOrderDO update) { + return update(update, new QueryWrapper() + .eq("id", id).eq("status", status)); + } + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayRefundMapper.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/refund/PayRefundMapper.java similarity index 78% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayRefundMapper.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/refund/PayRefundMapper.java index 2fd3f2299..ba8f521e9 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/dal/mysql/order/PayRefundMapper.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/refund/PayRefundMapper.java @@ -1,21 +1,16 @@ -package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order; +package cn.iocoder.yudao.module.pay.dal.mysql.refund; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundPageReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; +import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.apache.ibatis.annotations.Mapper; import java.util.List; -/** - * 退款订单 Mapper - * - * @author aquan - */ @Mapper public interface PayRefundMapper extends BaseMapperX { @@ -45,17 +40,18 @@ public interface PayRefundMapper extends BaseMapperX { .orderByDesc("id")); } - /** - * 查询符合的订单数量 - * - * @param appId 应用编号 - * @param status 订单状态 - * @return 条数 - */ default Long selectCount(Long appId, Integer status) { return selectCount(new LambdaQueryWrapper() .eq(PayRefundDO::getAppId, appId) .eq(PayRefundDO::getStatus, status)); } + + default PayRefundDO selectByReqNo(String reqNo) { + return selectOne("req_no", reqNo); + } + + default PayRefundDO selectByTradeNoAndMerchantRefundNo(String tradeNo, String merchantRefundNo){ + return selectOne("trade_no", tradeNo, "merchant_refund_no", merchantRefundNo); + } } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/redis/PayRedisKeyCoreConstants.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/PayRedisKeyCoreConstants.java similarity index 65% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/redis/PayRedisKeyCoreConstants.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/PayRedisKeyCoreConstants.java index 99384ec12..acba20be9 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/redis/PayRedisKeyCoreConstants.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/PayRedisKeyCoreConstants.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.redis; +package cn.iocoder.yudao.module.pay.dal.redis; import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; import org.redisson.api.RLock; @@ -6,7 +6,7 @@ import org.redisson.api.RLock; import static cn.iocoder.yudao.framework.redis.core.RedisKeyDefine.KeyTypeEnum.HASH; /** - * Lock4j Redis Key 枚举类 + * 支付 Redis Key 枚举类 * * @author 芋道源码 */ @@ -14,6 +14,6 @@ public interface PayRedisKeyCoreConstants { RedisKeyDefine PAY_NOTIFY_LOCK = new RedisKeyDefine("通知任务的分布式锁", "pay_notify:lock:", // 参数来自 DefaultLockKeyBuilder 类 - HASH, RLock.class, RedisKeyDefine.TimeoutTypeEnum.DYNAMIC); // Redisson 的 Lock 锁,使用 Hash 数据结构 + RedisKeyDefine.KeyTypeEnum.HASH, RLock.class, RedisKeyDefine.TimeoutTypeEnum.DYNAMIC); // Redisson 的 Lock 锁,使用 Hash 数据结构 } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/redis/notify/PayNotifyLockCoreRedisDAO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/notify/PayNotifyLockRedisDAO.java similarity index 79% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/redis/notify/PayNotifyLockCoreRedisDAO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/notify/PayNotifyLockRedisDAO.java index 5ce6b44b3..227eda28a 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/dal/redis/notify/PayNotifyLockCoreRedisDAO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/dal/redis/notify/PayNotifyLockRedisDAO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.dal.redis.notify; +package cn.iocoder.yudao.module.pay.dal.redis.notify; import org.redisson.api.RLock; import org.redisson.api.RedissonClient; @@ -7,7 +7,7 @@ import org.springframework.stereotype.Repository; import javax.annotation.Resource; import java.util.concurrent.TimeUnit; -import static cn.iocoder.yudao.coreservice.modules.pay.dal.redis.PayRedisKeyCoreConstants.PAY_NOTIFY_LOCK; +import static cn.iocoder.yudao.module.pay.dal.redis.PayRedisKeyCoreConstants.PAY_NOTIFY_LOCK; /** * 支付通知的锁 Redis DAO @@ -15,7 +15,7 @@ import static cn.iocoder.yudao.coreservice.modules.pay.dal.redis.PayRedisKeyCore * @author 芋道源码 */ @Repository -public class PayNotifyLockCoreRedisDAO { +public class PayNotifyLockRedisDAO { @Resource private RedissonClient redissonClient; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/notify/PayNotifyStatusEnum.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/notify/PayNotifyStatusEnum.java similarity index 89% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/notify/PayNotifyStatusEnum.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/notify/PayNotifyStatusEnum.java index 2c3c6b592..d1b7c1015 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/notify/PayNotifyStatusEnum.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/notify/PayNotifyStatusEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.enums.notify; +package cn.iocoder.yudao.module.pay.enums.notify; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/notify/PayNotifyTypeEnum.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/notify/PayNotifyTypeEnum.java similarity index 85% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/notify/PayNotifyTypeEnum.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/notify/PayNotifyTypeEnum.java index a501bc55f..8c259d93c 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/notify/PayNotifyTypeEnum.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/notify/PayNotifyTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.enums.notify; +package cn.iocoder.yudao.module.pay.enums.notify; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayOrderNotifyStatusEnum.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/order/PayOrderNotifyStatusEnum.java similarity index 89% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayOrderNotifyStatusEnum.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/order/PayOrderNotifyStatusEnum.java index 4bda485d2..b7161a9f4 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayOrderNotifyStatusEnum.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/order/PayOrderNotifyStatusEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.enums.order; +package cn.iocoder.yudao.module.pay.enums.order; import cn.iocoder.yudao.framework.common.core.IntArrayValuable; import lombok.AllArgsConstructor; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayOrderStatusEnum.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/order/PayOrderStatusEnum.java similarity index 90% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayOrderStatusEnum.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/order/PayOrderStatusEnum.java index b61c0400c..ab542a97c 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayOrderStatusEnum.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/order/PayOrderStatusEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.enums.order; +package cn.iocoder.yudao.module.pay.enums.order; import cn.iocoder.yudao.framework.common.core.IntArrayValuable; import lombok.AllArgsConstructor; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayRefundStatusEnum.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/refund/PayRefundStatusEnum.java similarity index 83% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayRefundStatusEnum.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/refund/PayRefundStatusEnum.java index 2a28ae9fc..390804dd3 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayRefundStatusEnum.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/refund/PayRefundStatusEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.enums.order; +package cn.iocoder.yudao.module.pay.enums.refund; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayRefundTypeEnum.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/refund/PayRefundTypeEnum.java similarity index 89% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayRefundTypeEnum.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/refund/PayRefundTypeEnum.java index ba7ee2fcc..5fb10a399 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/enums/order/PayRefundTypeEnum.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/enums/refund/PayRefundTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.enums.order; +package cn.iocoder.yudao.module.pay.enums.refund; import cn.iocoder.yudao.framework.common.core.IntArrayValuable; import lombok.AllArgsConstructor; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/job/notify/PayNotifyJob.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/job/notify/PayNotifyJob.java similarity index 75% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/job/notify/PayNotifyJob.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/job/notify/PayNotifyJob.java index 58685f1b5..820bca471 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/job/notify/PayNotifyJob.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/job/notify/PayNotifyJob.java @@ -1,7 +1,7 @@ -package cn.iocoder.yudao.adminserver.modules.pay.job.notify; +package cn.iocoder.yudao.module.pay.job.notify; -import cn.iocoder.yudao.coreservice.modules.pay.service.notify.PayNotifyCoreService; import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; +import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -18,7 +18,7 @@ import javax.annotation.Resource; public class PayNotifyJob implements JobHandler { @Resource - private PayNotifyCoreService payNotifyCoreService; + private PayNotifyService payNotifyCoreService; @Override public String execute(String param) throws Exception { diff --git a/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/job/package-info.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/job/package-info.java new file mode 100644 index 000000000..c45bf497f --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/job/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.pay.job; diff --git a/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/package-info.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/package-info.java new file mode 100644 index 000000000..1421e4e65 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/package-info.java @@ -0,0 +1,10 @@ +/** + * pay 模块,我们放支付业务,提供业务的支付能力。 + * 例如说:商户、应用、支付、退款等等 + * + * 1. Controller URL:以 /member/ 开头,避免和其它 Module 冲突 + * 2. DataObject 表名:以 member_ 开头,方便在数据库中区分 + * + * 注意,由于 Pay 模块和 Trade 模块,容易重名,所以类名都加载 Pay 的前缀~ + */ +package cn.iocoder.yudao.module.pay; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/app/PayAppService.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayAppService.java similarity index 75% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/app/PayAppService.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayAppService.java index da83ca825..62935e4dd 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/app/PayAppService.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayAppService.java @@ -1,12 +1,13 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.app; +package cn.iocoder.yudao.module.pay.service.merchant; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.framework.common.exception.ServiceException; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppUpdateReqVO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; import javax.validation.Valid; import java.util.Collection; @@ -100,4 +101,16 @@ public interface PayAppService { List list = this.getAppList(appIdList); return CollectionUtils.convertMap(list, PayAppDO::getId); } + + + /** + * 支付应用的合法性 + * + * 如果不合法,抛出 {@link ServiceException} 业务异常 + * + * @param id 应用编号 + * @return 应用信息 + */ + PayAppDO validPayApp(Long id); + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/app/impl/PayAppServiceImpl.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayAppServiceImpl.java similarity index 72% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/app/impl/PayAppServiceImpl.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayAppServiceImpl.java index bb6e765b3..f7d1a4e28 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/app/impl/PayAppServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayAppServiceImpl.java @@ -1,23 +1,24 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.app.impl; +package cn.iocoder.yudao.module.pay.service.merchant; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppUpdateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.convert.app.PayAppConvert; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.app.PayAppMapper; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.merchant.PayMerchantMapper; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayOrderMapper; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayRefundMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.app.PayAppService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppUpdateReqVO; +import cn.iocoder.yudao.module.pay.convert.app.PayAppConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayAppMapper; +import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayMerchantMapper; +import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderMapper; +import cn.iocoder.yudao.module.pay.dal.mysql.refund.PayRefundMapper; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; import com.google.common.annotations.VisibleForTesting; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -25,9 +26,9 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.util.*; -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; +import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; /** * 支付应用信息 Service 实现类 @@ -40,17 +41,14 @@ public class PayAppServiceImpl implements PayAppService { @Resource private PayAppMapper appMapper; - + // TODO @aquan:使用对方的 Service。模块与模块之间,避免直接调用对方的 mapper @Resource private PayMerchantMapper merchantMapper; - @Resource private PayOrderMapper orderMapper; - @Resource private PayRefundMapper refundMapper; - @Override public Long createApp(PayAppCreateReqVO createReqVO) { // 插入 @@ -126,12 +124,6 @@ public class PayAppServiceImpl implements PayAppService { return convertSet(merchantMapper.getMerchantListByName(merchantName), PayMerchantDO::getId); } - /** - * 修改应用信息状态 - * - * @param id 应用编号 - * @param status 状态{@link CommonStatusEnum} - */ @Override public void updateAppStatus(Long id, Integer status) { // 校验商户存在 @@ -143,12 +135,6 @@ public class PayAppServiceImpl implements PayAppService { appMapper.updateById(app); } - /** - * 根据商户 ID 获得支付应用信息列表, - * - * @param merchantId 商户 ID - * @return 支付应用信息列表 - */ @Override public List getListByMerchantId(String merchantId) { return appMapper.getListByMerchantId(merchantId); @@ -186,4 +172,18 @@ public class PayAppServiceImpl implements PayAppService { } } + @Override + public PayAppDO validPayApp(Long id) { + PayAppDO app = appMapper.selectById(id); + // 校验是否存在 + if (app == null) { + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_APP_NOT_FOUND); + } + // 校验是否禁用 + if (CommonStatusEnum.DISABLE.getStatus().equals(app.getStatus())) { + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_APP_IS_DISABLE); + } + return app; + } + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/PayChannelService.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelService.java similarity index 59% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/PayChannelService.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelService.java index 1eeb567dd..3907b0eca 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/PayChannelService.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelService.java @@ -1,9 +1,12 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.channel; +package cn.iocoder.yudao.module.pay.service.merchant; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.*; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.framework.common.exception.ServiceException; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelUpdateReqVO; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import org.springframework.web.multipart.MultipartFile; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; import javax.validation.Valid; import java.util.Collection; @@ -16,6 +19,11 @@ import java.util.List; */ public interface PayChannelService { + /** + * 初始化支付客户端 + */ + void initPayClients(); + /** * 创建支付渠道 * @@ -47,8 +55,7 @@ public interface PayChannelService { PayChannelDO getChannel(Long id); /** - * 获得支付渠道 - * 列表 + * 获得支付渠道列表 * * @param ids 编号 * @return 支付渠道 @@ -57,8 +64,7 @@ public interface PayChannelService { List getChannelList(Collection ids); /** - * 获得支付渠道 - * 分页 + * 获得支付渠道分页 * * @param pageReqVO 分页查询 * @return 支付渠道 @@ -84,24 +90,44 @@ public interface PayChannelService { List getChannelListByAppIds(Collection appIds); /** - * 根据条件获取通道数量 + * 根据条件获取渠道数量 * * @param merchantId 商户编号 * @param appid 应用编号 - * @param code 通道编码 + * @param code 渠道编码 * @return 数量 */ Integer getChannelCountByConditions(Long merchantId, Long appid, String code); /** - * 根据条件获取通道 + * 根据条件获取渠道 * * @param merchantId 商户编号 * @param appid 应用编号 - * @param code 通道编码 + * @param code 渠道编码 * @return 数量 */ PayChannelDO getChannelByConditions(Long merchantId, Long appid, String code); + /** + * 支付渠道的合法性 + * + * 如果不合法,抛出 {@link ServiceException} 业务异常 + * + * @param id 渠道编号 + * @return 渠道信息 + */ + PayChannelDO validPayChannel(Long id); + + /** + * 支付渠道的合法性 + * + * 如果不合法,抛出 {@link ServiceException} 业务异常 + * + * @param appId 应用编号 + * @param code 支付渠道 + * @return 渠道信息 + */ + PayChannelDO validPayChannel(Long appId, String code); } diff --git a/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelServiceImpl.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelServiceImpl.java new file mode 100644 index 000000000..68b6ff10d --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelServiceImpl.java @@ -0,0 +1,250 @@ +package cn.iocoder.yudao.module.pay.service.merchant; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONUtil; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelUpdateReqVO; +import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert; +import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; +import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayChannelMapper; +import cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import javax.validation.Validator; +import java.util.Collection; +import java.util.Comparator; +import java.util.Date; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; + +/** + * 支付渠道 Service 实现类 + * + * @author aquan + */ +@Service +@Slf4j +@Validated +public class PayChannelServiceImpl implements PayChannelService { + + /** + * 定时执行 {@link #schedulePeriodicRefresh()} 的周期 + * 因为已经通过 Redis Pub/Sub 机制,所以频率不需要高 + */ + private static final long SCHEDULER_PERIOD = 5 * 60 * 1000L; + + /** + * 缓存菜单的最大更新时间,用于后续的增量轮询,判断是否有更新 + */ + private volatile Date maxUpdateTime; + + @Resource + private PayClientFactory payClientFactory; + + @Resource + private PayChannelMapper channelMapper; + + @Resource + private Validator validator; + + @Override + @PostConstruct + public void initPayClients() { + // 获取支付渠道,如果有更新 + List payChannels = this.loadPayChannelIfUpdate(maxUpdateTime); + if (CollUtil.isEmpty(payChannels)) { + return; + } + + // 创建或更新支付 Client + payChannels.forEach(payChannel -> payClientFactory.createOrUpdatePayClient(payChannel.getId(), + payChannel.getCode(), payChannel.getConfig())); + + // 写入缓存 + assert payChannels.size() > 0; // 断言,避免告警 + maxUpdateTime = payChannels.stream().max(Comparator.comparing(BaseDO::getUpdateTime)).get().getUpdateTime(); + log.info("[initPayClients][初始化 PayChannel 数量为 {}]", payChannels.size()); + } + + @Scheduled(fixedDelay = SCHEDULER_PERIOD, initialDelay = SCHEDULER_PERIOD) + public void schedulePeriodicRefresh() { + initPayClients(); + } + + /** + * 如果支付渠道发生变化,从数据库中获取最新的全量支付渠道。 + * 如果未发生变化,则返回空 + * + * @param maxUpdateTime 当前支付渠道的最大更新时间 + * @return 支付渠道列表 + */ + private List loadPayChannelIfUpdate(Date maxUpdateTime) { + // 第一步,判断是否要更新。 + if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据 + log.info("[loadPayChannelIfUpdate][首次加载全量支付渠道]"); + } else { // 判断数据库中是否有更新的支付渠道 + if (channelMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) { + return null; + } + log.info("[loadPayChannelIfUpdate][增量加载全量支付渠道]"); + } + // 第二步,如果有更新,则从数据库加载所有支付渠道 + return channelMapper.selectList(); + } + + @Override + public Long createChannel(PayChannelCreateReqVO reqVO) { + // 断言是否有重复的 + PayChannelDO channelDO = this.getChannelByConditions(reqVO.getMerchantId(), reqVO.getAppId(), reqVO.getCode()); + if (ObjectUtil.isNotNull(channelDO)) { + throw exception(CHANNEL_EXIST_SAME_CHANNEL_ERROR); + } + + // 新增渠道 + PayChannelDO channel = PayChannelConvert.INSTANCE.convert(reqVO); + settingConfigAndCheckParam(channel, reqVO.getConfig()); + channelMapper.insert(channel); + return channel.getId(); + } + + @Override + public void updateChannel(PayChannelUpdateReqVO updateReqVO) { + // 校验存在 + this.validateChannelExists(updateReqVO.getId()); + // 更新 + PayChannelDO channel = PayChannelConvert.INSTANCE.convert(updateReqVO); + settingConfigAndCheckParam(channel, updateReqVO.getConfig()); + channelMapper.updateById(channel); + } + + @Override + public void deleteChannel(Long id) { + // 校验存在 + this.validateChannelExists(id); + // 删除 + channelMapper.deleteById(id); + } + + private void validateChannelExists(Long id) { + if (channelMapper.selectById(id) == null) { + throw exception(CHANNEL_NOT_EXISTS); + } + } + + @Override + public PayChannelDO getChannel(Long id) { + return channelMapper.selectById(id); + } + + @Override + public List getChannelList(Collection ids) { + return channelMapper.selectBatchIds(ids); + } + + @Override + public PageResult getChannelPage(PayChannelPageReqVO pageReqVO) { + return channelMapper.selectPage(pageReqVO); + } + + @Override + public List getChannelList(PayChannelExportReqVO exportReqVO) { + return channelMapper.selectList(exportReqVO); + } + + /** + * 根据支付应用ID集合获得支付渠道列表 + * + * @param appIds 应用编号集合 + * @return 支付渠道列表 + */ + @Override + public List getChannelListByAppIds(Collection appIds) { + return channelMapper.getChannelListByAppIds(appIds); + } + + + /** + * 根据条件获取渠道数量 + * + * @param merchantId 商户编号 + * @param appid 应用编号 + * @param code 渠道编码 + * @return 数量 + */ + @Override + public Integer getChannelCountByConditions(Long merchantId, Long appid, String code) { + return this.channelMapper.selectCount(merchantId, appid, code); + } + + /** + * 根据条件获取渠道 + * + * @param merchantId 商户编号 + * @param appid 应用编号 + * @param code 渠道编码 + * @return 数量 + */ + @Override + public PayChannelDO getChannelByConditions(Long merchantId, Long appid, String code) { + return this.channelMapper.selectOne(merchantId, appid, code); + } + + /** + * 设置渠道配置以及参数校验 + * + * @param channel 渠道 + * @param configStr 配置 + */ + private void settingConfigAndCheckParam(PayChannelDO channel, String configStr) { + // 得到这个渠道是微信的还是支付宝的 + Class payClass = PayChannelEnum.getByCode(channel.getCode()).getConfigClass(); + if (ObjectUtil.isNull(payClass)) { + throw exception(CHANNEL_NOT_EXISTS); + } + PayClientConfig config = JSONUtil.toBean(configStr, payClass); + + // 验证参数 + config.validate(validator); + channel.setConfig(config); + } + + @Override + public PayChannelDO validPayChannel(Long id) { + PayChannelDO channel = channelMapper.selectById(id); + this.validPayChannel(channel); + return channel; + } + + @Override + public PayChannelDO validPayChannel(Long appId, String code) { + PayChannelDO channel = channelMapper.selectByAppIdAndCode(appId, code); + this.validPayChannel(channel); + return channel; + } + + private void validPayChannel(PayChannelDO channel) { + if (channel == null) { + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_CHANNEL_NOT_FOUND); + } + if (CommonStatusEnum.DISABLE.getStatus().equals(channel.getStatus())) { + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_CHANNEL_IS_DISABLE); + } + } +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/merchant/PayMerchantService.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayMerchantService.java similarity index 81% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/merchant/PayMerchantService.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayMerchantService.java index b8e74dd75..40f02b99c 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/merchant/PayMerchantService.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayMerchantService.java @@ -1,12 +1,12 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.merchant; +package cn.iocoder.yudao.module.pay.service.merchant; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantUpdateReqVO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; import javax.validation.Valid; import java.util.Collection; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/merchant/impl/PayMerchantServiceImpl.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayMerchantServiceImpl.java similarity index 77% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/merchant/impl/PayMerchantServiceImpl.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayMerchantServiceImpl.java index b80132a1f..c14a87d7d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/merchant/impl/PayMerchantServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/merchant/PayMerchantServiceImpl.java @@ -1,16 +1,15 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.merchant.impl; +package cn.iocoder.yudao.module.pay.service.merchant; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantUpdateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.convert.merchant.PayMerchantConvert; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.app.PayAppMapper; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.merchant.PayMerchantMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantUpdateReqVO; +import cn.iocoder.yudao.module.pay.convert.merchant.PayMerchantConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayAppMapper; +import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayMerchantMapper; import cn.iocoder.yudao.framework.common.pojo.PageResult; import com.google.common.annotations.VisibleForTesting; import org.springframework.stereotype.Service; @@ -21,9 +20,8 @@ import java.time.LocalDateTime; import java.util.Collection; import java.util.List; -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.PAY_MERCHANT_EXIST_APP_CANT_DELETE; -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.PAY_MERCHANT_NOT_EXISTS; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; /** * 支付商户信息 Service 实现类 diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/PayNotifyCoreService.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyService.java similarity index 66% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/PayNotifyCoreService.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyService.java index 468375709..92358e471 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/PayNotifyCoreService.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyService.java @@ -1,15 +1,15 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.notify; +package cn.iocoder.yudao.module.pay.service.notify; -import cn.iocoder.yudao.coreservice.modules.pay.service.notify.dto.PayNotifyTaskCreateReqDTO; +import cn.iocoder.yudao.module.pay.service.notify.dto.PayNotifyTaskCreateReqDTO; import javax.validation.Valid; /** - * 支付通知 Core Service 接口 + * 支付通知 Service 接口 * * @author 芋道源码 */ -public interface PayNotifyCoreService { +public interface PayNotifyService { /** * 创建支付通知任务 diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/impl/PayNotifyCoreServiceImpl.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceImpl.java similarity index 77% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/impl/PayNotifyCoreServiceImpl.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceImpl.java index dff6de7fc..1d5091a5b 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/impl/PayNotifyCoreServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceImpl.java @@ -1,25 +1,25 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.notify.impl; +package cn.iocoder.yudao.module.pay.service.notify; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.http.HttpUtil; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.notify.PayNotifyLogDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.notify.PayNotifyTaskDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.notify.PayNotifyLogCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.notify.PayNotifyTaskCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.redis.notify.PayNotifyLockCoreRedisDAO; -import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum; -import cn.iocoder.yudao.coreservice.modules.pay.service.notify.PayNotifyCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.notify.dto.PayNotifyTaskCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.service.notify.vo.PayNotifyOrderReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.service.notify.vo.PayRefundOrderReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayOrderCoreService; +import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyTaskDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; +import cn.iocoder.yudao.module.pay.dal.mysql.notify.PayNotifyLogCoreMapper; +import cn.iocoder.yudao.module.pay.dal.mysql.notify.PayNotifyTaskCoreMapper; +import cn.iocoder.yudao.module.pay.dal.redis.notify.PayNotifyLockRedisDAO; +import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum; +import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum; +import cn.iocoder.yudao.module.pay.service.notify.dto.PayNotifyTaskCreateReqDTO; +import cn.iocoder.yudao.module.pay.service.notify.vo.PayNotifyOrderReqVO; +import cn.iocoder.yudao.module.pay.service.notify.vo.PayRefundOrderReqVO; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; +import cn.iocoder.yudao.module.pay.service.order.PayOrderService; +import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.annotation.Async; @@ -36,10 +36,6 @@ import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import static cn.hutool.core.exceptions.ExceptionUtil.getRootCauseMessage; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.SECOND_MILLIS; -import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; - /** * 支付通知 Core Service 实现类 * @@ -48,7 +44,7 @@ import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString @Service @Valid @Slf4j -public class PayNotifyCoreServiceImpl implements PayNotifyCoreService { +public class PayNotifyServiceImpl implements PayNotifyService { /** * 通知超时时间,单位:秒 @@ -57,11 +53,14 @@ public class PayNotifyCoreServiceImpl implements PayNotifyCoreService { /** * {@link #NOTIFY_TIMEOUT} 的毫秒 */ - public static final long NOTIFY_TIMEOUT_MILLIS = 120 * SECOND_MILLIS; + public static final long NOTIFY_TIMEOUT_MILLIS = 120 * DateUtils.SECOND_MILLIS; @Resource @Lazy // 循环依赖,避免报错 - private PayOrderCoreService payOrderCoreService; + private PayOrderService orderService; + @Resource + @Lazy // 循环依赖,避免报错 + private PayRefundService refundService; @Resource private PayNotifyTaskCoreMapper payNotifyTaskCoreMapper; @@ -72,14 +71,11 @@ public class PayNotifyCoreServiceImpl implements PayNotifyCoreService { private ThreadPoolTaskExecutor threadPoolTaskExecutor; // TODO 芋艿:未来提供独立的线程池 @Resource - private PayNotifyLockCoreRedisDAO payNotifyLockCoreRedisDAO; - - @Resource - private PayRefundCoreMapper payRefundCoreMapper; + private PayNotifyLockRedisDAO payNotifyLockCoreRedisDAO; @Resource @Lazy // 循环依赖(自己依赖自己),避免报错 - private PayNotifyCoreServiceImpl self; + private PayNotifyServiceImpl self; @Override public void createPayNotifyTask(PayNotifyTaskCreateReqDTO reqDTO) { @@ -89,12 +85,11 @@ public class PayNotifyCoreServiceImpl implements PayNotifyCoreService { .setNotifyTimes(0).setMaxNotifyTimes(PayNotifyTaskDO.NOTIFY_FREQUENCY.length + 1); // 补充 merchantId + appId + notifyUrl 字段 if (Objects.equals(task.getType(), PayNotifyTypeEnum.ORDER.getType())) { - PayOrderDO order = payOrderCoreService.getPayOrder(task.getDataId()); // 不进行非空判断,有问题直接异常 + PayOrderDO order = orderService.getOrder(task.getDataId()); // 不进行非空判断,有问题直接异常 task.setMerchantId(order.getMerchantId()).setAppId(order.getAppId()). setMerchantOrderId(order.getMerchantOrderId()).setNotifyUrl(order.getNotifyUrl()); } else if (Objects.equals(task.getType(), PayNotifyTypeEnum.REFUND.getType())) { - // TODO 芋艿,需要实现下哈 - PayRefundDO refundDO = payRefundCoreMapper.selectById(task.getDataId()); + PayRefundDO refundDO = refundService.getRefund(task.getDataId()); task.setMerchantId(refundDO.getMerchantId()).setAppId(refundDO.getAppId()) .setMerchantOrderId(refundDO.getMerchantOrderId()).setNotifyUrl(refundDO.getNotifyUrl()); } @@ -169,7 +164,7 @@ public class PayNotifyCoreServiceImpl implements PayNotifyCoreService { // 虽然已经通过分布式加锁,但是可能同时满足通知的条件,然后都去获得锁。此时,第一个执行完后,第二个还是能拿到锁,然后会再执行一次。 PayNotifyTaskDO dbTask = payNotifyTaskCoreMapper.selectById(task.getId()); if (DateUtils.afterNow(dbTask.getNextNotifyTime())) { - log.info("[executeNotify][dbTask({}) 任务被忽略,原因是未到达下次通知时间,可能是因为并发执行了]", toJsonString(dbTask)); + log.info("[executeNotify][dbTask({}) 任务被忽略,原因是未到达下次通知时间,可能是因为并发执行了]", JsonUtils.toJsonString(dbTask)); return; } @@ -193,7 +188,7 @@ public class PayNotifyCoreServiceImpl implements PayNotifyCoreService { Integer newStatus = this.processNotifyResult(task, invokeResult, invokeException); // 记录 PayNotifyLog 日志 - String response = invokeException != null ? getRootCauseMessage(invokeException) : toJsonString(invokeResult); + String response = invokeException != null ? ExceptionUtil.getRootCauseMessage(invokeException) : JsonUtils.toJsonString(invokeResult); payNotifyLogCoreMapper.insert(PayNotifyLogDO.builder().taskId(task.getId()) .notifyTimes(task.getNotifyTimes() + 1).status(newStatus).response(response).build()); } @@ -214,10 +209,10 @@ public class PayNotifyCoreServiceImpl implements PayNotifyCoreService { request = PayRefundOrderReqVO.builder().merchantOrderId(task.getMerchantOrderId()) .payRefundId(task.getDataId()).build(); } else { - throw new RuntimeException("未知的通知任务类型:" + toJsonString(task)); + throw new RuntimeException("未知的通知任务类型:" + JsonUtils.toJsonString(task)); } // 请求地址 - String response = HttpUtil.post(task.getNotifyUrl(), toJsonString(request), + String response = HttpUtil.post(task.getNotifyUrl(), JsonUtils.toJsonString(request), (int) NOTIFY_TIMEOUT_MILLIS); // 解析结果 return JsonUtils.parseObject(response, CommonResult.class); diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/dto/PayNotifyTaskCreateReqDTO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/dto/PayNotifyTaskCreateReqDTO.java similarity index 88% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/dto/PayNotifyTaskCreateReqDTO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/dto/PayNotifyTaskCreateReqDTO.java index 8d40ffb91..49d570d4e 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/dto/PayNotifyTaskCreateReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/dto/PayNotifyTaskCreateReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.notify.dto; +package cn.iocoder.yudao.module.pay.service.notify.dto; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/vo/PayNotifyOrderReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/vo/PayNotifyOrderReqVO.java similarity index 92% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/vo/PayNotifyOrderReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/vo/PayNotifyOrderReqVO.java index 94b1fec56..d4f6c1eae 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/vo/PayNotifyOrderReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/vo/PayNotifyOrderReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.notify.vo; +package cn.iocoder.yudao.module.pay.service.notify.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/vo/PayRefundOrderReqVO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/vo/PayRefundOrderReqVO.java similarity index 93% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/vo/PayRefundOrderReqVO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/vo/PayRefundOrderReqVO.java index d436d759b..978283d1b 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/notify/vo/PayRefundOrderReqVO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/vo/PayRefundOrderReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.notify.vo; +package cn.iocoder.yudao.module.pay.service.notify.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/vo/package-info.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/vo/package-info.java new file mode 100644 index 000000000..fb006dd68 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/notify/vo/package-info.java @@ -0,0 +1,6 @@ +/** + * 这里的 VO 包有点特殊,是提供给接入支付模块的业务,提供回调接口时,可以直接使用 VO + * + * 例如说,支付单的回调,使用 TODO 芋艿:想下怎么优化下 + */ +package cn.iocoder.yudao.module.pay.service.notify.vo; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderExtensionService.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderExtensionService.java similarity index 80% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderExtensionService.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderExtensionService.java index a139956b4..f707bc0df 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderExtensionService.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderExtensionService.java @@ -1,7 +1,7 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.order; +package cn.iocoder.yudao.module.pay.service.order; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; 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; @@ -32,7 +32,6 @@ public interface PayOrderExtensionService { */ List getOrderExtensionList(Collection ids); - /** * 根据订单成功的 扩展订单ID 查询所有的扩展订单转 成 map 返回 * @@ -40,9 +39,8 @@ public interface PayOrderExtensionService { * @return 订单扩展 map 集合 */ default Map getOrderExtensionMap(Collection successExtensionIdList) { - List list = this.getOrderExtensionList(successExtensionIdList); + List list = getOrderExtensionList(successExtensionIdList); return CollectionUtils.convertMap(list, PayOrderExtensionDO::getId); } - } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayOrderExtensionServiceImpl.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderExtensionServiceImpl.java similarity index 68% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayOrderExtensionServiceImpl.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderExtensionServiceImpl.java index 197275657..a97e3beff 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/impl/PayOrderExtensionServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderExtensionServiceImpl.java @@ -1,8 +1,7 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.order.impl; +package cn.iocoder.yudao.module.pay.service.order; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayOrderExtensionMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderExtensionService; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; +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; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderService.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java similarity index 55% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderService.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java index ebdf7e340..40ed287fc 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderService.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java @@ -1,11 +1,16 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.order; +package cn.iocoder.yudao.module.pay.service.order; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageReqVO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageReqVO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderCreateReqDTO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderSubmitReqDTO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderSubmitRespDTO; +import javax.validation.Valid; import java.util.Collection; import java.util.List; import java.util.Map; @@ -64,4 +69,29 @@ public interface PayOrderService { return CollectionUtils.convertMap(list, PayOrderDO::getId); } + /** + * 创建支付单 + * + * @param reqDTO 创建请求 + * @return 支付单编号 + */ + Long createPayOrder(@Valid PayOrderCreateReqDTO reqDTO); + + /** + * 提交支付 + * 此时,会发起支付渠道的调用 + * + * @param reqDTO 提交请求 + * @return 提交结果 + */ + PayOrderSubmitRespDTO submitPayOrder(@Valid PayOrderSubmitReqDTO reqDTO); + + /** + * 通知支付单成功 + * + * @param channelId 渠道编号 + * @param notifyData 通知数据 + */ + void notifyPayOrder(Long channelId, PayNotifyDataDTO notifyData) throws Exception; + } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java old mode 100644 new mode 100755 similarity index 63% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java index 50229b140..72bfac023 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayOrderCoreServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java @@ -1,25 +1,8 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.order.impl; +package cn.iocoder.yudao.module.pay.service.order; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.coreservice.modules.pay.convert.order.PayOrderCoreConvert; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderExtensionCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderNotifyStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayAppCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayChannelCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.notify.PayNotifyCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.notify.dto.PayNotifyTaskCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayOrderCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitRespDTO; +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.pay.config.PayProperties; @@ -28,58 +11,94 @@ import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderNotifyRespDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageReqVO; +import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; +import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderExtensionMapper; +import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderMapper; +import cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants; +import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; +import cn.iocoder.yudao.module.pay.service.merchant.PayAppService; +import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService; +import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; +import cn.iocoder.yudao.module.pay.service.notify.dto.PayNotifyTaskCreateReqDTO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderCreateReqDTO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderSubmitReqDTO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayOrderSubmitRespDTO; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; +import java.util.Collection; import java.util.Date; +import java.util.List; import java.util.Objects; -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.*; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - /** - * 支付订单 Core Service 实现类 + * 支付订单 Service 实现类 * - * @author 芋道源码 + * @author aquan */ @Service @Validated @Slf4j -public class PayOrderCoreServiceImpl implements PayOrderCoreService { +public class PayOrderServiceImpl implements PayOrderService { @Resource private PayProperties payProperties; - @Resource - private PayAppCoreService payAppCoreService; - @Resource - private PayChannelCoreService payChannelCoreService; - @Resource - private PayNotifyCoreService payNotifyCoreService; - @Resource private PayClientFactory payClientFactory; @Resource - private PayOrderCoreMapper payOrderCoreMapper; + private PayOrderMapper orderMapper; @Resource - private PayOrderExtensionCoreMapper payOrderExtensionCoreMapper; + private PayOrderExtensionMapper orderExtensionMapper; + + @Resource + private PayAppService appService; + @Resource + private PayChannelService channelService; + @Resource + private PayNotifyService notifyService; @Override - public PayOrderDO getPayOrder(Long id) { - return payOrderCoreMapper.selectById(id); + public PayOrderDO getOrder(Long id) { + return orderMapper.selectById(id); + } + + @Override + public PageResult getOrderPage(PayOrderPageReqVO pageReqVO) { + return orderMapper.selectPage(pageReqVO); + } + + @Override + public List getOrderList(PayOrderExportReqVO exportReqVO) { + return orderMapper.selectList(exportReqVO); + } + + // TODO @艿艿:需要优化。不确定这个方法的作用 + @Override + public List getOrderSubjectList(Collection idList) { + return orderMapper.findByIdListQueryOrderSubject(idList); } @Override public Long createPayOrder(PayOrderCreateReqDTO reqDTO) { // 校验 App - PayAppDO app = payAppCoreService.validPayApp(reqDTO.getAppId()); + PayAppDO app = appService.validPayApp(reqDTO.getAppId()); // 查询对应的支付交易单是否已经存在。如果是,则直接返回 - PayOrderDO order = payOrderCoreMapper.selectByAppIdAndMerchantOrderId( + PayOrderDO order = orderMapper.selectByAppIdAndMerchantOrderId( reqDTO.getAppId(), reqDTO.getMerchantOrderId()); if (order != null) { log.warn("[createPayOrder][appId({}) merchantOrderId({}) 已经存在对应的支付单({})]", order.getAppId(), @@ -88,7 +107,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { } // 创建支付交易单 - order = PayOrderCoreConvert.INSTANCE.convert(reqDTO) + order = PayOrderConvert.INSTANCE.convert(reqDTO) .setMerchantId(app.getMerchantId()).setAppId(app.getId()); // 商户相关字段 order.setNotifyUrl(app.getPayNotifyUrl()) @@ -99,7 +118,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { // todo @芋艿 创建支付的订单的退款状态枚举是不是有问题,应该是 PayRefundTypeEnum 吧 您这填写的是 PayOrderNotifyStatusEnum 回调状态枚举 order.setRefundStatus(PayOrderNotifyStatusEnum.NO.getStatus()) .setRefundTimes(0).setRefundAmount(0L); - payOrderCoreMapper.insert(order); + orderMapper.insert(order); // 最终返回 return order.getId(); } @@ -107,34 +126,34 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { @Override public PayOrderSubmitRespDTO submitPayOrder(PayOrderSubmitReqDTO reqDTO) { // 校验 App - payAppCoreService.validPayApp(reqDTO.getAppId()); + appService.validPayApp(reqDTO.getAppId()); // 校验支付渠道是否有效 - PayChannelDO channel = payChannelCoreService.validPayChannel(reqDTO.getAppId(), reqDTO.getChannelCode()); + PayChannelDO channel = channelService.validPayChannel(reqDTO.getAppId(), reqDTO.getChannelCode()); // 校验支付客户端是否正确初始化 PayClient client = payClientFactory.getPayClient(channel.getId()); if (client == null) { log.error("[submitPayOrder][渠道编号({}) 找不到对应的支付客户端]", channel.getId()); - throw exception(PAY_CHANNEL_CLIENT_NOT_FOUND); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_CHANNEL_CLIENT_NOT_FOUND); } // 获得 PayOrderDO ,并校验其是否存在 - PayOrderDO order = payOrderCoreMapper.selectById(reqDTO.getId()); + PayOrderDO order = orderMapper.selectById(reqDTO.getId()); if (order == null || !Objects.equals(order.getAppId(), reqDTO.getAppId())) { // 是否存在 - throw exception(PAY_ORDER_NOT_FOUND); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_ORDER_NOT_FOUND); } if (!PayOrderStatusEnum.WAITING.getStatus().equals(order.getStatus())) { // 校验状态,必须是待支付 - throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_ORDER_STATUS_IS_NOT_WAITING); } // 插入 PayOrderExtensionDO - PayOrderExtensionDO orderExtension = PayOrderCoreConvert.INSTANCE.convert(reqDTO) + PayOrderExtensionDO orderExtension = PayOrderConvert.INSTANCE.convert(reqDTO) .setOrderId(order.getId()).setNo(generateOrderExtensionNo()) .setChannelId(channel.getId()).setChannelCode(channel.getCode()) .setStatus(PayOrderStatusEnum.WAITING.getStatus()); - payOrderExtensionCoreMapper.insert(orderExtension); + orderExtensionMapper.insert(orderExtension); // 调用三方接口 - PayOrderUnifiedReqDTO unifiedOrderReqDTO = PayOrderCoreConvert.INSTANCE.convert2(reqDTO); + PayOrderUnifiedReqDTO unifiedOrderReqDTO = PayOrderConvert.INSTANCE.convert2(reqDTO); // 商户相关字段 //TODO jason @芋艿 是否加一个属性 如tradeNo 支付订单号, 用这个merchantOrderId让人迷糊 unifiedOrderReqDTO.setMerchantOrderId(orderExtension.getNo()) // 注意,此处使用的是 PayOrderExtensionDO.no 属性! @@ -197,12 +216,12 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { log.info("[notifyPayOrder][channelId({}) 回调数据({})]", channelId, notifyData.getBody()); // 校验支付渠道是否有效 - PayChannelDO channel = payChannelCoreService.validPayChannel(channelId); + PayChannelDO channel = channelService.validPayChannel(channelId); // 校验支付客户端是否正确初始化 PayClient client = payClientFactory.getPayClient(channel.getId()); if (client == null) { log.error("[notifyPayOrder][渠道编号({}) 找不到对应的支付客户端]", channel.getId()); - throw exception(PAY_CHANNEL_CLIENT_NOT_FOUND); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_CHANNEL_CLIENT_NOT_FOUND); } // 解析支付结果 @@ -210,45 +229,44 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService { // TODO 芋艿,先最严格的校验。即使调用方重复调用,实际哪个订单已经被重复回调的支付,也返回 false 。也没问题,因为实际已经回调成功了。 // 1.1 查询 PayOrderExtensionDO - PayOrderExtensionDO orderExtension = payOrderExtensionCoreMapper.selectByNo( - notifyRespDTO.getOrderExtensionNo()); + PayOrderExtensionDO orderExtension = orderExtensionMapper.selectByNo(notifyRespDTO.getOrderExtensionNo()); if (orderExtension == null) { - throw exception(PAY_ORDER_EXTENSION_NOT_FOUND); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_ORDER_EXTENSION_NOT_FOUND); } if (!PayOrderStatusEnum.WAITING.getStatus().equals(orderExtension.getStatus())) { // 校验状态,必须是待支付 - throw exception(PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING); } // 1.2 更新 PayOrderExtensionDO //TODO 支付宝交易超时 TRADE_FINISHED 需要更新交易关闭 - int updateCounts = payOrderExtensionCoreMapper.updateByIdAndStatus(orderExtension.getId(), + int updateCounts = orderExtensionMapper.updateByIdAndStatus(orderExtension.getId(), PayOrderStatusEnum.WAITING.getStatus(), PayOrderExtensionDO.builder().id(orderExtension.getId()) .status(PayOrderStatusEnum.SUCCESS.getStatus()).channelNotifyData(notifyData.getBody()).build()); if (updateCounts == 0) { // 校验状态,必须是待支付 - throw exception(PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING); } log.info("[notifyPayOrder][支付拓展单({}) 更新为已支付]", orderExtension.getId()); // 2.1 判断 PayOrderDO 是否处于待支付 - PayOrderDO order = payOrderCoreMapper.selectById(orderExtension.getOrderId()); + PayOrderDO order = orderMapper.selectById(orderExtension.getOrderId()); if (order == null) { - throw exception(PAY_ORDER_NOT_FOUND); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_ORDER_NOT_FOUND); } if (!PayOrderStatusEnum.WAITING.getStatus().equals(order.getStatus())) { // 校验状态,必须是待支付 - throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_ORDER_STATUS_IS_NOT_WAITING); } // 2.2 更新 PayOrderDO - updateCounts = payOrderCoreMapper.updateByIdAndStatus(order.getId(), PayOrderStatusEnum.WAITING.getStatus(), + updateCounts = orderMapper.updateByIdAndStatus(order.getId(), PayOrderStatusEnum.WAITING.getStatus(), PayOrderDO.builder().status(PayOrderStatusEnum.SUCCESS.getStatus()).channelId(channelId).channelCode(channel.getCode()) .successTime(notifyRespDTO.getSuccessTime()).successExtensionId(orderExtension.getId()) .channelOrderNo(notifyRespDTO.getChannelOrderNo()).channelUserId(notifyRespDTO.getChannelUserId()) .notifyTime(new Date()).build()); if (updateCounts == 0) { // 校验状态,必须是待支付 - throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_ORDER_STATUS_IS_NOT_WAITING); } log.info("[notifyPayOrder][支付订单({}) 更新为已支付]", order.getId()); // 3. 插入支付通知记录 - payNotifyCoreService.createPayNotifyTask(PayNotifyTaskCreateReqDTO.builder() + notifyService.createPayNotifyTask(PayNotifyTaskCreateReqDTO.builder() .type(PayNotifyTypeEnum.ORDER.getType()).dataId(order.getId()).build()); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayOrderCreateReqDTO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayOrderCreateReqDTO.java similarity index 95% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayOrderCreateReqDTO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayOrderCreateReqDTO.java index a5d2b0f4e..62bf511de 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayOrderCreateReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayOrderCreateReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.order.dto; +package cn.iocoder.yudao.module.pay.service.order.dto; import lombok.Data; import org.hibernate.validator.constraints.Length; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayOrderSubmitReqDTO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayOrderSubmitReqDTO.java similarity index 92% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayOrderSubmitReqDTO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayOrderSubmitReqDTO.java index eb08fbb3e..20f6ab264 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayOrderSubmitReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayOrderSubmitReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.order.dto; +package cn.iocoder.yudao.module.pay.service.order.dto; import lombok.Data; import lombok.experimental.Accessors; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayOrderSubmitRespDTO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayOrderSubmitRespDTO.java similarity index 83% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayOrderSubmitRespDTO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayOrderSubmitRespDTO.java index 2bcb504e8..a594253f5 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayOrderSubmitRespDTO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayOrderSubmitRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.order.dto; +package cn.iocoder.yudao.module.pay.service.order.dto; import lombok.Data; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayRefundReqDTO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayRefundReqDTO.java similarity index 93% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayRefundReqDTO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayRefundReqDTO.java index 6ec3fb13d..0eb24dbe2 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayRefundReqDTO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayRefundReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.order.dto; +package cn.iocoder.yudao.module.pay.service.order.dto; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayRefundRespDTO.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayRefundRespDTO.java similarity index 85% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayRefundRespDTO.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayRefundRespDTO.java index d065f3852..2e1a6fcd4 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/dto/PayRefundRespDTO.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/order/dto/PayRefundRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.order.dto; +package cn.iocoder.yudao.module.pay.service.order.dto; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/package-info.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/package-info.java new file mode 100644 index 000000000..2cad91eba --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.pay.service; diff --git a/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundService.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundService.java new file mode 100755 index 000000000..7ffd52b10 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundService.java @@ -0,0 +1,61 @@ +package cn.iocoder.yudao.module.pay.service.refund; + +import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayRefundReqDTO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayRefundRespDTO; + +import java.util.List; + +/** + * 退款订单 Service 接口 + * + * @author aquan + */ +public interface PayRefundService { + + /** + * 获得退款订单 + * + * @param id 编号 + * @return 退款订单 + */ + PayRefundDO getRefund(Long id); + + /** + * 获得退款订单分页 + * + * @param pageReqVO 分页查询 + * @return 退款订单分页 + */ + PageResult getRefundPage(PayRefundPageReqVO pageReqVO); + + /** + * 获得退款订单列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 退款订单列表 + */ + List getRefundList(PayRefundExportReqVO exportReqVO); + + /** + * 提交退款申请 + * + * @param reqDTO 退款申请信息 + * @return 退款申请返回信息 + */ + PayRefundRespDTO submitRefundOrder(PayRefundReqDTO reqDTO); + + /** + * 渠道的退款通知 + * + * @param channelId 渠道编号 + * @param notifyData 通知数据 + * @throws Exception 退款通知异常 + */ + void notifyPayRefund(Long channelId, PayNotifyDataDTO notifyData) throws Exception; + +} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java old mode 100644 new mode 100755 similarity index 62% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java index 944c62aa6..4e3a151fb --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/service/order/impl/PayRefundCoreServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java @@ -1,26 +1,7 @@ -package cn.iocoder.yudao.coreservice.modules.pay.service.order.impl; +package cn.iocoder.yudao.module.pay.service.refund; import cn.hutool.core.util.StrUtil; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayOrderExtensionCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.dal.mysql.order.PayRefundCoreMapper; -import cn.iocoder.yudao.coreservice.modules.pay.enums.notify.PayNotifyTypeEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderNotifyStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundTypeEnum; -import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayAppCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayChannelCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.notify.PayNotifyCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.notify.dto.PayNotifyTaskCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayRefundCoreService; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayRefundReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayRefundRespDTO; +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; import cn.iocoder.yudao.framework.pay.core.client.PayClient; import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; @@ -29,56 +10,102 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundNotifyDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedReqDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedRespDTO; import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; +import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderMapper; +import cn.iocoder.yudao.module.pay.dal.mysql.refund.PayRefundMapper; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants; +import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum; +import cn.iocoder.yudao.module.pay.service.merchant.PayAppService; +import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService; +import cn.iocoder.yudao.module.pay.service.notify.PayNotifyService; +import cn.iocoder.yudao.module.pay.service.notify.dto.PayNotifyTaskCreateReqDTO; +import cn.iocoder.yudao.module.pay.service.order.PayOrderExtensionService; +import cn.iocoder.yudao.module.pay.service.order.PayOrderService; +import cn.iocoder.yudao.module.pay.service.order.dto.PayRefundReqDTO; +import cn.iocoder.yudao.module.pay.service.order.dto.PayRefundRespDTO; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.util.Date; +import java.util.List; import java.util.Objects; -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.*; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - +/** + * 退款订单 Service 实现类 + * + * @author aquan + */ @Service @Slf4j -public class PayRefundCoreServiceImpl implements PayRefundCoreService { - - @Resource - private PayOrderCoreMapper payOrderCoreMapper; - @Resource - private PayRefundCoreMapper payRefundCoreMapper; - @Resource - private PayOrderExtensionCoreMapper payOrderExtensionCoreMapper; - - @Resource - private PayAppCoreService payAppCoreService; - @Resource - private PayChannelCoreService payChannelCoreService; - @Resource - private PayNotifyCoreService payNotifyCoreService; +@Validated +public class PayRefundServiceImpl implements PayRefundService { @Resource private PayClientFactory payClientFactory; + @Resource + private PayRefundMapper refundMapper; + @Resource + private PayOrderMapper orderMapper; // TODO @jason:需要改成不直接操作 db; + + @Resource + private PayOrderService orderService; + @Resource + private PayOrderExtensionService orderExtensionService; + @Resource + private PayAppService appService; + @Resource + private PayChannelService channelService; + @Resource + private PayNotifyService notifyService; + + @Override + public PayRefundDO getRefund(Long id) { + return refundMapper.selectById(id); + } + + @Override + public PageResult getRefundPage(PayRefundPageReqVO pageReqVO) { + return refundMapper.selectPage(pageReqVO); + } + + @Override + public List getRefundList(PayRefundExportReqVO exportReqVO) { + return refundMapper.selectList(exportReqVO); + } + @Override @Transactional(rollbackFor = Exception.class) public PayRefundRespDTO submitRefundOrder(PayRefundReqDTO req) { // 获得 PayOrderDO - PayOrderDO order = payOrderCoreMapper.selectById(req.getPayOrderId()); + PayOrderDO order = orderService.getOrder(req.getPayOrderId()); // 校验订单是否存在 if (Objects.isNull(order) ) { - throw exception(PAY_ORDER_NOT_FOUND); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_ORDER_NOT_FOUND); } // 校验 App - PayAppDO app = payAppCoreService.validPayApp(order.getAppId()); + PayAppDO app = appService.validPayApp(order.getAppId()); // 校验支付渠道是否有效 - PayChannelDO channel = payChannelCoreService.validPayChannel(order.getChannelId()); + PayChannelDO channel = channelService.validPayChannel(order.getChannelId()); // 校验支付客户端是否正确初始化 PayClient client = payClientFactory.getPayClient(channel.getId()); if (client == null) { log.error("[refund][渠道编号({}) 找不到对应的支付客户端]", channel.getId()); - throw exception(PAY_CHANNEL_CLIENT_NOT_FOUND); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_CHANNEL_CLIENT_NOT_FOUND); } // 校验退款的条件 @@ -88,19 +115,19 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { if (Objects.equals(req.getAmount(), order.getAmount())) { refundType = PayRefundTypeEnum.ALL; } - PayOrderExtensionDO orderExtensionDO = payOrderExtensionCoreMapper.selectById(order.getSuccessExtensionId()); - PayRefundDO payRefundDO = payRefundCoreMapper.selectByTradeNoAndMerchantRefundNo(orderExtensionDO.getNo(), req.getMerchantRefundId()); + PayOrderExtensionDO orderExtensionDO = orderExtensionService.getOrderExtension(order.getSuccessExtensionId()); + PayRefundDO payRefundDO = refundMapper.selectByTradeNoAndMerchantRefundNo(orderExtensionDO.getNo(), req.getMerchantRefundId()); if(Objects.nonNull(payRefundDO)){ // 退款订单已经提交过。 //TODO 校验相同退款单的金额 // TODO @jason:咱要不封装一个 ObjectUtils.equalsAny if (Objects.equals(PayRefundStatusEnum.SUCCESS.getStatus(), payRefundDO.getStatus()) - || Objects.equals(PayRefundStatusEnum.CLOSE.getStatus(), payRefundDO.getStatus())) { + || Objects.equals(PayRefundStatusEnum.CLOSE.getStatus(), payRefundDO.getStatus())) { //已成功退款 - throw exception(PAY_REFUND_SUCCEED); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_REFUND_SUCCEED); } //可以重复提交,保证 退款请求号 一致,由渠道保证幂等 - }else { + } else { // 成功,插入退款单 状态为生成.没有和渠道交互 // TODO @jason:搞到 convert 里。一些额外的自动,手动 set 下; payRefundDO = PayRefundDO.builder().channelOrderNo(order.getChannelOrderNo()) @@ -122,7 +149,7 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { .notifyStatus(PayOrderNotifyStatusEnum.NO.getStatus()) .type(refundType.getStatus()) .build(); - payRefundCoreMapper.insert(payRefundDO); + refundMapper.insert(payRefundDO); } // TODO @jason:搞到 convert 里。一些额外的自动,手动 set 下; PayRefundUnifiedReqDTO unifiedReqDTO = new PayRefundUnifiedReqDTO(); @@ -142,18 +169,17 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { return PayRefundRespDTO.builder().refundId(payRefundDO.getId()).build(); } - @Override @Transactional(rollbackFor = Exception.class) public void notifyPayRefund(Long channelId, PayNotifyDataDTO notifyData) { log.info("[notifyPayRefund][channelId({}) 回调数据({})]", channelId, notifyData.getBody()); // 校验支付渠道是否有效 - PayChannelDO channel = payChannelCoreService.validPayChannel(channelId); + PayChannelDO channel = channelService.validPayChannel(channelId); // 校验支付客户端是否正确初始化 PayClient client = payClientFactory.getPayClient(channel.getId()); if (client == null) { log.error("[notifyPayOrder][渠道编号({}) 找不到对应的支付客户端]", channel.getId()); - throw exception(PAY_CHANNEL_CLIENT_NOT_FOUND); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_CHANNEL_CLIENT_NOT_FOUND); } // 解析渠道退款通知数据, 统一处理 PayRefundNotifyDTO refundNotify = client.parseRefundNotify(notifyData); @@ -167,14 +193,14 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { private void payRefundSuccess(PayRefundNotifyDTO refundNotify) { // 校验退款单存在 - PayRefundDO refundDO = payRefundCoreMapper.selectByTradeNoAndMerchantRefundNo(refundNotify.getTradeNo(), refundNotify.getReqNo()); + PayRefundDO refundDO = refundMapper.selectByTradeNoAndMerchantRefundNo(refundNotify.getTradeNo(), refundNotify.getReqNo()); if (refundDO == null) { log.error("[payRefundSuccess][不存在 seqNo 为{} 的支付退款单]", refundNotify.getReqNo()); - throw exception(PAY_REFUND_NOT_FOUND); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_REFUND_NOT_FOUND); } // 得到已退金额 - PayOrderDO payOrderDO = payOrderCoreMapper.selectById(refundDO.getOrderId()); + PayOrderDO payOrderDO = orderService.getOrder(refundDO.getOrderId()); Long refundedAmount = payOrderDO.getRefundAmount(); PayOrderStatusEnum orderStatus = PayOrderStatusEnum.SUCCESS; @@ -189,7 +215,7 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { .setStatus(orderStatus.getStatus()) .setRefundTimes(payOrderDO.getRefundTimes() + 1) .setRefundStatus(refundDO.getType()); - payOrderCoreMapper.updateById(updateOrderDO); + orderMapper.updateById(updateOrderDO); // 更新退款订单 PayRefundDO updateRefundDO = new PayRefundDO(); @@ -199,11 +225,11 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { .setTradeNo(refundNotify.getTradeNo()) .setNotifyTime(new Date()) .setStatus(PayRefundStatusEnum.SUCCESS.getStatus()); - payRefundCoreMapper.updateById(updateRefundDO); + refundMapper.updateById(updateRefundDO); // 插入退款通知记录 // TODO 通知商户成功或者失败. 现在通知似乎没有实现, 只是回调 - payNotifyCoreService.createPayNotifyTask(PayNotifyTaskCreateReqDTO.builder() + notifyService.createPayNotifyTask(PayNotifyTaskCreateReqDTO.builder() .type(PayNotifyTypeEnum.REFUND.getType()).dataId(refundDO.getId()).build()); } @@ -215,19 +241,19 @@ public class PayRefundCoreServiceImpl implements PayRefundCoreService { private void validatePayRefund(PayRefundReqDTO req, PayOrderDO order) { // 校验状态,必须是支付状态 if (!PayOrderStatusEnum.SUCCESS.getStatus().equals(order.getStatus())) { - throw exception(PAY_ORDER_STATUS_IS_NOT_SUCCESS); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_ORDER_STATUS_IS_NOT_SUCCESS); } // 是否已经全额退款 if (PayRefundTypeEnum.ALL.getStatus().equals(order.getRefundStatus())) { - throw exception(PAY_REFUND_ALL_REFUNDED); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_REFUND_ALL_REFUNDED); } // 校验金额 退款金额不能大于 原定的金额 if (req.getAmount() + order.getRefundAmount() > order.getAmount()){ - throw exception(PAY_REFUND_AMOUNT_EXCEED); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_REFUND_AMOUNT_EXCEED); } // 校验渠道订单号 if (StrUtil.isEmpty(order.getChannelOrderNo())) { - throw exception(PAY_REFUND_CHN_ORDER_NO_IS_NULL); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.PAY_REFUND_CHN_ORDER_NO_IS_NULL); } //TODO 退款的期限 退款次数的控制 } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/util/PaySeqUtils.java b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/util/PaySeqUtils.java similarity index 94% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/util/PaySeqUtils.java rename to yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/util/PaySeqUtils.java index 959cef746..e6409e960 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/pay/util/PaySeqUtils.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/main/java/cn/iocoder/yudao/module/pay/util/PaySeqUtils.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.pay.util; +package cn.iocoder.yudao.module.pay.util; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; @@ -10,6 +10,7 @@ import java.util.concurrent.atomic.AtomicLong; /** * 支付相关编号的生产 */ +// TODO @jason:需要改造,基于 db; public class PaySeqUtils { private static final AtomicLong REFUND_REQ_NO_SEQ = new AtomicLong(0L); @@ -47,4 +48,5 @@ public class PaySeqUtils { DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN), (int) MER_ORDER_NO_SEQ.getAndIncrement() % 10000); } + } diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/app/PayAppServiceTest.java b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayAppServiceTest.java similarity index 90% rename from yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/app/PayAppServiceTest.java rename to yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayAppServiceTest.java index 7dee06402..0939ade8b 100644 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/app/PayAppServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayAppServiceTest.java @@ -1,18 +1,17 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.app; +package cn.iocoder.yudao.module.pay.service.merchant; import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppUpdateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.app.PayAppMapper; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.merchant.PayMerchantMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.app.impl.PayAppServiceImpl; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppUpdateReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayAppMapper; +import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayMerchantMapper; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.boot.test.mock.mockito.MockBean; @@ -22,13 +21,13 @@ import javax.annotation.Resource; import java.util.Collections; import java.util.List; -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.PAY_APP_NOT_FOUND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; import static org.junit.jupiter.api.Assertions.*; /** diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/PayChannelServiceTest.java b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelServiceTest.java similarity index 93% rename from yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/PayChannelServiceTest.java rename to yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelServiceTest.java index b8d2bc917..6397bb413 100644 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/channel/PayChannelServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelServiceTest.java @@ -1,18 +1,17 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.channel; +package cn.iocoder.yudao.module.pay.service.merchant; -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelUpdateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.channel.PayChannelMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.channel.impl.PayChannelServiceImpl; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelUpdateReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; +import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayChannelMapper; +import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; import com.alibaba.fastjson.JSON; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; @@ -20,24 +19,16 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; import java.util.List; -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.CHANNEL_NOT_EXISTS; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.CHANNEL_NOT_EXISTS; import static org.junit.jupiter.api.Assertions.*; -/** - * {@link PayChannelServiceImpl} 的单元测试类 - * - * @author 芋艿 - */ -@Import({ - PayChannelServiceImpl.class, - PayChannelConfig.class -}) +@Import({PayChannelServiceImpl.class}) public class PayChannelServiceTest extends BaseDbUnitTest { @Resource @@ -66,7 +57,6 @@ public class PayChannelServiceTest extends BaseDbUnitTest { assertPojoEquals(reqVO, channel, "config"); // 关于config 对象应该拿出来重新对比 assertPojoEquals(v2Config, channel.getConfig()); - } @Test @@ -350,7 +340,6 @@ public class PayChannelServiceTest extends BaseDbUnitTest { assertPojoEquals(payClientConfig, list.get(0).getConfig()); } - public WXPayClientConfig getV2Config() { return new WXPayClientConfig() .setAppId("APP00001") @@ -400,5 +389,4 @@ public class PayChannelServiceTest extends BaseDbUnitTest { .setRootCertContent("13321321321dsad"); } - } diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/merchant/PayMerchantServiceTest.java b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayMerchantServiceTest.java similarity index 89% rename from yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/merchant/PayMerchantServiceTest.java rename to yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayMerchantServiceTest.java index 0e7cf135d..08d097083 100644 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/merchant/PayMerchantServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayMerchantServiceTest.java @@ -1,29 +1,28 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.merchant; +package cn.iocoder.yudao.module.pay.service.merchant; import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantCreateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo.PayMerchantUpdateReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.merchant.PayMerchantMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.impl.PayMerchantServiceImpl; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantCreateReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantPageReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantUpdateReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO; +import cn.iocoder.yudao.module.pay.dal.mysql.merchant.PayMerchantMapper; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; import javax.annotation.Resource; import java.util.List; -import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.PAY_MERCHANT_NOT_EXISTS; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; import static org.junit.jupiter.api.Assertions.*; /** diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderServiceTest.java b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java similarity index 91% rename from yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderServiceTest.java rename to yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java index 85b00a2d0..e3ac7394c 100755 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/order/PayOrderServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java @@ -1,19 +1,18 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.order; +package cn.iocoder.yudao.module.pay.service.order; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayOrderMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.order.impl.PayOrderServiceImpl; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderNotifyStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundTypeEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; +import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderMapper; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum; +import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; diff --git a/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/package-info.java b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/package-info.java new file mode 100644 index 000000000..2cad91eba --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.pay.service; diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/refund/PayRefundServiceTest.java b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java similarity index 90% rename from yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/refund/PayRefundServiceTest.java rename to yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java index ee19dba14..1d9173217 100755 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/pay/service/refund/PayRefundServiceTest.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java @@ -1,17 +1,16 @@ -package cn.iocoder.yudao.adminserver.modules.pay.service.refund; +package cn.iocoder.yudao.module.pay.service.refund; -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundExportReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundPageReqVO; -import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayRefundMapper; -import cn.iocoder.yudao.adminserver.modules.pay.service.order.impl.PayRefundServiceImpl; -import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderNotifyStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundStatusEnum; -import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundTypeEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; +import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; +import cn.iocoder.yudao.module.pay.dal.mysql.refund.PayRefundMapper; +import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum; +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum; +import cn.iocoder.yudao.module.pay.test.BaseDbUnitTest; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/BaseDbAndRedisUnitTest.java b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/BaseDbAndRedisUnitTest.java similarity index 95% rename from yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/BaseDbAndRedisUnitTest.java rename to yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/BaseDbAndRedisUnitTest.java index 2cc60cc30..1c6d3278d 100644 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/BaseDbAndRedisUnitTest.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/BaseDbAndRedisUnitTest.java @@ -1,9 +1,8 @@ -package cn.iocoder.yudao.adminserver; +package cn.iocoder.yudao.module.pay.test; -import cn.iocoder.yudao.adminserver.config.RedisTestConfiguration; -import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; +import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; import org.redisson.spring.starter.RedissonAutoConfiguration; diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/BaseDbUnitTest.java b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/BaseDbUnitTest.java similarity index 97% rename from yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/BaseDbUnitTest.java rename to yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/BaseDbUnitTest.java index 5f7daeded..27affbfc6 100644 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/BaseDbUnitTest.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/BaseDbUnitTest.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver; +package cn.iocoder.yudao.module.pay.test; import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/BaseRedisUnitTest.java b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/BaseRedisUnitTest.java similarity index 86% rename from yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/BaseRedisUnitTest.java rename to yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/BaseRedisUnitTest.java index 7e650bc3e..11933c9fd 100644 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/BaseRedisUnitTest.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/BaseRedisUnitTest.java @@ -1,8 +1,6 @@ -package cn.iocoder.yudao.adminserver; +package cn.iocoder.yudao.module.pay.test; -import cn.iocoder.yudao.adminserver.config.RedisTestConfiguration; import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; -import cn.iocoder.yudao.framework.tracer.config.YudaoTracerAutoConfiguration; import org.redisson.spring.starter.RedissonAutoConfiguration; import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/config/RedisTestConfiguration.java b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/RedisTestConfiguration.java similarity index 96% rename from yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/config/RedisTestConfiguration.java rename to yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/RedisTestConfiguration.java index 15a39f757..c8742129a 100644 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/config/RedisTestConfiguration.java +++ b/yudao-module-pay/yudao-module-pay-impl/src/test/java/cn/iocoder/yudao/module/pay/test/RedisTestConfiguration.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.adminserver.config; +package cn.iocoder.yudao.module.pay.test; import com.github.fppt.jedismock.RedisServer; import org.springframework.boot.autoconfigure.data.redis.RedisProperties; diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java index 9b73264e1..ab6d1b3a2 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java @@ -20,31 +20,6 @@ public interface DictTypeConstants { String SMS_SEND_STATUS = "sys_sms_send_status"; // 短信发送状态 String SMS_RECEIVE_STATUS = "sys_sms_receive_status"; // 短信接收状态 - /** - * 支付-订单-订单状态 - */ - String PAY_ORDER_STATUS = "pay_order_status"; - - /** - * 支付-订单-订单回调商户状态 - */ - String PAY_ORDER_NOTIFY_STATUS = "pay_order_notify_status"; - - /** - * 支付-订单-订单退款状态 - */ - String PAY_ORDER_REFUND_STATUS = "pay_order_refund_status"; - - /** - * 支付-退款订单-退款状态 - */ - String PAY_REFUND_ORDER_STATUS = "pay_refund_order_status"; - - /** - * 支付-退款订单-退款类别 - */ - String PAY_REFUND_ORDER_TYPE = "pay_refund_order_type"; - String BPM_TASK_ASSIGN_RULE_TYPE = "bpm_task_assign_rule_type"; // 任务分配规则类型 String BPM_TASK_ASSIGN_SCRIPT = "bpm_task_assign_script"; // 任务分配自定义脚本 diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/convert/order/PayRefundConvert.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/convert/order/PayRefundConvert.java deleted file mode 100644 index 999a3ba56..000000000 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/convert/order/PayRefundConvert.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.yudao.userserver.modules.pay.convert.order; - -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayRefundReqDTO; -import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayRefundRespDTO; -import cn.iocoder.yudao.userserver.modules.pay.controller.order.vo.PayRefundReqVO; -import cn.iocoder.yudao.userserver.modules.pay.controller.order.vo.PayRefundRespVO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -/** - * 支付退款 Convert - * - * @author jason - */ -@Mapper -public interface PayRefundConvert { - - PayRefundConvert INSTANCE = Mappers.getMapper(PayRefundConvert.class); - - PayRefundReqDTO convert(PayRefundReqVO reqVO); - - PayRefundRespVO convert(PayRefundRespDTO req); -} diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md deleted file mode 100644 index 8153487b7..000000000 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/package-info.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/package-info.java deleted file mode 100644 index 1aa11cdd2..000000000 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/pay/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * pay 包下,我们放支付业务,提供业务的支付能力。 - * 例如说:商户、应用、支付、退款等等 - * - * 缩写:pay - */ -package cn.iocoder.yudao.userserver.modules.pay;