web端查询提现申请详情
web端审核提现申请
This commit is contained in:
2025-08-21 09:32:15 +08:00
parent 7634bc7385
commit b007d0545d
9 changed files with 128 additions and 15 deletions

View File

@ -1,5 +1,7 @@
package com.greenorange.promotion.controller.course;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -47,6 +49,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
@ -208,6 +211,13 @@ public class CourseOrderController {
Long id = commonRequest.getId();
CourseOrder courseOrder = courseOrderService.getById(id);
// 判断是否超过7天
Date orderCreateTime = courseOrder.getCreateTime();
Date now = DateUtil.date();
// 计算两个时间相隔多少天(向下取整)
long days = DateUtil.between(orderCreateTime, now, DateUnit.DAY);
ThrowUtils.throwIf(days >= 7, ErrorCode.OPERATION_ERROR, "订单已超过7天无法退款");
// 修改订单状态
LambdaUpdateWrapper<CourseOrder> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(CourseOrder::getId, courseOrder.getId())

View File

@ -156,6 +156,12 @@ public class ProjectDetailController {
Long subUserId = subUserProjectCommission.getSubUserId();
// 设置抽佣比例
BigDecimal uniteRate = userCommissionRateMap.get(userId);
if (uniteRate == null && userId == 0) {
LambdaQueryWrapper<UserMainInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(UserMainInfo::getUserId, subUserId);
UserMainInfo userMainInfo = userMainInfoService.getOne(queryWrapper);
uniteRate = userMainInfo.getUniteRate();
}
subUserProjectCommission.setCurrentCommissionRate(uniteRate);
// 设置单价
BigDecimal myUnitPrice = subUserProjectCommissionMap.get(userId);

View File

@ -2,6 +2,7 @@ package com.greenorange.promotion.controller.projectSettlement;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.greenorange.promotion.annotation.RequiresPermission;
import com.greenorange.promotion.annotation.SysLog;
@ -10,12 +11,15 @@ import com.greenorange.promotion.common.ErrorCode;
import com.greenorange.promotion.common.ResultUtils;
import com.greenorange.promotion.constant.UserConstant;
import com.greenorange.promotion.exception.ThrowUtils;
import com.greenorange.promotion.model.dto.CommonRequest;
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyAddRequest;
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyQueryRequest;
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyReviewRequest;
import com.greenorange.promotion.model.entity.FundsChange;
import com.greenorange.promotion.model.entity.UserAccount;
import com.greenorange.promotion.model.entity.UserMainInfo;
import com.greenorange.promotion.model.entity.WithdrawalApply;
import com.greenorange.promotion.model.enums.WithdrawStatusEnum;
import com.greenorange.promotion.model.vo.fundsChange.FundsChangeVO;
import com.greenorange.promotion.model.vo.fundsChange.FundsItemVO;
import com.greenorange.promotion.model.vo.userAccount.UserAccountConditionVO;
@ -173,6 +177,47 @@ public class WithdrawalApplyController {
/**
* Web端管理员查看提现申请详情
* @param commonRequest 提现申请记录id
* @return 提现申请记录
*/
@PostMapping("get/id")
@Operation(summary = "Web端管理员查看提现申请详情", description = "参数提现申请记录id权限管理员方法名queryWithdrawalApplyById")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "提现申请记录管理", content = "Web端管理员分页查询提现申请记录")
public BaseResponse<WithdrawalApplyVO> queryWithdrawalApplyById(@Valid @RequestBody CommonRequest commonRequest) {
Long id = commonRequest.getId();
WithdrawalApply withdrawalApply = withdrawalApplyService.getById(id);
WithdrawalApplyVO withdrawalApplyVO = commonService.copyProperties(withdrawalApply, WithdrawalApplyVO.class);
return ResultUtils.success(withdrawalApplyVO);
}
/**
* Web端管理员审核提现申请
* @param withdrawalApplyReviewRequest 提现申请记录审核请求体
* @return 是否批准成功
*/
@PostMapping("review")
@Operation(summary = "Web端管理员审核提现申请", description = "参数提现申请记录审核请求体权限管理员方法名approveWithdrawalApplyById")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
// @SysLog(title = "提现申请记录管理", content = "Web端管理员分页查询提现申请记录")
public BaseResponse<Boolean> approveWithdrawalApplyById(@Valid @RequestBody WithdrawalApplyReviewRequest withdrawalApplyReviewRequest) {
Long id = withdrawalApplyReviewRequest.getId();
String withdrawalStatus = withdrawalApplyReviewRequest.getWithdrawalStatus();
WithdrawalApply withdrawalApply = withdrawalApplyService.getById(id);
ThrowUtils.throwIf(!withdrawalApply.getWithdrawalStatus().equals(WithdrawStatusEnum.PROCESSING.getValue()), ErrorCode.OPERATION_ERROR, "提现申请记录状态错误");
LambdaUpdateWrapper<WithdrawalApply> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(WithdrawalApply::getId, id).set(WithdrawalApply::getWithdrawalStatus, withdrawalStatus);
withdrawalApplyService.update(updateWrapper);
return ResultUtils.success(true);
}
/**
* Web端管理员分页查询提现申请记录
* @param withdrawalApplyQueryRequest 提现申请记录查询请求体

View File

@ -513,14 +513,16 @@ public class UserPerformanceSummaryController {
* 0 0 0 * * ?” = 每天 00:00:00 执行一次
* @return 是否更新成功
*/
// @Scheduled(cron = "0 0 0 * * ?")
@Scheduled(cron = "00 16 20 * * ?")
@Scheduled(cron = "0 0 0 * * ?")
// @Scheduled(cron = "00 16 20 * * ?")
@Operation(summary = "轮询课程推广待提成记录表", description = "参数权限管理员方法名pollCourseOrder")
public void pollCourseOrder() {
// 找出下单时间超过7天的订单分别统计主管和员工的可结算金额
Map<Long, BigDecimal> toSettleMap = new HashMap<>();
Map<Long, BigDecimal> totalAmountMap = new HashMap<>();
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = commonService.findByFieldEqTargetField(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.PENDING.getValue(), coursePromotionCommissionPendingService);
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = commonService.findByFieldEqTargetFieldWithSpecificFields(CoursePromotionCommissionPending::getCommissionStatus,
CommissionStatusEnum.PENDING.getValue(), coursePromotionCommissionPendingService, List.of(CoursePromotionCommissionPending::getId, CoursePromotionCommissionPending::getFirstUserId, CoursePromotionCommissionPending::getSecondUserId,
CoursePromotionCommissionPending::getTotalAmount, CoursePromotionCommissionPending::getFirstReward, CoursePromotionCommissionPending::getSecondReward));
for (CoursePromotionCommissionPending coursePromotionCommissionPending : coursePromotionCommissionPendingList) {
Date orderCreateTime = coursePromotionCommissionPending.getOrderCreateTime();
Date now = DateUtil.date();
@ -536,7 +538,9 @@ public class UserPerformanceSummaryController {
}
coursePromotionCommissionPendingService.updateBatchById(coursePromotionCommissionPendingList);
// 修改用户绩效汇总表
List<UserPerformanceSummary> userPerformanceSummaryList = userPerformanceSummaryService.list();
LambdaQueryWrapper<UserPerformanceSummary> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(UserPerformanceSummary::getUserId, UserPerformanceSummary::getToRelease, UserPerformanceSummary::getToSettle, UserPerformanceSummary::getNetAmount, UserPerformanceSummary::getId);
List<UserPerformanceSummary> userPerformanceSummaryList = userPerformanceSummaryService.list(lambdaQueryWrapper);
for (UserPerformanceSummary userPerformanceSummary : userPerformanceSummaryList) {
Long userId = userPerformanceSummary.getUserId();
BigDecimal toSettleAmount = toSettleMap.get(userId);

View File

@ -0,0 +1,40 @@
package com.greenorange.promotion.model.dto.withdrawalApply;
import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.WithdrawStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 提现申请记录审核请求体
*/
@Data
@Schema(description = "提现申请记录审核请求体", requiredProperties = {
"id", "withdrawalStatus"
})
public class WithdrawalApplyReviewRequest implements Serializable {
/**
* 提现申请ID
*/
@Min(value = 1L, message = "提现申请ID ID不能小于1")
@Schema(description = "提现申请ID", example = "1")
private Long id;
/**
* 提现状态[提现中(processing)|提现成功(success)|提现失败(failed)]
*/
@EnumValue(enumClass = WithdrawStatusEnum.class)
@Schema(description = "提现状态[提现中(processing)|提现成功(success)|提现失败(failed)]", example = "processing")
private String withdrawalStatus;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -256,7 +256,7 @@ public class ProjectCommissionServiceImpl extends ServiceImpl<ProjectCommissionM
LambdaQueryWrapper<ProjectCommission> projectCommissionLambdaQueryWrapper = new LambdaQueryWrapper<>();
projectCommissionLambdaQueryWrapper.eq(ProjectCommission::getUserId, userId);
projectCommissionLambdaQueryWrapper.select(ProjectCommission::getProjectDetailId);
projectCommissionLambdaQueryWrapper.select(ProjectCommission::getProjectDetailId, ProjectCommission::getId);
List<ProjectCommission> projectCommissionList = this.list(projectCommissionLambdaQueryWrapper);
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetFieldWithSpecificFields(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, ProjectDetail::getId,
@ -287,7 +287,7 @@ public class ProjectCommissionServiceImpl extends ServiceImpl<ProjectCommissionM
// 修改下级用户的项目明细抽佣比例
LambdaQueryWrapper<SubUserProjectCommission> subUserProjectCommissionLambdaQueryWrapper = new LambdaQueryWrapper<>();
subUserProjectCommissionLambdaQueryWrapper.eq(SubUserProjectCommission::getUserId, userId);
subUserProjectCommissionLambdaQueryWrapper.select(SubUserProjectCommission::getProjectDetailId);
subUserProjectCommissionLambdaQueryWrapper.select(SubUserProjectCommission::getProjectDetailId, SubUserProjectCommission::getId);
List<SubUserProjectCommission> subUserProjectCommissionList = subUserProjectCommissionService.list(subUserProjectCommissionLambdaQueryWrapper);
for (SubUserProjectCommission subUserProjectCommission : subUserProjectCommissionList) {
Long projectDetailId = subUserProjectCommission.getProjectDetailId();

View File

@ -223,9 +223,14 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
// 生成邀请二维码
String invitationQrcode = generateInvitationQrcode(myUserInfo.getInvitationCode(), userRoleEnum);
// 添加用户主要信息
UserMainInfo userMainInfo = UserMainInfo.builder().userId(myUserInfo.getId()).inviteQrCode(invitationQrcode).build();
userMainInfoService.save(userMainInfo);
// 更新上级用户团队人数
updateParentUserInfoTeamCount(parentUserInfo.getId());
// 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
saveBatchProjectCommissionAndSubUserProjectCommission(myUserInfo.getId(), parentUserInfo.getId());
}
@ -461,11 +466,16 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
// 生成邀请二维码
String invitationQrcode = generateInvitationQrcode(myUserInfo.getInvitationCode(), UserRoleEnum.STAFF);
// 添加用户主要信息
UserMainInfo userMainInfo = UserMainInfo.builder().userId(myUserInfo.getId()).inviteQrCode(invitationQrcode).build();
userMainInfoService.save(userMainInfo);
// // 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
// saveBatchProjectCommissionAndSubUserProjectCommission(myUserInfo.getId(), parentUserInfo.getId());
// 更新上级用户团队人数
updateParentUserInfoTeamCount(parentUserInfo.getId());
// 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
saveBatchProjectCommissionAndSubUserProjectCommission(myUserInfo.getId(), parentUserInfo.getId());
// 修改晋升申请记录的审核状态并绑定申请成功的用户id
LambdaUpdateWrapper<AdvancementApply> advancementApplyLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
@ -513,7 +523,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
@Override
public LambdaQueryWrapper<UserInfo> getMiniUserInfoQueryWrapper() {
LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
userInfoLambdaQueryWrapper.in(UserInfo::getUserRole, UserRoleEnum.USER, UserRoleEnum.MANAGER, UserRoleEnum.SUPERVISOR, UserRoleEnum.STAFF);
userInfoLambdaQueryWrapper.in(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE, UserConstant.STAFF_ROLE, UserConstant.SUPERVISOR_ROLE, UserConstant.MANAGER_ROLE);
return userInfoLambdaQueryWrapper;
}
@ -533,16 +543,13 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
/**
* 批量更新父级用户团队人数
*/
private UserMainInfo updateParentUserInfoTeamCount(Long userId) {
UserMainInfo userMainInfo = new UserMainInfo();
userMainInfo.setUserId(userId);
private void updateParentUserInfoTeamCount(Long userId) {
List<Long> pathToRoot = this.findPathToRoot(userId);
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(pathToRoot, userMainInfoService, id -> id, UserMainInfo::getUserId);
for (UserMainInfo mainInfo : userMainInfoList) {
mainInfo.setTeamSize(mainInfo.getTeamSize() + 1);
}
userMainInfoService.updateBatchById(userMainInfoList);
return userMainInfo;
}

View File

@ -121,7 +121,8 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
param.put("page", "pages/loginModule/register/register");
param.put("scene", inviteCode + "=" + userRoleEnum.getValue());
param.put("width", 430);
param.put("env_version", "release");
param.put("check_path", false);
param.put("env_version", "develop");
String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken;
String jsonParams = JSONUtil.toJsonStr(param);
byte[] responseBytes = HttpUtil.createPost(url)

View File

@ -1,4 +1,4 @@
spring:
profiles:
active: test
active: graduation