Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product

This commit is contained in:
jason 2023-08-29 15:29:02 +08:00
commit 278f2af8f8
27 changed files with 307 additions and 124 deletions

View File

@ -5,11 +5,11 @@ DROP TABLE IF EXISTS `pay_wallet`;
CREATE TABLE `pay_wallet` CREATE TABLE `pay_wallet`
( (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`user_id` bigint NOT NULL COMMENT '用户 id', `user_id` bigint NOT NULL COMMENT '用户编号',
`user_type` tinyint NOT NULL DEFAULT 0 COMMENT '用户类型', `user_type` tinyint NOT NULL DEFAULT 0 COMMENT '用户类型',
`balance` int NOT NULL DEFAULT 0 COMMENT '余额, 单位分', `balance` int NOT NULL DEFAULT 0 COMMENT '余额单位分',
`total_expense` bigint NOT NULL DEFAULT 0 COMMENT '累计支出, 单位分', `total_expense` bigint NOT NULL DEFAULT 0 COMMENT '累计支出单位分',
`total_recharge` bigint NOT NULL DEFAULT 0 COMMENT '累计充值, 单位分', `total_recharge` bigint NOT NULL DEFAULT 0 COMMENT '累计充值单位分',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
@ -41,4 +41,4 @@ CREATE TABLE `pay_wallet_transaction`
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='支付钱包余额明细表'; ) ENGINE=InnoDB COMMENT='支付钱包余额明细表';

View File

@ -32,6 +32,7 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_DELIVERY_FAIL_REFUND_STATUS_NOT_NONE = new ErrorCode(1011000021, "交易订单发货失败,订单已退款或部分退款"); ErrorCode ORDER_DELIVERY_FAIL_REFUND_STATUS_NOT_NONE = new ErrorCode(1011000021, "交易订单发货失败,订单已退款或部分退款");
ErrorCode ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000022, "交易订单发货失败,拼团未成功"); ErrorCode ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000022, "交易订单发货失败,拼团未成功");
ErrorCode ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000023, "交易订单发货失败,砍价未成功"); ErrorCode ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000023, "交易订单发货失败,砍价未成功");
ErrorCode ORDER_DELIVERY_FAIL_DELIVERY_TYPE_NOT_EXPRESS = new ErrorCode(1011000024, "交易订单发货失败,发货类型不是快递");
// ========== After Sale 模块 1011000100 ========== // ========== After Sale 模块 1011000100 ==========
ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1011000100, "售后单不存在"); ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1011000100, "售后单不存在");

View File

