| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.state.Order; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TOrderServerResp; |
| | | import com.stylefeng.guns.modular.system.enums.OrderStateEnum; |
| | | import com.stylefeng.guns.modular.system.model.TAgent; |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import com.stylefeng.guns.modular.system.model.TOrder; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | @Autowired |
| | | private ITAgentService tAgentService; |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | @Autowired |
| | | private ITOrderService tOrderService; |
| | | @Autowired |
| | | private ITRevenueService tRevenueService; |
| | | |
| | | private String PREFIX = "/system/tHomePage/"; |
| | | |
| | |
| | | * 跳转到地图 |
| | | */ |
| | | @RequestMapping("/map") |
| | | public String map() { |
| | | public String map(Integer agentId,Integer type,Model model) { |
| | | |
| | | if(Objects.nonNull(agentId)){ |
| | | // 查询统计在线司机,待接单,服务中,已完成,已取消 |
| | | Map<String,Integer> map = new HashMap<>(4); |
| | | int serverCount = tDriverService.selectCount(new EntityWrapper<TDriver>() |
| | | .eq("agentId", agentId) |
| | | .eq("serverStatus", 2)); |
| | | tOrderService.getDataStatisticsCount(agentId,map); |
| | | model.addAttribute("map",map); |
| | | |
| | | // 查询服务中的订单列表 |
| | | List<TOrderServerResp> orderServerRespList = tOrderService.getDataStatisticsServerList(agentId); |
| | | model.addAttribute("serverList",orderServerRespList); |
| | | |
| | | // 查询今天所有订单 |
| | | List<TOrder> allList = tOrderService.getDataStatisticsAllList(agentId); |
| | | |
| | | // TODO 拿到所有司机地址 |
| | | |
| | | }else { |
| | | // TODO 查询广东全区域数据 |
| | | } |
| | | |
| | | return PREFIX + "tHomePageMap.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到地图 |
| | | * 跳转到首页统计 |
| | | */ |
| | | @RequestMapping("/statistics") |
| | | public String statistics(Model model) { |
| | | public String statistics(Integer agentId,String dayDate,String yearDate,String monthDate,Integer type,Model model) { |
| | | model.addAttribute("txt",new SimpleDateFormat("yyyy年MM月dd日").format(new Date()) + DateUtil.getWeekDay(new Date()) + ",欢迎" + |
| | | Objects.requireNonNull(ShiroKit.getUser()).getName() + "登录"); |
| | | if(Objects.nonNull(agentId)){ |
| | | // 统计代理商 |
| | | tAgentService.getDataStatistics(agentId,model); |
| | | |
| | | // 统计司机数 |
| | | tDriverService.getDataStatistics(agentId,model); |
| | | |
| | | // TODO 订单统计:按今天,昨天,本周,本月 |
| | | |
| | | // 订单统计,每年按月份 |
| | | tOrderService.getDataStatisticsByYear(agentId,yearDate,model); |
| | | |
| | | // 业绩排名 performanceTable |
| | | if (1 == type){ |
| | | // 单量 |
| | | tOrderService.getDataStatisticsOrderCount(agentId,monthDate,model); |
| | | }else { |
| | | // 收入、佣金 |
| | | tRevenueService.getDataStatisticsIncomeOrCommission(agentId,monthDate,type,model); |
| | | } |
| | | |
| | | }else { |
| | | // TODO 查询广东全区域数据 |
| | | } |
| | | return PREFIX + "tHomePageStatistics.html"; |
| | | } |
| | | |