| | |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.service.TOrderMealService; |
| | | import com.ruoyi.system.service.TOrderSaleService; |
| | | import com.ruoyi.system.vo.OrderTrendsVO; |
| | | import com.ruoyi.system.vo.PersonnelStatisticsVO; |
| | | import com.ruoyi.system.vo.SalesRankingVO; |
| | | import com.ruoyi.system.vo.SalesVolumeVO; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | @ApiOperation( value = "下单趋势") |
| | | @PostMapping(value = "/orderingTrends") |
| | | public AjaxResult<List<SalesRankingVO>> orderingTrends(@RequestBody TDataStatisticsQuery query) { |
| | | public AjaxResult<List<OrderTrendsVO>> orderingTrends(@RequestBody TDataStatisticsQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getRoleType(); |
| | | Long objectId = tokenService.getLoginUser().getObjectId(); |
| | | query.setShopId(objectId); |
| | |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | List<SalesRankingVO> salesRankingVOS; |
| | | List<OrderTrendsVO> orderTrendsVOS; |
| | | if(roleType == 2){ |
| | | salesRankingVOS = orderMealService.salesRanking(query); |
| | | orderTrendsVOS = orderMealService.orderingTrends(query); |
| | | }else{ |
| | | salesRankingVOS = orderSaleService.salesRanking(query); |
| | | orderTrendsVOS = orderSaleService.orderingTrends(query); |
| | | } |
| | | return AjaxResult.success(salesRankingVOS); |
| | | return AjaxResult.success(orderTrendsVOS); |
| | | } |
| | | |
| | | @ApiOperation( value = "接待人数统计") |
| | | @PostMapping(value = "/personnelStatistics") |
| | | public AjaxResult<List<PersonnelStatisticsVO>> personnelStatistics(@RequestBody TDataStatisticsQuery query) { |
| | | Long objectId = tokenService.getLoginUser().getObjectId(); |
| | | query.setShopId(objectId); |
| | | if(Objects.isNull(query.getTimeType())){ |
| | | query.setTimeType(1); |
| | | } |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | switch (query.getTimeType()){ |
| | | case 1: |
| | | // 今日 |
| | | startTime = LocalDateTime.MIN; |
| | | endTime = LocalDateTime.MAX; |
| | | break; |
| | | case 2: |
| | | // 昨日 |
| | | startTime = LocalDateTime.now().minusDays(1); |
| | | endTime = LocalDateTime.now().minusDays(1); |
| | | break; |
| | | case 3: |
| | | // 近7天 |
| | | startTime = LocalDateTime.now().minusDays(7); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | case 4: |
| | | // 近30天 |
| | | startTime = LocalDateTime.now().minusDays(30); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | return AjaxResult.success(orderMealService.personnelStatistics(query)); |
| | | } |
| | | |
| | | |