From c2931dfdb47b766ea117f711913d4993c818dd6d Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期六, 15 六月 2024 15:50:47 +0800 Subject: [PATCH] 提交【管理后台】订单管理-售后管理相关接口 --- ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtOrderVO.java | 3 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderReturnRequestMapper.java | 9 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CustomConfigController.java | 11 + ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderReturnRequestService.java | 27 ++ ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderController.java | 4 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ICustomConfigService.java | 3 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderReturnRequestQuery.java | 49 ++++ ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/Order.java | 4 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtReturnRequestAuditDTO.java | 26 ++ ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 79 +++++-- ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderQuery.java | 10 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CustomConfigServiceImpl.java | 24 ++ ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/AgreementController.java | 6 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderReturnRequestServiceImpl.java | 196 +++++++++++++++++ ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/enums/OrderTypeEnum.java | 39 +++ ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderReturnRequestController.java | 60 +++++ ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtOrderReturnRequestVO.java | 51 ++++ ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderService.java | 4 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtAfterSaleSettingDTO.java | 35 +++ ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/OrderReturnRequest.java | 3 20 files changed, 600 insertions(+), 43 deletions(-) diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/Order.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/Order.java index 3ac0ddf..3148705 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/Order.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/Order.java @@ -149,5 +149,7 @@ @ApiModelProperty(value = "实际商品价格") private BigDecimal sjPrice; - + + @ApiModelProperty("拍卖会id") + private Long auctionSalesroomId; } diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/enums/OrderTypeEnum.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/enums/OrderTypeEnum.java new file mode 100644 index 0000000..b292a54 --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/enums/OrderTypeEnum.java @@ -0,0 +1,39 @@ +package com.ruoyi.common.core.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.AllArgsConstructor; +import lombok.Getter; + + +@Getter +@AllArgsConstructor +public enum OrderTypeEnum { + + /* 拍卖类型 1=商城订单 1=拍卖订单*/ + + MALL_ODER(1, "商城订单"), + AUCTION_ORDER(2, "拍卖订单"); + @EnumValue + private final int code; + @JsonValue + private final String desc; + + + /** + * 通过code获取枚举 + * + * @param code + * @return + */ + public static OrderTypeEnum fromCode(Integer code) { + OrderTypeEnum[] resultTypes = OrderTypeEnum.values(); + for (OrderTypeEnum resultType : resultTypes) { + if (code.equals(resultType.getCode())) { + return resultType; + } + } + return null; + } + +} diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderController.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderController.java index 50274c5..fa549f4 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderController.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderController.java @@ -3,8 +3,8 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.page.PageDTO; -import com.ruoyi.order.controller.management.dto.MgtMallOrderQuery; import com.ruoyi.order.controller.management.dto.MgtOrderConfirmShipmentDTO; +import com.ruoyi.order.controller.management.dto.MgtOrderQuery; import com.ruoyi.order.controller.management.vo.MgtOrderVO; import com.ruoyi.order.service.IOrderService; import io.swagger.annotations.Api; @@ -48,7 +48,7 @@ @ApiOperation("订单分页列表") @PostMapping("/page") public R<PageDTO<MgtOrderVO>> getOrderPage( - @Validated @RequestBody MgtMallOrderQuery query) { + @Validated @RequestBody MgtOrderQuery query) { return R.ok(orderService.getOrderPage(query)); } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderReturnRequestController.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderReturnRequestController.java index 42cc815..6f0a502 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderReturnRequestController.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderReturnRequestController.java @@ -1,8 +1,21 @@ package com.ruoyi.order.controller.management; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.page.PageDTO; +import com.ruoyi.order.controller.management.dto.MgtOrderReturnRequestQuery; +import com.ruoyi.order.controller.management.dto.MgtReturnRequestAuditDTO; +import com.ruoyi.order.controller.management.vo.MgtOrderReturnRequestVO; +import com.ruoyi.order.service.IOrderReturnRequestService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -20,4 +33,51 @@ @Api(tags = {"管理后台-售后管理相关接口"}, value = "管理后台-售后管理相关接口") public class MgtOrderReturnRequestController { + private final IOrderReturnRequestService orderReturnRequestService; + + /** + * 获取售后管理列表分页数据 + * + * @param query 售后管理查询对象 + * @return PageDTO<MgtOrderReturnRequestVO> + */ + @ApiOperation("获取售后管理列表分页数据") + @PostMapping("/page") + public R<PageDTO<MgtOrderReturnRequestVO>> getOrderReturnRequestPage( + @Validated @RequestBody MgtOrderReturnRequestQuery query) { + return R.ok(orderReturnRequestService.getOrderReturnRequestPage(query)); + } + + /** + * 查看详情 + * + * @param id 售后id + * @return MgtOrderReturnRequestVO + */ + @ApiOperation("查看详情") + @PostMapping("/detail/{id}") + public R<MgtOrderReturnRequestVO> getOrderReturnRequestDetail( + @ApiParam(name = "id", value = "售后id", required = true) @PathVariable("id") Long id) { + return R.ok(orderReturnRequestService.getOrderReturnRequestDetail(id)); + } + + /** + * 审核 + * + * @param dto 管理后台-售后审核传输对象 + */ + @ApiOperation("审核") + @PutMapping("/audit") + public R<?> auditReturnRequest(@Validated @RequestBody MgtReturnRequestAuditDTO dto) { + orderReturnRequestService.auditReturnRequest(dto); + return R.ok(); + } + + @ApiOperation("确认收货") + @PutMapping("/confirm/{id}") + public R<?> confirmReturnRequest( + @ApiParam(name = "id", value = "售后id", required = true) @PathVariable("id") Long id) { + orderReturnRequestService.confirmReturnRequest(id); + return R.ok(); + } } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtMallOrderQuery.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderQuery.java similarity index 76% rename from ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtMallOrderQuery.java rename to ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderQuery.java index 01f2193..93a77b3 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtMallOrderQuery.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderQuery.java @@ -2,9 +2,11 @@ import com.ruoyi.common.core.enums.OrderFromEnum; import com.ruoyi.common.core.enums.OrderStatusEnum; +import com.ruoyi.common.core.enums.OrderTypeEnum; import com.ruoyi.common.core.web.page.BasePage; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; @@ -14,8 +16,8 @@ */ @Data @EqualsAndHashCode(callSuper = true) -@ApiModel(value = "商城订单查询对象") -public class MgtMallOrderQuery extends BasePage { +@ApiModel(value = "订单查询对象") +public class MgtOrderQuery extends BasePage { private static final long serialVersionUID = 7466073766154410614L; @@ -36,4 +38,8 @@ @ApiModelProperty(value = "订单状态 1=待支付 2=待发货 3=待收货 4=已完成 5=已取消,6 售后") private OrderStatusEnum orderStatus; + + @ApiModelProperty(value = "订单类型 1=商城订单 2=拍卖订单") + @NotNull(message = "订单类型不能为空") + private OrderTypeEnum queryType; } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderReturnRequestQuery.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderReturnRequestQuery.java new file mode 100644 index 0000000..6795410 --- /dev/null +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderReturnRequestQuery.java @@ -0,0 +1,49 @@ +package com.ruoyi.order.controller.management.dto; + +import com.ruoyi.common.core.enums.AuditStatusEnum; +import com.ruoyi.common.core.enums.OrderTypeEnum; +import com.ruoyi.common.core.enums.RequestTypeEnum; +import com.ruoyi.common.core.enums.ReturnRequestStatusEnum; +import com.ruoyi.common.core.web.page.BasePage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Set; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author mitao + * @date 2024/6/15 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "售后管理查询对象") +public class MgtOrderReturnRequestQuery extends BasePage { + + private static final long serialVersionUID = -2488762912713305360L; + + @ApiModelProperty(value = "订单编号") + private String orderNo; + + + @ApiModelProperty(value = "售后类型 1=退款 2=退款退货") + private RequestTypeEnum requestType; + + @ApiModelProperty(value = "会员姓名") + private String nickname; + + @ApiModelProperty("联系方式") + private String phone; + + @ApiModelProperty(value = "售后状态 1=待审核 2=待退货 3=待平台收货 4=已完成 5=已拒绝") + private ReturnRequestStatusEnum status; + + @ApiModelProperty(value = "审核状态 1=待审核 2=已通过 3=已拒绝") + private AuditStatusEnum auditStatus; + + @ApiModelProperty(value = "订单类型 1=商城订单 2=拍卖订单") + private OrderTypeEnum orderType; + + @ApiModelProperty(value = "会员id列表", hidden = true) + private Set<Long> memberIdSet; +} diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtReturnRequestAuditDTO.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtReturnRequestAuditDTO.java new file mode 100644 index 0000000..f809b19 --- /dev/null +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtReturnRequestAuditDTO.java @@ -0,0 +1,26 @@ +package com.ruoyi.order.controller.management.dto; + +import com.ruoyi.common.core.enums.AuditStatusEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +@Data +@ApiModel(value = "管理后台-售后审核传输对象", description = "管理后台-售后审核传输对象") +public class MgtReturnRequestAuditDTO implements Serializable { + + private static final long serialVersionUID = -8029337933255222034L; + + @ApiModelProperty(value = "售后id") + @NotNull(message = "售后id不能为空") + private Long id; + + @ApiModelProperty(value = "审核状态 已通过 已拒绝") + @NotNull(message = "审核状态不能为空") + private AuditStatusEnum auditStatus; + + @ApiModelProperty(value = "拒绝原因") + private String refuseComment; +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtOrderReturnRequestVO.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtOrderReturnRequestVO.java index ad911ad..5d5a0af 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtOrderReturnRequestVO.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtOrderReturnRequestVO.java @@ -1,11 +1,16 @@ package com.ruoyi.order.controller.management.vo; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.enums.AuditStatusEnum; +import com.ruoyi.common.core.enums.OrderTypeEnum; +import com.ruoyi.common.core.enums.PaymentMethodEnum; import com.ruoyi.common.core.enums.RequestTypeEnum; import com.ruoyi.common.core.enums.ReturnRequestStatusEnum; +import com.ruoyi.system.api.domain.vo.Express100VO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; import lombok.Data; @@ -58,6 +63,50 @@ @ApiModelProperty(value = "备注") private String remark; - @ApiModelProperty(value = "快递单号") + @ApiModelProperty(value = "退货快递单号") private String courierNumber; + + @ApiModelProperty(value = "订单编号") + private String orderNo; + + @ApiModelProperty(value = "下单时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime orderTime; + + @ApiModelProperty(value = "会员姓名") + private Long memberId; + + @ApiModelProperty(value = "会员姓名") + private String nickname; + + @ApiModelProperty("联系方式") + private String phone; + + @ApiModelProperty(value = "支付时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime payTime; + + @ApiModelProperty(value = "支付方式 1=微信 2=支付宝") + private PaymentMethodEnum paymentMethod; + + @ApiModelProperty(value = "商品价格") + private BigDecimal price; + + @ApiModelProperty(value = "积分") + private Integer points; + + @ApiModelProperty(value = "支付合计") + private BigDecimal totalAmount; + + @ApiModelProperty(value = "优惠金额") + private BigDecimal discountMoney; + + @ApiModelProperty(value = "订单类型 1=商城订单 2=拍卖订单") + private OrderTypeEnum orderType; + + @ApiModelProperty("发货快递") + private String logisticsNum; + + @ApiModelProperty("物流信息") + private Express100VO express100VO; } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtOrderVO.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtOrderVO.java index dafca6c..16319cd 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtOrderVO.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtOrderVO.java @@ -40,6 +40,9 @@ @ApiModelProperty(value = "所属拍卖场") private String salesroomName; + @ApiModelProperty("拍卖会id") + private Long auctionSalesroomId; + @ApiModelProperty(value = "保证金") private BigDecimal bound; diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/OrderReturnRequest.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/OrderReturnRequest.java index f8d4507..a1ba5bd 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/OrderReturnRequest.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/OrderReturnRequest.java @@ -97,5 +97,6 @@ @ApiModelProperty(value = "快递单号") private String courierNumber; - + @ApiModelProperty(value = "物流编码") + private String logisticsNum; } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderReturnRequestMapper.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderReturnRequestMapper.java index 01f5822..afd706d 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderReturnRequestMapper.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderReturnRequestMapper.java @@ -1,7 +1,11 @@ package com.ruoyi.order.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.order.controller.management.dto.MgtOrderReturnRequestQuery; +import com.ruoyi.order.controller.management.vo.MgtOrderReturnRequestVO; import com.ruoyi.order.domain.OrderReturnRequest; +import org.apache.ibatis.annotations.Param; /** * <p> @@ -13,4 +17,9 @@ */ public interface OrderReturnRequestMapper extends BaseMapper<OrderReturnRequest> { + Page<MgtOrderReturnRequestVO> getOrderReturnRequestPage( + @Param("page") Page<MgtOrderReturnRequestVO> page, + @Param("query") MgtOrderReturnRequestQuery query); + + MgtOrderReturnRequestVO getOrderReturnRequestDetail(Long id); } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderReturnRequestService.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderReturnRequestService.java index 3fc115b..cdf00c8 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderReturnRequestService.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderReturnRequestService.java @@ -1,6 +1,10 @@ package com.ruoyi.order.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.utils.page.PageDTO; +import com.ruoyi.order.controller.management.dto.MgtOrderReturnRequestQuery; +import com.ruoyi.order.controller.management.dto.MgtReturnRequestAuditDTO; +import com.ruoyi.order.controller.management.vo.MgtOrderReturnRequestVO; import com.ruoyi.order.domain.OrderReturnRequest; import com.ruoyi.system.api.domain.dto.OrderReturnDTO; import com.ruoyi.system.api.domain.vo.OrderReturnVO; @@ -21,5 +25,28 @@ OrderReturnVO OrderReturnRequestInfo(@RequestBody OrderReturnDTO OrderReturnDTO); + /** + * 获取售后管理列表分页数据 + * + * @param query 售后管理查询对象 + * @return PageDTO<MgtOrderReturnRequestVO> + */ + PageDTO<MgtOrderReturnRequestVO> getOrderReturnRequestPage(MgtOrderReturnRequestQuery query); + /** + * 查看详情 + * + * @param id 售后id + * @return MgtOrderReturnRequestVO + */ + MgtOrderReturnRequestVO getOrderReturnRequestDetail(Long id); + + /** + * 审核 + * + * @param dto 管理后台-售后审核传输对象 + */ + void auditReturnRequest(MgtReturnRequestAuditDTO dto); + + void confirmReturnRequest(Long id); } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderService.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderService.java index 6ce91c4..0863254 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderService.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderService.java @@ -2,8 +2,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.utils.page.PageDTO; -import com.ruoyi.order.controller.management.dto.MgtMallOrderQuery; import com.ruoyi.order.controller.management.dto.MgtOrderConfirmShipmentDTO; +import com.ruoyi.order.controller.management.dto.MgtOrderQuery; import com.ruoyi.order.controller.management.vo.MgtOrderVO; import com.ruoyi.system.api.domain.Order; import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; @@ -81,7 +81,7 @@ * @param query 商城订单查询对象 * @return PageDTO<MgtMallOrderVO> */ - PageDTO<MgtOrderVO> getOrderPage(MgtMallOrderQuery query); + PageDTO<MgtOrderVO> getOrderPage(MgtOrderQuery query); /** * 获取商城订单详情 diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderReturnRequestServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderReturnRequestServiceImpl.java index 8c661f5..3f4450c 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderReturnRequestServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderReturnRequestServiceImpl.java @@ -2,31 +2,52 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.enums.AuditStatusEnum; import com.ruoyi.common.core.enums.OrderStatusEnum; +import com.ruoyi.common.core.enums.PaymentMethodEnum; +import com.ruoyi.common.core.enums.RequestTypeEnum; import com.ruoyi.common.core.enums.ReturnRequestStatusEnum; +import com.ruoyi.common.core.exception.ServiceException; +import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.page.BeanUtils; +import com.ruoyi.common.core.utils.page.PageDTO; +import com.ruoyi.order.controller.management.dto.MgtOrderReturnRequestQuery; +import com.ruoyi.order.controller.management.dto.MgtReturnRequestAuditDTO; +import com.ruoyi.order.controller.management.vo.MgtOrderReturnRequestVO; import com.ruoyi.order.domain.OrderReturnRequest; +import com.ruoyi.order.domain.Paylog; import com.ruoyi.order.mapper.OrderMapper; import com.ruoyi.order.mapper.OrderReturnRequestMapper; import com.ruoyi.order.service.IOrderReturnRequestService; +import com.ruoyi.order.util.SinataUtil; import com.ruoyi.system.api.domain.CustomConfig; -import com.ruoyi.system.api.domain.GoodsCategory; import com.ruoyi.system.api.domain.Member; import com.ruoyi.system.api.domain.Order; +import com.ruoyi.system.api.domain.dto.LogisticsDTO; +import com.ruoyi.system.api.domain.dto.MemberDTO; import com.ruoyi.system.api.domain.dto.OrderReturnDTO; +import com.ruoyi.system.api.domain.vo.Express100VO; import com.ruoyi.system.api.domain.vo.OrderReturnVO; +import com.ruoyi.system.api.feignClient.MemberClient; import com.ruoyi.system.api.feignClient.SysUserClient; import com.ruoyi.system.api.util.HuaWeiOBSUtil; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; import java.io.IOException; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import javax.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; /** * <p> @@ -43,7 +64,12 @@ @Resource private OrderMapper orderMapper; - + @Resource + private MemberClient memberClient; + @Resource + private LogisticsServiceImpl logisticsService; + @Resource + private PaylogServiceImpl paylogService; @Override public void saveOrderReturnRequest(OrderReturnDTO OrderReturnDTO) { @@ -95,4 +121,162 @@ OrderReturnVO orderReturnVO = BeanUtils.copyBean(one, OrderReturnVO.class); return orderReturnVO; } + + /** + * 获取售后管理列表分页数据 + * + * @param query 售后管理查询对象 + * @return PageDTO<MgtOrderReturnRequestVO> + */ + @Override + public PageDTO<MgtOrderReturnRequestVO> getOrderReturnRequestPage( + MgtOrderReturnRequestQuery query) { + Set<Long> memberIdSet; + Page<MgtOrderReturnRequestVO> page = new Page<>(query.getPageCurr(), query.getPageSize()); + if (StringUtils.isNotBlank(query.getNickname()) || StringUtils.isNotBlank( + query.getPhone())) { + MemberDTO memberDTO = new MemberDTO(); + memberDTO.setNickname(query.getNickname()); + memberDTO.setPhone(query.getPhone()); + List<Member> memberList = memberClient.getMemberListByCondition(memberDTO, + SecurityConstants.INNER).getData(); + if (StringUtils.isEmpty(memberList)) { + return PageDTO.empty(page); + } + memberIdSet = memberList.stream().map(Member::getId) + .collect(Collectors.toSet()); + } + page = baseMapper.getOrderReturnRequestPage(page, query); + if (StringUtils.isEmpty(page.getRecords())) { + return PageDTO.empty(page); + } + Set<Long> memIdSet = page.getRecords().stream().map(MgtOrderReturnRequestVO::getMemberId) + .collect(Collectors.toSet()); + List<Member> members = memberClient.getMemberListByIds(memIdSet, SecurityConstants.INNER) + .getData(); + Map<Long, Member> memberMap = members.stream() + .collect(Collectors.toMap(Member::getId, Function.identity())); + page.getRecords().forEach(item -> { + Member member = memberMap.get(item.getMemberId()); + if (StringUtils.isNotNull(member)) { + item.setNickname(member.getNickname()); + item.setPhone(member.getPhone()); + } + }); + return PageDTO.of(page); + } + + /** + * 查看详情 + * + * @param id 售后id + * @return MgtOrderReturnRequestVO + */ + @Override + public MgtOrderReturnRequestVO getOrderReturnRequestDetail(Long id) { + MgtOrderReturnRequestVO returnRequestVO = baseMapper.getOrderReturnRequestDetail(id); + // 远程调用member服务,获取会员信息 + Member member = memberClient.getMembeOne(returnRequestVO.getMemberId(), + SecurityConstants.INNER).getData(); + if (StringUtils.isNotNull(member)) { + returnRequestVO.setNickname(member.getNickname()); + returnRequestVO.setPhone(member.getPhone()); + } + if (returnRequestVO.getRequestType() == RequestTypeEnum.REFUNDS_AND_RETURNS + && returnRequestVO.getStatus() + == ReturnRequestStatusEnum.TO_BE_RECEIVED_BY_THE_PLATFORM + && returnRequestVO.getAuditStatus() == AuditStatusEnum.PASSED) { + LogisticsDTO logisticsDTO = new LogisticsDTO(); + logisticsDTO.setCompany(returnRequestVO.getLogisticsNum()); + logisticsDTO.setPostid(returnRequestVO.getCourierNumber()); + Express100VO logisticsList = logisticsService.getLogisticsList(logisticsDTO); + if (StringUtils.isNotNull(logisticsList)) { + returnRequestVO.setExpress100VO(logisticsList); + } + } + return returnRequestVO; + } + + /** + * 审核 + * + * @param dto 管理后台-售后审核传输对象 + */ + @Override + public void auditReturnRequest(MgtReturnRequestAuditDTO dto) { + OrderReturnRequest orderReturnRequest = getOrderReturnRequest(dto.getId()); + if (orderReturnRequest.getAuditStatus() != AuditStatusEnum.TO_BE_REVIEWED) { + throw new ServiceException("该售后已被审核"); + } + if (dto.getAuditStatus() == AuditStatusEnum.PASSED) { + orderReturnRequest.setStatus(ReturnRequestStatusEnum.TO_BE_RETURNED); + orderReturnRequest.setAuditStatus(AuditStatusEnum.PASSED); + } else { + orderReturnRequest.setStatus(ReturnRequestStatusEnum.REJECTED); + orderReturnRequest.setAuditStatus(AuditStatusEnum.REJECTED); + orderReturnRequest.setRefuseReason(dto.getRefuseComment()); + } + this.updateById(orderReturnRequest); + } + + private OrderReturnRequest getOrderReturnRequest(Long id) { + OrderReturnRequest orderReturnRequest = this.getById(id); + if (StringUtils.isNull(orderReturnRequest)) { + throw new ServiceException("售后不存在"); + } + return orderReturnRequest; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void confirmReturnRequest(Long id) { + OrderReturnRequest orderReturnRequest = getOrderReturnRequest(id); + if (orderReturnRequest.getStatus() + != ReturnRequestStatusEnum.TO_BE_RECEIVED_BY_THE_PLATFORM + || orderReturnRequest.getAuditStatus() != AuditStatusEnum.PASSED) { + throw new ServiceException("该售后状态不允许确认收货"); + } + orderReturnRequest.setStatus(ReturnRequestStatusEnum.COMPLETED); + this.updateById(orderReturnRequest); + // 退款 + Order order = orderMapper.selectById(orderReturnRequest.getOrderId()); + + if (StringUtils.isNull(order)) { + throw new ServiceException("订单不存在"); + } + String orderNo = order.getOrderNo(); + Paylog paylog = paylogService.lambdaQuery().eq(Paylog::getOutTradeNo, orderNo) + .last("limit 1").one(); + PaymentMethodEnum paymentMethod = order.getPaymentMethod(); + if (StringUtils.isNotNull(paylog)) { + boolean result = handleRefund(paymentMethod, paylog, orderNo); + if (result) { + paylog.setState(3);// 已退款 + order.setOrderStatus(OrderStatusEnum.REFUNDED); + paylogService.updateById(paylog); + orderMapper.updateById(order); + } + } + } + + private boolean handleRefund(PaymentMethodEnum paymentMethod, Paylog paylog, String orderNo) { + boolean result = false; + if (paymentMethod == PaymentMethodEnum.WECHAT) { + String refundMoney = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100D); + int refundFee = Integer.parseInt( + refundMoney.substring(0, refundMoney.length() - 3)); + String money = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100D); + Integer totalFee = Integer.parseInt(money.substring(0, money.length() - 3)); + String regEx = "[^0-9]"; + Pattern p = Pattern.compile(regEx); + Matcher m = p.matcher(orderNo); + String ma = m.replaceAll("").trim(); + result = paylogService.refundForWxpay(2, paylog.getTradeNo(), + paylog.getOutTradeNo(), "R" + ma, totalFee, refundFee, "4"); + } else if (paymentMethod == PaymentMethodEnum.ALIPAY) { + result = paylogService.refundForAlipay(paylog.getOutTradeNo(), paylog.getTradeNo(), + paylog.getPayMoney()); + } + return result; + } } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java index 0911361..76b0823 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java @@ -12,6 +12,7 @@ import com.ruoyi.common.core.enums.BondStatusEnum; import com.ruoyi.common.core.enums.OrderFromEnum; import com.ruoyi.common.core.enums.OrderStatusEnum; +import com.ruoyi.common.core.enums.OrderTypeEnum; import com.ruoyi.common.core.enums.PaymentMethodEnum; import com.ruoyi.common.core.enums.RequestTypeEnum; import com.ruoyi.common.core.enums.ReturnRequestStatusEnum; @@ -20,8 +21,8 @@ import com.ruoyi.common.core.utils.page.BeanUtils; import com.ruoyi.common.core.utils.page.PageDTO; import com.ruoyi.common.redis.service.RedisService; -import com.ruoyi.order.controller.management.dto.MgtMallOrderQuery; import com.ruoyi.order.controller.management.dto.MgtOrderConfirmShipmentDTO; +import com.ruoyi.order.controller.management.dto.MgtOrderQuery; import com.ruoyi.order.controller.management.vo.MgtOrderReturnRequestVO; import com.ruoyi.order.controller.management.vo.MgtOrderVO; import com.ruoyi.order.domain.OrderReturnRequest; @@ -74,10 +75,7 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.annotation.Resource; - import lombok.Synchronized; - -import org.redisson.api.RLock; import org.redisson.api.RedissonClient; import org.springframework.stereotype.Service; @@ -759,7 +757,7 @@ * @return PageDTO<MgtMallOrderVO> */ @Override - public PageDTO<MgtOrderVO> getOrderPage(MgtMallOrderQuery query) { + public PageDTO<MgtOrderVO> getOrderPage(MgtOrderQuery query) { PageDTO<MgtOrderVO> pageVO; // 封装会员条件查询对象 MemberDTO memberDTO = null; @@ -783,9 +781,15 @@ } page = this.lambdaQuery() .in(StringUtils.isNotEmpty(memberIdSet), Order::getMemberId, memberIdSet) + .ne(query.getQueryType().equals(OrderTypeEnum.MALL_ODER), Order::getOrderFrom, + OrderFromEnum.AUCTION_ORDERS) + .eq(query.getQueryType().equals(OrderTypeEnum.AUCTION_ORDER), Order::getOrderFrom, + OrderFromEnum.AUCTION_ORDERS) .like(StringUtils.isNotBlank(query.getOrderNo()), Order::getOrderNo, query.getOrderNo()) - .eq(StringUtils.isNotNull(query.getOrderFrom()), Order::getOrderFrom, + .eq(StringUtils.isNotNull(query.getOrderFrom()) && query.getQueryType() + .equals(OrderTypeEnum.MALL_ODER), + Order::getOrderFrom, query.getOrderFrom()) .like(StringUtils.isNotBlank(query.getSkuName()), Order::getSkuName, query.getSkuName()) @@ -798,12 +802,30 @@ pageVO = PageDTO.of(page, MgtOrderVO.class); if (query.getOrderFrom() == OrderFromEnum.AUCTION_ORDERS) { List<MgtOrderVO> list = pageVO.getList(); + // 封装参数查询拍卖会 + Set<Long> auctionSalesroomGoodsIdSet = list.stream() + .filter(order -> order.getAuctionType() == AuctionOrderTypeEnum.AUCTION_ITEMS) + .map(MgtOrderVO::getGoodsSkuId).collect(Collectors.toSet()); + List<AuctionSalesroom> auctionSalesroomList = auctionClient.getAuctionSalesroomByIds( + auctionSalesroomGoodsIdSet, SecurityConstants.INNER) + .getData(); + Map<Long, String> salesroomMap = auctionSalesroomList.stream() + .collect(Collectors.toMap(AuctionSalesroom::getId, + AuctionSalesroom::getSalesroomName)); // 封装参数查询拍卖订单保证金 - Set<Long> orderIdSet = list.stream().map(MgtOrderVO::getId) + Set<Long> auctionGoodsIdSet = list.stream() + .filter(order -> order.getAuctionType() == AuctionOrderTypeEnum.REGULAR_ITEMS) + .map(MgtOrderVO::getGoodsSkuId) .collect(Collectors.toSet()); + + Set<Long> auctionSalesroomSet = auctionSalesroomList.stream() + .map(AuctionSalesroom::getId) + .collect(Collectors.toSet()); + List<OrderAuctionBond> auctionBondList = orderAuctionBondMapper.selectList( Wrappers.lambdaQuery(OrderAuctionBond.class) - .in(OrderAuctionBond::getOrderId, orderIdSet) + .in(OrderAuctionBond::getAuctionGoodsId, auctionGoodsIdSet) + .in(OrderAuctionBond::getAuctionSalesroomId, auctionSalesroomSet) .eq(OrderAuctionBond::getBoundStatus, BondStatusEnum.PAID)); Map<String, OrderAuctionBond> auctionSalesroomBondMap = auctionBondList.stream() @@ -816,27 +838,18 @@ .collect(Collectors.toMap( bond -> bond.getAuctionGoodsId() + "-" + bond.getMemberId(), Function.identity())); - // 封装参数查询拍卖会 - Set<Long> auctionSalesroomGoodsIdSet = list.stream() - .filter(order -> order.getAuctionType() == AuctionOrderTypeEnum.AUCTION_ITEMS) - .map(MgtOrderVO::getGoodsSkuId).collect(Collectors.toSet()); - List<AuctionSalesroom> auctionSalesroomList = auctionClient.getAuctionSalesroomByIds( - auctionSalesroomGoodsIdSet, SecurityConstants.INNER) - .getData(); - Map<Long, String> salesroomMap = auctionSalesroomList.stream() - .collect(Collectors.toMap(AuctionSalesroom::getId, - AuctionSalesroom::getSalesroomName)); + list.forEach(order -> { if (order.getAuctionType() == AuctionOrderTypeEnum.AUCTION_ITEMS) { order.setSalesroomName( StringUtils.isNotBlank(salesroomMap.get(order.getGoodsSkuId())) - ? salesroomMap.get(order.getGoodsSkuId()) : "无"); + ? salesroomMap.get(order.getAuctionSalesroomId()) : "无"); order.setBoundStatus( StringUtils.isNotNull(auctionSalesroomBondMap.get( - order.getGoodsSkuId() + "-" + order.getMemberId()) + order.getAuctionSalesroomId() + "-" + order.getMemberId()) .getBoundStatus()) ? auctionSalesroomBondMap.get( - order.getGoodsSkuId() + "-" + order.getMemberId()) + order.getAuctionSalesroomId() + "-" + order.getMemberId()) .getBoundStatus() : null); } @@ -1044,12 +1057,30 @@ @Override public void refundBond(Long id) { Order order = getOrder(id); - OrderAuctionBond orderAuctionBond = orderAuctionBondMapper.selectOne( - Wrappers.lambdaQuery(OrderAuctionBond.class) - .eq(OrderAuctionBond::getOrderId, id)); + OrderAuctionBond orderAuctionBond; + if (order.getAuctionType() == AuctionOrderTypeEnum.AUCTION_ITEMS) { + orderAuctionBond = orderAuctionBondMapper.selectOne( + Wrappers.lambdaQuery(OrderAuctionBond.class) + .eq(OrderAuctionBond::getAuctionSalesroomId, + order.getAuctionSalesroomId()) + .eq(OrderAuctionBond::getBoundStatus, BondStatusEnum.PAID)); + if (StringUtils.isNotNull(orderAuctionBond) + && orderAuctionBond.getBoundStatus() == BondStatusEnum.REFUNDED) { + throw new ServiceException("改拍卖会已退保证金"); + } + } else { + orderAuctionBond = orderAuctionBondMapper.selectOne( + Wrappers.lambdaQuery(OrderAuctionBond.class) + .eq(OrderAuctionBond::getAuctionGoodsId, + order.getGoodsSkuId()) + .eq(OrderAuctionBond::getBoundStatus, BondStatusEnum.PAID)); + } Paylog paylog = iPaylogService.lambdaQuery() .eq(Paylog::getOutTradeNo, orderAuctionBond.getOrderNo()) .last("limit 1").one(); + if (StringUtils.isNull(paylog)) { + throw new ServiceException("支付记录不存在"); + } PaymentMethodEnum paymentMethod = orderAuctionBond.getPaymentMethod(); if (orderAuctionBond.getBoundStatus() == BondStatusEnum.PAID) { boolean result = handleRefund(paymentMethod, paylog, orderAuctionBond.getOrderNo()); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/AgreementController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/AgreementController.java index 67b808d..d6386a6 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/AgreementController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/AgreementController.java @@ -5,14 +5,11 @@ import com.ruoyi.system.domain.Agreement; import com.ruoyi.system.service.IAgreementService; import io.swagger.annotations.ApiOperation; +import javax.annotation.Resource; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; - import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; -import java.util.List; /** * <p> @@ -24,6 +21,7 @@ */ @RestController @RequestMapping("/agreement") + public class AgreementController { @Resource private IAgreementService iAgreementService; diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CustomConfigController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CustomConfigController.java index 544f024..65c9f63 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CustomConfigController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CustomConfigController.java @@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.core.domain.R; import com.ruoyi.system.api.domain.CustomConfig; +import com.ruoyi.system.domain.dto.MgtAfterSaleSettingDTO; import com.ruoyi.system.domain.dto.PointsConfigDTO; import com.ruoyi.system.domain.vo.CustomConfigVO; import com.ruoyi.system.service.ICustomConfigService; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; @@ -30,6 +32,7 @@ */ @RestController @RequestMapping("/custom-config") +@Api(value = "系统配置接口", tags = "系统配置接口") public class CustomConfigController { @Resource private ICustomConfigService iCustomConfigService; @@ -87,4 +90,12 @@ iCustomConfigService.saveOrderDescription(description); return R.ok(); } + + + @ApiOperation(value = "售后设置") + @PostMapping("/save-after-sale-setting") + public R<?> saveAfterSaleSetting(@Validated @RequestBody MgtAfterSaleSettingDTO dto) { + iCustomConfigService.saveAfterSaleSetting(dto); + return R.ok(); + } } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtAfterSaleSettingDTO.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtAfterSaleSettingDTO.java new file mode 100644 index 0000000..6a8ecbb --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtAfterSaleSettingDTO.java @@ -0,0 +1,35 @@ +package com.ruoyi.system.domain.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author mitao + * @date 2024/6/15 + */ +@Data +@ApiModel(value = "售后设置对象") +public class MgtAfterSaleSettingDTO implements Serializable { + + private static final long serialVersionUID = 6993506291454436640L; + + @ApiModelProperty("退货地址-收货人姓名") + @NotBlank(message = "收货人姓名不能为空") + private String receiverName; + + @ApiModelProperty("退货地址-收货人电话") + @NotBlank(message = "收货人电话不能为空") + private String receiverPhone; + + @ApiModelProperty("退货地址-收获地址") + @NotBlank(message = "收获地址不能为空") + private String receiverAddress; + + @ApiModelProperty("售后周期") + @NotNull(message = "售后周期不能为空") + private Integer returnCycle; +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ICustomConfigService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ICustomConfigService.java index fd77004..47396ef 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ICustomConfigService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ICustomConfigService.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.system.api.domain.CustomConfig; +import com.ruoyi.system.domain.dto.MgtAfterSaleSettingDTO; import com.ruoyi.system.domain.dto.PointsConfigDTO; import com.ruoyi.system.domain.vo.CustomConfigVO; import java.util.List; @@ -44,4 +45,6 @@ * @param description 订单说明 */ void saveOrderDescription(String description); + + void saveAfterSaleSetting(MgtAfterSaleSettingDTO dto); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CustomConfigServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CustomConfigServiceImpl.java index 4f41ff5..1a43f2c 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CustomConfigServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CustomConfigServiceImpl.java @@ -5,6 +5,7 @@ import com.ruoyi.common.core.utils.page.BeanUtils; import com.ruoyi.system.api.constants.ConfigEnum; import com.ruoyi.system.api.domain.CustomConfig; +import com.ruoyi.system.domain.dto.MgtAfterSaleSettingDTO; import com.ruoyi.system.domain.dto.PointsConfigDTO; import com.ruoyi.system.domain.vo.CustomConfigVO; import com.ruoyi.system.mapper.CustomConfigMapper; @@ -109,4 +110,27 @@ orderDescription.setConfigValue(description); this.saveOrUpdate(orderDescription); } + + @Override + @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) + public void saveAfterSaleSetting(MgtAfterSaleSettingDTO dto) { + handleConfigSetting(dto.getReceiverName(), ConfigEnum.RETURN_ADDRESS_USER_NAME); + handleConfigSetting(dto.getReceiverPhone(), ConfigEnum.RETURN_ADDRESS_USER_PHONE); + handleConfigSetting(dto.getReceiverAddress(), ConfigEnum.RETURN_ADDRESS_USER_ADDRESS); + handleConfigSetting(dto.getReturnCycle().toString(), ConfigEnum.RETURN_CYCLE); + } + + private void handleConfigSetting(String value, ConfigEnum configEnum) { + Optional<CustomConfig> receiverNameConfigOptional = getCustomConfigByKey( + ConfigEnum.RETURN_ADDRESS_USER_NAME.getKey()); + CustomConfig receiverNameConfig = receiverNameConfigOptional.orElseGet(() -> { + CustomConfig config = new CustomConfig(); + config.setConfigKey(ConfigEnum.RETURN_ADDRESS_USER_NAME.getKey()); + config.setConfigType(ConfigEnum.RETURN_ADDRESS_USER_NAME.getKeyType()); + config.setConfigName(ConfigEnum.RETURN_ADDRESS_USER_NAME.getKeyName()); + return config; + }); + receiverNameConfig.setConfigValue(value); + this.saveOrUpdate(receiverNameConfig); + } } -- Gitblit v1.7.1