1、修正软件购买:首购记录不存在创建时购买记录的首购标记为true;2、组织可用金swagger文档说明修改;

This commit is contained in:
gaoqr
2025-09-18 09:23:12 +08:00
parent 7c60cbf73a
commit b14ed0628a
2 changed files with 20 additions and 2 deletions
@@ -46,7 +46,7 @@ public class OrganAmountController {
} }
@GetMapping("/available") @GetMapping("/available")
@Operation(summary = "获取管理端组织可用金") @Operation(summary = "获取组织可用金")
public CommonResult<OrganAvailableAmountRespVO> getOrganAvailableAmount() { public CommonResult<OrganAvailableAmountRespVO> getOrganAvailableAmount() {
return success(organAmountService.getOrganAvailableAmount()); return success(organAmountService.getOrganAvailableAmount());
} }
@@ -57,6 +57,8 @@ public class PayProductProcessor {
private MybatisIdProperties mybatisIdProperties; private MybatisIdProperties mybatisIdProperties;
private boolean initialized = false;
public PayProductProcessor(ProductsDO productsDO, ProductsDetailDO productsDetailDO, PurchaseRecordDO orgInitialPurchaseRecord, OrganAmountDO organAmountDO, public PayProductProcessor(ProductsDO productsDO, ProductsDetailDO productsDetailDO, PurchaseRecordDO orgInitialPurchaseRecord, OrganAmountDO organAmountDO,
Long organId, ChenfengPayConfig payConfig, MybatisIdProperties mybatisIdProperties) { Long organId, ChenfengPayConfig payConfig, MybatisIdProperties mybatisIdProperties) {
this.productsDO = productsDO; this.productsDO = productsDO;
@@ -75,7 +77,15 @@ public class PayProductProcessor {
*/ */
public ProductProcessorRespVO processPayment(PayProductChannelCodeEnum payType) { public ProductProcessorRespVO processPayment(PayProductChannelCodeEnum payType) {
// 首次购买记录存在则需要做计算,否则直接用定价规则的现价 // 首次购买记录存在则需要做计算,否则直接用定价规则的现价
BigDecimal price = ObjectUtil.isNotNull(orgInitialPurchaseRecord) ? computePrice(orgInitialPurchaseRecord, productsDetailDO) : productsDetailDO.getCurrentPrice(); boolean initialPurchaseExist = ObjectUtil.isNotNull(orgInitialPurchaseRecord);
BigDecimal price;
if (initialPurchaseExist) {
price = computePrice(orgInitialPurchaseRecord, productsDetailDO);
} else {
price = productsDetailDO.getCurrentPrice();
// 首次购买记录是空,那么当前就是首次订购
initialized = true;
}
// 当前组织的余额 // 当前组织的余额
BigDecimal balance = organAmountDO.getAmount(); BigDecimal balance = organAmountDO.getAmount();
// 当前组织的赠送金 // 当前组织的赠送金
@@ -138,6 +148,7 @@ public class PayProductProcessor {
.monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount()) .monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount())
.accountBalanceSpent(price) .accountBalanceSpent(price)
.isInvocing(InvoiceStatusEnum.INVOICABLE.getCode()) .isInvocing(InvoiceStatusEnum.INVOICABLE.getCode())
.initial(initialized)
.build(); .build();
purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(), purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(),
purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(), purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(),
@@ -194,6 +205,7 @@ public class PayProductProcessor {
.monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount()) .monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount())
.accountBalanceSpent(price) .accountBalanceSpent(price)
.isInvocing(InvoiceStatusEnum.INVOICABLE.getCode()) .isInvocing(InvoiceStatusEnum.INVOICABLE.getCode())
.initial(initialized)
.build(); .build();
purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(), purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(),
purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(), purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(),
@@ -247,6 +259,7 @@ public class PayProductProcessor {
.originalAmount(productsDetailDO.getCurrentPrice()) .originalAmount(productsDetailDO.getCurrentPrice())
.monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount()) .monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount())
.alipaySpent(price) .alipaySpent(price)
.initial(initialized)
.build(); .build();
purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(), purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(),
purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(), purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(),
@@ -282,6 +295,7 @@ public class PayProductProcessor {
.originalAmount(productsDetailDO.getCurrentPrice()) .originalAmount(productsDetailDO.getCurrentPrice())
.monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount()) .monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount())
.wechatSpent(price) .wechatSpent(price)
.initial(initialized)
.build(); .build();
purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(), purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(),
purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(), purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(),
@@ -322,6 +336,7 @@ public class PayProductProcessor {
.originalAmount(productsDetailDO.getCurrentPrice()) .originalAmount(productsDetailDO.getCurrentPrice())
.monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount()) .monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount())
.isInvocing(InvoiceStatusEnum.INVOICABLE.getCode()) .isInvocing(InvoiceStatusEnum.INVOICABLE.getCode())
.initial(initialized)
.build(); .build();
purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(), purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(),
purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(), purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(),
@@ -397,6 +412,7 @@ public class PayProductProcessor {
.totalAmount(price) .totalAmount(price)
.originalAmount(productsDetailDO.getCurrentPrice()) .originalAmount(productsDetailDO.getCurrentPrice())
.monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount()) .monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount())
.initial(initialized)
.build(); .build();
purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(), purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(),
purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(), purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(),
@@ -471,6 +487,7 @@ public class PayProductProcessor {
.totalAmount(price) .totalAmount(price)
.originalAmount(productsDetailDO.getCurrentPrice()) .originalAmount(productsDetailDO.getCurrentPrice())
.monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount()) .monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount())
.initial(initialized)
.build(); .build();
purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(), purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(),
purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(), purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(),
@@ -548,6 +565,7 @@ public class PayProductProcessor {
.totalAmount(price) .totalAmount(price)
.originalAmount(productsDetailDO.getCurrentPrice()) .originalAmount(productsDetailDO.getCurrentPrice())
.monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount()) .monthAverageAmount(orgInitialPurchaseRecord.getMonthAverageAmount())
.initial(initialized)
.build(); .build();
purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(), purchaseRecordDO.setEndTime(calculateEndTime(purchaseRecordDO.getStartTime(),
purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(), purchaseRecordDO.getPurchaseDuration(), purchaseRecordDO.getPurchaseDurationUnit(),