@ -7,13 +7,15 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi; import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO; import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO;
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDisagreeReqVO; import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.*;
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSalePageReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRefuseReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRespPageItemVO;
import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert; import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert;
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO; import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO;
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService;
import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService; import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService;
import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.annotation.security.PermitAll; import javax.annotation.security.PermitAll;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
import java.util.Map; import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -41,7 +44,10 @@ public class TradeAfterSaleController {
@Resource @Resource
private TradeAfterSaleService afterSaleService; private TradeAfterSaleService afterSaleService;
@Resource
private TradeOrderQueryService tradeOrderQueryService;
@Resource
private AfterSaleLogService afterSaleLogService;
@Resource @Resource
private MemberUserApi memberUserApi; private MemberUserApi memberUserApi;
@ -61,6 +67,24 @@ public class TradeAfterSaleController {
return success(TradeAfterSaleConvert.INSTANCE.convertPage(pageResult, memberUsers)); return success(TradeAfterSaleConvert.INSTANCE.convertPage(pageResult, memberUsers));
} }
@GetMapping("/get-detail")
@Operation(summary = "获得售后订单详情")
@Parameter(name = "id", description = "售后编号", required = true, example = "1")
@PreAuthorize("@ss.hasPermission('trade:after-sale:query')")
public CommonResult<TradeAfterSaleDetailRespVO> getOrderDetail(@RequestParam("id") Long id) {
// 查询订单
TradeAfterSaleDO afterSale = afterSaleService.getAfterSale(id);
// 查询订单
TradeOrderDO order = tradeOrderQueryService.getOrder(afterSale.getOrderId());
// 查询订单项
List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(id);
// 拼接数据
MemberUserRespDTO user = memberUserApi.getUser(afterSale.getUserId());
// 获取售后日志
List<TradeAfterSaleLogRespDTO> logs = afterSaleLogService.getLog(afterSale.getId());
return success(TradeAfterSaleConvert.INSTANCE.convert(afterSale, order, orderItems, user, logs));
}
@PutMapping("/agree") @PutMapping("/agree")
@Operation(summary = "同意售后") @Operation(summary = "同意售后")
@Parameter(name = "id", description = "售后编号", required = true, example = "1") @Parameter(name = "id", description = "售后编号", required = true, example = "1")
@ -88,7 +112,7 @@ public class TradeAfterSaleController {
} }
@PutMapping("/refuse") @PutMapping("/refuse")
@Operation(summary = "确认收货") @Operation(summary = "拒绝收货")
@Parameter(name = "id", description = "售后编号", required = true, example = "1") @Parameter(name = "id", description = "售后编号", required = true, example = "1")
@PreAuthorize("@ss.hasPermission('trade:after-sale:receive')") @PreAuthorize("@ss.hasPermission('trade:after-sale:receive')")
public CommonResult<Boolean> refuseAfterSale(TradeAfterSaleRefuseReqVO refuseReqVO) { public CommonResult<Boolean> refuseAfterSale(TradeAfterSaleRefuseReqVO refuseReqVO) {

View File

@ -0,0 +1,53 @@
package cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo;
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderBaseVO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderItemBaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Schema(description = "管理后台 - 售后订单的详情 Response VO")
@Data
public class TradeAfterSaleDetailRespVO extends TradeAfterSaleBaseVO {
@Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "售后编号不能为空")
private Long id;
/**
* 订单项列表
*/
private List<Item> items;
/**
* 订单基本信息
*/
private TradeOrderBaseVO order;
/**
* 用户信息
*/
private MemberUserRespVO user;
/**
* 售后日志
*/
private List<TradeAfterSaleLogRespVO> afterSaleLog;
@Schema(description = "管理后台 - 交易订单的详情的订单项目")
@Data
public static class Item extends TradeOrderItemBaseVO {
/**
* 属性数组
*/
private List<ProductPropertyValueDetailRespVO> properties;
}
}

View File

@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.trade.controller.admin.delivery;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.*; import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.*;
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert; import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO; import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
@ -64,10 +66,13 @@ public class DeliveryPickUpStoreController {
} }
@GetMapping("/list-all-simple") @GetMapping("/list-all-simple")
@Operation(summary = "取快递公司精简信息列表") @Operation(summary = "得自提门店精简信息列表")
public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() { public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() {
List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus()); List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list)); return success(CollectionUtils.convertList(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list), item -> {
item.setAreaName(AreaUtils.format(item.getAreaId()));
return item;
}));
} }
@GetMapping("/list") @GetMapping("/list")

View File

@ -23,7 +23,8 @@ public class DeliveryPickUpStoreSimpleRespVO {
@Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733") @Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733")
private Integer areaId; private Integer areaId;
// TODO @puhui999要把 areaName 也返回哈 @Schema(description = "区域名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "xx市")
private String areaName;
@Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号") @Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号")
private String detailAddress; private String detailAddress;

View File

