| | |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.ui.Model; |
| | |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 司机审核列表控制器 |
| | |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | @Autowired |
| | | private ITOrderTaxiService orderTaxiService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService tCompanyService; |
| | |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/inviteList") |
| | | @ResponseBody |
| | | public Object list(Integer uid,String userName,String time) { |
| | | if (uid==null)return null; |
| | | String startTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(time)){ |
| | | String[] timeArray = time.split(" - "); |
| | | startTime = timeArray[0]+" 00:00:00"; |
| | | endTime = timeArray[1]+" 23:59:59"; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<Map<String, Object>> userList = tDriverService.inviteList(page, startTime,endTime,userName,uid); |
| | | for (Map<String, Object> stringObjectMap : userList) { |
| | | String string = stringObjectMap.get("inviteUserId").toString(); |
| | | TDriver tUser = tDriverService.selectById(string); |
| | | stringObjectMap.put("inviteUserName",tUser.getName()); |
| | | } |
| | | page.setRecords(userList); |
| | | return super.packForBT(page); |
| | | } |
| | | /** |
| | | * 跳转到司机审核列表首页 |
| | | */ |
| | |
| | | public String index() { |
| | | return PREFIX + "tDriver.html"; |
| | | } |
| | | |
| | | @RequestMapping("/invite/{id}") |
| | | public String inviteList(@PathVariable("id")Integer id, Model model) { |
| | | model.addAttribute("id",id); |
| | | return PREFIX + "tDriver_invite.html"; |
| | | } |
| | | /** |
| | | * 跳转到审核通过司机首页 |
| | | */ |
| | |
| | | */ |
| | | @RequestMapping("/tDriver_add") |
| | | public String tDriverAdd(Model model) { |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2) |
| | | .ne("flag",3)); |
| | | model.addAttribute("companyList",companyList); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | |
| | | model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName()); |
| | | |
| | | if (1 == roleType){ |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2) |
| | | .ne("flag",3)); |
| | | model.addAttribute("companyList",companyList); |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",tDriver.getCompanyId())); |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>() |
| | | .ne("flag",3).eq("type", 3).eq("superiorId",tDriver.getCompanyId())); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | }else if (2 == roleType){ |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",ShiroKit.getUser().getObjectId())); |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>() |
| | | .ne("flag",3).eq("type", 3).eq("superiorId",ShiroKit.getUser().getObjectId())); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | } |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ITOrderEvaluateService itOrderEvaluateService; |
| | | @Autowired |
| | | private IInviteService inviteService; |
| | | /** |
| | | * 获取审核通过的司机列表 |
| | | */ |
| | |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<Map<String, Object>> driverList = tDriverService.getDriverList(page, ShiroKit.getUser().getRoleType(), ShiroKit.getUser().getObjectId(), |
| | | beginTime, endTime, companyName, phone, name, addType, authState); |
| | | List<Integer> driverIds = driverList.stream().map(map -> Integer.valueOf(map.get("id").toString())).collect(Collectors.toList()); |
| | | // 查询司机订单 |
| | | List<TOrderTaxi> orderTaxiList = orderTaxiService.selectList(new EntityWrapper<TOrderTaxi>() |
| | | .in("driverId", driverIds)); |
| | | // 查询司机所有的收入 |
| | | List<TPubTransactionDetails> tPubTransactionDetailsIncome = pubTransactionDetailsService.selectList(new EntityWrapper<TPubTransactionDetails>() |
| | | .in("userId", driverIds) |
| | | .eq("userType", 2) |
| | | .eq("type", 1) |
| | | .eq("state",1) |
| | | .eq("orderType", 2)); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | for (Map<String, Object> stringObjectMap : driverList) { |
| | | String string = stringObjectMap.get("id").toString(); |
| | | int i = inviteService.selectCount(new EntityWrapper<Invite>() |
| | | .eq("inviteUserId", string) |
| | | .eq("userType",2)); |
| | | stringObjectMap.put("inviteNumber", i); |
| | | // 司机id |
| | | Integer id = Integer.valueOf(stringObjectMap.get("id").toString()); |
| | | List<TOrderEvaluate> driverId = itOrderEvaluateService.selectList(new EntityWrapper<TOrderEvaluate>() |
| | |
| | | String formattedV = df.format(v); |
| | | stringObjectMap.put("fraction",formattedV); |
| | | } |
| | | |
| | | // 司机订单统计 |
| | | if(CollectionUtils.isEmpty(orderTaxiList)){ |
| | | stringObjectMap.put("dayReceivingOrders", 0); |
| | | stringObjectMap.put("sumReceivingOrders", 0); |
| | | stringObjectMap.put("dayIncome", 0); |
| | | stringObjectMap.put("sumIncome", 0); |
| | | }else { |
| | | long dayReceivingOrders = orderTaxiList.stream().filter(orderTaxi -> orderTaxi.getDriverId().equals(id) && format.format(orderTaxi.getTravelTime()).equals(format.format(new Date()))).count(); |
| | | stringObjectMap.put("dayReceivingOrders", dayReceivingOrders); |
| | | long sumReceivingOrders = orderTaxiList.stream().filter(orderTaxi -> orderTaxi.getDriverId().equals(id)).count(); |
| | | stringObjectMap.put("sumReceivingOrders", sumReceivingOrders); |
| | | // 今日统计收入 |
| | | Optional<BigDecimal> dayReduceIncome = tPubTransactionDetailsIncome.stream().filter(pubTransactionDetails -> pubTransactionDetails.getUserId().equals(id) |
| | | && format.format(pubTransactionDetails.getInsertTime()).equals(format.format(new Date()))) |
| | | .map(TPubTransactionDetails::getMoney).reduce(BigDecimal::add); |
| | | dayReduceIncome.ifPresent(bigDecimal -> stringObjectMap.put("dayIncome", bigDecimal)); |
| | | |
| | | // 过滤所有统计 |
| | | Optional<BigDecimal> sumReduceIncome = tPubTransactionDetailsIncome.stream().filter(pubTransactionDetails -> pubTransactionDetails.getUserId().equals(id)) |
| | | .map(TPubTransactionDetails::getMoney).reduce(BigDecimal::add); |
| | | sumReduceIncome.ifPresent(bigDecimal -> stringObjectMap.put("sumIncome", bigDecimal)); |
| | | } |
| | | |
| | | } |
| | | page.setRecords(driverList); |
| | | return super.packForBT(page); |
| | |
| | | shellList.add("服务模式"); |
| | | shellList.add("关联线路"); |
| | | shellList.add("评分"); |
| | | shellList.add("邀请次数"); |
| | | shellList.add("历史接单数"); |
| | | shellList.add("历史订单总金额"); |
| | | shellList.add("当前钱包余额"); |
| | |
| | | }else{ |
| | | shellList.add("0"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("inviteNumber"))){ |
| | | shellList.add(object.get("inviteNumber").toString()); |
| | | }else{ |
| | | shellList.add("0"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("historyNum"))){ |
| | | shellList.add(object.get("historyNum").toString()); |
| | | }else{ |