初步完成小程序端和web端的所有接口
This commit is contained in:
@ -27,6 +27,7 @@ import com.greenorange.promotion.service.userInfo.UserPerformanceSummaryService;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
@ -84,89 +85,7 @@ public class UserPerformanceSummaryController {
|
|||||||
@Operation(summary = "Web端仪表盘", description = "参数:无,权限:管理员,方法名:webQueryDashboard")
|
@Operation(summary = "Web端仪表盘", description = "参数:无,权限:管理员,方法名:webQueryDashboard")
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
public BaseResponse<WebQueryDashboardVO> webQueryDashboard() {
|
public BaseResponse<WebQueryDashboardVO> webQueryDashboard() {
|
||||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
WebQueryDashboardVO webQueryDashboardVO = userPerformanceSummaryService.queryManagerDashboard();
|
||||||
BigDecimal netAmount = BigDecimal.ZERO;
|
|
||||||
Integer promoCount = 0;
|
|
||||||
Integer superCount;
|
|
||||||
Integer empCount = 0;
|
|
||||||
Integer orderCount = 0;
|
|
||||||
BigDecimal toRelease = BigDecimal.ZERO;
|
|
||||||
BigDecimal toSettle = BigDecimal.ZERO;
|
|
||||||
BigDecimal settled = BigDecimal.ZERO;
|
|
||||||
BigDecimal refunded = BigDecimal.ZERO;
|
|
||||||
|
|
||||||
Integer todayOrderCount;
|
|
||||||
BigDecimal todayOrderAmount;
|
|
||||||
Integer todayRefundCount;
|
|
||||||
BigDecimal todayRefundAmount;
|
|
||||||
Integer todayPromotionCount;
|
|
||||||
|
|
||||||
Integer monthOrderCount;
|
|
||||||
BigDecimal monthOrderAmount;
|
|
||||||
Integer monthRefundCount;
|
|
||||||
BigDecimal monthRefundAmount;
|
|
||||||
Integer monthPromotionCount;
|
|
||||||
|
|
||||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.SUPERVISOR_ROLE, userInfoService);
|
|
||||||
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(userInfoList, userPerformanceSummaryService, UserInfo::getId, UserPerformanceSummary::getUserId);
|
|
||||||
superCount = userPerformanceSummaryList.size();
|
|
||||||
for (UserPerformanceSummary userPerformanceSummary : userPerformanceSummaryList) {
|
|
||||||
totalAmount = totalAmount.add(userPerformanceSummary.getTotalAmount());
|
|
||||||
netAmount = netAmount.add(userPerformanceSummary.getNetAmount());
|
|
||||||
promoCount += userPerformanceSummary.getPromoCount();
|
|
||||||
empCount += userPerformanceSummary.getEmpCount();
|
|
||||||
orderCount += userPerformanceSummary.getOrderCount();
|
|
||||||
toRelease = toRelease.add(userPerformanceSummary.getToRelease());
|
|
||||||
toSettle = toSettle.add(userPerformanceSummary.getToSettle());
|
|
||||||
settled = settled.add(userPerformanceSummary.getSettled());
|
|
||||||
refunded = refunded.add(userPerformanceSummary.getRefunded());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DateTime now = DateUtil.date();
|
|
||||||
|
|
||||||
// 查看今天的绩效
|
|
||||||
DateTime beginOfDay = DateUtil.beginOfDay(now);
|
|
||||||
DateTime endOfDay = DateUtil.endOfDay(now);
|
|
||||||
Map<String, Object> todayPerformanceSummary = userPerformanceSummaryService.getPerformanceSummaryByStartAndEndTime(beginOfDay, endOfDay);
|
|
||||||
todayOrderCount = (Integer) todayPerformanceSummary.get("orderCount");
|
|
||||||
todayOrderAmount = (BigDecimal) todayPerformanceSummary.get("orderAmount");
|
|
||||||
todayRefundCount = (Integer) todayPerformanceSummary.get("refundCount");
|
|
||||||
todayRefundAmount = (BigDecimal) todayPerformanceSummary.get("refundAmount");
|
|
||||||
todayPromotionCount = (Integer) todayPerformanceSummary.get("promotionCount");
|
|
||||||
|
|
||||||
// 查看本月的绩效
|
|
||||||
DateTime beginOfMonth = DateUtil.beginOfMonth(now);
|
|
||||||
DateTime endOfMonth = DateUtil.beginOfMonth(now);
|
|
||||||
Map<String, Object> monthPerformanceSummary = userPerformanceSummaryService.getPerformanceSummaryByStartAndEndTime(beginOfMonth, endOfMonth);
|
|
||||||
monthOrderCount = (Integer) monthPerformanceSummary.get("orderCount");
|
|
||||||
monthOrderAmount = (BigDecimal) monthPerformanceSummary.get("orderAmount");
|
|
||||||
monthRefundCount = (Integer) monthPerformanceSummary.get("refundCount");
|
|
||||||
monthRefundAmount = (BigDecimal) monthPerformanceSummary.get("refundAmount");
|
|
||||||
monthPromotionCount = (Integer) monthPerformanceSummary.get("promotionCount");
|
|
||||||
|
|
||||||
WebQueryDashboardVO webQueryDashboardVO = WebQueryDashboardVO.builder()
|
|
||||||
.totalAmount(totalAmount)
|
|
||||||
.netAmount(netAmount)
|
|
||||||
.promoCount(promoCount)
|
|
||||||
.superCount(superCount)
|
|
||||||
.empCount(empCount)
|
|
||||||
.orderCount(orderCount)
|
|
||||||
.toRelease(toRelease)
|
|
||||||
.toSettle(toSettle)
|
|
||||||
.settled(settled)
|
|
||||||
.refunded(refunded)
|
|
||||||
.todayOrderCount(todayOrderCount)
|
|
||||||
.todayOrderAmount(todayOrderAmount)
|
|
||||||
.todayRefundCount(todayRefundCount)
|
|
||||||
.todayRefundAmount(todayRefundAmount)
|
|
||||||
.todayPromotionCount(todayPromotionCount)
|
|
||||||
.monthOrderCount(monthOrderCount)
|
|
||||||
.monthOrderAmount(monthOrderAmount)
|
|
||||||
.monthRefundCount(monthRefundCount)
|
|
||||||
.monthRefundAmount(monthRefundAmount)
|
|
||||||
.monthPromotionCount(monthPromotionCount)
|
|
||||||
.build();
|
|
||||||
return ResultUtils.success(webQueryDashboardVO);
|
return ResultUtils.success(webQueryDashboardVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,4 +791,33 @@ public class UserPerformanceSummaryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序端仪表盘
|
||||||
|
* @return 用户绩效汇总
|
||||||
|
*/
|
||||||
|
@PostMapping("mini/query/dashboard")
|
||||||
|
@Operation(summary = "小程序端仪表盘", description = "参数:无,权限:管理员,方法名:miniQueryDashboard")
|
||||||
|
@RequiresPermission(mustRole = UserConstant.MANAGER_ROLE)
|
||||||
|
public BaseResponse<WebQueryDashboardVO> miniQueryDashboard(HttpServletRequest request) {
|
||||||
|
Long userId = (Long) request.getAttribute("userId");
|
||||||
|
UserInfo userInfo = userInfoService.getById(userId);
|
||||||
|
String userRole = userInfo.getUserRole();
|
||||||
|
UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||||
|
WebQueryDashboardVO webQueryDashboardVO;
|
||||||
|
if (UserRoleEnum.MANAGER.equals(userRoleEnum)) {
|
||||||
|
webQueryDashboardVO = userPerformanceSummaryService.queryManagerDashboard();
|
||||||
|
} else {
|
||||||
|
webQueryDashboardVO = userPerformanceSummaryService.querySupervisorOrStaffDashboard(userRoleEnum, userId);
|
||||||
|
}
|
||||||
|
return ResultUtils.success(webQueryDashboardVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -9,6 +9,8 @@ import com.greenorange.promotion.model.dto.userPerformanceSummary.*;
|
|||||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||||
import com.greenorange.promotion.model.entity.UserPerformanceSummary;
|
import com.greenorange.promotion.model.entity.UserPerformanceSummary;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||||
|
import com.greenorange.promotion.model.vo.dashboard.WebQueryDashboardVO;
|
||||||
import com.greenorange.promotion.model.vo.userPerformanceSummary.SupervisorPerformanceSummaryVO;
|
import com.greenorange.promotion.model.vo.userPerformanceSummary.SupervisorPerformanceSummaryVO;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -61,5 +63,18 @@ public interface UserPerformanceSummaryService extends IService<UserPerformanceS
|
|||||||
/**
|
/**
|
||||||
* 查看某个时间段的绩效
|
* 查看某个时间段的绩效
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getPerformanceSummaryByStartAndEndTime(DateTime beginOfDay, DateTime endOfDay);
|
Map<String, Object> getPerformanceSummaryByStartAndEndTime(DateTime beginOfDay, DateTime endOfDay, UserRoleEnum userRoleEnum, Long userId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经理查看仪表盘
|
||||||
|
*/
|
||||||
|
WebQueryDashboardVO queryManagerDashboard();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主管或员工查看仪表盘
|
||||||
|
*/
|
||||||
|
WebQueryDashboardVO querySupervisorOrStaffDashboard(UserRoleEnum userRoleEnum, Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,20 +2,22 @@ package com.greenorange.promotion.service.userInfo.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
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.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.greenorange.promotion.common.PageRequest;
|
import com.greenorange.promotion.common.PageRequest;
|
||||||
import com.greenorange.promotion.constant.CommonConstant;
|
import com.greenorange.promotion.constant.CommonConstant;
|
||||||
import com.greenorange.promotion.constant.SystemConstant;
|
import com.greenorange.promotion.constant.SystemConstant;
|
||||||
|
import com.greenorange.promotion.constant.UserConstant;
|
||||||
import com.greenorange.promotion.model.dto.CommonStringRequest;
|
import com.greenorange.promotion.model.dto.CommonStringRequest;
|
||||||
import com.greenorange.promotion.model.dto.userPerformanceSummary.*;
|
import com.greenorange.promotion.model.dto.userPerformanceSummary.*;
|
||||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
import com.greenorange.promotion.model.entity.*;
|
||||||
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
|
||||||
import com.greenorange.promotion.model.entity.EmployeePromotionRecords;
|
|
||||||
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.vo.dashboard.WebQueryDashboardVO;
|
||||||
import com.greenorange.promotion.model.vo.userPerformanceSummary.SupervisorPerformanceSummaryVO;
|
import com.greenorange.promotion.model.vo.userPerformanceSummary.SupervisorPerformanceSummaryVO;
|
||||||
|
import com.greenorange.promotion.service.common.CommonService;
|
||||||
import com.greenorange.promotion.service.course.CoursePromotionCommissionPendingService;
|
import com.greenorange.promotion.service.course.CoursePromotionCommissionPendingService;
|
||||||
import com.greenorange.promotion.service.userInfo.EmployeePromotionRecordsService;
|
import com.greenorange.promotion.service.userInfo.EmployeePromotionRecordsService;
|
||||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||||
@ -62,6 +64,14 @@ public class UserPerformanceSummaryServiceImpl extends ServiceImpl<UserPerforman
|
|||||||
private EmployeePromotionRecordsService employeePromotionRecordsService;
|
private EmployeePromotionRecordsService employeePromotionRecordsService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserInfoService userInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CommonService commonService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取查询条件
|
* 获取查询条件
|
||||||
*/
|
*/
|
||||||
@ -193,7 +203,7 @@ public class UserPerformanceSummaryServiceImpl extends ServiceImpl<UserPerforman
|
|||||||
* 查看某个时间段的绩效
|
* 查看某个时间段的绩效
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getPerformanceSummaryByStartAndEndTime(DateTime beginOfDay, DateTime endOfDay) {
|
public Map<String, Object> getPerformanceSummaryByStartAndEndTime(DateTime beginOfDay, DateTime endOfDay, UserRoleEnum userRoleEnum, Long userId) {
|
||||||
Map<String, Object> performanceSummaryMap = new HashMap<>();
|
Map<String, Object> performanceSummaryMap = new HashMap<>();
|
||||||
Integer orderCount;
|
Integer orderCount;
|
||||||
BigDecimal orderAmount = BigDecimal.ZERO;
|
BigDecimal orderAmount = BigDecimal.ZERO;
|
||||||
@ -205,6 +215,11 @@ public class UserPerformanceSummaryServiceImpl extends ServiceImpl<UserPerforman
|
|||||||
QueryWrapper<CoursePromotionCommissionPending> coursePromotionQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CoursePromotionCommissionPending> coursePromotionQueryWrapper = new QueryWrapper<>();
|
||||||
coursePromotionQueryWrapper.ge("orderCreateTime", beginOfDay);
|
coursePromotionQueryWrapper.ge("orderCreateTime", beginOfDay);
|
||||||
coursePromotionQueryWrapper.le("orderCreateTime", endOfDay);
|
coursePromotionQueryWrapper.le("orderCreateTime", endOfDay);
|
||||||
|
if (UserRoleEnum.SUPERVISOR.equals(userRoleEnum)) {
|
||||||
|
coursePromotionQueryWrapper.eq("firstUserId", userId);
|
||||||
|
} else if (UserRoleEnum.STAFF.equals(userRoleEnum)) {
|
||||||
|
coursePromotionQueryWrapper.eq("secondUserId", userId);
|
||||||
|
}
|
||||||
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = coursePromotionCommissionPendingService.list(coursePromotionQueryWrapper);
|
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = coursePromotionCommissionPendingService.list(coursePromotionQueryWrapper);
|
||||||
orderCount = coursePromotionCommissionPendingList.size();
|
orderCount = coursePromotionCommissionPendingList.size();
|
||||||
for (CoursePromotionCommissionPending coursePromotionCommissionPending : coursePromotionCommissionPendingList) {
|
for (CoursePromotionCommissionPending coursePromotionCommissionPending : coursePromotionCommissionPendingList) {
|
||||||
@ -220,6 +235,11 @@ public class UserPerformanceSummaryServiceImpl extends ServiceImpl<UserPerforman
|
|||||||
QueryWrapper<EmployeePromotionRecords> empQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<EmployeePromotionRecords> empQueryWrapper = new QueryWrapper<>();
|
||||||
empQueryWrapper.ge("createTime", beginOfDay);
|
empQueryWrapper.ge("createTime", beginOfDay);
|
||||||
empQueryWrapper.le("createTime", endOfDay);
|
empQueryWrapper.le("createTime", endOfDay);
|
||||||
|
if (UserRoleEnum.SUPERVISOR.equals(userRoleEnum)) {
|
||||||
|
coursePromotionQueryWrapper.eq("firstUserId", userId);
|
||||||
|
} else if (UserRoleEnum.STAFF.equals(userRoleEnum)) {
|
||||||
|
coursePromotionQueryWrapper.eq("secondUserId", userId);
|
||||||
|
}
|
||||||
List<EmployeePromotionRecords> employeePromotionRecordsList = employeePromotionRecordsService.list(empQueryWrapper);
|
List<EmployeePromotionRecords> employeePromotionRecordsList = employeePromotionRecordsService.list(empQueryWrapper);
|
||||||
promotionCount = employeePromotionRecordsList.size();
|
promotionCount = employeePromotionRecordsList.size();
|
||||||
|
|
||||||
@ -231,6 +251,187 @@ public class UserPerformanceSummaryServiceImpl extends ServiceImpl<UserPerforman
|
|||||||
return performanceSummaryMap;
|
return performanceSummaryMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经理查看仪表盘
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WebQueryDashboardVO queryManagerDashboard() {
|
||||||
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
|
BigDecimal netAmount = BigDecimal.ZERO;
|
||||||
|
Integer promoCount = 0;
|
||||||
|
Integer superCount;
|
||||||
|
Integer empCount = 0;
|
||||||
|
Integer orderCount = 0;
|
||||||
|
BigDecimal toRelease = BigDecimal.ZERO;
|
||||||
|
BigDecimal toSettle = BigDecimal.ZERO;
|
||||||
|
BigDecimal settled = BigDecimal.ZERO;
|
||||||
|
BigDecimal refunded = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
Integer todayOrderCount;
|
||||||
|
BigDecimal todayOrderAmount;
|
||||||
|
Integer todayRefundCount;
|
||||||
|
BigDecimal todayRefundAmount;
|
||||||
|
Integer todayPromotionCount;
|
||||||
|
|
||||||
|
Integer monthOrderCount;
|
||||||
|
BigDecimal monthOrderAmount;
|
||||||
|
Integer monthRefundCount;
|
||||||
|
BigDecimal monthRefundAmount;
|
||||||
|
Integer monthPromotionCount;
|
||||||
|
|
||||||
|
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.SUPERVISOR_ROLE, userInfoService);
|
||||||
|
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetField(userInfoList, this, UserInfo::getId, UserPerformanceSummary::getUserId);
|
||||||
|
superCount = userPerformanceSummaryList.size();
|
||||||
|
for (UserPerformanceSummary userPerformanceSummary : userPerformanceSummaryList) {
|
||||||
|
totalAmount = totalAmount.add(userPerformanceSummary.getTotalAmount());
|
||||||
|
netAmount = netAmount.add(userPerformanceSummary.getNetAmount());
|
||||||
|
promoCount += userPerformanceSummary.getPromoCount();
|
||||||
|
empCount += userPerformanceSummary.getEmpCount();
|
||||||
|
orderCount += userPerformanceSummary.getOrderCount();
|
||||||
|
toRelease = toRelease.add(userPerformanceSummary.getToRelease());
|
||||||
|
toSettle = toSettle.add(userPerformanceSummary.getToSettle());
|
||||||
|
settled = settled.add(userPerformanceSummary.getSettled());
|
||||||
|
refunded = refunded.add(userPerformanceSummary.getRefunded());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DateTime now = DateUtil.date();
|
||||||
|
|
||||||
|
// 查看今天的绩效
|
||||||
|
DateTime beginOfDay = DateUtil.beginOfDay(now);
|
||||||
|
DateTime endOfDay = DateUtil.endOfDay(now);
|
||||||
|
Map<String, Object> todayPerformanceSummary = this.getPerformanceSummaryByStartAndEndTime(beginOfDay, endOfDay, UserRoleEnum.MANAGER, null);
|
||||||
|
todayOrderCount = (Integer) todayPerformanceSummary.get("orderCount");
|
||||||
|
todayOrderAmount = (BigDecimal) todayPerformanceSummary.get("orderAmount");
|
||||||
|
todayRefundCount = (Integer) todayPerformanceSummary.get("refundCount");
|
||||||
|
todayRefundAmount = (BigDecimal) todayPerformanceSummary.get("refundAmount");
|
||||||
|
todayPromotionCount = (Integer) todayPerformanceSummary.get("promotionCount");
|
||||||
|
|
||||||
|
// 查看本月的绩效
|
||||||
|
DateTime beginOfMonth = DateUtil.beginOfMonth(now);
|
||||||
|
DateTime endOfMonth = DateUtil.beginOfMonth(now);
|
||||||
|
Map<String, Object> monthPerformanceSummary = this.getPerformanceSummaryByStartAndEndTime(beginOfMonth, endOfMonth, UserRoleEnum.MANAGER, null);
|
||||||
|
monthOrderCount = (Integer) monthPerformanceSummary.get("orderCount");
|
||||||
|
monthOrderAmount = (BigDecimal) monthPerformanceSummary.get("orderAmount");
|
||||||
|
monthRefundCount = (Integer) monthPerformanceSummary.get("refundCount");
|
||||||
|
monthRefundAmount = (BigDecimal) monthPerformanceSummary.get("refundAmount");
|
||||||
|
monthPromotionCount = (Integer) monthPerformanceSummary.get("promotionCount");
|
||||||
|
|
||||||
|
WebQueryDashboardVO webQueryDashboardVO = WebQueryDashboardVO.builder()
|
||||||
|
.totalAmount(totalAmount)
|
||||||
|
.netAmount(netAmount)
|
||||||
|
.promoCount(promoCount)
|
||||||
|
.superCount(superCount)
|
||||||
|
.empCount(empCount)
|
||||||
|
.orderCount(orderCount)
|
||||||
|
.toRelease(toRelease)
|
||||||
|
.toSettle(toSettle)
|
||||||
|
.settled(settled)
|
||||||
|
.refunded(refunded)
|
||||||
|
.todayOrderCount(todayOrderCount)
|
||||||
|
.todayOrderAmount(todayOrderAmount)
|
||||||
|
.todayRefundCount(todayRefundCount)
|
||||||
|
.todayRefundAmount(todayRefundAmount)
|
||||||
|
.todayPromotionCount(todayPromotionCount)
|
||||||
|
.monthOrderCount(monthOrderCount)
|
||||||
|
.monthOrderAmount(monthOrderAmount)
|
||||||
|
.monthRefundCount(monthRefundCount)
|
||||||
|
.monthRefundAmount(monthRefundAmount)
|
||||||
|
.monthPromotionCount(monthPromotionCount)
|
||||||
|
.build();
|
||||||
|
return webQueryDashboardVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主管查看仪表盘
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WebQueryDashboardVO querySupervisorOrStaffDashboard(UserRoleEnum userRoleEnum, Long userId) {
|
||||||
|
BigDecimal totalAmount;
|
||||||
|
BigDecimal netAmount;
|
||||||
|
Integer promoCount;
|
||||||
|
Integer superCount = 0;
|
||||||
|
Integer empCount;
|
||||||
|
Integer orderCount;
|
||||||
|
BigDecimal toRelease;
|
||||||
|
BigDecimal toSettle;
|
||||||
|
BigDecimal settled;
|
||||||
|
BigDecimal refunded;
|
||||||
|
|
||||||
|
Integer todayOrderCount;
|
||||||
|
BigDecimal todayOrderAmount;
|
||||||
|
Integer todayRefundCount;
|
||||||
|
BigDecimal todayRefundAmount;
|
||||||
|
Integer todayPromotionCount;
|
||||||
|
|
||||||
|
Integer monthOrderCount;
|
||||||
|
BigDecimal monthOrderAmount;
|
||||||
|
Integer monthRefundCount;
|
||||||
|
BigDecimal monthRefundAmount;
|
||||||
|
Integer monthPromotionCount;
|
||||||
|
LambdaQueryWrapper<UserPerformanceSummary> userPerformanceSummaryLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserPerformanceSummary::getUserId, userId, this);
|
||||||
|
UserPerformanceSummary userPerformanceSummary = this.getOne(userPerformanceSummaryLambdaQueryWrapper);
|
||||||
|
totalAmount = userPerformanceSummary.getTotalAmount();
|
||||||
|
netAmount = userPerformanceSummary.getNetAmount();
|
||||||
|
promoCount = userPerformanceSummary.getPromoCount();
|
||||||
|
empCount = userPerformanceSummary.getEmpCount();
|
||||||
|
orderCount = userPerformanceSummary.getOrderCount();
|
||||||
|
toRelease = userPerformanceSummary.getToRelease();
|
||||||
|
toSettle = userPerformanceSummary.getToSettle();
|
||||||
|
settled = userPerformanceSummary.getSettled();
|
||||||
|
refunded = userPerformanceSummary.getRefunded();
|
||||||
|
|
||||||
|
|
||||||
|
DateTime now = DateUtil.date();
|
||||||
|
|
||||||
|
// 查看今天的绩效
|
||||||
|
DateTime beginOfDay = DateUtil.beginOfDay(now);
|
||||||
|
DateTime endOfDay = DateUtil.endOfDay(now);
|
||||||
|
Map<String, Object> todayPerformanceSummary = this.getPerformanceSummaryByStartAndEndTime(beginOfDay, endOfDay, userRoleEnum, userId);
|
||||||
|
todayOrderCount = (Integer) todayPerformanceSummary.get("orderCount");
|
||||||
|
todayOrderAmount = (BigDecimal) todayPerformanceSummary.get("orderAmount");
|
||||||
|
todayRefundCount = (Integer) todayPerformanceSummary.get("refundCount");
|
||||||
|
todayRefundAmount = (BigDecimal) todayPerformanceSummary.get("refundAmount");
|
||||||
|
todayPromotionCount = (Integer) todayPerformanceSummary.get("promotionCount");
|
||||||
|
|
||||||
|
// 查看本月的绩效
|
||||||
|
DateTime beginOfMonth = DateUtil.beginOfMonth(now);
|
||||||
|
DateTime endOfMonth = DateUtil.beginOfMonth(now);
|
||||||
|
Map<String, Object> monthPerformanceSummary = this.getPerformanceSummaryByStartAndEndTime(beginOfMonth, endOfMonth, userRoleEnum, userId);
|
||||||
|
monthOrderCount = (Integer) monthPerformanceSummary.get("orderCount");
|
||||||
|
monthOrderAmount = (BigDecimal) monthPerformanceSummary.get("orderAmount");
|
||||||
|
monthRefundCount = (Integer) monthPerformanceSummary.get("refundCount");
|
||||||
|
monthRefundAmount = (BigDecimal) monthPerformanceSummary.get("refundAmount");
|
||||||
|
monthPromotionCount = (Integer) monthPerformanceSummary.get("promotionCount");
|
||||||
|
|
||||||
|
WebQueryDashboardVO webQueryDashboardVO = WebQueryDashboardVO.builder()
|
||||||
|
.totalAmount(totalAmount)
|
||||||
|
.netAmount(netAmount)
|
||||||
|
.promoCount(promoCount)
|
||||||
|
.superCount(superCount)
|
||||||
|
.empCount(empCount)
|
||||||
|
.orderCount(orderCount)
|
||||||
|
.toRelease(toRelease)
|
||||||
|
.toSettle(toSettle)
|
||||||
|
.settled(settled)
|
||||||
|
.refunded(refunded)
|
||||||
|
.todayOrderCount(todayOrderCount)
|
||||||
|
.todayOrderAmount(todayOrderAmount)
|
||||||
|
.todayRefundCount(todayRefundCount)
|
||||||
|
.todayRefundAmount(todayRefundAmount)
|
||||||
|
.todayPromotionCount(todayPromotionCount)
|
||||||
|
.monthOrderCount(monthOrderCount)
|
||||||
|
.monthOrderAmount(monthOrderAmount)
|
||||||
|
.monthRefundCount(monthRefundCount)
|
||||||
|
.monthRefundAmount(monthRefundAmount)
|
||||||
|
.monthPromotionCount(monthPromotionCount)
|
||||||
|
.build();
|
||||||
|
return webQueryDashboardVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user