@ -85,8 +85,7 @@ public class TradeOrderController {
tradeOrderQueryService.getExpressTrackList(id, getLoginUserId()))); tradeOrderQueryService.getExpressTrackList(id, getLoginUserId())));
} }
// TODO @puhui999put 请求哈 @PutMapping("/delivery")
@PostMapping("/delivery")
@Operation(summary = "订单发货") @Operation(summary = "订单发货")
@PreAuthorize("@ss.hasPermission('trade:order:update')") @PreAuthorize("@ss.hasPermission('trade:order:update')")
public CommonResult<Boolean> deliveryOrder(@RequestBody TradeOrderDeliveryReqVO deliveryReqVO) { public CommonResult<Boolean> deliveryOrder(@RequestBody TradeOrderDeliveryReqVO deliveryReqVO) {
@ -94,8 +93,7 @@ public class TradeOrderController {
return success(true); return success(true);
} }
// TODO @puhui999put 请求哈update-remark @PutMapping("/update-remark")
@PostMapping("/remark")
@Operation(summary = "订单备注") @Operation(summary = "订单备注")
@PreAuthorize("@ss.hasPermission('trade:order:update')") @PreAuthorize("@ss.hasPermission('trade:order:update')")
public CommonResult<Boolean> updateOrderRemark(@RequestBody TradeOrderRemarkReqVO reqVO) { public CommonResult<Boolean> updateOrderRemark(@RequestBody TradeOrderRemarkReqVO reqVO) {
@ -103,8 +101,7 @@ public class TradeOrderController {
return success(true); return success(true);
} }
// TODO @puhui999put 请求哈update-price @PutMapping("/update-price")
@PostMapping("/adjust-price")
@Operation(summary = "订单调价") @Operation(summary = "订单调价")
@PreAuthorize("@ss.hasPermission('trade:order:update')") @PreAuthorize("@ss.hasPermission('trade:order:update')")
public CommonResult<Boolean> updateOrderPrice(@RequestBody TradeOrderUpdatePriceReqVO reqVO) { public CommonResult<Boolean> updateOrderPrice(@RequestBody TradeOrderUpdatePriceReqVO reqVO) {
@ -112,8 +109,7 @@ public class TradeOrderController {
return success(true); return success(true);
} }
// TODO @puhui999put 请求哈update-address @PutMapping("/update-address")
@PostMapping("/adjust-address")
@Operation(summary = "修改订单收货地址") @Operation(summary = "修改订单收货地址")
@PreAuthorize("@ss.hasPermission('trade:order:update')") @PreAuthorize("@ss.hasPermission('trade:order:update')")
public CommonResult<Boolean> updateOrderAddress(@RequestBody TradeOrderUpdateAddressReqVO reqVO) { public CommonResult<Boolean> updateOrderAddress(@RequestBody TradeOrderUpdateAddressReqVO reqVO) {

View File

@ -4,19 +4,26 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO; import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDetailRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRespPageItemVO; import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRespPageItemVO;
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO; import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO; import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderBaseVO;
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleCreateReqVO; import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleRespVO; import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleRespVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO; import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleLogDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO;
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.List;
import java.util.Map; import java.util.Map;
@Mapper @Mapper
@ -61,4 +68,22 @@ public interface TradeAfterSaleConvert {
PageResult<AppTradeAfterSaleRespVO> convertPage02(PageResult<TradeAfterSaleDO> page); PageResult<AppTradeAfterSaleRespVO> convertPage02(PageResult<TradeAfterSaleDO> page);
List<TradeAfterSaleLogRespDTO> convertList(List<TradeAfterSaleLogDO> list);
List<TradeAfterSaleLogRespVO> convertList1(List<TradeAfterSaleLogRespDTO> list);
TradeOrderBaseVO convert(TradeOrderDO order);
@Mapping(target = "id", source = "afterSale.id")
TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List<TradeOrderItemDO> orderItems, List<TradeAfterSaleLogRespVO> logs);
default TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, TradeOrderDO order, List<TradeOrderItemDO> orderItems,
MemberUserRespDTO user, List<TradeAfterSaleLogRespDTO> logs) {
TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems, convertList1(logs));
// 处理用户信息
respVO.setUser(convert(user));
// 处理订单信息
respVO.setOrder(convert(order));
return respVO;
}
} }

View File

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* 贸易售后日志详情 DTO
*
* @author HUIHUI
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TradeAfterSaleLogRespDTO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20669")
private Long id;
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22634")
@NotNull(message = "用户编号不能为空")
private Long userId;
@Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "用户类型不能为空")
private Integer userType;
@Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3023")
@NotNull(message = "售后编号不能为空")
private Long afterSaleId;
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25870")
@NotNull(message = "订单编号不能为空")
private Long orderId;
@Schema(description = "订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23154")
@NotNull(message = "订单项编号不能为空")
private Long orderItemId;
@Schema(description = "售后状态(之前)", example = "2")
private Integer beforeStatus;
@Schema(description = "售后状态(之后)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "售后状态(之后)不能为空")
private Integer afterStatus;
@Schema(description = "操作明细", requiredMode = Schema.RequiredMode.REQUIRED, example = "维权完成退款金额¥37776.00")
@NotNull(message = "操作明细不能为空")
private String content;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

View File

@ -2,6 +2,9 @@ package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service;
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO; import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO;
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO;
import java.util.List;
/** /**
* 交易售后日志 Service 接口 * 交易售后日志 Service 接口
@ -20,4 +23,12 @@ public interface AfterSaleLogService {
*/ */
void createLog(TradeAfterSaleLogCreateReqDTO logDTO); void createLog(TradeAfterSaleLogCreateReqDTO logDTO);
/**
* 获取售后日志
*
* @param afterSaleId 售后 id
* @return 售后日志
*/
List<TradeAfterSaleLogRespDTO> getLog(Long afterSaleId);
} }

