完善了web端和小程序端查询客户下单记录接口
This commit is contained in:
@ -5,7 +5,9 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.greenorange.promotion.mapper")
|
||||
public class GreenOrangeApplication {
|
||||
|
@ -17,6 +17,7 @@ import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.Cour
|
||||
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.model.entity.UserPerformanceSummary;
|
||||
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import com.greenorange.promotion.model.vo.coursePromotionCommissionPending.CoursePromotionCommissionPendingVO;
|
||||
@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -59,96 +61,99 @@ public class CoursePromotionCommissionPendingController {
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端根据(一级)(二级)用户id查询课程推广待提成记录
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("query/userId")
|
||||
@Operation(summary = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录", description = "参数:无,权限:管理员,方法名:queryCoursePromotionCommissionPendingByUserId")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程推广待提成记录管理", content = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录")
|
||||
public BaseResponse<List<CoursePromotionCommissionPendingVO>> queryCoursePromotionCommissionPendingByUserId(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
UserInfo userInfo = userInfoService.getById(userId);
|
||||
String userRole = userInfo.getUserRole();
|
||||
UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||
LambdaQueryWrapper<CoursePromotionCommissionPending> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (UserRoleEnum.SUPERVISOR.equals(userRoleEnum)) {
|
||||
lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getFirstUserId, userId);
|
||||
}else if (UserRoleEnum.STAFF.equals(userRoleEnum)) {
|
||||
lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getSecondUserId, userId);
|
||||
} else {
|
||||
throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
|
||||
}
|
||||
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = coursePromotionCommissionPendingService.list(lambdaQueryWrapper);
|
||||
List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOS = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
||||
return ResultUtils.success(coursePromotionCommissionPendingVOS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员根据id查询课程推广待提成记录
|
||||
* @param commonRequest 课程推广待提成记录id
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("query/id")
|
||||
@Operation(summary = "web端管理员根据id查询课程推广待提成记录", description = "参数:课程推广待提成记录id,权限:管理员,方法名:queryCoursePromotionCommissionPendingById")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id查询课程推广待提成记录")
|
||||
public BaseResponse<CoursePromotionCommissionPendingVO> queryCoursePromotionCommissionPendingById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
||||
CoursePromotionCommissionPendingVO coursePromotionCommissionPendingVO = commonService.copyProperties(coursePromotionCommissionPending, CoursePromotionCommissionPendingVO.class);
|
||||
return ResultUtils.success(coursePromotionCommissionPendingVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员根据id修改课程推广待提成记录状态
|
||||
* @param commonRequest 课程推广待提成记录id
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "web端管理员根据id修改课程推广待提成记录状态", description = "参数:课程推广待提成记录id,权限:管理员,方法名:modifyCoursePromotionCommissionPendingStatus")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id修改课程推广待提成记录状态")
|
||||
public BaseResponse<Boolean> modifyCoursePromotionCommissionPendingStatus(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
||||
String commissionStatus = coursePromotionCommissionPending.getCommissionStatus();
|
||||
ThrowUtils.throwIf(!commissionStatus.equals(CommissionStatusEnum.PENDING.getValue()), ErrorCode.OPERATION_ERROR, "课程推广待提成记录状态错误");
|
||||
LambdaUpdateWrapper<CoursePromotionCommissionPending> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CoursePromotionCommissionPending::getId, id).set(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.COMPLETED.getValue());
|
||||
coursePromotionCommissionPendingService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员分页查询课程推广待提成记录
|
||||
* @param coursePromotionCommissionPendingQueryRequest 课程推广待提成记录查询请求体
|
||||
* @return 课程推广待提成记录列表
|
||||
*/
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询课程推广待提成记录", description = "参数:课程推广待提成记录查询请求体,权限:管理员,方法名:listCoursePromotionCommissionPendingByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程推广待提成记录管理", content = "Web端管理员分页查询课程推广待提成记录")
|
||||
public BaseResponse<Page<CoursePromotionCommissionPendingVO>> listCoursePromotionCommissionPendingByPage(@Valid @RequestBody CoursePromotionCommissionPendingQueryRequest coursePromotionCommissionPendingQueryRequest) {
|
||||
long current = coursePromotionCommissionPendingQueryRequest.getCurrent();
|
||||
long pageSize = coursePromotionCommissionPendingQueryRequest.getPageSize();
|
||||
QueryWrapper<CoursePromotionCommissionPending> queryWrapper = coursePromotionCommissionPendingService.getQueryWrapper(coursePromotionCommissionPendingQueryRequest);
|
||||
Page<CoursePromotionCommissionPending> page = coursePromotionCommissionPendingService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = page.getRecords();
|
||||
List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOList = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
||||
Page<CoursePromotionCommissionPendingVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(coursePromotionCommissionPendingVOList);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 小程序端根据(一级)(二级)用户id查询课程推广待提成记录
|
||||
// * @return 是否修改成功
|
||||
// */
|
||||
// @PostMapping("query/userId")
|
||||
// @Operation(summary = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录", description = "参数:无,权限:管理员,方法名:queryCoursePromotionCommissionPendingByUserId")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "课程推广待提成记录管理", content = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录")
|
||||
// public BaseResponse<List<CoursePromotionCommissionPendingVO>> queryCoursePromotionCommissionPendingByUserId(HttpServletRequest request) {
|
||||
// Long userId = (Long) request.getAttribute("userId");
|
||||
// UserInfo userInfo = userInfoService.getById(userId);
|
||||
// String userRole = userInfo.getUserRole();
|
||||
// UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||
// LambdaQueryWrapper<CoursePromotionCommissionPending> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// if (UserRoleEnum.SUPERVISOR.equals(userRoleEnum)) {
|
||||
// lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getFirstUserId, userId);
|
||||
// }else if (UserRoleEnum.STAFF.equals(userRoleEnum)) {
|
||||
// lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getSecondUserId, userId);
|
||||
// } else {
|
||||
// throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
|
||||
// }
|
||||
// List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = coursePromotionCommissionPendingService.list(lambdaQueryWrapper);
|
||||
// List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOS = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
||||
// return ResultUtils.success(coursePromotionCommissionPendingVOS);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * web端管理员根据id查询课程推广待提成记录
|
||||
// * @param commonRequest 课程推广待提成记录id
|
||||
// * @return 是否修改成功
|
||||
// */
|
||||
// @PostMapping("query/id")
|
||||
// @Operation(summary = "web端管理员根据id查询课程推广待提成记录", description = "参数:课程推广待提成记录id,权限:管理员,方法名:queryCoursePromotionCommissionPendingById")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id查询课程推广待提成记录")
|
||||
// public BaseResponse<CoursePromotionCommissionPendingVO> queryCoursePromotionCommissionPendingById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// Long id = commonRequest.getId();
|
||||
// CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
||||
// CoursePromotionCommissionPendingVO coursePromotionCommissionPendingVO = commonService.copyProperties(coursePromotionCommissionPending, CoursePromotionCommissionPendingVO.class);
|
||||
// return ResultUtils.success(coursePromotionCommissionPendingVO);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * web端管理员根据id修改课程推广待提成记录状态
|
||||
// * @param commonRequest 课程推广待提成记录id
|
||||
// * @return 是否修改成功
|
||||
// */
|
||||
// @PostMapping("update")
|
||||
// @Operation(summary = "web端管理员根据id修改课程推广待提成记录状态", description = "参数:课程推广待提成记录id,权限:管理员,方法名:modifyCoursePromotionCommissionPendingStatus")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id修改课程推广待提成记录状态")
|
||||
// public BaseResponse<Boolean> modifyCoursePromotionCommissionPendingStatus(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// Long id = commonRequest.getId();
|
||||
// CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
||||
// String commissionStatus = coursePromotionCommissionPending.getCommissionStatus();
|
||||
// ThrowUtils.throwIf(!commissionStatus.equals(CommissionStatusEnum.PENDING.getValue()), ErrorCode.OPERATION_ERROR, "课程推广待提成记录状态错误");
|
||||
// LambdaUpdateWrapper<CoursePromotionCommissionPending> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
// updateWrapper.eq(CoursePromotionCommissionPending::getId, id).set(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.COMPLETED.getValue());
|
||||
// coursePromotionCommissionPendingService.update(updateWrapper);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Web端管理员分页查询课程推广待提成记录
|
||||
// * @param coursePromotionCommissionPendingQueryRequest 课程推广待提成记录查询请求体
|
||||
// * @return 课程推广待提成记录列表
|
||||
// */
|
||||
// @PostMapping("page")
|
||||
// @Operation(summary = "Web端管理员分页查询课程推广待提成记录", description = "参数:课程推广待提成记录查询请求体,权限:管理员,方法名:listCoursePromotionCommissionPendingByPage")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "课程推广待提成记录管理", content = "Web端管理员分页查询课程推广待提成记录")
|
||||
// public BaseResponse<Page<CoursePromotionCommissionPendingVO>> listCoursePromotionCommissionPendingByPage(@Valid @RequestBody CoursePromotionCommissionPendingQueryRequest coursePromotionCommissionPendingQueryRequest) {
|
||||
// long current = coursePromotionCommissionPendingQueryRequest.getCurrent();
|
||||
// long pageSize = coursePromotionCommissionPendingQueryRequest.getPageSize();
|
||||
// QueryWrapper<CoursePromotionCommissionPending> queryWrapper = coursePromotionCommissionPendingService.getQueryWrapper(coursePromotionCommissionPendingQueryRequest);
|
||||
// Page<CoursePromotionCommissionPending> page = coursePromotionCommissionPendingService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
// List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = page.getRecords();
|
||||
// List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOList = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
||||
// Page<CoursePromotionCommissionPendingVO> voPage = new Page<>(current, pageSize);
|
||||
// voPage.setRecords(coursePromotionCommissionPendingVOList);
|
||||
// voPage.setPages(page.getPages());
|
||||
// voPage.setTotal(page.getTotal());
|
||||
// return ResultUtils.success(voPage);
|
||||
// }
|
||||
}
|
@ -2,6 +2,7 @@ package com.greenorange.promotion.controller.userInfo;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.hash.Hash;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -18,6 +19,7 @@ import com.greenorange.promotion.model.entity.*;
|
||||
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderBaseInfoVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderDetailInfoVO;
|
||||
import com.greenorange.promotion.model.vo.userPerformanceSummary.SupervisorPerformanceSummaryVO;
|
||||
import com.greenorange.promotion.model.vo.userPerformanceSummary.UserPerformanceSummaryDetailVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
@ -33,6 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -180,7 +183,7 @@ public class UserPerformanceSummaryController {
|
||||
@PostMapping("user/page")
|
||||
@Operation(summary = "Web端管理员根据员工id分页查询客户订单汇总", description = "参数:用户绩效汇总查询请求体,权限:管理员,方法名:listUserPerformanceSummaryByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Page<CourseOrderBaseInfoVO>> listUserPerformanceSummaryByPage(@Valid @RequestBody UserCourseOrderQueryRequest userPerformanceSummaryQueryRequest) {
|
||||
public BaseResponse<Page<CourseOrderDetailInfoVO>> listUserPerformanceSummaryByPage(@Valid @RequestBody UserCourseOrderQueryRequest userPerformanceSummaryQueryRequest) {
|
||||
long current = userPerformanceSummaryQueryRequest.getCurrent();
|
||||
long pageSize = userPerformanceSummaryQueryRequest.getPageSize();
|
||||
Long staffUserId = userPerformanceSummaryQueryRequest.getStaffUserId();
|
||||
@ -194,19 +197,33 @@ public class UserPerformanceSummaryController {
|
||||
|
||||
Page<CourseOrder> page = courseOrderService.page(new Page<>(current, pageSize), courseOrderQueryWrapper);
|
||||
List<CourseOrder> courseOrderList = page.getRecords();
|
||||
List<CourseOrderBaseInfoVO> courseOrderBaseInfoVOS = commonService.convertList(courseOrderList, CourseOrderBaseInfoVO.class);
|
||||
List<CourseOrderDetailInfoVO> courseOrderDetailInfoVOS = commonService.convertList(courseOrderList, CourseOrderDetailInfoVO.class);
|
||||
|
||||
// 封装Map集合(键:用户id, 值:用户信息)
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||
for (CourseOrderBaseInfoVO courseOrderBaseInfoVO : courseOrderBaseInfoVOS) {
|
||||
UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVO.getUserId());
|
||||
courseOrderBaseInfoVO.setNickName(userInfo.getNickName());
|
||||
courseOrderBaseInfoVO.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
for (CourseOrderDetailInfoVO courseOrderBaseInfoVOS : courseOrderDetailInfoVOS) {
|
||||
UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVOS.getUserId());
|
||||
courseOrderBaseInfoVOS.setNickName(userInfo.getNickName());
|
||||
courseOrderBaseInfoVOS.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
}
|
||||
|
||||
Page<CourseOrderBaseInfoVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(courseOrderBaseInfoVOS);
|
||||
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = commonService.findByFieldInTargetField(courseOrderList, coursePromotionCommissionPendingService, CourseOrder::getId, CoursePromotionCommissionPending::getOrderId);
|
||||
// 封装Map集合(键:用户id, 值:课程推广待提成记录)
|
||||
Map<Long, CoursePromotionCommissionPending> coursePromotionCommissionPendingMap = new HashMap<>();
|
||||
for (CoursePromotionCommissionPending coursePromotionCommissionPending : coursePromotionCommissionPendingList) coursePromotionCommissionPendingMap.put(coursePromotionCommissionPending.getOrderId(), coursePromotionCommissionPending);
|
||||
for (CourseOrderDetailInfoVO courseOrderDetailInfoVO : courseOrderDetailInfoVOS) {
|
||||
Long orderId = courseOrderDetailInfoVO.getId();
|
||||
CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingMap.get(orderId);
|
||||
courseOrderDetailInfoVO.setFirstRate(coursePromotionCommissionPending.getFirstRate());
|
||||
courseOrderDetailInfoVO.setSecondRate(coursePromotionCommissionPending.getSecondRate());
|
||||
courseOrderDetailInfoVO.setFirstReward(coursePromotionCommissionPending.getFirstReward());
|
||||
courseOrderDetailInfoVO.setSecondReward(coursePromotionCommissionPending.getSecondReward());
|
||||
courseOrderDetailInfoVO.setCommissionStatus(coursePromotionCommissionPending.getCommissionStatus());
|
||||
}
|
||||
|
||||
Page<CourseOrderDetailInfoVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(courseOrderDetailInfoVOS);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
@ -374,18 +391,62 @@ public class UserPerformanceSummaryController {
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * Web端管理员一键结算
|
||||
// * @param rakeRewardsUpdateRequest 抽成比例更新请求体
|
||||
// * @return 是否更新成功
|
||||
// */
|
||||
// @PostMapping("update/rate")
|
||||
// @Operation(summary = "Web端管理员修改一、二级抽成比例", description = "参数:抽成比例更新请求体,权限:管理员,方法名:updateRakeRewardsRate")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// public BaseResponse<Boolean> updateRakeRewardsRate(@Valid @RequestBody RakeRewardsUpdateRequest rakeRewardsUpdateRequest) {
|
||||
// userPerformanceSummaryService.updateRakeRewards(rakeRewardsUpdateRequest);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
/**
|
||||
* Web端管理员一键结算
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
@PostMapping("unite/settle")
|
||||
@Operation(summary = "Web端管理员一键结算", description = "参数:无,权限:管理员,方法名:oneClickBilling")
|
||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
public BaseResponse<Boolean> oneClickBilling() {
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = userPerformanceSummaryService.list();
|
||||
for (UserPerformanceSummary userPerformanceSummary : userPerformanceSummaryList) {
|
||||
userPerformanceSummary.setSettled(userPerformanceSummary.getSettled().add(userPerformanceSummary.getToSettle()));
|
||||
userPerformanceSummary.setToSettle(BigDecimal.ZERO);
|
||||
}
|
||||
userPerformanceSummaryService.updateBatchById(userPerformanceSummaryList);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 轮询课程推广待提成记录表
|
||||
* cron 表达式:秒 分 时 日 月 周
|
||||
* 0 0 0 * * ?” = 每天 00:00:00 执行一次
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
@Operation(summary = "轮询课程推广待提成记录表", description = "参数:无,权限:管理员,方法名:pollCourseOrder")
|
||||
public void pollCourseOrder() {
|
||||
// 找出下单时间超过7天的订单,分别统计主管和员工的可结算金额
|
||||
Map<Long, BigDecimal> toSettleMap = new HashMap<>();
|
||||
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = commonService.findByFieldEqTargetField(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.PENDING.getValue(), coursePromotionCommissionPendingService);
|
||||
for (CoursePromotionCommissionPending coursePromotionCommissionPending : coursePromotionCommissionPendingList) {
|
||||
Date orderCreateTime = coursePromotionCommissionPending.getOrderCreateTime();
|
||||
Date now = DateUtil.date();
|
||||
// 计算两个时间相隔多少天(向下取整)
|
||||
long days = DateUtil.between(orderCreateTime, now, DateUnit.DAY);
|
||||
if (days >= 7) {
|
||||
coursePromotionCommissionPending.setCommissionStatus(CommissionStatusEnum.COMPLETED.getValue());
|
||||
toSettleMap.merge(coursePromotionCommissionPending.getFirstUserId(), coursePromotionCommissionPending.getFirstReward().multiply(SystemConstant.REFUND_RATE), BigDecimal::add);
|
||||
toSettleMap.merge(coursePromotionCommissionPending.getSecondUserId(), coursePromotionCommissionPending.getSecondReward().multiply(SystemConstant.REFUND_RATE), BigDecimal::add);
|
||||
}
|
||||
}
|
||||
coursePromotionCommissionPendingService.updateBatchById(coursePromotionCommissionPendingList);
|
||||
// 修改用户绩效汇总表
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = userPerformanceSummaryService.list();
|
||||
for (UserPerformanceSummary userPerformanceSummary : userPerformanceSummaryList) {
|
||||
Long userId = userPerformanceSummary.getUserId();
|
||||
BigDecimal toSettleAmount = toSettleMap.get(userId);
|
||||
if (toSettleAmount != null) {
|
||||
userPerformanceSummary.setToRelease(userPerformanceSummary.getToRelease().subtract(toSettleAmount));
|
||||
userPerformanceSummary.setToSettle(userPerformanceSummary.getToSettle().add(toSettleAmount));
|
||||
}
|
||||
}
|
||||
userPerformanceSummaryService.updateBatchById(userPerformanceSummaryList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -522,7 +583,7 @@ public class UserPerformanceSummaryController {
|
||||
@PostMapping("query/user")
|
||||
@Operation(summary = "小程序端员工查询客户下单汇总", description = "参数:员工绩效汇总查询请求体,权限:管理员,方法名:miniListUserPerformanceSummary")
|
||||
@RequiresPermission(mustRole = UserConstant.STAFF_ROLE)
|
||||
public BaseResponse<List<CourseOrderBaseInfoVO>> miniListUserPerformanceSummary(@Valid @RequestBody MiniUserCourseOrderQueryRequest miniUserCourseOrderQueryRequest) {
|
||||
public BaseResponse<List<CourseOrderDetailInfoVO>> miniListUserPerformanceSummary(@Valid @RequestBody MiniUserCourseOrderQueryRequest miniUserCourseOrderQueryRequest) {
|
||||
String orderNumber = miniUserCourseOrderQueryRequest.getOrderNumber();
|
||||
Long staffUserId = miniUserCourseOrderQueryRequest.getStaffUserId();
|
||||
QueryWrapper<CourseOrder> courseOrderQueryWrapper = new QueryWrapper<>();
|
||||
@ -534,17 +595,32 @@ public class UserPerformanceSummaryController {
|
||||
courseOrderQueryWrapper.in("userId", ids);
|
||||
|
||||
List<CourseOrder> courseOrderList = courseOrderService.list(courseOrderQueryWrapper);
|
||||
List<CourseOrderBaseInfoVO> courseOrderBaseInfoVOS = commonService.convertList(courseOrderList, CourseOrderBaseInfoVO.class);
|
||||
List<CourseOrderDetailInfoVO> courseOrderDetailInfoVOS = commonService.convertList(courseOrderList, CourseOrderDetailInfoVO.class);
|
||||
|
||||
// 封装Map集合(键:用户id, 值:用户信息)
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||
for (CourseOrderBaseInfoVO courseOrderBaseInfoVO : courseOrderBaseInfoVOS) {
|
||||
UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVO.getUserId());
|
||||
courseOrderBaseInfoVO.setNickName(userInfo.getNickName());
|
||||
courseOrderBaseInfoVO.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
for (CourseOrderDetailInfoVO courseOrderBaseInfoVOS : courseOrderDetailInfoVOS) {
|
||||
UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVOS.getUserId());
|
||||
courseOrderBaseInfoVOS.setNickName(userInfo.getNickName());
|
||||
courseOrderBaseInfoVOS.setPhoneNumber(userInfo.getPhoneNumber());
|
||||
}
|
||||
return ResultUtils.success(courseOrderBaseInfoVOS);
|
||||
|
||||
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = commonService.findByFieldInTargetField(courseOrderList, coursePromotionCommissionPendingService, CourseOrder::getId, CoursePromotionCommissionPending::getOrderId);
|
||||
// 封装Map集合(键:用户id, 值:课程推广待提成记录)
|
||||
Map<Long, CoursePromotionCommissionPending> coursePromotionCommissionPendingMap = new HashMap<>();
|
||||
for (CoursePromotionCommissionPending coursePromotionCommissionPending : coursePromotionCommissionPendingList) coursePromotionCommissionPendingMap.put(coursePromotionCommissionPending.getOrderId(), coursePromotionCommissionPending);
|
||||
for (CourseOrderDetailInfoVO courseOrderDetailInfoVO : courseOrderDetailInfoVOS) {
|
||||
Long orderId = courseOrderDetailInfoVO.getId();
|
||||
CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingMap.get(orderId);
|
||||
courseOrderDetailInfoVO.setFirstRate(coursePromotionCommissionPending.getFirstRate());
|
||||
courseOrderDetailInfoVO.setSecondRate(coursePromotionCommissionPending.getSecondRate());
|
||||
courseOrderDetailInfoVO.setFirstReward(coursePromotionCommissionPending.getFirstReward());
|
||||
courseOrderDetailInfoVO.setSecondReward(coursePromotionCommissionPending.getSecondReward());
|
||||
courseOrderDetailInfoVO.setCommissionStatus(coursePromotionCommissionPending.getCommissionStatus());
|
||||
}
|
||||
|
||||
return ResultUtils.success(courseOrderDetailInfoVOS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.greenorange.promotion.model.vo.courseOrder;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@ -58,4 +59,7 @@ public class CourseOrderBaseInfoVO implements Serializable {
|
||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.greenorange.promotion.model.vo.courseOrder;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@ -57,4 +58,7 @@ public class CourseOrderCardVO implements Serializable {
|
||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
package com.greenorange.promotion.model.vo.courseOrder;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CourseOrderDetailInfoVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 课程订单ID
|
||||
*/
|
||||
@Schema(description = "课程订单ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Schema(description = "昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202506241339232334d234234243")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "100.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 订单状态[交易关闭,交易成功,待支付,已退款]
|
||||
*/
|
||||
@Schema(description = "订单状态[交易关闭,交易成功,待支付,已退款]", example = "交易成功")
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 一级抽佣比例
|
||||
*/
|
||||
@Schema(description = "一级抽佣比例", example = "0.05")
|
||||
private BigDecimal firstRate;
|
||||
|
||||
/**
|
||||
* 二级抽佣比例
|
||||
*/
|
||||
@Schema(description = "二级抽佣比例", example = "0.05")
|
||||
private BigDecimal secondRate;
|
||||
|
||||
/**
|
||||
* 一级抽成奖励
|
||||
*/
|
||||
@Schema(description = "一级抽成奖励", example = "5.00")
|
||||
private BigDecimal firstReward;
|
||||
|
||||
/**
|
||||
* 二级抽成奖励
|
||||
*/
|
||||
@Schema(description = "二级抽成奖励", example = "5.00")
|
||||
private BigDecimal secondReward;
|
||||
|
||||
/**
|
||||
* 提成状态
|
||||
*/
|
||||
@Schema(description = "提成状态", example = "待提成")
|
||||
private String commissionStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -38,8 +38,8 @@ spring:
|
||||
|
||||
#文件上传和下载地址
|
||||
file:
|
||||
# upload-dir: /www/wwwroot/fileUpload_qc/
|
||||
upload-dir: D:/qingcheng/image/
|
||||
upload-dir: /www/wwwroot/fileUpload_qc/
|
||||
# upload-dir: D:/qingcheng/image/
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user