Commit 278f2af8f8e61fb32d1087372e6f700480514ae3
Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product
Showing
26 changed files
with
295 additions
and
112 deletions
sql/mysql/pay_wallet.sql
| @@ -5,11 +5,11 @@ DROP TABLE IF EXISTS `pay_wallet`; | @@ -5,11 +5,11 @@ DROP TABLE IF EXISTS `pay_wallet`; | ||
| 5 | CREATE TABLE `pay_wallet` | 5 | CREATE TABLE `pay_wallet` |
| 6 | ( | 6 | ( |
| 7 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', | 7 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', |
| 8 | - `user_id` bigint NOT NULL COMMENT '用户 id', | 8 | + `user_id` bigint NOT NULL COMMENT '用户编号', |
| 9 | `user_type` tinyint NOT NULL DEFAULT 0 COMMENT '用户类型', | 9 | `user_type` tinyint NOT NULL DEFAULT 0 COMMENT '用户类型', |
| 10 | - `balance` int NOT NULL DEFAULT 0 COMMENT '余额, 单位分', | ||
| 11 | - `total_expense` bigint NOT NULL DEFAULT 0 COMMENT '累计支出, 单位分', | ||
| 12 | - `total_recharge` bigint NOT NULL DEFAULT 0 COMMENT '累计充值, 单位分', | 10 | + `balance` int NOT NULL DEFAULT 0 COMMENT '余额,单位分', |
| 11 | + `total_expense` bigint NOT NULL DEFAULT 0 COMMENT '累计支出,单位分', | ||
| 12 | + `total_recharge` bigint NOT NULL DEFAULT 0 COMMENT '累计充值,单位分', | ||
| 13 | `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | 13 | `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', |
| 14 | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | 14 | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| 15 | `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | 15 | `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', |
| @@ -41,4 +41,4 @@ CREATE TABLE `pay_wallet_transaction` | @@ -41,4 +41,4 @@ CREATE TABLE `pay_wallet_transaction` | ||
| 41 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 41 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 42 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 42 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 43 | PRIMARY KEY (`id`) USING BTREE | 43 | PRIMARY KEY (`id`) USING BTREE |
| 44 | -) ENGINE=InnoDB COMMENT='支付钱包余额明细表'; | ||
| 45 | \ No newline at end of file | 44 | \ No newline at end of file |
| 45 | +) ENGINE=InnoDB COMMENT='支付钱包余额明细表'; |
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/ErrorCodeConstants.java
| @@ -32,6 +32,7 @@ public interface ErrorCodeConstants { | @@ -32,6 +32,7 @@ public interface ErrorCodeConstants { | ||
| 32 | ErrorCode ORDER_DELIVERY_FAIL_REFUND_STATUS_NOT_NONE = new ErrorCode(1011000021, "交易订单发货失败,订单已退款或部分退款"); | 32 | ErrorCode ORDER_DELIVERY_FAIL_REFUND_STATUS_NOT_NONE = new ErrorCode(1011000021, "交易订单发货失败,订单已退款或部分退款"); |
| 33 | ErrorCode ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000022, "交易订单发货失败,拼团未成功"); | 33 | ErrorCode ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000022, "交易订单发货失败,拼团未成功"); |
| 34 | ErrorCode ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000023, "交易订单发货失败,砍价未成功"); | 34 | ErrorCode ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000023, "交易订单发货失败,砍价未成功"); |
| 35 | + ErrorCode ORDER_DELIVERY_FAIL_DELIVERY_TYPE_NOT_EXPRESS = new ErrorCode(1011000024, "交易订单发货失败,发货类型不是快递"); | ||
| 35 | 36 | ||
| 36 | // ========== After Sale 模块 1011000100 ========== | 37 | // ========== After Sale 模块 1011000100 ========== |
| 37 | ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1011000100, "售后单不存在"); | 38 | ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1011000100, "售后单不存在"); |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/TradeAfterSaleController.java
| @@ -7,13 +7,15 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | @@ -7,13 +7,15 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||
| 7 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; | 7 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 8 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | 8 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 9 | import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO; | 9 | import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO; |
| 10 | -import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDisagreeReqVO; | ||
| 11 | -import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSalePageReqVO; | ||
| 12 | -import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRefuseReqVO; | ||
| 13 | -import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRespPageItemVO; | 10 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.*; |
| 14 | import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert; | 11 | import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert; |
| 15 | import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO; | 12 | import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO; |
| 13 | +import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; | ||
| 14 | +import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; | ||
| 15 | +import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO; | ||
| 16 | +import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService; | ||
| 16 | import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService; | 17 | import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService; |
| 18 | +import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; | ||
| 17 | import io.swagger.v3.oas.annotations.Operation; | 19 | import io.swagger.v3.oas.annotations.Operation; |
| 18 | import io.swagger.v3.oas.annotations.Parameter; | 20 | import io.swagger.v3.oas.annotations.Parameter; |
| 19 | import io.swagger.v3.oas.annotations.tags.Tag; | 21 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.*; | @@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.*; | ||
| 25 | import javax.annotation.Resource; | 27 | import javax.annotation.Resource; |
| 26 | import javax.annotation.security.PermitAll; | 28 | import javax.annotation.security.PermitAll; |
| 27 | import javax.validation.Valid; | 29 | import javax.validation.Valid; |
| 30 | +import java.util.List; | ||
| 28 | import java.util.Map; | 31 | import java.util.Map; |
| 29 | 32 | ||
| 30 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 33 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| @@ -41,7 +44,10 @@ public class TradeAfterSaleController { | @@ -41,7 +44,10 @@ public class TradeAfterSaleController { | ||
| 41 | 44 | ||
| 42 | @Resource | 45 | @Resource |
| 43 | private TradeAfterSaleService afterSaleService; | 46 | private TradeAfterSaleService afterSaleService; |
| 44 | - | 47 | + @Resource |
| 48 | + private TradeOrderQueryService tradeOrderQueryService; | ||
| 49 | + @Resource | ||
| 50 | + private AfterSaleLogService afterSaleLogService; | ||
| 45 | @Resource | 51 | @Resource |
| 46 | private MemberUserApi memberUserApi; | 52 | private MemberUserApi memberUserApi; |
| 47 | 53 | ||
| @@ -61,6 +67,24 @@ public class TradeAfterSaleController { | @@ -61,6 +67,24 @@ public class TradeAfterSaleController { | ||
| 61 | return success(TradeAfterSaleConvert.INSTANCE.convertPage(pageResult, memberUsers)); | 67 | return success(TradeAfterSaleConvert.INSTANCE.convertPage(pageResult, memberUsers)); |
| 62 | } | 68 | } |
| 63 | 69 | ||
| 70 | + @GetMapping("/get-detail") | ||
| 71 | + @Operation(summary = "获得售后订单详情") | ||
| 72 | + @Parameter(name = "id", description = "售后编号", required = true, example = "1") | ||
| 73 | + @PreAuthorize("@ss.hasPermission('trade:after-sale:query')") | ||
| 74 | + public CommonResult<TradeAfterSaleDetailRespVO> getOrderDetail(@RequestParam("id") Long id) { | ||
| 75 | + // 查询订单 | ||
| 76 | + TradeAfterSaleDO afterSale = afterSaleService.getAfterSale(id); | ||
| 77 | + // 查询订单 | ||
| 78 | + TradeOrderDO order = tradeOrderQueryService.getOrder(afterSale.getOrderId()); | ||
| 79 | + // 查询订单项 | ||
| 80 | + List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(id); | ||
| 81 | + // 拼接数据 | ||
| 82 | + MemberUserRespDTO user = memberUserApi.getUser(afterSale.getUserId()); | ||
| 83 | + // 获取售后日志 | ||
| 84 | + List<TradeAfterSaleLogRespDTO> logs = afterSaleLogService.getLog(afterSale.getId()); | ||
| 85 | + return success(TradeAfterSaleConvert.INSTANCE.convert(afterSale, order, orderItems, user, logs)); | ||
| 86 | + } | ||
| 87 | + | ||
| 64 | @PutMapping("/agree") | 88 | @PutMapping("/agree") |
| 65 | @Operation(summary = "同意售后") | 89 | @Operation(summary = "同意售后") |
| 66 | @Parameter(name = "id", description = "售后编号", required = true, example = "1") | 90 | @Parameter(name = "id", description = "售后编号", required = true, example = "1") |
| @@ -88,7 +112,7 @@ public class TradeAfterSaleController { | @@ -88,7 +112,7 @@ public class TradeAfterSaleController { | ||
| 88 | } | 112 | } |
| 89 | 113 | ||
| 90 | @PutMapping("/refuse") | 114 | @PutMapping("/refuse") |
| 91 | - @Operation(summary = "确认收货") | 115 | + @Operation(summary = "拒绝收货") |
| 92 | @Parameter(name = "id", description = "售后编号", required = true, example = "1") | 116 | @Parameter(name = "id", description = "售后编号", required = true, example = "1") |
| 93 | @PreAuthorize("@ss.hasPermission('trade:after-sale:receive')") | 117 | @PreAuthorize("@ss.hasPermission('trade:after-sale:receive')") |
| 94 | public CommonResult<Boolean> refuseAfterSale(TradeAfterSaleRefuseReqVO refuseReqVO) { | 118 | public CommonResult<Boolean> refuseAfterSale(TradeAfterSaleRefuseReqVO refuseReqVO) { |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO; | ||
| 4 | +import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO; | ||
| 5 | +import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderBaseVO; | ||
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderItemBaseVO; | ||
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import javax.validation.constraints.NotNull; | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +@Schema(description = "管理后台 - 售后订单的详情 Response VO") | ||
| 15 | +@Data | ||
| 16 | +public class TradeAfterSaleDetailRespVO extends TradeAfterSaleBaseVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 19 | + @NotNull(message = "售后编号不能为空") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 订单项列表 | ||
| 24 | + */ | ||
| 25 | + private List<Item> items; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 订单基本信息 | ||
| 29 | + */ | ||
| 30 | + private TradeOrderBaseVO order; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 用户信息 | ||
| 34 | + */ | ||
| 35 | + private MemberUserRespVO user; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 售后日志 | ||
| 39 | + */ | ||
| 40 | + private List<TradeAfterSaleLogRespVO> afterSaleLog; | ||
| 41 | + | ||
| 42 | + @Schema(description = "管理后台 - 交易订单的详情的订单项目") | ||
| 43 | + @Data | ||
| 44 | + public static class Item extends TradeOrderItemBaseVO { | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 属性数组 | ||
| 48 | + */ | ||
| 49 | + private List<ProductPropertyValueDetailRespVO> properties; | ||
| 50 | + | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryPickUpStoreController.java
| @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.trade.controller.admin.delivery; | @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.trade.controller.admin.delivery; | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | ||
| 6 | import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.*; | 8 | import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.*; |
| 7 | import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert; | 9 | import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert; |
| 8 | import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO; | 10 | import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO; |
| @@ -64,10 +66,13 @@ public class DeliveryPickUpStoreController { | @@ -64,10 +66,13 @@ public class DeliveryPickUpStoreController { | ||
| 64 | } | 66 | } |
| 65 | 67 | ||
| 66 | @GetMapping("/list-all-simple") | 68 | @GetMapping("/list-all-simple") |
| 67 | - @Operation(summary = "获取快递公司精简信息列表") | 69 | + @Operation(summary = "获得自提门店精简信息列表") |
| 68 | public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() { | 70 | public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() { |
| 69 | List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus()); | 71 | List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus()); |
| 70 | - return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list)); | 72 | + return success(CollectionUtils.convertList(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list), item -> { |
| 73 | + item.setAreaName(AreaUtils.format(item.getAreaId())); | ||
| 74 | + return item; | ||
| 75 | + })); | ||
| 71 | } | 76 | } |
| 72 | 77 | ||
| 73 | @GetMapping("/list") | 78 | @GetMapping("/list") |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/pickup/DeliveryPickUpStoreSimpleRespVO.java
| @@ -23,7 +23,8 @@ public class DeliveryPickUpStoreSimpleRespVO { | @@ -23,7 +23,8 @@ public class DeliveryPickUpStoreSimpleRespVO { | ||
| 23 | @Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733") | 23 | @Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733") |
| 24 | private Integer areaId; | 24 | private Integer areaId; |
| 25 | 25 | ||
| 26 | - // TODO @puhui999:要把 areaName 也返回哈 | 26 | + @Schema(description = "区域名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "xx市") |
| 27 | + private String areaName; | ||
| 27 | 28 | ||
| 28 | @Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号") | 29 | @Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号") |
| 29 | private String detailAddress; | 30 | private String detailAddress; |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java
| @@ -85,8 +85,7 @@ public class TradeOrderController { | @@ -85,8 +85,7 @@ public class TradeOrderController { | ||
| 85 | tradeOrderQueryService.getExpressTrackList(id, getLoginUserId()))); | 85 | tradeOrderQueryService.getExpressTrackList(id, getLoginUserId()))); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | - // TODO @puhui999:put 请求哈 | ||
| 89 | - @PostMapping("/delivery") | 88 | + @PutMapping("/delivery") |
| 90 | @Operation(summary = "订单发货") | 89 | @Operation(summary = "订单发货") |
| 91 | @PreAuthorize("@ss.hasPermission('trade:order:update')") | 90 | @PreAuthorize("@ss.hasPermission('trade:order:update')") |
| 92 | public CommonResult<Boolean> deliveryOrder(@RequestBody TradeOrderDeliveryReqVO deliveryReqVO) { | 91 | public CommonResult<Boolean> deliveryOrder(@RequestBody TradeOrderDeliveryReqVO deliveryReqVO) { |
| @@ -94,8 +93,7 @@ public class TradeOrderController { | @@ -94,8 +93,7 @@ public class TradeOrderController { | ||
| 94 | return success(true); | 93 | return success(true); |
| 95 | } | 94 | } |
| 96 | 95 | ||
| 97 | - // TODO @puhui999:put 请求哈,update-remark; | ||
| 98 | - @PostMapping("/remark") | 96 | + @PutMapping("/update-remark") |
| 99 | @Operation(summary = "订单备注") | 97 | @Operation(summary = "订单备注") |
| 100 | @PreAuthorize("@ss.hasPermission('trade:order:update')") | 98 | @PreAuthorize("@ss.hasPermission('trade:order:update')") |
| 101 | public CommonResult<Boolean> updateOrderRemark(@RequestBody TradeOrderRemarkReqVO reqVO) { | 99 | public CommonResult<Boolean> updateOrderRemark(@RequestBody TradeOrderRemarkReqVO reqVO) { |
| @@ -103,8 +101,7 @@ public class TradeOrderController { | @@ -103,8 +101,7 @@ public class TradeOrderController { | ||
| 103 | return success(true); | 101 | return success(true); |
| 104 | } | 102 | } |
| 105 | 103 | ||
| 106 | - // TODO @puhui999:put 请求哈,update-price; | ||
| 107 | - @PostMapping("/adjust-price") | 104 | + @PutMapping("/update-price") |
| 108 | @Operation(summary = "订单调价") | 105 | @Operation(summary = "订单调价") |
| 109 | @PreAuthorize("@ss.hasPermission('trade:order:update')") | 106 | @PreAuthorize("@ss.hasPermission('trade:order:update')") |
| 110 | public CommonResult<Boolean> updateOrderPrice(@RequestBody TradeOrderUpdatePriceReqVO reqVO) { | 107 | public CommonResult<Boolean> updateOrderPrice(@RequestBody TradeOrderUpdatePriceReqVO reqVO) { |
| @@ -112,8 +109,7 @@ public class TradeOrderController { | @@ -112,8 +109,7 @@ public class TradeOrderController { | ||
| 112 | return success(true); | 109 | return success(true); |
| 113 | } | 110 | } |
| 114 | 111 | ||
| 115 | - // TODO @puhui999:put 请求哈,update-address; | ||
| 116 | - @PostMapping("/adjust-address") | 112 | + @PutMapping("/update-address") |
| 117 | @Operation(summary = "修改订单收货地址") | 113 | @Operation(summary = "修改订单收货地址") |
| 118 | @PreAuthorize("@ss.hasPermission('trade:order:update')") | 114 | @PreAuthorize("@ss.hasPermission('trade:order:update')") |
| 119 | public CommonResult<Boolean> updateOrderAddress(@RequestBody TradeOrderUpdateAddressReqVO reqVO) { | 115 | public CommonResult<Boolean> updateOrderAddress(@RequestBody TradeOrderUpdateAddressReqVO reqVO) { |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/TradeAfterSaleConvert.java
| @@ -4,19 +4,26 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -4,19 +4,26 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | 4 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 5 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; | 5 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| 6 | import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO; | 6 | import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO; |
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDetailRespVO; | ||
| 7 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRespPageItemVO; | 8 | import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRespPageItemVO; |
| 9 | +import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO; | ||
| 8 | import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO; | 10 | import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO; |
| 9 | import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO; | 11 | import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO; |
| 12 | +import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderBaseVO; | ||
| 10 | import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleCreateReqVO; | 13 | import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleCreateReqVO; |
| 11 | import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleRespVO; | 14 | import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleRespVO; |
| 12 | import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO; | 15 | import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO; |
| 16 | +import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleLogDO; | ||
| 17 | +import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; | ||
| 13 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; | 18 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; |
| 19 | +import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO; | ||
| 14 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; | 20 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; |
| 15 | import org.mapstruct.Mapper; | 21 | import org.mapstruct.Mapper; |
| 16 | import org.mapstruct.Mapping; | 22 | import org.mapstruct.Mapping; |
| 17 | import org.mapstruct.Mappings; | 23 | import org.mapstruct.Mappings; |
| 18 | import org.mapstruct.factory.Mappers; | 24 | import org.mapstruct.factory.Mappers; |
| 19 | 25 | ||
| 26 | +import java.util.List; | ||
| 20 | import java.util.Map; | 27 | import java.util.Map; |
| 21 | 28 | ||
| 22 | @Mapper | 29 | @Mapper |
| @@ -61,4 +68,22 @@ public interface TradeAfterSaleConvert { | @@ -61,4 +68,22 @@ public interface TradeAfterSaleConvert { | ||
| 61 | 68 | ||
| 62 | PageResult<AppTradeAfterSaleRespVO> convertPage02(PageResult<TradeAfterSaleDO> page); | 69 | PageResult<AppTradeAfterSaleRespVO> convertPage02(PageResult<TradeAfterSaleDO> page); |
| 63 | 70 | ||
| 71 | + List<TradeAfterSaleLogRespDTO> convertList(List<TradeAfterSaleLogDO> list); | ||
| 72 | + | ||
| 73 | + List<TradeAfterSaleLogRespVO> convertList1(List<TradeAfterSaleLogRespDTO> list); | ||
| 74 | + | ||
| 75 | + TradeOrderBaseVO convert(TradeOrderDO order); | ||
| 76 | + | ||
| 77 | + @Mapping(target = "id", source = "afterSale.id") | ||
| 78 | + TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List<TradeOrderItemDO> orderItems, List<TradeAfterSaleLogRespVO> logs); | ||
| 79 | + | ||
| 80 | + default TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, TradeOrderDO order, List<TradeOrderItemDO> orderItems, | ||
| 81 | + MemberUserRespDTO user, List<TradeAfterSaleLogRespDTO> logs) { | ||
| 82 | + TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems, convertList1(logs)); | ||
| 83 | + // 处理用户信息 | ||
| 84 | + respVO.setUser(convert(user)); | ||
| 85 | + // 处理订单信息 | ||
| 86 | + respVO.setOrder(convert(order)); | ||
| 87 | + return respVO; | ||
| 88 | + } | ||
| 64 | } | 89 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/dto/TradeAfterSaleLogRespDTO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.NoArgsConstructor; | ||
| 7 | + | ||
| 8 | +import javax.validation.constraints.NotNull; | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 贸易售后日志详情 DTO | ||
| 13 | + * | ||
| 14 | + * @author HUIHUI | ||
| 15 | + */ | ||
| 16 | +@Data | ||
| 17 | +@NoArgsConstructor | ||
| 18 | +@AllArgsConstructor | ||
| 19 | +public class TradeAfterSaleLogRespDTO { | ||
| 20 | + | ||
| 21 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20669") | ||
| 22 | + private Long id; | ||
| 23 | + | ||
| 24 | + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22634") | ||
| 25 | + @NotNull(message = "用户编号不能为空") | ||
| 26 | + private Long userId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 29 | + @NotNull(message = "用户类型不能为空") | ||
| 30 | + private Integer userType; | ||
| 31 | + | ||
| 32 | + @Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3023") | ||
| 33 | + @NotNull(message = "售后编号不能为空") | ||
| 34 | + private Long afterSaleId; | ||
| 35 | + | ||
| 36 | + @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25870") | ||
| 37 | + @NotNull(message = "订单编号不能为空") | ||
| 38 | + private Long orderId; | ||
| 39 | + | ||
| 40 | + @Schema(description = "订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23154") | ||
| 41 | + @NotNull(message = "订单项编号不能为空") | ||
| 42 | + private Long orderItemId; | ||
| 43 | + | ||
| 44 | + @Schema(description = "售后状态(之前)", example = "2") | ||
| 45 | + private Integer beforeStatus; | ||
| 46 | + | ||
| 47 | + @Schema(description = "售后状态(之后)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 48 | + @NotNull(message = "售后状态(之后)不能为空") | ||
| 49 | + private Integer afterStatus; | ||
| 50 | + | ||
| 51 | + @Schema(description = "操作明细", requiredMode = Schema.RequiredMode.REQUIRED, example = "维权完成,退款金额:¥37776.00") | ||
| 52 | + @NotNull(message = "操作明细不能为空") | ||
| 53 | + private String content; | ||
| 54 | + | ||
| 55 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 56 | + private LocalDateTime createTime; | ||
| 57 | + | ||
| 58 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/service/AfterSaleLogService.java
| @@ -2,6 +2,9 @@ package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service; | @@ -2,6 +2,9 @@ package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service; | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO; | 4 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO; |
| 5 | +import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 5 | 8 | ||
| 6 | /** | 9 | /** |
| 7 | * 交易售后日志 Service 接口 | 10 | * 交易售后日志 Service 接口 |
| @@ -20,4 +23,12 @@ public interface AfterSaleLogService { | @@ -20,4 +23,12 @@ public interface AfterSaleLogService { | ||
| 20 | */ | 23 | */ |
| 21 | void createLog(TradeAfterSaleLogCreateReqDTO logDTO); | 24 | void createLog(TradeAfterSaleLogCreateReqDTO logDTO); |
| 22 | 25 | ||
| 26 | + /** | ||
| 27 | + * 获取售后日志 | ||
| 28 | + * | ||
| 29 | + * @param afterSaleId 售后 id | ||
| 30 | + * @return 售后日志 | ||
| 31 | + */ | ||
| 32 | + List<TradeAfterSaleLogRespDTO> getLog(Long afterSaleId); | ||
| 33 | + | ||
| 23 | } | 34 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleService.java
| @@ -43,6 +43,14 @@ public interface TradeAfterSaleService { | @@ -43,6 +43,14 @@ public interface TradeAfterSaleService { | ||
| 43 | TradeAfterSaleDO getAfterSale(Long userId, Long id); | 43 | TradeAfterSaleDO getAfterSale(Long userId, Long id); |
| 44 | 44 | ||
| 45 | /** | 45 | /** |
| 46 | + * 【管理员】获得售后单 | ||
| 47 | + * | ||
| 48 | + * @param id 售后编号 | ||
| 49 | + * @return 售后订单 | ||
| 50 | + */ | ||
| 51 | + TradeAfterSaleDO getAfterSale(Long id); | ||
| 52 | + | ||
| 53 | + /** | ||
| 46 | * 【会员】创建售后订单 | 54 | * 【会员】创建售后订单 |
| 47 | * | 55 | * |
| 48 | * @param userId 会员用户编号 | 56 | * @param userId 会员用户编号 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java
| @@ -26,6 +26,7 @@ import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleWayEnum; | @@ -26,6 +26,7 @@ import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleWayEnum; | ||
| 26 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum; | 26 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum; |
| 27 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; | 27 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; |
| 28 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO; | 28 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO; |
| 29 | +import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO; | ||
| 29 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService; | 30 | import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService; |
| 30 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; | 31 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; |
| 31 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; | 32 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; |
| @@ -40,6 +41,7 @@ import org.springframework.validation.annotation.Validated; | @@ -40,6 +41,7 @@ import org.springframework.validation.annotation.Validated; | ||
| 40 | 41 | ||
| 41 | import javax.annotation.Resource; | 42 | import javax.annotation.Resource; |
| 42 | import java.time.LocalDateTime; | 43 | import java.time.LocalDateTime; |
| 44 | +import java.util.List; | ||
| 43 | 45 | ||
| 44 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 46 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 45 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; | 47 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; |
| @@ -87,6 +89,15 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa | @@ -87,6 +89,15 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa | ||
| 87 | } | 89 | } |
| 88 | 90 | ||
| 89 | @Override | 91 | @Override |
| 92 | + public TradeAfterSaleDO getAfterSale(Long id) { | ||
| 93 | + TradeAfterSaleDO afterSale = tradeAfterSaleMapper.selectById(id); | ||
| 94 | + if (afterSale == null) { | ||
| 95 | + throw exception(AFTER_SALE_NOT_FOUND); | ||
| 96 | + } | ||
| 97 | + return afterSale; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @Override | ||
| 90 | @Transactional(rollbackFor = Exception.class) | 101 | @Transactional(rollbackFor = Exception.class) |
| 91 | public Long createAfterSale(Long userId, AppTradeAfterSaleCreateReqVO createReqVO) { | 102 | public Long createAfterSale(Long userId, AppTradeAfterSaleCreateReqVO createReqVO) { |
| 92 | // 第一步,前置校验 | 103 | // 第一步,前置校验 |
| @@ -439,4 +450,11 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa | @@ -439,4 +450,11 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa | ||
| 439 | log.error("[createLog][request({}) 日志记录错误]", toJsonString(logDTO), exception); | 450 | log.error("[createLog][request({}) 日志记录错误]", toJsonString(logDTO), exception); |
| 440 | } | 451 | } |
| 441 | } | 452 | } |
| 453 | + | ||
| 454 | + @Override | ||
| 455 | + public List<TradeAfterSaleLogRespDTO> getLog(Long afterSaleId) { | ||
| 456 | + // TODO 不熟悉流程先这么滴 | ||
| 457 | + List<TradeAfterSaleLogDO> saleLogDOs = tradeAfterSaleLogMapper.selectList(TradeAfterSaleLogDO::getAfterSaleId, afterSaleId); | ||
| 458 | + return TradeAfterSaleConvert.INSTANCE.convertList(saleLogDOs); | ||
| 459 | + } | ||
| 442 | } | 460 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java
| @@ -414,7 +414,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -414,7 +414,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 414 | // TODO @puhui999:只有选择快递的,才可以发货 | 414 | // TODO @puhui999:只有选择快递的,才可以发货 |
| 415 | // 1.1 校验并获得交易订单(可发货) | 415 | // 1.1 校验并获得交易订单(可发货) |
| 416 | TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId()); | 416 | TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId()); |
| 417 | - | 417 | + // 校验 deliveryType 是否为快递,是快递才可以发货 |
| 418 | + if (ObjectUtil.notEqual(order.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getMode())) { | ||
| 419 | + throw exception(ORDER_DELIVERY_FAIL_DELIVERY_TYPE_NOT_EXPRESS); | ||
| 420 | + } | ||
| 418 | // TODO @puhui999:下面不修改 deliveryType,直接校验 deliveryType 是否为快递,是快递才可以发货;先做严格的方式哈。 | 421 | // TODO @puhui999:下面不修改 deliveryType,直接校验 deliveryType 是否为快递,是快递才可以发货;先做严格的方式哈。 |
| 419 | // 判断发货类型 | 422 | // 判断发货类型 |
| 420 | TradeOrderDO updateOrderObj = new TradeOrderDO(); | 423 | TradeOrderDO updateOrderObj = new TradeOrderDO(); |
| @@ -428,10 +431,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -428,10 +431,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 428 | if (deliveryExpress.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) { | 431 | if (deliveryExpress.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) { |
| 429 | throw exception(EXPRESS_STATUS_NOT_ENABLE); | 432 | throw exception(EXPRESS_STATUS_NOT_ENABLE); |
| 430 | } | 433 | } |
| 431 | - updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()).setDeliveryType(DeliveryTypeEnum.EXPRESS.getMode()); | 434 | + updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()); |
| 432 | } else { | 435 | } else { |
| 433 | // 2.2 无需发货 | 436 | // 2.2 无需发货 |
| 434 | - updateOrderObj.setLogisticsId(0L).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode()); | 437 | + updateOrderObj.setLogisticsId(0L).setLogisticsNo(""); |
| 435 | } | 438 | } |
| 436 | // 更新 TradeOrderDO 状态为已发货,等待收货 | 439 | // 更新 TradeOrderDO 状态为已发货,等待收货 |
| 437 | updateOrderObj.setStatus(TradeOrderStatusEnum.DELIVERED.getStatus()).setDeliveryTime(LocalDateTime.now()); | 440 | updateOrderObj.setStatus(TradeOrderStatusEnum.DELIVERED.getStatus()).setDeliveryTime(LocalDateTime.now()); |
| @@ -471,16 +474,14 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -471,16 +474,14 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 471 | // 订单类型:拼团 | 474 | // 订单类型:拼团 |
| 472 | if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { | 475 | if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { |
| 473 | // 校验订单拼团是否成功 | 476 | // 校验订单拼团是否成功 |
| 474 | - // TODO @puhui999:是不是取反? | ||
| 475 | - if (combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) { | 477 | + if (!combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) { |
| 476 | throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS); | 478 | throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS); |
| 477 | } | 479 | } |
| 478 | } | 480 | } |
| 479 | // 订单类类型:砍价 | 481 | // 订单类类型:砍价 |
| 480 | if (Objects.equals(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) { | 482 | if (Objects.equals(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) { |
| 481 | // 校验订单砍价是否成功 | 483 | // 校验订单砍价是否成功 |
| 482 | - // TODO @puhui999:是不是取反? | ||
| 483 | - if (bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) { | 484 | + if (!bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) { |
| 484 | throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS); | 485 | throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS); |
| 485 | } | 486 | } |
| 486 | } | 487 | } |
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletTransactionQueryTypeEnum.java deleted
| 1 | -package cn.iocoder.yudao.module.pay.enums.member; | ||
| 2 | - | ||
| 3 | -import cn.hutool.core.util.ArrayUtil; | ||
| 4 | -import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||
| 5 | -import lombok.AllArgsConstructor; | ||
| 6 | -import lombok.Getter; | ||
| 7 | - | ||
| 8 | -import java.util.Arrays; | ||
| 9 | - | ||
| 10 | -// TODO @jason:可以简化,直接 PageVO 定义两个 Integer; | ||
| 11 | -/** | ||
| 12 | - * 钱包流水查询类型 | ||
| 13 | - * | ||
| 14 | - * @author jason | ||
| 15 | - */ | ||
| 16 | -@AllArgsConstructor | ||
| 17 | -@Getter | ||
| 18 | -public enum WalletTransactionQueryTypeEnum implements IntArrayValuable { | ||
| 19 | - | ||
| 20 | - RECHARGE(1, "充值"), | ||
| 21 | - EXPENSE(2, "消费"); | ||
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 类型 | ||
| 25 | - */ | ||
| 26 | - private final Integer type; | ||
| 27 | - /** | ||
| 28 | - * 描述 | ||
| 29 | - */ | ||
| 30 | - private final String description; | ||
| 31 | - | ||
| 32 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(WalletTransactionQueryTypeEnum::getType).toArray(); | ||
| 33 | - | ||
| 34 | - @Override | ||
| 35 | - public int[] array() { | ||
| 36 | - return ARRAYS; | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - public static WalletTransactionQueryTypeEnum valueOf(Integer type) { | ||
| 40 | - return ArrayUtil.firstMatch(o -> o.getType().equals(type), values()); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | -} |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java
| @@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet; | @@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletRespVO; | 5 | +import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; |
| 6 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO; | ||
| 6 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; | 7 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; |
| 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 8 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; | 9 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; |
| @@ -34,9 +35,10 @@ public class AppPayWalletController { | @@ -34,9 +35,10 @@ public class AppPayWalletController { | ||
| 34 | 35 | ||
| 35 | @GetMapping("/get") | 36 | @GetMapping("/get") |
| 36 | @Operation(summary = "获取钱包") | 37 | @Operation(summary = "获取钱包") |
| 38 | + @PreAuthenticated | ||
| 37 | public CommonResult<AppPayWalletRespVO> getPayWallet() { | 39 | public CommonResult<AppPayWalletRespVO> getPayWallet() { |
| 38 | - PayWalletDO payWallet = payWalletService.getPayWallet(getLoginUserId(), UserTypeEnum.MEMBER.getValue()); | ||
| 39 | - return success(PayWalletConvert.INSTANCE.convert(payWallet)); | 40 | + PayWalletDO wallet = payWalletService.getPayWallet(getLoginUserId(), UserTypeEnum.MEMBER.getValue()); |
| 41 | + return success(PayWalletConvert.INSTANCE.convert(wallet)); | ||
| 40 | } | 42 | } |
| 41 | 43 | ||
| 42 | } | 44 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletTransactionController.java
| @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet; | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet; | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionPageReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionRespVO; | 6 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; |
| 7 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO; | ||
| 8 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; | 8 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; |
| 9 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 9 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 10 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; | 10 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; |
| @@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController; | @@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController; | ||
| 19 | import javax.annotation.Resource; | 19 | import javax.annotation.Resource; |
| 20 | import javax.validation.Valid; | 20 | import javax.validation.Valid; |
| 21 | 21 | ||
| 22 | +import java.time.LocalDateTime; | ||
| 23 | + | ||
| 22 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 24 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 23 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 25 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 24 | 26 | ||
| @@ -33,11 +35,19 @@ public class AppPayWalletTransactionController { | @@ -33,11 +35,19 @@ public class AppPayWalletTransactionController { | ||
| 33 | private PayWalletTransactionService payWalletTransactionService; | 35 | private PayWalletTransactionService payWalletTransactionService; |
| 34 | 36 | ||
| 35 | @GetMapping("/page") | 37 | @GetMapping("/page") |
| 36 | - @Operation(summary = "获得钱包余额明细分页") | ||
| 37 | - public CommonResult<PageResult<AppPayWalletTransactionRespVO>> pageWalletTransaction( | ||
| 38 | - @Valid AppPayWalletTransactionPageReqVO pageVO) { | 38 | + @Operation(summary = "获得钱包流水分页") |
| 39 | + public CommonResult<PageResult<AppPayWalletTransactionRespVO>> getWalletTransactionPage( | ||
| 40 | + @Valid AppPayWalletTransactionPageReqVO pageReqVO) { | ||
| 41 | + if (true) { | ||
| 42 | + PageResult<AppPayWalletTransactionRespVO> result = new PageResult<>(10L); | ||
| 43 | + result.getList().add(new AppPayWalletTransactionRespVO().setPrice(1L) | ||
| 44 | + .setTitle("测试").setCreateTime(LocalDateTime.now())); | ||
| 45 | + result.getList().add(new AppPayWalletTransactionRespVO().setPrice(-1L) | ||
| 46 | + .setTitle("测试2").setCreateTime(LocalDateTime.now())); | ||
| 47 | + return success(result); | ||
| 48 | + } | ||
| 39 | PageResult<PayWalletTransactionDO> result = payWalletTransactionService.getWalletTransactionPage(getLoginUserId(), | 49 | PageResult<PayWalletTransactionDO> result = payWalletTransactionService.getWalletTransactionPage(getLoginUserId(), |
| 40 | - UserTypeEnum.MEMBER.getValue(), pageVO); | 50 | + UserTypeEnum.MEMBER.getValue(), pageReqVO); |
| 41 | return success(PayWalletTransactionConvert.INSTANCE.convertPage(result)); | 51 | return success(PayWalletTransactionConvert.INSTANCE.convertPage(result)); |
| 42 | } | 52 | } |
| 43 | } | 53 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletTransactionPageReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionPageReqVO.java
| 1 | -package cn.iocoder.yudao.module.pay.controller.app.wallet.vo; | 1 | +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | -import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 5 | -import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionQueryTypeEnum; | ||
| 6 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | import lombok.Data; | 5 | import lombok.Data; |
| 8 | 6 | ||
| @@ -10,8 +8,16 @@ import lombok.Data; | @@ -10,8 +8,16 @@ import lombok.Data; | ||
| 10 | @Data | 8 | @Data |
| 11 | public class AppPayWalletTransactionPageReqVO extends PageParam { | 9 | public class AppPayWalletTransactionPageReqVO extends PageParam { |
| 12 | 10 | ||
| 13 | - @Schema(description = "流水查询分类", example = "1") | ||
| 14 | - @InEnum(value = WalletTransactionQueryTypeEnum.class, message = "查询类型必须是 {value}") | 11 | + /** |
| 12 | + * 类型 - 收入 | ||
| 13 | + */ | ||
| 14 | + public static final Integer TYPE_INCOME = 1; | ||
| 15 | + /** | ||
| 16 | + * 类型 - 支出 | ||
| 17 | + */ | ||
| 18 | + public static final Integer TYPE_EXPENSE = 2; | ||
| 19 | + | ||
| 20 | + @Schema(description = "类型", example = "1") | ||
| 15 | private Integer type; | 21 | private Integer type; |
| 16 | 22 | ||
| 17 | } | 23 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletTransactionRespVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionRespVO.java
| 1 | -package cn.iocoder.yudao.module.pay.controller.app.wallet.vo; | 1 | +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| @@ -8,6 +8,7 @@ import java.time.LocalDateTime; | @@ -8,6 +8,7 @@ import java.time.LocalDateTime; | ||
| 8 | @Schema(description = "用户 APP - 钱包流水分页 Response VO") | 8 | @Schema(description = "用户 APP - 钱包流水分页 Response VO") |
| 9 | @Data | 9 | @Data |
| 10 | public class AppPayWalletTransactionRespVO { | 10 | public class AppPayWalletTransactionRespVO { |
| 11 | + | ||
| 11 | @Schema(description = "交易金额, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | 12 | @Schema(description = "交易金额, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| 12 | private Integer amount; | 13 | private Integer amount; |
| 13 | 14 | ||
| @@ -16,4 +17,14 @@ public class AppPayWalletTransactionRespVO { | @@ -16,4 +17,14 @@ public class AppPayWalletTransactionRespVO { | ||
| 16 | 17 | ||
| 17 | @Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | 18 | @Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| 18 | private LocalDateTime transactionTime; | 19 | private LocalDateTime transactionTime; |
| 20 | + | ||
| 21 | + @Schema(description = "交易金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | ||
| 22 | + private Long price; | ||
| 23 | + | ||
| 24 | + @Schema(description = "流水标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "土豆土豆") | ||
| 25 | + private String title; | ||
| 26 | + | ||
| 27 | + @Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 28 | + private LocalDateTime createTime; | ||
| 29 | + | ||
| 19 | } | 30 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletRespVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/wallet/AppPayWalletRespVO.java
| 1 | -package cn.iocoder.yudao.module.pay.controller.app.wallet.vo; | 1 | +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | -/** | ||
| 7 | - * @author jason | ||
| 8 | - */ | ||
| 9 | @Schema(description = "用户 APP - 获取用户钱包 Response VO") | 6 | @Schema(description = "用户 APP - 获取用户钱包 Response VO") |
| 10 | @Data | 7 | @Data |
| 11 | public class AppPayWalletRespVO { | 8 | public class AppPayWalletRespVO { |
| @@ -16,6 +13,7 @@ public class AppPayWalletRespVO { | @@ -16,6 +13,7 @@ public class AppPayWalletRespVO { | ||
| 16 | @Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") | 13 | @Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") |
| 17 | private Long totalExpense; | 14 | private Long totalExpense; |
| 18 | 15 | ||
| 19 | - @Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") | 16 | + @Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000") |
| 20 | private Long totalRecharge; | 17 | private Long totalRecharge; |
| 18 | + | ||
| 21 | } | 19 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java
| 1 | package cn.iocoder.yudao.module.pay.convert.wallet; | 1 | package cn.iocoder.yudao.module.pay.convert.wallet; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletRespVO; | 3 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO; |
| 4 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | 4 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 5 | import org.mapstruct.Mapper; | 5 | import org.mapstruct.Mapper; |
| 6 | import org.mapstruct.factory.Mappers; | 6 | import org.mapstruct.factory.Mappers; |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java
| 1 | package cn.iocoder.yudao.module.pay.convert.wallet; | 1 | package cn.iocoder.yudao.module.pay.convert.wallet; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionRespVO; | 4 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO; |
| 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 6 | import org.mapstruct.Mapper; | 6 | import org.mapstruct.Mapper; |
| 7 | import org.mapstruct.factory.Mappers; | 7 | import org.mapstruct.factory.Mappers; |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletTransactionDO.java
| @@ -48,6 +48,7 @@ public class PayWalletTransactionDO extends BaseDO { | @@ -48,6 +48,7 @@ public class PayWalletTransactionDO extends BaseDO { | ||
| 48 | */ | 48 | */ |
| 49 | private Long bizId; | 49 | private Long bizId; |
| 50 | 50 | ||
| 51 | + // TODO @jason:想了下,改成 title;流水标题;因为账户明细那,会看到这个; | ||
| 51 | /** | 52 | /** |
| 52 | * 附加说明 | 53 | * 附加说明 |
| 53 | */ | 54 | */ |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java
| @@ -9,7 +9,8 @@ import org.apache.ibatis.annotations.Mapper; | @@ -9,7 +9,8 @@ import org.apache.ibatis.annotations.Mapper; | ||
| 9 | public interface PayWalletMapper extends BaseMapperX<PayWalletDO> { | 9 | public interface PayWalletMapper extends BaseMapperX<PayWalletDO> { |
| 10 | 10 | ||
| 11 | default PayWalletDO selectByUserIdAndType(Long userId, Integer userType) { | 11 | default PayWalletDO selectByUserIdAndType(Long userId, Integer userType) { |
| 12 | - return selectOne(PayWalletDO::getUserId, userId, PayWalletDO::getUserType, userType); | 12 | + return selectOne(PayWalletDO::getUserId, userId, |
| 13 | + PayWalletDO::getUserType, userType); | ||
| 13 | } | 14 | } |
| 14 | } | 15 | } |
| 15 | 16 |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java
| 1 | package cn.iocoder.yudao.module.pay.dal.mysql.wallet; | 1 | package cn.iocoder.yudao.module.pay.dal.mysql.wallet; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 7 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; | ||
| 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 9 | -import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionQueryTypeEnum; | ||
| 10 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 11 | 10 | ||
| 11 | +import java.util.Objects; | ||
| 12 | + | ||
| 12 | @Mapper | 13 | @Mapper |
| 13 | public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> { | 14 | public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> { |
| 14 | 15 | ||
| 15 | - default PageResult<PayWalletTransactionDO> selectPageByWalletIdAndQueryType(Long walletId, | ||
| 16 | - WalletTransactionQueryTypeEnum queryType, | ||
| 17 | - PageParam pageParam) { | 16 | + default PageResult<PayWalletTransactionDO> selectPage(Long walletId, |
| 17 | + AppPayWalletTransactionPageReqVO pageReqVO) { | ||
| 18 | LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>() | 18 | LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>() |
| 19 | .eq(PayWalletTransactionDO::getWalletId, walletId); | 19 | .eq(PayWalletTransactionDO::getWalletId, walletId); |
| 20 | - if (WalletTransactionQueryTypeEnum.RECHARGE == queryType ) { | ||
| 21 | - query.ge(PayWalletTransactionDO::getAmount, 0); | ||
| 22 | - } | ||
| 23 | - if (WalletTransactionQueryTypeEnum.EXPENSE == queryType ) { | 20 | + if (Objects.equals(pageReqVO.getType(), AppPayWalletTransactionPageReqVO.TYPE_INCOME)) { |
| 21 | + query.gt(PayWalletTransactionDO::getAmount, 0); | ||
| 22 | + } else if (Objects.equals(pageReqVO.getType(), AppPayWalletTransactionPageReqVO.TYPE_EXPENSE)) { | ||
| 24 | query.lt(PayWalletTransactionDO::getAmount, 0); | 23 | query.lt(PayWalletTransactionDO::getAmount, 0); |
| 25 | } | 24 | } |
| 26 | query.orderByDesc(PayWalletTransactionDO::getId); | 25 | query.orderByDesc(PayWalletTransactionDO::getId); |
| 27 | - return selectPage(pageParam, query); | 26 | + return selectPage(pageReqVO, query); |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | default PayWalletTransactionDO selectByNo(String no) { | 29 | default PayWalletTransactionDO selectByNo(String no) { |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java
| 1 | package cn.iocoder.yudao.module.pay.service.wallet; | 1 | package cn.iocoder.yudao.module.pay.service.wallet; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionPageReqVO; | 4 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; |
| 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 6 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; | 6 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; |
| 7 | 7 |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java
| 1 | package cn.iocoder.yudao.module.pay.service.wallet; | 1 | package cn.iocoder.yudao.module.pay.service.wallet; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionPageReqVO; | 4 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; |
| 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 7 | import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletTransactionMapper; | 7 | import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletTransactionMapper; |
| 8 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; | 8 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; |
| 9 | -import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionQueryTypeEnum; | ||
| 10 | import lombok.extern.slf4j.Slf4j; | 9 | import lombok.extern.slf4j.Slf4j; |
| 11 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| 12 | 11 | ||
| @@ -35,12 +34,10 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ | @@ -35,12 +34,10 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ | ||
| 35 | AppPayWalletTransactionPageReqVO pageVO) { | 34 | AppPayWalletTransactionPageReqVO pageVO) { |
| 36 | PayWalletDO wallet = payWalletService.getPayWallet(userId, userType); | 35 | PayWalletDO wallet = payWalletService.getPayWallet(userId, userType); |
| 37 | if (wallet == null) { | 36 | if (wallet == null) { |
| 38 | - log.error("[pageWalletTransaction] 用户 {} 钱包不存在", userId); | 37 | + log.error("[getWalletTransactionPage][用户({}/{}) 钱包不存在", userId, userType); |
| 39 | throw exception(WALLET_NOT_FOUND); | 38 | throw exception(WALLET_NOT_FOUND); |
| 40 | } | 39 | } |
| 41 | - // TODO @jason:不用 WalletTransactionQueryTypeEnum.valueOf(pageVO.getType()) 哈,直接 pageVO 里面判断值比对就好啦; | ||
| 42 | - return payWalletTransactionMapper.selectPageByWalletIdAndQueryType(wallet.getId(), | ||
| 43 | - WalletTransactionQueryTypeEnum.valueOf(pageVO.getType()), pageVO); | 40 | + return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO); |
| 44 | } | 41 | } |
| 45 | 42 | ||
| 46 | @Override | 43 | @Override |