View File

@ -42,6 +42,14 @@ public interface TradeAfterSaleService {
*/ */
TradeAfterSaleDO getAfterSale(Long userId, Long id); TradeAfterSaleDO getAfterSale(Long userId, Long id);
/**
* 管理员获得售后单
*
* @param id 售后编号
* @return 售后订单
*/
TradeAfterSaleDO getAfterSale(Long id);
/** /**
* 会员创建售后订单 * 会员创建售后订单
* *

View File

@ -26,6 +26,7 @@ import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleWayEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum; import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO; import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogCreateReqDTO;
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.dto.TradeAfterSaleLogRespDTO;
import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService; import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService;
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService; import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService;
@ -40,6 +41,7 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
@ -86,6 +88,15 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa
return tradeAfterSaleMapper.selectByIdAndUserId(id, userId); return tradeAfterSaleMapper.selectByIdAndUserId(id, userId);
} }
@Override
public TradeAfterSaleDO getAfterSale(Long id) {
TradeAfterSaleDO afterSale = tradeAfterSaleMapper.selectById(id);
if (afterSale == null) {
throw exception(AFTER_SALE_NOT_FOUND);
}
return afterSale;
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long createAfterSale(Long userId, AppTradeAfterSaleCreateReqVO createReqVO) { public Long createAfterSale(Long userId, AppTradeAfterSaleCreateReqVO createReqVO) {
@ -439,4 +450,11 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa
log.error("[createLog][request({}) 日志记录错误]", toJsonString(logDTO), exception); log.error("[createLog][request({}) 日志记录错误]", toJsonString(logDTO), exception);
} }
} }
@Override
public List<TradeAfterSaleLogRespDTO> getLog(Long afterSaleId) {
// TODO 不熟悉流程先这么滴
List<TradeAfterSaleLogDO> saleLogDOs = tradeAfterSaleLogMapper.selectList(TradeAfterSaleLogDO::getAfterSaleId, afterSaleId);
return TradeAfterSaleConvert.INSTANCE.convertList(saleLogDOs);
}
} }

View File

@ -414,7 +414,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
// TODO @puhui999只有选择快递的才可以发货 // TODO @puhui999只有选择快递的才可以发货
// 1.1 校验并获得交易订单可发货 // 1.1 校验并获得交易订单可发货
TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId()); TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
// 校验 deliveryType 是否为快递是快递才可以发货
if (ObjectUtil.notEqual(order.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getMode())) {
throw exception(ORDER_DELIVERY_FAIL_DELIVERY_TYPE_NOT_EXPRESS);
}
// TODO @puhui999下面不修改 deliveryType直接校验 deliveryType 是否为快递是快递才可以发货先做严格的方式哈 // TODO @puhui999下面不修改 deliveryType直接校验 deliveryType 是否为快递是快递才可以发货先做严格的方式哈
// 判断发货类型 // 判断发货类型
TradeOrderDO updateOrderObj = new TradeOrderDO(); TradeOrderDO updateOrderObj = new TradeOrderDO();
@ -428,10 +431,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
if (deliveryExpress.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) { if (deliveryExpress.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) {
throw exception(EXPRESS_STATUS_NOT_ENABLE); throw exception(EXPRESS_STATUS_NOT_ENABLE);
} }
updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()).setDeliveryType(DeliveryTypeEnum.EXPRESS.getMode()); updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo());
} else { } else {
// 2.2 无需发货 // 2.2 无需发货
updateOrderObj.setLogisticsId(0L).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode()); updateOrderObj.setLogisticsId(0L).setLogisticsNo("");
} }
// 更新 TradeOrderDO 状态为已发货等待收货 // 更新 TradeOrderDO 状态为已发货等待收货
updateOrderObj.setStatus(TradeOrderStatusEnum.DELIVERED.getStatus()).setDeliveryTime(LocalDateTime.now()); updateOrderObj.setStatus(TradeOrderStatusEnum.DELIVERED.getStatus()).setDeliveryTime(LocalDateTime.now());
@ -471,16 +474,14 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
// 订单类型拼团 // 订单类型拼团
if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) {
// 校验订单拼团是否成功 // 校验订单拼团是否成功
// TODO @puhui999是不是取反 if (!combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) {
if (combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) {
throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS); throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS);
} }
} }
// 订单类类型砍价 // 订单类类型砍价
if (Objects.equals(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) { if (Objects.equals(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) {
// 校验订单砍价是否成功 // 校验订单砍价是否成功
// TODO @puhui999是不是取反 if (!bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) {
if (bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) {
throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS); throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS);
} }
} }

View File

@ -1,43 +0,0 @@
package cn.iocoder.yudao.module.pay.enums.member;
import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
// TODO @jason可以简化直接 PageVO 定义两个 Integer
/**
* 钱包流水查询类型
*
* @author jason
*/
@AllArgsConstructor
@Getter
public enum WalletTransactionQueryTypeEnum implements IntArrayValuable {
RECHARGE(1, "充值"),
EXPENSE(2, "消费");
/**
* 类型
*/
private final Integer type;
/**
* 描述
*/
private final String description;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(WalletTransactionQueryTypeEnum::getType).toArray();
@Override
public int[] array() {
return ARRAYS;
}
public static WalletTransactionQueryTypeEnum valueOf(Integer type) {
return ArrayUtil.firstMatch(o -> o.getType().equals(type), values());
}
}

View File

@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletRespVO; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO;
import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
@ -34,9 +35,10 @@ public class AppPayWalletController {
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获取钱包") @Operation(summary = "获取钱包")
@PreAuthenticated
public CommonResult<AppPayWalletRespVO> getPayWallet() { public CommonResult<AppPayWalletRespVO> getPayWallet() {
PayWalletDO payWallet = payWalletService.getPayWallet(getLoginUserId(), UserTypeEnum.MEMBER.getValue()); PayWalletDO wallet = payWalletService.getPayWallet(getLoginUserId(), UserTypeEnum.MEMBER.getValue());
return success(PayWalletConvert.INSTANCE.convert(payWallet)); return success(PayWalletConvert.INSTANCE.convert(wallet));
} }
} }

