|
|
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull; |
|
|
|
import org.springframework.data.domain.Page; |
|
|
|
import org.springframework.data.domain.PageRequest; |
|
|
|
import org.springframework.data.domain.Pageable; |
|
|
|
import org.springframework.data.domain.Sort; |
|
|
|
import org.springframework.data.jpa.domain.Specification; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
@@ -69,6 +70,15 @@ public class RefundStatisticsPageHandler extends AbstractAfterSalesManager<Refun |
|
|
|
if (ObjectUtils.isEmpty(type)) { |
|
|
|
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(String.format("操作失败,操作范围[%s]不合法", exportOrQuery)); |
|
|
|
} |
|
|
|
// 排序参数 是否合法 |
|
|
|
String sort = request.getSort(); |
|
|
|
if(!ObjectUtils.isEmpty(sort)){ |
|
|
|
try { |
|
|
|
Sort.Direction.fromString(sort); |
|
|
|
}catch (IllegalArgumentException e){ |
|
|
|
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(String.format("操作失败,排序值[%s]不合法", sort)); |
|
|
|
} |
|
|
|
} |
|
|
|
boolean is = FunctionalityConfigExportOrQuery.QUERY.equals(type); |
|
|
|
// 2 根据操作类型 决定数据大小 |
|
|
|
if (is) { |
|
|
@@ -137,8 +147,12 @@ public class RefundStatisticsPageHandler extends AbstractAfterSalesManager<Refun |
|
|
|
* @return 整合数据 |
|
|
|
*/ |
|
|
|
public RefundStatsPageResponse toResponse(RefundStatisticsPageRequest request) throws ServiceHandleException { |
|
|
|
// 排序 |
|
|
|
String sortParam = request.getSort(); |
|
|
|
|
|
|
|
Sort sort = Sort.by(new Sort.Order( ObjectUtils.isEmpty(sortParam) ? Sort.Direction.DESC : Sort.Direction.fromString(sortParam),"insertTime")); |
|
|
|
// 创建分页对象 |
|
|
|
Pageable pageable = PageRequest.of(request.getPageNo() - 1, request.getPageSize()); |
|
|
|
Pageable pageable = PageRequest.of(request.getPageNo() - 1, request.getPageSize(),sort); |
|
|
|
// 创建Specification |
|
|
|
Specification<RefundStats> spec = createSpecification(request); |
|
|
|
// 执行查询 |