New file |
| | |
| | | package cn.exrick.xboot.your.controller.pc; |
| | | |
| | | import cn.exrick.xboot.core.common.utils.ResultUtil; |
| | | import cn.exrick.xboot.core.common.vo.Result; |
| | | import cn.exrick.xboot.your.entity.Car; |
| | | import cn.exrick.xboot.your.service.IEventLogService; |
| | | import cn.exrick.xboot.your.service.IOrderTaskService; |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import cn.exrick.xboot.your.service.ICarService; |
| | | import cn.exrick.xboot.your.service.ICustomerService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author whj |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @Api(tags = "大屏统计其他页面接口") |
| | | @RequestMapping("/xboot/pcStatistic2") |
| | | @Transactional |
| | | public class Statistic2Controller { |
| | | |
| | | @Autowired |
| | | private ICarService iCarService; |
| | | @Autowired |
| | | private ICustomerService iCustomerService; |
| | | @Autowired |
| | | private IOrderTaskService iOrderTaskService; |
| | | @Autowired |
| | | private IEventLogService iEventLogService; |
| | | |
| | | @RequestMapping(value = "/getCarCount", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取车辆数目") |
| | | public Result<Object> getCarCount() { |
| | | Calendar cal = Calendar.getInstance(); |
| | | int year = cal.get(Calendar.YEAR); |
| | | QueryWrapper<Car> wrapper = new QueryWrapper<>(); |
| | | |
| | | Month month= iCarService.getCarCount(year); |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(month.getJanuary()); |
| | | list.add(month.getFebruary()); |
| | | list.add(month.getMarch()); |
| | | list.add(month.getApril()); |
| | | list.add(month.getMay()); |
| | | list.add(month.getJune()); |
| | | list.add(month.getJuly()); |
| | | list.add(month.getAugust()); |
| | | list.add(month.getSeptember()); |
| | | list.add(month.getOctober()); |
| | | list.add(month.getNovember()); |
| | | list.add(month.getDecember()); |
| | | return new ResultUtil<Object>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getCustomerCount", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取商户数目") |
| | | public Result<Object> getCustomerCount() { |
| | | Calendar cal = Calendar.getInstance(); |
| | | int year = cal.get(Calendar.YEAR); |
| | | QueryWrapper<Car> wrapper = new QueryWrapper<>(); |
| | | |
| | | Month month= iCustomerService.getCustomerCount(year); |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(month.getJanuary()); |
| | | list.add(month.getFebruary()); |
| | | list.add(month.getMarch()); |
| | | list.add(month.getApril()); |
| | | list.add(month.getMay()); |
| | | list.add(month.getJune()); |
| | | list.add(month.getJuly()); |
| | | list.add(month.getAugust()); |
| | | list.add(month.getSeptember()); |
| | | list.add(month.getOctober()); |
| | | list.add(month.getNovember()); |
| | | list.add(month.getDecember()); |
| | | return new ResultUtil<Object>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getSendNum", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取每个月送货数量") |
| | | public Result<Object> getSendNum() { |
| | | Calendar cal = Calendar.getInstance(); |
| | | int year = cal.get(Calendar.YEAR); |
| | | QueryWrapper<Car> wrapper = new QueryWrapper<>(); |
| | | |
| | | Month month= iOrderTaskService.getSendNum(year); |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(month.getJanuary()); |
| | | list.add(month.getFebruary()); |
| | | list.add(month.getMarch()); |
| | | list.add(month.getApril()); |
| | | list.add(month.getMay()); |
| | | list.add(month.getJune()); |
| | | list.add(month.getJuly()); |
| | | list.add(month.getAugust()); |
| | | list.add(month.getSeptember()); |
| | | list.add(month.getOctober()); |
| | | list.add(month.getNovember()); |
| | | list.add(month.getDecember()); |
| | | return new ResultUtil<Object>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getAvgNum", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取商户平均送货数量") |
| | | public Result<Object> getAvgNum() { |
| | | Calendar cal = Calendar.getInstance(); |
| | | int year = cal.get(Calendar.YEAR); |
| | | QueryWrapper<Car> wrapper = new QueryWrapper<>(); |
| | | |
| | | Month month= iCustomerService.getCustomerCount(year); |
| | | Month month2= iOrderTaskService.getSendNum(year); |
| | | |
| | | List<Integer> list = new ArrayList<>(); |
| | | |
| | | list.add(month.getJanuary()!=0 ? month2.getJanuary()/month.getJanuary() : 0); |
| | | list.add(month.getFebruary()!=0 ? month2.getFebruary()/month.getFebruary() : 0); |
| | | list.add(month.getMarch()!=0 ? month2.getMarch()/month.getMarch() : 0); |
| | | list.add(month.getApril()!=0 ? month2.getApril()/month.getApril() : 0); |
| | | list.add(month.getMay()!=0 ? month2.getMay()/month.getMay() : 0); |
| | | list.add(month.getJune()!=0 ? month2.getJune()/month.getJune() : 0); |
| | | list.add(month.getJuly()!=0 ? month2.getJuly()/month.getJuly() : 0); |
| | | list.add(month.getAugust()!=0 ? month2.getAugust()/month.getAugust() : 0); |
| | | list.add(month.getSeptember()!=0 ? month2.getSeptember()/month.getSeptember() : 0); |
| | | list.add(month.getOctober()!=0 ? month2.getOctober()/month.getOctober() : 0); |
| | | list.add(month.getNovember()!=0 ? month2.getNovember()/month.getNovember() : 0); |
| | | list.add(month.getDecember()!=0 ? month2.getDecember()/month.getDecember() : 0); |
| | | |
| | | return new ResultUtil<Object>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getEventNum", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取商户平均送货数量") |
| | | public Result<Object> getEventNum(Integer type) { |
| | | Calendar cal = Calendar.getInstance(); |
| | | int year = cal.get(Calendar.YEAR); |
| | | QueryWrapper<Car> wrapper = new QueryWrapper<>(); |
| | | |
| | | Month month= iEventLogService.getEventNum(year,type); |
| | | |
| | | List<Integer> list = new ArrayList<>(); |
| | | if (month!=null){ |
| | | list.add(month.getJanuary()); |
| | | list.add(month.getFebruary()); |
| | | list.add(month.getMarch()); |
| | | list.add(month.getApril()); |
| | | list.add(month.getMay()); |
| | | list.add(month.getJune()); |
| | | list.add(month.getJuly()); |
| | | list.add(month.getAugust()); |
| | | list.add(month.getSeptember()); |
| | | list.add(month.getOctober()); |
| | | list.add(month.getNovember()); |
| | | list.add(month.getDecember()); |
| | | } |
| | | |
| | | return new ResultUtil<Object>().setData(list); |
| | | } |
| | | } |