View File

@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO;
import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService;
@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@ -33,11 +35,19 @@ public class AppPayWalletTransactionController {
private PayWalletTransactionService payWalletTransactionService; private PayWalletTransactionService payWalletTransactionService;
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得钱包余额明细分页") @Operation(summary = "获得钱包流水分页")
public CommonResult<PageResult<AppPayWalletTransactionRespVO>> pageWalletTransaction( public CommonResult<PageResult<AppPayWalletTransactionRespVO>> getWalletTransactionPage(
@Valid AppPayWalletTransactionPageReqVO pageVO) { @Valid AppPayWalletTransactionPageReqVO pageReqVO) {
if (true) {
PageResult<AppPayWalletTransactionRespVO> result = new PageResult<>(10L);
result.getList().add(new AppPayWalletTransactionRespVO().setPrice(1L)
.setTitle("测试").setCreateTime(LocalDateTime.now()));
result.getList().add(new AppPayWalletTransactionRespVO().setPrice(-1L)
.setTitle("测试2").setCreateTime(LocalDateTime.now()));
return success(result);
}
PageResult<PayWalletTransactionDO> result = payWalletTransactionService.getWalletTransactionPage(getLoginUserId(), PageResult<PayWalletTransactionDO> result = payWalletTransactionService.getWalletTransactionPage(getLoginUserId(),
UserTypeEnum.MEMBER.getValue(), pageVO); UserTypeEnum.MEMBER.getValue(), pageReqVO);
return success(PayWalletTransactionConvert.INSTANCE.convertPage(result)); return success(PayWalletTransactionConvert.INSTANCE.convertPage(result));
} }
} }

