From 04f53da68699036bb09bb98d852f8843f63a0cd2 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Mon, 30 Nov 2020 01:28:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=94=AF=E4=BB=98=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E3=80=81=E9=80=80=E6=AC=BE=E6=88=90=E5=8A=9F=E7=9A=84=20MQ=20?= =?UTF-8?q?=E6=B6=88=E8=B4=B9=E9=80=BB=E8=BE=91=E8=BF=9B=E8=A1=8C=E8=BF=81?= =?UTF-8?q?=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/api/constant/PayRefundStatus.java | 45 ------ .../mall/pay/biz/dao/PayRefundMapper.java | 38 ------ .../pay/biz/dao/PayTransactionMapper.java | 38 ------ .../main/resources/mapper/PayRefundMapper.xml | 122 ----------------- .../mapper/PayTransactionExtensionMapper.xml | 25 ---- .../resources/mapper/PayTransactionMapper.xml | 128 ------------------ .../enums/refund/PayRefundStatus.java | 30 ++++ .../common/dubbo}/DubboReferencePool.java | 6 +- .../mall/payservice/common/package-info.java | 1 + .../mysql/dataobject/refund/PayRefundDO.java | 3 +- .../mysql/mapper/refund/PayRefundMapper.java | 57 ++++++++ .../transaction/PayTransactionMapper.java | 36 +++++ .../AbstractPayNotifySuccessMQConsumer.java | 38 +++--- .../consumer/PayRefundSuccessMQConsumer.java | 15 +- .../PayTransactionSuccessMQConsumer.java | 14 +- 15 files changed, 163 insertions(+), 433 deletions(-) delete mode 100644 moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/api/constant/PayRefundStatus.java delete mode 100644 moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/dao/PayRefundMapper.java delete mode 100644 moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/dao/PayTransactionMapper.java delete mode 100644 moved/pay/pay-application/src/main/resources/mapper/PayRefundMapper.xml delete mode 100644 moved/pay/pay-application/src/main/resources/mapper/PayTransactionExtensionMapper.xml delete mode 100644 moved/pay/pay-application/src/main/resources/mapper/PayTransactionMapper.xml create mode 100644 pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/enums/refund/PayRefundStatus.java rename {moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/component => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/common/dubbo}/DubboReferencePool.java (94%) create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/common/package-info.java create mode 100644 pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/refund/PayRefundMapper.java rename moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/mq/AbstractPayNotifySuccessConsumer.java => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/mq/consumer/AbstractPayNotifySuccessMQConsumer.java (62%) rename moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/mq/PayRefundSuccessConsumer.java => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/mq/consumer/PayRefundSuccessMQConsumer.java (71%) rename moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/mq/PayTransactionSuccessConsumer.java => pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/mq/consumer/PayTransactionSuccessMQConsumer.java (74%) diff --git a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/api/constant/PayRefundStatus.java b/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/api/constant/PayRefundStatus.java deleted file mode 100644 index a68f80010..000000000 --- a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/api/constant/PayRefundStatus.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.mall.pay.api.constant; - -/** - * 支付退款状态枚举 - */ -public enum PayRefundStatus { - - WAITING(1, "处理中"), - SUCCESS(2, "成功"), - FAILURE(3, "失败"), // 例如说,支付单超时 - ; - - /** - * 状态 - */ - private Integer value; - /** - * 名字 - */ - private String name; - - PayRefundStatus(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public PayRefundStatus setValue(Integer value) { - this.value = value; - return this; - } - - public String getName() { - return name; - } - - public PayRefundStatus setName(String name) { - this.name = name; - return this; - } - -} diff --git a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/dao/PayRefundMapper.java b/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/dao/PayRefundMapper.java deleted file mode 100644 index 2b6e2a40b..000000000 --- a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/dao/PayRefundMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.pay.biz.dao; - -import cn.iocoder.mall.pay.biz.dataobject.PayRefundDO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.Date; -import java.util.List; - -@Repository -public interface PayRefundMapper { - - void insert(PayRefundDO entity); - - int update(@Param("entity") PayRefundDO entity, - @Param("whereStatus") Integer whereStatus); - - PayRefundDO selectById(@Param("id") Integer id); - - PayRefundDO selectByRefundCode(@Param("refundCode") String refundCode); - - List selectListByPage(@Param("createBeginTime") Date createBeginTime, - @Param("createEndTime") Date createEndTime, - @Param("finishBeginTime") Date finishBeginTime, - @Param("finishEndTime") Date finishEndTime, - @Param("status") Integer status, - @Param("payChannel") Integer payChannel, - @Param("offset") Integer offset, - @Param("limit") Integer limit); - - Integer selectCountByPage(@Param("createBeginTime") Date createBeginTime, - @Param("createEndTime") Date createEndTime, - @Param("finishBeginTime") Date finishBeginTime, - @Param("finishEndTime") Date finishEndTime, - @Param("status") Integer status, - @Param("payChannel") Integer payChannel); - -} diff --git a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/dao/PayTransactionMapper.java b/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/dao/PayTransactionMapper.java deleted file mode 100644 index cb341a4c8..000000000 --- a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/dao/PayTransactionMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.pay.biz.dao; - -import cn.iocoder.mall.pay.biz.dataobject.PayTransactionDO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.Collection; -import java.util.Date; -import java.util.List; - -@Repository -public interface PayTransactionMapper { - - int updateForRefundTotal(@Param("id") Integer id, - @Param("refundTotalIncr") Integer refundTotalIncr); - - - List selectListByPage(@Param("createBeginTime") Date createBeginTime, - @Param("createEndTime") Date createEndTime, - @Param("paymentBeginTime") Date paymentBeginTime, - @Param("paymentEndTime") Date paymentEndTime, - @Param("status") Integer status, - @Param("hasRefund") Boolean hasRefund, - @Param("payChannel") Integer payChannel, - @Param("orderSubject") String orderSubject, - @Param("offset") Integer offset, - @Param("limit") Integer limit); - - Integer selectCountByPage(@Param("createBeginTime") Date createBeginTime, - @Param("createEndTime") Date createEndTime, - @Param("paymentBeginTime") Date paymentBeginTime, - @Param("paymentEndTime") Date paymentEndTime, - @Param("status") Integer status, - @Param("hasRefund") Boolean hasRefund, - @Param("payChannel") Integer payChannel, - @Param("orderSubject") String orderSubject); - -} diff --git a/moved/pay/pay-application/src/main/resources/mapper/PayRefundMapper.xml b/moved/pay/pay-application/src/main/resources/mapper/PayRefundMapper.xml deleted file mode 100644 index 38e75b4e7..000000000 --- a/moved/pay/pay-application/src/main/resources/mapper/PayRefundMapper.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - id, transaction_id, refund_code, app_id, create_ip, order_id, - order_description, price, status, - finish_time, notify_url, extension_data, refund_channel, refund_time, notify_time, - trade_no, create_time - - - - INSERT INTO refund ( - transaction_id, refund_code, app_id, create_ip, order_id, - order_description, price, status, - finish_time, notify_url, extension_data, refund_channel, refund_time, notify_time, - trade_no, create_time - ) VALUES ( - #{transactionId}, #{refundCode}, #{appId}, #{createIp}, #{orderId}, - #{orderDescription}, #{price}, #{status}, - #{finishTime}, #{notifyUrl}, #{extensionData}, #{refundChannel}, #{refundTime}, #{notifyTime}, - #{tradeNo}, #{createTime} - ) - - - - UPDATE refund - - - , status = #{entity.status} - - - , finish_time = #{entity.finishTime} - - - , extension_data = #{entity.extensionData} - - - , refund_time = #{entity.refundTime} - - - , notify_time = #{entity.notifyTime} - - - , trade_no = #{entity.tradeNo} - - - WHERE id = #{entity.id} - - AND status = #{whereStatus} - - - - - - - - - - - - diff --git a/moved/pay/pay-application/src/main/resources/mapper/PayTransactionExtensionMapper.xml b/moved/pay/pay-application/src/main/resources/mapper/PayTransactionExtensionMapper.xml deleted file mode 100644 index 7452c428a..000000000 --- a/moved/pay/pay-application/src/main/resources/mapper/PayTransactionExtensionMapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - id, transaction_id, pay_channel, transaction_code, extension_data, - create_ip, status, create_time - - - - - - - diff --git a/moved/pay/pay-application/src/main/resources/mapper/PayTransactionMapper.xml b/moved/pay/pay-application/src/main/resources/mapper/PayTransactionMapper.xml deleted file mode 100644 index a46325ab8..000000000 --- a/moved/pay/pay-application/src/main/resources/mapper/PayTransactionMapper.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - id, app_id, create_ip, order_id, order_subject, - order_description, order_memo, price, status, expire_time, - finish_time, notify_url, extension_id, pay_channel, payment_time, - notify_time, trade_no, refund_total, create_time - - - - UPDATE transaction - - - , status = #{entity.status} - - - , extension_id = #{entity.extensionId} - - - , pay_channel = #{entity.payChannel} - - - , payment_time = #{entity.paymentTime} - - - , finish_time = #{entity.finishTime} - - - , notify_time = #{entity.notifyTime} - - - , trade_no = #{entity.tradeNo} - - - WHERE id = #{entity.id} - - AND status = #{whereStatus} - - - - - UPDATE `transaction` - SET refund_total = refund_total + ${refundTotalIncr} - WHERE price >= refund_total + ${refundTotalIncr} - - - - - - - - - diff --git a/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/enums/refund/PayRefundStatus.java b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/enums/refund/PayRefundStatus.java new file mode 100644 index 000000000..efbe9fbe6 --- /dev/null +++ b/pay-service-project/pay-service-api/src/main/java/cn/iocoder/mall/payservice/enums/refund/PayRefundStatus.java @@ -0,0 +1,30 @@ +package cn.iocoder.mall.payservice.enums.refund; + +import lombok.Getter; + +/** + * 支付退款状态枚举 + */ +@Getter +public enum PayRefundStatus { + + WAITING(1, "处理中"), + SUCCESS(2, "成功"), + FAILURE(3, "失败"), // 例如说,支付单超时 + ; + + /** + * 状态 + */ + private final Integer value; + /** + * 名字 + */ + private final String name; + + PayRefundStatus(Integer value, String name) { + this.value = value; + this.name = name; + } + +} diff --git a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/component/DubboReferencePool.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/common/dubbo/DubboReferencePool.java similarity index 94% rename from moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/component/DubboReferencePool.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/common/dubbo/DubboReferencePool.java index 62d6e6adf..f853aea20 100644 --- a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/component/DubboReferencePool.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/common/dubbo/DubboReferencePool.java @@ -1,6 +1,6 @@ -package cn.iocoder.mall.pay.biz.component; +package cn.iocoder.mall.payservice.common.dubbo; -import cn.iocoder.common.framework.util.StringUtil; +import cn.iocoder.common.framework.util.StringUtils; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; @@ -48,7 +48,7 @@ public class DubboReferencePool { private ReferenceMeta createGenericService(String notifyUrl) { // 使用 # 号分隔,格式为 服务名#方法名#版本号 - List notifyUrlParts = StringUtil.split(notifyUrl, "#"); + List notifyUrlParts = StringUtils.split(notifyUrl, "#"); // 创建 ApplicationConfig 对象 ApplicationConfig application = new ApplicationConfig(); application.setName(dubboApplicationName); diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/common/package-info.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/common/package-info.java new file mode 100644 index 000000000..ed83cb4e9 --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/common/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.mall.payservice.common; diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/refund/PayRefundDO.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/refund/PayRefundDO.java index 081612dae..4281a1f5f 100644 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/refund/PayRefundDO.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/dataobject/refund/PayRefundDO.java @@ -1,6 +1,7 @@ package cn.iocoder.mall.payservice.dal.mysql.dataobject.refund; import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; +import cn.iocoder.mall.payservice.enums.refund.PayRefundStatus; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -68,7 +69,7 @@ public class PayRefundDO extends DeletableDO { /** * 退款状态 * - * @see cn.iocoder.mall.pay.api.constant.PayRefundStatus + * 外键 {@link PayRefundStatus} */ private Integer status; /** diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/refund/PayRefundMapper.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/refund/PayRefundMapper.java new file mode 100644 index 000000000..ebcbd72f7 --- /dev/null +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/refund/PayRefundMapper.java @@ -0,0 +1,57 @@ +package cn.iocoder.mall.payservice.dal.mysql.mapper.refund; + +import cn.iocoder.mall.payservice.dal.mysql.dataobject.refund.PayRefundDO; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +@Repository +public interface PayRefundMapper extends BaseMapper { + + default int update(PayRefundDO entity, Integer whereStatus) { + return update(entity, new QueryWrapper() + .eq("id", entity.getId()).eq("status", whereStatus)); + } + + default PayRefundDO selectByRefundCode(String refundCode) { + return selectOne(new QueryWrapper() + .eq("refund_code", refundCode)); + } + + +// +// AND create_time >= #{createBeginTime} +// +// +// AND #{createEndTime} >= create_time +// +// +// AND finish_time >= #{finishBeginTime} +// +// +// AND #{finishEndTime} >= finish_time +// +// +// AND status = #{status} +// +// +// AND pay_channel = #{payChannel} +// + +// List selectListByPage(@Param("createBeginTime") Date createBeginTime, +// @Param("createEndTime") Date createEndTime, +// @Param("finishBeginTime") Date finishBeginTime, +// @Param("finishEndTime") Date finishEndTime, +// @Param("status") Integer status, +// @Param("payChannel") Integer payChannel, +// @Param("offset") Integer offset, +// @Param("limit") Integer limit); +// +// Integer selectCountByPage(@Param("createBeginTime") Date createBeginTime, +// @Param("createEndTime") Date createEndTime, +// @Param("finishBeginTime") Date finishBeginTime, +// @Param("finishEndTime") Date finishEndTime, +// @Param("status") Integer status, +// @Param("payChannel") Integer payChannel); + +} diff --git a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/PayTransactionMapper.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/PayTransactionMapper.java index 927599e62..14b24d8f9 100644 --- a/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/PayTransactionMapper.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/dal/mysql/mapper/transaction/PayTransactionMapper.java @@ -7,6 +7,42 @@ import org.springframework.stereotype.Repository; @Repository public interface PayTransactionMapper extends BaseMapper { +// +// UPDATE `transaction` +// SET refund_total = refund_total + ${refundTotalIncr} +// WHERE price >= refund_total + ${refundTotalIncr} +// + +// int updateForRefundTotal(@Param("id") Integer id, +// @Param("refundTotalIncr") Integer refundTotalIncr); + +// +// AND create_time >= #{createBeginTime} +// +// +// AND #{createEndTime} >= create_time +// +// +// AND payment_time >= #{paymentBeginTime} +// +// +// AND #{paymentEndTime} >= payment_time +// +// +// AND status = #{status} +// +// +// AND refund_total > 0 +// +// +// AND refund_total = 0 +// +// +// AND pay_channel = #{payChannel} +// +// +// order_subject LIKE "%"#{orderSubject}"%" +// // default IPage selectPage(TransactionPageBO pageBO) { // return selectPage(new Page<>(pageBO.getPageNo(), pageBO.getPageSize()), diff --git a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/mq/AbstractPayNotifySuccessConsumer.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/mq/consumer/AbstractPayNotifySuccessMQConsumer.java similarity index 62% rename from moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/mq/AbstractPayNotifySuccessConsumer.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/mq/consumer/AbstractPayNotifySuccessMQConsumer.java index 4ff7343d4..05f36f697 100644 --- a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/mq/AbstractPayNotifySuccessConsumer.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/mq/consumer/AbstractPayNotifySuccessMQConsumer.java @@ -1,14 +1,14 @@ -package cn.iocoder.mall.pay.biz.mq; +package cn.iocoder.mall.payservice.mq.consumer; import cn.iocoder.common.framework.util.DateUtil; import cn.iocoder.common.framework.util.ExceptionUtil; -import cn.iocoder.mall.pay.api.constant.PayTransactionNotifyStatusEnum; -import cn.iocoder.mall.pay.api.message.AbstractPayNotifySuccessMessage; -import cn.iocoder.mall.pay.biz.component.DubboReferencePool; -import cn.iocoder.mall.pay.biz.dao.PayNotifyLogMapper; -import cn.iocoder.mall.pay.biz.dao.PayNotifyTaskMapper; -import cn.iocoder.mall.pay.biz.dataobject.PayNotifyLogDO; -import cn.iocoder.mall.pay.biz.dataobject.PayNotifyTaskDO; +import cn.iocoder.mall.payservice.common.dubbo.DubboReferencePool; +import cn.iocoder.mall.payservice.dal.mysql.dataobject.notify.PayNotifyLogDO; +import cn.iocoder.mall.payservice.dal.mysql.dataobject.notify.PayNotifyTaskDO; +import cn.iocoder.mall.payservice.dal.mysql.mapper.notify.PayNotifyLogMapper; +import cn.iocoder.mall.payservice.dal.mysql.mapper.notify.PayNotifyTaskMapper; +import cn.iocoder.mall.payservice.enums.notify.PayNotifyStatusEnum; +import cn.iocoder.mall.payservice.mq.producer.message.AbstractPayNotifySuccessMessage; import com.alibaba.fastjson.JSON; import org.apache.rocketmq.spring.core.RocketMQListener; import org.springframework.beans.factory.annotation.Autowired; @@ -17,13 +17,13 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Calendar; import java.util.Date; -public abstract class AbstractPayNotifySuccessConsumer implements RocketMQListener { +public abstract class AbstractPayNotifySuccessMQConsumer implements RocketMQListener { @Autowired private DubboReferencePool dubboReferencePool; @Autowired - private PayNotifyTaskMapper payTransactionNotifyTaskMapper; + private PayNotifyTaskMapper payNotifyTaskMapper; @Autowired private PayNotifyLogMapper payTransactionNotifyLogMapper; @@ -39,25 +39,27 @@ public abstract class AbstractPayNotifySuccessConsumer= PayNotifyTaskDO.NOTIFY_FREQUENCY.length) { - updateTask.setStatus(PayTransactionNotifyStatusEnum.FAILURE.getValue()); + updateTask.setStatus(PayNotifyStatusEnum.FAILURE.getStatus()); } else { updateTask.setNextNotifyTime(DateUtil.addDate(Calendar.SECOND, PayNotifyTaskDO.NOTIFY_FREQUENCY[updateTask.getNotifyTimes()])); updateTask.setStatus(defaultStatus); diff --git a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/mq/PayRefundSuccessConsumer.java b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/mq/consumer/PayRefundSuccessMQConsumer.java similarity index 71% rename from moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/mq/PayRefundSuccessConsumer.java rename to pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/mq/consumer/PayRefundSuccessMQConsumer.java index 2f6afc102..3f4737d25 100644 --- a/moved/pay/pay-application/src/main/java/cn/iocoder/mall/pay/biz/mq/PayRefundSuccessConsumer.java +++ b/pay-service-project/pay-service-app/src/main/java/cn/iocoder/mall/payservice/mq/consumer/PayRefundSuccessMQConsumer.java @@ -1,9 +1,9 @@ -package cn.iocoder.mall.pay.biz.mq; +package cn.iocoder.mall.payservice.mq.consumer; -import cn.iocoder.mall.pay.api.message.PayRefundSuccessMessage; -import cn.iocoder.mall.pay.biz.component.DubboReferencePool; -import cn.iocoder.mall.pay.biz.dao.PayRefundMapper; -import cn.iocoder.mall.pay.biz.dataobject.PayRefundDO; +import cn.iocoder.mall.payservice.common.dubbo.DubboReferencePool; +import cn.iocoder.mall.payservice.dal.mysql.dataobject.refund.PayRefundDO; +import cn.iocoder.mall.payservice.dal.mysql.mapper.refund.PayRefundMapper; +import cn.iocoder.mall.payservice.mq.producer.message.PayRefundSuccessMessage; import org.apache.dubbo.rpc.service.GenericService; import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; import org.apache.rocketmq.spring.core.RocketMQListener; @@ -18,8 +18,7 @@ import java.util.Date; topic = PayRefundSuccessMessage.TOPIC, consumerGroup = "pay-consumer-group-" + PayRefundSuccessMessage.TOPIC ) -@Deprecated // 艿艿:突然发现,业务方实际无需回调。参考了 https://help.youzan.com/displaylist/detail_4_998 的文章。业务方,只要记录下退款单号,进行关联即可。 -public class PayRefundSuccessConsumer extends AbstractPayNotifySuccessConsumer +public class PayRefundSuccessMQConsumer extends AbstractPayNotifySuccessMQConsumer implements RocketMQListener { @Autowired @@ -40,7 +39,7 @@ public class PayRefundSuccessConsumer extends AbstractPayNotifySuccessConsumer

+public class PayTransactionSuccessMQConsumer extends AbstractPayNotifySuccessMQConsumer implements RocketMQListener { @Autowired @@ -39,7 +39,7 @@ public class PayTransactionSuccessConsumer extends AbstractPayNotifySuccessConsu @Override protected void afterInvokeSuccess(PayTransactionSuccessMessage message) { PayTransactionDO updateTransaction = new PayTransactionDO().setId(message.getTransactionId()).setFinishTime(new Date()); - payTransactionMapper.update(updateTransaction, null); + payTransactionMapper.updateById(updateTransaction); } }