完善了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.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
@EnableScheduling
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@MapperScan("com.greenorange.promotion.mapper")
|
@MapperScan("com.greenorange.promotion.mapper")
|
||||||
public class GreenOrangeApplication {
|
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.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingUpdateRequest;
|
||||||
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||||
import com.greenorange.promotion.model.entity.UserInfo;
|
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.CommissionStatusEnum;
|
||||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||||
import com.greenorange.promotion.model.vo.coursePromotionCommissionPending.CoursePromotionCommissionPendingVO;
|
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 org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@ -59,96 +61,99 @@ public class CoursePromotionCommissionPendingController {
|
|||||||
private UserInfoService userInfoService;
|
private UserInfoService userInfoService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 小程序端根据(一级)(二级)用户id查询课程推广待提成记录
|
|
||||||
* @return 是否修改成功
|
//
|
||||||
*/
|
// /**
|
||||||
@PostMapping("query/userId")
|
// * 小程序端根据(一级)(二级)用户id查询课程推广待提成记录
|
||||||
@Operation(summary = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录", description = "参数:无,权限:管理员,方法名:queryCoursePromotionCommissionPendingByUserId")
|
// * @return 是否修改成功
|
||||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
// */
|
||||||
@SysLog(title = "课程推广待提成记录管理", content = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录")
|
// @PostMapping("query/userId")
|
||||||
public BaseResponse<List<CoursePromotionCommissionPendingVO>> queryCoursePromotionCommissionPendingByUserId(HttpServletRequest request) {
|
// @Operation(summary = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录", description = "参数:无,权限:管理员,方法名:queryCoursePromotionCommissionPendingByUserId")
|
||||||
Long userId = (Long) request.getAttribute("userId");
|
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||||
UserInfo userInfo = userInfoService.getById(userId);
|
// @SysLog(title = "课程推广待提成记录管理", content = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录")
|
||||||
String userRole = userInfo.getUserRole();
|
// public BaseResponse<List<CoursePromotionCommissionPendingVO>> queryCoursePromotionCommissionPendingByUserId(HttpServletRequest request) {
|
||||||
UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
// Long userId = (Long) request.getAttribute("userId");
|
||||||
LambdaQueryWrapper<CoursePromotionCommissionPending> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
// UserInfo userInfo = userInfoService.getById(userId);
|
||||||
if (UserRoleEnum.SUPERVISOR.equals(userRoleEnum)) {
|
// String userRole = userInfo.getUserRole();
|
||||||
lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getFirstUserId, userId);
|
// UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||||
}else if (UserRoleEnum.STAFF.equals(userRoleEnum)) {
|
// LambdaQueryWrapper<CoursePromotionCommissionPending> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getSecondUserId, userId);
|
// if (UserRoleEnum.SUPERVISOR.equals(userRoleEnum)) {
|
||||||
} else {
|
// lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getFirstUserId, userId);
|
||||||
throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
|
// }else if (UserRoleEnum.STAFF.equals(userRoleEnum)) {
|
||||||
}
|
// lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getSecondUserId, userId);
|
||||||
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = coursePromotionCommissionPendingService.list(lambdaQueryWrapper);
|
// } else {
|
||||||
List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOS = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
// throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
|
||||||
return ResultUtils.success(coursePromotionCommissionPendingVOS);
|
// }
|
||||||
}
|
// List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = coursePromotionCommissionPendingService.list(lambdaQueryWrapper);
|
||||||
|
// List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOS = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
||||||
|
// return ResultUtils.success(coursePromotionCommissionPendingVOS);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
//
|
||||||
* web端管理员根据id查询课程推广待提成记录
|
//
|
||||||
* @param commonRequest 课程推广待提成记录id
|
//
|
||||||
* @return 是否修改成功
|
// /**
|
||||||
*/
|
// * web端管理员根据id查询课程推广待提成记录
|
||||||
@PostMapping("query/id")
|
// * @param commonRequest 课程推广待提成记录id
|
||||||
@Operation(summary = "web端管理员根据id查询课程推广待提成记录", description = "参数:课程推广待提成记录id,权限:管理员,方法名:queryCoursePromotionCommissionPendingById")
|
// * @return 是否修改成功
|
||||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
// */
|
||||||
@SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id查询课程推广待提成记录")
|
// @PostMapping("query/id")
|
||||||
public BaseResponse<CoursePromotionCommissionPendingVO> queryCoursePromotionCommissionPendingById(@Valid @RequestBody CommonRequest commonRequest) {
|
// @Operation(summary = "web端管理员根据id查询课程推广待提成记录", description = "参数:课程推广待提成记录id,权限:管理员,方法名:queryCoursePromotionCommissionPendingById")
|
||||||
Long id = commonRequest.getId();
|
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||||
CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
// @SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id查询课程推广待提成记录")
|
||||||
CoursePromotionCommissionPendingVO coursePromotionCommissionPendingVO = commonService.copyProperties(coursePromotionCommissionPending, CoursePromotionCommissionPendingVO.class);
|
// public BaseResponse<CoursePromotionCommissionPendingVO> queryCoursePromotionCommissionPendingById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||||
return ResultUtils.success(coursePromotionCommissionPendingVO);
|
// 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 是否修改成功
|
// /**
|
||||||
*/
|
// * web端管理员根据id修改课程推广待提成记录状态
|
||||||
@PostMapping("update")
|
// * @param commonRequest 课程推广待提成记录id
|
||||||
@Operation(summary = "web端管理员根据id修改课程推广待提成记录状态", description = "参数:课程推广待提成记录id,权限:管理员,方法名:modifyCoursePromotionCommissionPendingStatus")
|
// * @return 是否修改成功
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
// */
|
||||||
@SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id修改课程推广待提成记录状态")
|
// @PostMapping("update")
|
||||||
public BaseResponse<Boolean> modifyCoursePromotionCommissionPendingStatus(@Valid @RequestBody CommonRequest commonRequest) {
|
// @Operation(summary = "web端管理员根据id修改课程推广待提成记录状态", description = "参数:课程推广待提成记录id,权限:管理员,方法名:modifyCoursePromotionCommissionPendingStatus")
|
||||||
Long id = commonRequest.getId();
|
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
// @SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id修改课程推广待提成记录状态")
|
||||||
String commissionStatus = coursePromotionCommissionPending.getCommissionStatus();
|
// public BaseResponse<Boolean> modifyCoursePromotionCommissionPendingStatus(@Valid @RequestBody CommonRequest commonRequest) {
|
||||||
ThrowUtils.throwIf(!commissionStatus.equals(CommissionStatusEnum.PENDING.getValue()), ErrorCode.OPERATION_ERROR, "课程推广待提成记录状态错误");
|
// Long id = commonRequest.getId();
|
||||||
LambdaUpdateWrapper<CoursePromotionCommissionPending> updateWrapper = new LambdaUpdateWrapper<>();
|
// CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
||||||
updateWrapper.eq(CoursePromotionCommissionPending::getId, id).set(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.COMPLETED.getValue());
|
// String commissionStatus = coursePromotionCommissionPending.getCommissionStatus();
|
||||||
coursePromotionCommissionPendingService.update(updateWrapper);
|
// ThrowUtils.throwIf(!commissionStatus.equals(CommissionStatusEnum.PENDING.getValue()), ErrorCode.OPERATION_ERROR, "课程推广待提成记录状态错误");
|
||||||
return ResultUtils.success(true);
|
// 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 课程推广待提成记录列表
|
// /**
|
||||||
*/
|
// * Web端管理员分页查询课程推广待提成记录
|
||||||
@PostMapping("page")
|
// * @param coursePromotionCommissionPendingQueryRequest 课程推广待提成记录查询请求体
|
||||||
@Operation(summary = "Web端管理员分页查询课程推广待提成记录", description = "参数:课程推广待提成记录查询请求体,权限:管理员,方法名:listCoursePromotionCommissionPendingByPage")
|
// * @return 课程推广待提成记录列表
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
// */
|
||||||
@SysLog(title = "课程推广待提成记录管理", content = "Web端管理员分页查询课程推广待提成记录")
|
// @PostMapping("page")
|
||||||
public BaseResponse<Page<CoursePromotionCommissionPendingVO>> listCoursePromotionCommissionPendingByPage(@Valid @RequestBody CoursePromotionCommissionPendingQueryRequest coursePromotionCommissionPendingQueryRequest) {
|
// @Operation(summary = "Web端管理员分页查询课程推广待提成记录", description = "参数:课程推广待提成记录查询请求体,权限:管理员,方法名:listCoursePromotionCommissionPendingByPage")
|
||||||
long current = coursePromotionCommissionPendingQueryRequest.getCurrent();
|
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
long pageSize = coursePromotionCommissionPendingQueryRequest.getPageSize();
|
// @SysLog(title = "课程推广待提成记录管理", content = "Web端管理员分页查询课程推广待提成记录")
|
||||||
QueryWrapper<CoursePromotionCommissionPending> queryWrapper = coursePromotionCommissionPendingService.getQueryWrapper(coursePromotionCommissionPendingQueryRequest);
|
// public BaseResponse<Page<CoursePromotionCommissionPendingVO>> listCoursePromotionCommissionPendingByPage(@Valid @RequestBody CoursePromotionCommissionPendingQueryRequest coursePromotionCommissionPendingQueryRequest) {
|
||||||
Page<CoursePromotionCommissionPending> page = coursePromotionCommissionPendingService.page(new Page<>(current, pageSize), queryWrapper);
|
// long current = coursePromotionCommissionPendingQueryRequest.getCurrent();
|
||||||
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = page.getRecords();
|
// long pageSize = coursePromotionCommissionPendingQueryRequest.getPageSize();
|
||||||
List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOList = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
// QueryWrapper<CoursePromotionCommissionPending> queryWrapper = coursePromotionCommissionPendingService.getQueryWrapper(coursePromotionCommissionPendingQueryRequest);
|
||||||
Page<CoursePromotionCommissionPendingVO> voPage = new Page<>(current, pageSize);
|
// Page<CoursePromotionCommissionPending> page = coursePromotionCommissionPendingService.page(new Page<>(current, pageSize), queryWrapper);
|
||||||
voPage.setRecords(coursePromotionCommissionPendingVOList);
|
// List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = page.getRecords();
|
||||||
voPage.setPages(page.getPages());
|
// List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOList = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
||||||
voPage.setTotal(page.getTotal());
|
// Page<CoursePromotionCommissionPendingVO> voPage = new Page<>(current, pageSize);
|
||||||
return ResultUtils.success(voPage);
|
// 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.bean.BeanUtil;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.lang.hash.Hash;
|
import cn.hutool.core.lang.hash.Hash;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.CommissionStatusEnum;
|
||||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderBaseInfoVO;
|
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.SupervisorPerformanceSummaryVO;
|
||||||
import com.greenorange.promotion.model.vo.userPerformanceSummary.UserPerformanceSummaryDetailVO;
|
import com.greenorange.promotion.model.vo.userPerformanceSummary.UserPerformanceSummaryDetailVO;
|
||||||
import com.greenorange.promotion.service.common.CommonService;
|
import com.greenorange.promotion.service.common.CommonService;
|
||||||
@ -33,6 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
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.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -180,7 +183,7 @@ public class UserPerformanceSummaryController {
|
|||||||
@PostMapping("user/page")
|
@PostMapping("user/page")
|
||||||
@Operation(summary = "Web端管理员根据员工id分页查询客户订单汇总", description = "参数:用户绩效汇总查询请求体,权限:管理员,方法名:listUserPerformanceSummaryByPage")
|
@Operation(summary = "Web端管理员根据员工id分页查询客户订单汇总", description = "参数:用户绩效汇总查询请求体,权限:管理员,方法名:listUserPerformanceSummaryByPage")
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
@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 current = userPerformanceSummaryQueryRequest.getCurrent();
|
||||||
long pageSize = userPerformanceSummaryQueryRequest.getPageSize();
|
long pageSize = userPerformanceSummaryQueryRequest.getPageSize();
|
||||||
Long staffUserId = userPerformanceSummaryQueryRequest.getStaffUserId();
|
Long staffUserId = userPerformanceSummaryQueryRequest.getStaffUserId();
|
||||||
@ -194,19 +197,33 @@ public class UserPerformanceSummaryController {
|
|||||||
|
|
||||||
Page<CourseOrder> page = courseOrderService.page(new Page<>(current, pageSize), courseOrderQueryWrapper);
|
Page<CourseOrder> page = courseOrderService.page(new Page<>(current, pageSize), courseOrderQueryWrapper);
|
||||||
List<CourseOrder> courseOrderList = page.getRecords();
|
List<CourseOrder> courseOrderList = page.getRecords();
|
||||||
List<CourseOrderBaseInfoVO> courseOrderBaseInfoVOS = commonService.convertList(courseOrderList, CourseOrderBaseInfoVO.class);
|
List<CourseOrderDetailInfoVO> courseOrderDetailInfoVOS = commonService.convertList(courseOrderList, CourseOrderDetailInfoVO.class);
|
||||||
|
|
||||||
// 封装Map集合(键:用户id, 值:用户信息)
|
// 封装Map集合(键:用户id, 值:用户信息)
|
||||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||||
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||||
for (CourseOrderBaseInfoVO courseOrderBaseInfoVO : courseOrderBaseInfoVOS) {
|
for (CourseOrderDetailInfoVO courseOrderBaseInfoVOS : courseOrderDetailInfoVOS) {
|
||||||
UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVO.getUserId());
|
UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVOS.getUserId());
|
||||||
courseOrderBaseInfoVO.setNickName(userInfo.getNickName());
|
courseOrderBaseInfoVOS.setNickName(userInfo.getNickName());
|
||||||
courseOrderBaseInfoVO.setPhoneNumber(userInfo.getPhoneNumber());
|
courseOrderBaseInfoVOS.setPhoneNumber(userInfo.getPhoneNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
Page<CourseOrderBaseInfoVO> voPage = new Page<>(current, pageSize);
|
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = commonService.findByFieldInTargetField(courseOrderList, coursePromotionCommissionPendingService, CourseOrder::getId, CoursePromotionCommissionPending::getOrderId);
|
||||||
voPage.setRecords(courseOrderBaseInfoVOS);
|
// 封装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.setPages(page.getPages());
|
||||||
voPage.setTotal(page.getTotal());
|
voPage.setTotal(page.getTotal());
|
||||||
return ResultUtils.success(voPage);
|
return ResultUtils.success(voPage);
|
||||||
@ -374,18 +391,62 @@ public class UserPerformanceSummaryController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Web端管理员一键结算
|
* Web端管理员一键结算
|
||||||
// * @param rakeRewardsUpdateRequest 抽成比例更新请求体
|
* @return 是否更新成功
|
||||||
// * @return 是否更新成功
|
*/
|
||||||
// */
|
@PostMapping("unite/settle")
|
||||||
// @PostMapping("update/rate")
|
@Operation(summary = "Web端管理员一键结算", description = "参数:无,权限:管理员,方法名:oneClickBilling")
|
||||||
// @Operation(summary = "Web端管理员修改一、二级抽成比例", description = "参数:抽成比例更新请求体,权限:管理员,方法名:updateRakeRewardsRate")
|
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
public BaseResponse<Boolean> oneClickBilling() {
|
||||||
// public BaseResponse<Boolean> updateRakeRewardsRate(@Valid @RequestBody RakeRewardsUpdateRequest rakeRewardsUpdateRequest) {
|
List<UserPerformanceSummary> userPerformanceSummaryList = userPerformanceSummaryService.list();
|
||||||
// userPerformanceSummaryService.updateRakeRewards(rakeRewardsUpdateRequest);
|
for (UserPerformanceSummary userPerformanceSummary : userPerformanceSummaryList) {
|
||||||
// return ResultUtils.success(true);
|
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")
|
@PostMapping("query/user")
|
||||||
@Operation(summary = "小程序端员工查询客户下单汇总", description = "参数:员工绩效汇总查询请求体,权限:管理员,方法名:miniListUserPerformanceSummary")
|
@Operation(summary = "小程序端员工查询客户下单汇总", description = "参数:员工绩效汇总查询请求体,权限:管理员,方法名:miniListUserPerformanceSummary")
|
||||||
@RequiresPermission(mustRole = UserConstant.STAFF_ROLE)
|
@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();
|
String orderNumber = miniUserCourseOrderQueryRequest.getOrderNumber();
|
||||||
Long staffUserId = miniUserCourseOrderQueryRequest.getStaffUserId();
|
Long staffUserId = miniUserCourseOrderQueryRequest.getStaffUserId();
|
||||||
QueryWrapper<CourseOrder> courseOrderQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CourseOrder> courseOrderQueryWrapper = new QueryWrapper<>();
|
||||||
@ -534,17 +595,32 @@ public class UserPerformanceSummaryController {
|
|||||||
courseOrderQueryWrapper.in("userId", ids);
|
courseOrderQueryWrapper.in("userId", ids);
|
||||||
|
|
||||||
List<CourseOrder> courseOrderList = courseOrderService.list(courseOrderQueryWrapper);
|
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集合(键:用户id, 值:用户信息)
|
||||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||||
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
for (UserInfo userInfo : userInfoList) userInfoMap.put(userInfo.getId(), userInfo);
|
||||||
for (CourseOrderBaseInfoVO courseOrderBaseInfoVO : courseOrderBaseInfoVOS) {
|
for (CourseOrderDetailInfoVO courseOrderBaseInfoVOS : courseOrderDetailInfoVOS) {
|
||||||
UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVO.getUserId());
|
UserInfo userInfo = userInfoMap.get(courseOrderBaseInfoVOS.getUserId());
|
||||||
courseOrderBaseInfoVO.setNickName(userInfo.getNickName());
|
courseOrderBaseInfoVOS.setNickName(userInfo.getNickName());
|
||||||
courseOrderBaseInfoVO.setPhoneNumber(userInfo.getPhoneNumber());
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -58,4 +59,7 @@ public class CourseOrderBaseInfoVO implements Serializable {
|
|||||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||||
private Date createTime;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -57,4 +58,7 @@ public class CourseOrderCardVO implements Serializable {
|
|||||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||||
private Date createTime;
|
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:
|
file:
|
||||||
# upload-dir: /www/wwwroot/fileUpload_qc/
|
upload-dir: /www/wwwroot/fileUpload_qc/
|
||||||
upload-dir: D:/qingcheng/image/
|
# upload-dir: D:/qingcheng/image/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user