Browse Source

fixed 退款售后服务管理优化

fushengqian 1 year ago
parent
commit
485b21ea1b

+ 4 - 1
fuint-application/src/main/java/com/fuint/common/dto/RefundDto.java

@@ -1,9 +1,9 @@
 package com.fuint.common.dto;
 
+import com.fuint.repository.model.MtStore;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
-
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.List;
@@ -60,6 +60,9 @@ public class RefundDto implements Serializable {
     @ApiModelProperty("退货地址")
     private AddressDto address;
 
+    @ApiModelProperty("店铺信息")
+    private MtStore storeInfo;
+
     @ApiModelProperty("创建时间")
     private String createTime;
 

+ 1 - 1
fuint-application/src/main/java/com/fuint/common/service/RefundService.java

@@ -25,7 +25,7 @@ public interface RefundService extends IService<MtRefund> {
      * @param paginationRequest
      * @return
      */
-    PaginationResponse<MtRefund> getRefundListByPagination(PaginationRequest paginationRequest) throws BusinessCheckException;
+    PaginationResponse<RefundDto> getRefundListByPagination(PaginationRequest paginationRequest) throws BusinessCheckException;
 
     /**
      * 获取用户的售后订单

+ 26 - 4
fuint-application/src/main/java/com/fuint/common/service/impl/RefundServiceImpl.java

@@ -86,6 +86,11 @@ public class RefundServiceImpl extends ServiceImpl<MtRefundMapper, MtRefund> imp
      * */
     private AlipayService alipayService;
 
+    /**
+     * 店铺接口
+     */
+    private StoreService storeService;
+
     /**
      * 分页查询售后订单列表
      *
@@ -93,7 +98,7 @@ public class RefundServiceImpl extends ServiceImpl<MtRefundMapper, MtRefund> imp
      * @return
      */
     @Override
-    public PaginationResponse<MtRefund> getRefundListByPagination(PaginationRequest paginationRequest) {
+    public PaginationResponse<RefundDto> getRefundListByPagination(PaginationRequest paginationRequest) throws BusinessCheckException {
         Page<MtBanner> pageHelper = PageHelper.startPage(paginationRequest.getCurrentPage(), paginationRequest.getPageSize());
         LambdaQueryWrapper<MtRefund> lambdaQueryWrapper = Wrappers.lambdaQuery();
         lambdaQueryWrapper.ne(MtRefund::getStatus, StatusEnum.DISABLE.getKey());
@@ -130,11 +135,28 @@ public class RefundServiceImpl extends ServiceImpl<MtRefundMapper, MtRefund> imp
             lambdaQueryWrapper.le(MtRefund::getCreateTime, endTime);
         }
         lambdaQueryWrapper.orderByDesc(MtRefund::getId);
-        List<MtRefund> dataList = mtRefundMapper.selectList(lambdaQueryWrapper);
-
+        List<MtRefund> refundList = mtRefundMapper.selectList(lambdaQueryWrapper);
+        List<RefundDto> dataList = new ArrayList<>();
+        if (refundList != null && refundList.size() > 0) {
+            for (MtRefund mtRefund : refundList) {
+                 RefundDto refundDto = new RefundDto();
+                 BeanUtils.copyProperties(mtRefund, refundDto);
+                 refundDto.setCreateTime(DateUtil.formatDate(mtRefund.getCreateTime(), "yyyy-MM-dd HH:mm"));
+                 refundDto.setUpdateTime(DateUtil.formatDate(mtRefund.getCreateTime(), "yyyy-MM-dd HH:mm"));
+                 if (refundDto.getStoreId() != null && refundDto.getStoreId() > 0) {
+                     MtStore mtStore = storeService.queryStoreById(refundDto.getStoreId());
+                     refundDto.setStoreInfo(mtStore);
+                 }
+                 if (refundDto.getOrderId() != null && refundDto.getOrderId() > 0) {
+                     UserOrderDto orderDto = orderService.getOrderById(refundDto.getOrderId());
+                     refundDto.setOrderInfo(orderDto);
+                 }
+                 dataList.add(refundDto);
+            }
+        }
         PageRequest pageRequest = PageRequest.of(paginationRequest.getCurrentPage(), paginationRequest.getPageSize());
         PageImpl pageImpl = new PageImpl(dataList, pageRequest, pageHelper.getTotal());
-        PaginationResponse<MtRefund> paginationResponse = new PaginationResponse(pageImpl, MtRefund.class);
+        PaginationResponse<RefundDto> paginationResponse = new PaginationResponse(pageImpl, RefundDto.class);
         paginationResponse.setTotalPages(pageHelper.getPages());
         paginationResponse.setTotalElements(pageHelper.getTotal());
         paginationResponse.setContent(dataList);

+ 1 - 2
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendRefundController.java

@@ -14,7 +14,6 @@ import com.fuint.framework.pagination.PaginationRequest;
 import com.fuint.framework.pagination.PaginationResponse;
 import com.fuint.framework.web.BaseController;
 import com.fuint.framework.web.ResponseObject;
-import com.fuint.repository.model.MtRefund;
 import com.fuint.repository.model.MtUser;
 import com.fuint.repository.model.TAccount;
 import com.fuint.utils.StringUtil;
@@ -130,7 +129,7 @@ public class BackendRefundController extends BaseController {
             params.put("endTime", endTime);
         }
         paginationRequest.setSearchParams(params);
-        PaginationResponse<MtRefund> paginationResponse = refundService.getRefundListByPagination(paginationRequest);
+        PaginationResponse<RefundDto> paginationResponse = refundService.getRefundListByPagination(paginationRequest);
 
         // 售后状态列表
         RefundStatusEnum[] statusListEnum = RefundStatusEnum.values();