View File

@ -1,17 +0,0 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionQueryTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "用户 APP - 钱包流水分页 Request VO")
@Data
public class AppPayWalletTransactionPageReqVO extends PageParam {
@Schema(description = "流水查询分类", example = "1")
@InEnum(value = WalletTransactionQueryTypeEnum.class, message = "查询类型必须是 {value}")
private Integer type;
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "用户 APP - 钱包流水分页 Request VO")
@Data
public class AppPayWalletTransactionPageReqVO extends PageParam {
/**
* 类型 - 收入
*/
public static final Integer TYPE_INCOME = 1;
/**
* 类型 - 支出
*/
public static final Integer TYPE_EXPENSE = 2;
@Schema(description = "类型", example = "1")
private Integer type;
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet.vo; package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -8,6 +8,7 @@ import java.time.LocalDateTime;
@Schema(description = "用户 APP - 钱包流水分页 Response VO") @Schema(description = "用户 APP - 钱包流水分页 Response VO")
@Data @Data
public class AppPayWalletTransactionRespVO { public class AppPayWalletTransactionRespVO {
@Schema(description = "交易金额, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") @Schema(description = "交易金额, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Integer amount; private Integer amount;
@ -16,4 +17,14 @@ public class AppPayWalletTransactionRespVO {
@Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") @Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private LocalDateTime transactionTime; private LocalDateTime transactionTime;
@Schema(description = "交易金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Long price;
@Schema(description = "流水标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "土豆土豆")
private String title;
@Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
} }

View File

@ -1,11 +1,8 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet.vo; package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
/**
* @author jason
*/
@Schema(description = "用户 APP - 获取用户钱包 Response VO") @Schema(description = "用户 APP - 获取用户钱包 Response VO")
@Data @Data
public class AppPayWalletRespVO { public class AppPayWalletRespVO {
@ -16,6 +13,7 @@ public class AppPayWalletRespVO {
@Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") @Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
private Long totalExpense; private Long totalExpense;
@Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") @Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
private Long totalRecharge; private Long totalRecharge;
} }

View File

@ -1,6 +1,6 @@
package cn.iocoder.yudao.module.pay.convert.wallet; package cn.iocoder.yudao.module.pay.convert.wallet;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.pay.convert.wallet; package cn.iocoder.yudao.module.pay.convert.wallet;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;

View File

@ -48,6 +48,7 @@ public class PayWalletTransactionDO extends BaseDO {
*/ */
private Long bizId; private Long bizId;
// TODO @jason想了下改成 title流水标题因为账户明细那会看到这个
/** /**
* 附加说明 * 附加说明
*/ */

View File

@ -9,7 +9,8 @@ import org.apache.ibatis.annotations.Mapper;
public interface PayWalletMapper extends BaseMapperX<PayWalletDO> { public interface PayWalletMapper extends BaseMapperX<PayWalletDO> {
default PayWalletDO selectByUserIdAndType(Long userId, Integer userType) { default PayWalletDO selectByUserIdAndType(Long userId, Integer userType) {
return selectOne(PayWalletDO::getUserId, userId, PayWalletDO::getUserType, userType); return selectOne(PayWalletDO::getUserId, userId,
PayWalletDO::getUserType, userType);
} }
} }

View File

@ -1,30 +1,29 @@
package cn.iocoder.yudao.module.pay.dal.mysql.wallet; package cn.iocoder.yudao.module.pay.dal.mysql.wallet;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionQueryTypeEnum;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.Objects;
@Mapper @Mapper
public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> { public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> {
default PageResult<PayWalletTransactionDO> selectPageByWalletIdAndQueryType(Long walletId, default PageResult<PayWalletTransactionDO> selectPage(Long walletId,
WalletTransactionQueryTypeEnum queryType, AppPayWalletTransactionPageReqVO pageReqVO) {
PageParam pageParam) {
LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>() LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>()
.eq(PayWalletTransactionDO::getWalletId, walletId); .eq(PayWalletTransactionDO::getWalletId, walletId);
if (WalletTransactionQueryTypeEnum.RECHARGE == queryType ) { if (Objects.equals(pageReqVO.getType(), AppPayWalletTransactionPageReqVO.TYPE_INCOME)) {
query.ge(PayWalletTransactionDO::getAmount, 0); query.gt(PayWalletTransactionDO::getAmount, 0);
} } else if (Objects.equals(pageReqVO.getType(), AppPayWalletTransactionPageReqVO.TYPE_EXPENSE)) {
if (WalletTransactionQueryTypeEnum.EXPENSE == queryType ) {
query.lt(PayWalletTransactionDO::getAmount, 0); query.lt(PayWalletTransactionDO::getAmount, 0);
} }
query.orderByDesc(PayWalletTransactionDO::getId); query.orderByDesc(PayWalletTransactionDO::getId);
return selectPage(pageParam, query); return selectPage(pageReqVO, query);
} }
default PayWalletTransactionDO selectByNo(String no) { default PayWalletTransactionDO selectByNo(String no) {

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.pay.service.wallet; package cn.iocoder.yudao.module.pay.service.wallet;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum;

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.pay.service.wallet; package cn.iocoder.yudao.module.pay.service.wallet;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletTransactionMapper; import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletTransactionMapper;
import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum;
import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionQueryTypeEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -35,12 +34,10 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ
AppPayWalletTransactionPageReqVO pageVO) { AppPayWalletTransactionPageReqVO pageVO) {
PayWalletDO wallet = payWalletService.getPayWallet(userId, userType); PayWalletDO wallet = payWalletService.getPayWallet(userId, userType);
if (wallet == null) { if (wallet == null) {
log.error("[pageWalletTransaction] 用户 {} 钱包不存在", userId); log.error("[getWalletTransactionPage][用户({}/{}) 钱包不存在", userId, userType);
throw exception(WALLET_NOT_FOUND); throw exception(WALLET_NOT_FOUND);
} }
// TODO @jason不用 WalletTransactionQueryTypeEnum.valueOf(pageVO.getType()) 直接 pageVO 里面判断值比对就好啦 return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO);
return payWalletTransactionMapper.selectPageByWalletIdAndQueryType(wallet.getId(),
WalletTransactionQueryTypeEnum.valueOf(pageVO.getType()), pageVO);
} }
@Override @Override