Bladeren bron

update

shuiqilin-optimize
houyi 9 maanden geleden
bovenliggende
commit
57cd4c124d

+ 1
- 0
application.pid Bestand weergeven

@@ -0,0 +1 @@
29128

+ 2
- 2
src/main/java/com/qtzl/alterSales/dao/repo/jpa/primary/WechatPayApplyResultLogRepo.java Bestand weergeven

@@ -78,8 +78,8 @@ public interface WechatPayApplyResultLogRepo extends
* @param datePrefix 时间
* @return List<Map<String, Object>>
*/
@Query("SELECT new com.qtzl.alterSales.manager.vo.WechatPayApplyLogGroupByTimeCountVO(substring(e.timeEnd, 1, 6), count(e)) FROM WechatPayApplyResultLog e WHERE e.timeEnd like concat(?1, '%') AND e.tradeState = 'SUCCESS' GROUP BY substring(e.timeEnd, 1, 6)")
WechatPayApplyLogGroupByTimeCountVO countByYearMonth(String datePrefix);
@Query("SELECT count(1) FROM WechatPayApplyResultLog e WHERE e.timeEnd like concat(?1, '%') AND e.tradeState = 'SUCCESS'")
Long countByYearMonth(String datePrefix);


}

+ 2
- 2
src/main/java/com/qtzl/alterSales/dao/repo/jpa/second/AflServerFeeRefundRepo.java Bestand weergeven

@@ -28,8 +28,8 @@ public interface AflServerFeeRefundRepo extends AbstractJpaRepo<AflServerFeeRefu
@Query("select a from AflServerFeeRefund a where a.refundDate like concat(?1, '%') ")
Page<AflServerFeeRefund> findPage(String datePre, Pageable pageable);

@Query("select new com.qtzl.alterSales.manager.vo.WechatPayApplyLogGroupByTimeCountVO(substring(a.refundDate, 1, 7), count(1)) from AflServerFeeRefund a where a.refundDate like concat(?1, '%') group by substring(a.refundDate, 1, 7)")
WechatPayApplyLogGroupByTimeCountVO countByYearMonth(String datePrefix);
@Query("select count(1) from AflServerFeeRefund a where a.refundDate like concat(?1, '%')")
Long countByYearMonth(String datePrefix);

/***
* 根据微信退款单号查询退款明细

+ 10
- 14
src/main/java/com/qtzl/alterSales/manager/service/AflCommissionReportExportServiceImpl.java Bestand weergeven

@@ -14,7 +14,6 @@ import com.qtzl.alterSales.dao.repo.jpa.second.AflServerFeeRefundRepo;
import com.qtzl.alterSales.manager.model.protocol.UcServiceError;
import com.qtzl.alterSales.manager.service.third.ConstantConfig;
import com.qtzl.alterSales.manager.service.third.FmsService;
import com.qtzl.alterSales.manager.vo.WechatPayApplyLogGroupByTimeCountVO;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
@@ -90,36 +89,33 @@ public class AflCommissionReportExportServiceImpl implements AflCommissionReport
int endDateInt = convertToInteger(endDate);
List<AflMchStatistics> aflMchStatistics = Optional.ofNullable(aflMchStatisticsRepo.findBySubMchIdAndStatisticalDateRange(subMchId, startDateInt, endDateInt)).orElse(Collections.emptyList());


ExcelHeadCommissionVO vo = new ExcelHeadCommissionVO();
vo.setIndex(indexSer.getAndIncrement());
WechatPayApplyLogGroupByTimeCountVO orderCountVo = Optional.ofNullable(wechatPayApplyResultLogRepo.countByYearMonth(String.valueOf(e))).orElse(new WechatPayApplyLogGroupByTimeCountVO());
long count = Optional.ofNullable(wechatPayApplyResultLogRepo.countByYearMonth(String.valueOf(e))).orElse(0L);

String yearAndMonthFormat = year + "-" + month;
WechatPayApplyLogGroupByTimeCountVO refundOrderCountVo = Optional.ofNullable(aflServerFeeRefundRepo.countByYearMonth(yearAndMonthFormat)).orElse(new WechatPayApplyLogGroupByTimeCountVO());
long refundCount = Optional.ofNullable(aflServerFeeRefundRepo.countByYearMonth(yearAndMonthFormat)).orElse(0L);

// 当月订单总数
Long orderNum = Optional.ofNullable(orderCountVo.getCount()).orElse(0L);
// 退费订单总数
Long refundOrderNum = Optional.ofNullable(refundOrderCountVo.getCount()).orElse(0L);
// 实际用户订单数 actualUserNum = orderNum - refundOrderNum
long actualUserCount = orderNum - refundOrderNum;
long actualUserCount = count - refundCount;

// 手续费总额. 服务费即为手续费
BigDecimal serviceFee = aflMchStatistics.stream().map(AflMchStatistics::getTotalServiceFee).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
// 50元服务费的服务费
BigDecimal serviceFee = aflMchStatistics.stream().filter(v -> v.getFeeType().contains("服务费")).map(AflMchStatistics::getTotalServiceFee).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
// 通行费的服务费
BigDecimal toll = aflMchStatistics.stream().filter(v -> v.getFeeType().contains("通行费")).map(AflMchStatistics::getTotalServiceFee).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);

// 比亚迪手续费
BigDecimal bydChannelFee = BigDecimal.valueOf(actualUserCount * 20.5 * 0.001).setScale(2, RoundingMode.HALF_UP);
// 晟安通手续费
BigDecimal satChannelFee = BigDecimal.valueOf(actualUserCount * 13.7 * 0.001).setScale(2, RoundingMode.HALF_UP);

// 手续费总额 - 比亚迪手续费 - 晟安通手续费 = 黔通手续费
// 50元服务费的手续费总额 - 比亚迪手续费 - 晟安通手续费 = 黔通手续费
BigDecimal qtChannelFee = serviceFee.subtract(bydChannelFee).subtract(satChannelFee).setScale(2, RoundingMode.HALF_UP);

vo.setSatChannelFee(satChannelFee);
vo.setSatChannelFee(satChannelFee.add(toll));
vo.setBdyChannelFee(bydChannelFee);
vo.setQtChannelFee(qtChannelFee);
vo.setChannelFee(serviceFee);
vo.setChannelFee(serviceFee.add(toll));
vo.setYear(year);
vo.setMonth(month);
vo.setRemark("");

BIN
src/main/resources/excel-template/BydCommissionTemplate.xlsx Bestand weergeven


+ 1
- 3
src/test/java/ReportTest.java Bestand weergeven

@@ -42,9 +42,7 @@ public class ReportTest {
*/
@Test
public void aflServerFeeRefundRepo() {
WechatPayApplyLogGroupByTimeCountVO wechatPayApplyLogGroupByTimeCountVO = aflServerFeeRefundRepo.countByYearMonth("2024-10");
System.out.println("wechatPayApplyLogGroupByTimeCountVO:" + JSONUtil.toJsonStr(wechatPayApplyLogGroupByTimeCountVO));
Assert.assertNotNull(wechatPayApplyLogGroupByTimeCountVO);

}



Laden…
Annuleren
Opslaan