|
|
@@ -59,7 +59,8 @@ public class AflReportExportDataLoader extends Thread { |
|
|
|
this.executor = Executors.newFixedThreadPool( |
|
|
|
reportEnum != null && CollUtil.isNotEmpty(reportEnum.getExportDataEnums()) ? reportEnum.getExportDataEnums().size() : 4); |
|
|
|
|
|
|
|
this.aflMchStatisticsRepo = SpringContextHolder.getBean(AflMchStatisticsRepo.class); |
|
|
|
SpringContextHolder.getBean(AflMchStatisticsRepo.class); |
|
|
|
this.aflMchStatisticsService = SpringContextHolder.getBean(AflMchStatisticsService.class); |
|
|
|
this.aflPaccountRefundCountRepo = SpringContextHolder.getBean(AflPaccountRefundCountRepo.class); |
|
|
|
this.refundStatsRepo = SpringContextHolder.getBean(RefundStatsRepo.class); |
|
|
|
this.aflServerFeeRefundRepo = SpringContextHolder.getBean(AflServerFeeRefundRepo.class); |
|
|
@@ -82,7 +83,7 @@ public class AflReportExportDataLoader extends Thread { |
|
|
|
private final ReportEnum reportEnum; |
|
|
|
private final AbstractReportRequest request; |
|
|
|
|
|
|
|
private final AflMchStatisticsRepo aflMchStatisticsRepo; |
|
|
|
private final AflMchStatisticsService aflMchStatisticsService; |
|
|
|
private final AflPaccountRefundCountRepo aflPaccountRefundCountRepo; |
|
|
|
private final RefundStatsRepo refundStatsRepo; |
|
|
|
private final AflServerFeeRefundRepo aflServerFeeRefundRepo; |
|
|
@@ -369,36 +370,12 @@ public class AflReportExportDataLoader extends Thread { |
|
|
|
* @return InnerData |
|
|
|
*/ |
|
|
|
private InnerData<AflMchStatistics, AflMchStatistics> getInnerDataFor2973TypeData(String subMchId, ReportYearMonthRequest reportYearMonthRequest, Pageable pageable) { |
|
|
|
Specification<AflMchStatistics> specification = getAflMchStatisticsSpecification(subMchId, reportYearMonthRequest); |
|
|
|
Page<AflMchStatistics> page = aflMchStatisticsRepo.findAll(specification, pageable); |
|
|
|
return new InnerData<>(page, page.getContent()); |
|
|
|
} |
|
|
|
|
|
|
|
@NotNull |
|
|
|
private static Specification<AflMchStatistics> getAflMchStatisticsSpecification(String subMchId, ReportYearMonthRequest reportYearMonthRequest) { |
|
|
|
List<Integer> yearAndMonths = reportYearMonthRequest.getYearAndMonths(); |
|
|
|
return new Specification<>() { |
|
|
|
@Serial |
|
|
|
private static final long serialVersionUID = 1272259068454990513L; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Predicate toPredicate(@NotNull Root<AflMchStatistics> root, @NotNull CriteriaQuery<?> query, @NotNull CriteriaBuilder criteriaBuilder) { |
|
|
|
List<Predicate> predicates = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotEmpty(subMchId)) { |
|
|
|
predicates.add(criteriaBuilder.equal(root.get("subMchId").as(String.class), subMchId)); |
|
|
|
} |
|
|
|
if (CollUtil.isNotEmpty(yearAndMonths)) { |
|
|
|
List<Predicate> likePredicates = new ArrayList<>(); |
|
|
|
for (Integer yearAndMonth : yearAndMonths) { |
|
|
|
likePredicates.add(criteriaBuilder.like(root.get("statisticalDate").as(String.class), yearAndMonth + "%")); |
|
|
|
} |
|
|
|
Predicate allLikePredicate = criteriaBuilder.or(likePredicates.toArray(new Predicate[0])); |
|
|
|
predicates.add(allLikePredicate); |
|
|
|
} |
|
|
|
Predicate[] pre = new Predicate[predicates.size()]; |
|
|
|
return query.where(predicates.toArray(pre)).getRestriction(); |
|
|
|
} |
|
|
|
}; |
|
|
|
Integer yearAndMonth = yearAndMonths.get(0); |
|
|
|
Integer year = yearAndMonth / 100; |
|
|
|
Integer month = yearAndMonth % 100; |
|
|
|
Page<AflMchStatistics> page = aflMchStatisticsService.findPage(year, month, subMchId, pageable); |
|
|
|
return new InnerData<>(page, page.getContent()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |