1、新增可用充值活动接口;2、账户明细补充手工调账的赠送金值;

This commit is contained in:
gaoqr
2025-10-09 10:50:19 +08:00
parent fe5e14002f
commit e9a649c6d9
8 changed files with 44 additions and 15 deletions
@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 充值活动管理")
@@ -64,5 +66,10 @@ public class RechargeActiveController {
return success(BeanUtils.toBean(pageResult, RechargeRespVO.class));
}
@GetMapping("/available")
@Operation(summary = "获取可用充值活动")
public CommonResult<List<RechargeRespVO>> getAvailableRechargeActivePage() {
List<GiftMoneyDetailsDO> pageResult = productsService.getAvailableRechargeActiveList();
return success(BeanUtils.toBean(pageResult, RechargeRespVO.class));
}
}
@@ -40,23 +40,15 @@ public class RechargePageReqVO extends PageParam {
@Schema(description = "赠送金额")
private BigDecimal giftAmount;
@Schema(description = "投放开始时间")
@Schema(description = "投放时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] startTime;
@Schema(description = "投放结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] endTime;
@Schema(description = "操作时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] updateTime;
@Schema(description = "备注")
private String remark;
@Schema(description = "是否删除")
private Integer deleted;
private Boolean deleted;
@Schema(description = "排序", example = "ascend")
private String order;
@@ -25,7 +25,7 @@ public interface GiftMoneyDetailsMapper extends BaseMapperX<GiftMoneyDetailsDO>
.eqIfPresent(GiftMoneyDetailsDO::getGiftAmount, reqVO.getGiftAmount())
.eqIfPresent(GiftMoneyDetailsDO::getRechargeAmount, reqVO.getRechargeAmount())
.betweenIfPresent(GiftMoneyDetailsDO::getStartTime, reqVO.getStartTime())
.betweenIfPresent(GiftMoneyDetailsDO::getEndTime, reqVO.getEndTime());
.eqIfPresent(GiftMoneyDetailsDO::getDeleted, reqVO.getDeleted());
Integer rechargeType = reqVO.getRechargeType();
// WECHAT_AND_ALIPAY查全部、否则查WECHAT_AND_ALIPAY+查询类型
@@ -78,6 +78,7 @@ public class IncomeExpenseServiceImpl implements IncomeExpenseService {
}
} else if (TradeTypeEnum.MANUAL_ADJUST.getCode().equals(tradeType)) {
respVO.setRechargeAmount(i.getCashAmountChange());
respVO.setRechargeGiftAmount(i.getGiftAmountChange());
// 手工调账算到充值
respVO.setTradeType(TradeTypeEnum.RECHARGE.getCode());
}
@@ -7,6 +7,8 @@ import com.cf.imes.module.system.dal.dataobject.funds.recharge.GiftMoneyDetailsD
import jakarta.validation.Valid;
import java.util.List;
/**
* 充值活动详情表 gift_money_details Service 接口
*
@@ -50,6 +52,13 @@ public interface RechargeActiveService {
*/
PageResult<GiftMoneyDetailsDO> getPage(RechargePageReqVO pageReqVO);
/**
* 获取可用充值活动
*
* @return
*/
List<GiftMoneyDetailsDO> getAvailableRechargeActiveList();
/**
* 查询充值活动,不存返回null,无业务异常
*
@@ -1,6 +1,8 @@
package com.cf.imes.module.system.service.funds.recharge;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.Assert.AssertUtils;
import com.cf.imes.framework.common.util.object.BeanUtils;
@@ -15,6 +17,9 @@ import org.springframework.validation.annotation.Validated;
import jakarta.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.RECHARGE_ACTIVE_NAME_IS_EXIST;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.RECHARGE_ACTIVE_NO_EXIST;
@@ -89,7 +94,22 @@ public class RechargeActiveServiceImpl implements RechargeActiveService{
return giftMoneyDetailsMapper.selectPage(pageReqVO);
}
@Override
public List<GiftMoneyDetailsDO> getAvailableRechargeActiveList() {
RechargePageReqVO rechargePageReqVO = new RechargePageReqVO();
// 查询全部
rechargePageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
// 查询条件
rechargePageReqVO.setDeleted(false);
PageResult<GiftMoneyDetailsDO> giftMoneyDetailsDOPageResult = giftMoneyDetailsMapper.selectPage(rechargePageReqVO);
List<GiftMoneyDetailsDO> resultList = giftMoneyDetailsDOPageResult.getList();
if (CollUtil.isNotEmpty(resultList)) {
LocalDateTime now = LocalDateTime.now();
// 筛选掉投放时间还没到和过期的
resultList = resultList.stream().filter(item -> item.getStartTime().isBefore(now) && item.getEndTime().isAfter(now)).toList();
}
return resultList;
}
// 校验是否存在
private GiftMoneyDetailsDO validateRechargeActiveExists(Long id) {
@@ -205,7 +205,7 @@ chenfeng:
- /admin-api/system/product-details/organ/purchase
- /admin-api/system/purchase
- /admin-api/system/pay/product
- /admin-api/system/recharge-active/page
- /admin-api/system/recharge-active/available
- /admin-api/system/pay/recharge
ignore-tables:
- system_organization
@@ -221,7 +221,7 @@ chenfeng:
- /admin-api/system/product-details/organ/purchase
- /admin-api/system/purchase
- /admin-api/system/pay/product
- /admin-api/system/recharge-active/page
- /admin-api/system/recharge-active/available
- /admin-api/system/pay/recharge
ignore-tables:
- system_organization