| | |
| | | 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.service.*; |
| | | 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; |
| | |
| | | @Autowired |
| | | private ICustomerService iCustomerService; |
| | | @Autowired |
| | | private IOrderTaskService iOrderTaskService; |
| | | @Autowired |
| | | private IEventLogService iEventLogService; |
| | | @Autowired |
| | | private IOrderLogService iOrderLogService; |
| | | |
| | | |
| | | @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<>(); |
| | | |
| | | int m = cal.get(Calendar.MONTH) + 1; |
| | | |
| | | Month month= iCarService.getCarCount(year); |
| | | if (month==null) { |
| | | month = new Month(); |
| | | } |
| | | |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(month.getJanuary()); |
| | | list.add(month.getFebruary()); |
| | |
| | | list.add(month.getOctober()); |
| | | list.add(month.getNovember()); |
| | | list.add(month.getDecember()); |
| | | |
| | | for (int i=m;i<12;i++){ |
| | | list.set(i,0); |
| | | } |
| | | return new ResultUtil<Object>().setData(list); |
| | | } |
| | | |
| | |
| | | public Result<Object> getCustomerCount() { |
| | | Calendar cal = Calendar.getInstance(); |
| | | int year = cal.get(Calendar.YEAR); |
| | | QueryWrapper<Car> wrapper = new QueryWrapper<>(); |
| | | |
| | | int m = cal.get(Calendar.MONTH) + 1; |
| | | |
| | | Month month= iCustomerService.getCustomerCount(year); |
| | | if (month==null) { |
| | | month = new Month(); |
| | | } |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(month.getJanuary()); |
| | | list.add(month.getFebruary()); |
| | |
| | | list.add(month.getOctober()); |
| | | list.add(month.getNovember()); |
| | | list.add(month.getDecember()); |
| | | |
| | | for (int i=m;i<12;i++){ |
| | | list.set(i,0); |
| | | } |
| | | return new ResultUtil<Object>().setData(list); |
| | | } |
| | | |
| | |
| | | int year = cal.get(Calendar.YEAR); |
| | | QueryWrapper<Car> wrapper = new QueryWrapper<>(); |
| | | |
| | | Month month= iOrderTaskService.getSendNum(year); |
| | | Month month= iOrderLogService.getSendNum(year); |
| | | List<Integer> list = new ArrayList<>(); |
| | | if (month==null) { |
| | | month = new Month(); |
| | | } |
| | | list.add(month.getJanuary()/10000); |
| | | list.add(month.getFebruary()/10000); |
| | | list.add(month.getMarch()/10000); |
| | | list.add(month.getApril()/10000); |
| | | list.add(month.getMay()/10000); |
| | | list.add(month.getJune()/10000); |
| | | list.add(month.getJuly()/10000); |
| | | list.add(month.getAugust()/10000); |
| | | list.add(month.getSeptember()/10000); |
| | | list.add(month.getOctober()/10000); |
| | | list.add(month.getNovember()/10000); |
| | | list.add(month.getDecember()/10000); |
| | | 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) { |
| | | month = new Month(); |
| | | } |
| | | list.add(month.getJanuary()); |
| | | list.add(month.getFebruary()); |
| | | list.add(month.getMarch()); |
| | |
| | | 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); |
| | | } |