| | |
| | | */ |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userPhone", addOrderWarpper.getPhone()).eq("status", 1).in("state", Arrays.asList(101, 102, 103, 104, 105, 106, 201))); |
| | | if(count > 0){ |
| | | return ResultUtil.error("该用户还有未完成的订单"); |
| | | return ResultUtil.error("该用户还有未完成的订单", ""); |
| | | } |
| | | Driver driver = driverService.selectById(uid); |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", uid).eq("status", 1)); |
| | |
| | | if(ToolUtil.isNotEmpty(addOrderWarpper.getEndAddress())){ |
| | | Map<String, String> distance = MapUtil.getDistance(order.getStartLng() + "," + order.getStartLat(), order.getEndLng() + "," + order.getEndLat(), 1); |
| | | if(null == distance){ |
| | | return ResultUtil.error("获取预估距离出错"); |
| | | return ResultUtil.error("获取预估距离出错", ""); |
| | | } |
| | | d = Double.valueOf(distance.get("distance")) / 1000; |
| | | order.setEstimatedMileage(d); |
| | |
| | | pushOrderInfoWarpper.setDriverLat(split[1]); |
| | | pushOrderInfoWarpper.setDriverLng(split[0]); |
| | | } |
| | | pushOrderInfoWarpper.setWaitTime(order.getWaitTime()); |
| | | int w = 0; |
| | | if(null != order.getStartWaitTime()){ |
| | | w = Double.valueOf((System.currentTimeMillis() - order.getStartWaitTime().getTime()) / 60000).intValue(); |
| | | } |
| | | pushOrderInfoWarpper.setWaitTime(order.getWaitTime() + w); |
| | | pushOrderInfoWarpper.setState(order.getState()); |
| | | pushOrderInfoWarpper.setActualMileage(Double.valueOf(order.getActualMileage() / 1000)); |
| | | pushOrderInfoWarpper.setTravelTime(0); |
| | |
| | | Order order = this.selectById(orderId); |
| | | order.setState(state); |
| | | |
| | | // TODO: 2023/5/18 临时 |
| | | payType = 1; |
| | | if(state == 108){ |
| | | payType = 2; |
| | | } |
| | | |
| | | if(payType == 2 && state == 107){ |
| | | order.setPayType(3); |
| | | Coupon coupon = userToCouponService.queryCoupon(order.getUserId(), order.getOrderMoney()); |
| | | if(null != coupon){ |
| | | order.setCouponId(coupon.getId()); |
| | |
| | | } |
| | | |
| | | if(payType == 2 && state == 108){ |
| | | order.setPayType(3); |
| | | order.setPayTime(new Date()); |
| | | if(null != order.getCouponId()){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(order.getCouponId()); |
| | |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getCouponBalance()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); |
| | | accountChangeDetail.setNewData(driver.getCouponBalance()); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | } |
| | |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getCommission()); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num1); |
| | | accountChangeDetail.setNewData(driver1.getCommission()); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getCommission()); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num5); |
| | | accountChangeDetail.setNewData(driver1.getCommission()); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num5 ? num3 - num5 : 0); |
| | |
| | | accountChangeDetail.setUserId(driver2.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver2.getCommission()); |
| | | accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver2.setCommission(driver2.getCommission() + num6); |
| | | accountChangeDetail.setNewData(driver2.getCommission()); |
| | | accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | driverService.updateById(driver2); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num6 ? num3 - num6 : 0); |
| | |
| | | accountChangeDetail.setUserId(driver3.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver3.getCommission()); |
| | | accountChangeDetail.setOldData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver3.setCommission(driver3.getCommission() + num7); |
| | | accountChangeDetail.setNewData(driver3.getCommission()); |
| | | accountChangeDetail.setNewData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); |
| | | driverService.updateById(driver3); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num7 ? num3 - num7 : 0); |
| | |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getCommission()); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num3_); |
| | | accountChangeDetail.setNewData(driver1.getCommission()); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num3_ ? num3 - num3_ : 0); |
| | |
| | | accountChangeDetail.setUserId(driver2.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver2.getCommission()); |
| | | accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver2.setCommission(driver2.getCommission() + num4); |
| | | accountChangeDetail.setNewData(driver2.getCommission()); |
| | | accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | driverService.updateById(driver2); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num4 ? num3 - num4 : 0); |
| | |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getCommission()); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num2_); |
| | | accountChangeDetail.setNewData(driver1.getCommission()); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num2_ ? num3 - num2_ : 0); |
| | |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(9); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver.getBalance()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setExplain("线下收款服务费支出"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver.setBalance(driver.getBalance() - n); |
| | | accountChangeDetail.setNewData(driver.getBalance()); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | } |
| | |
| | | List<Integer> state = Arrays.asList(107, 108, 109); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("driverId", driverId).in("state", state).eq("status", 1)); |
| | | performanceSummaryWarpper.setTotalOrder(count); |
| | | List<PerformanceRankingWarpper> list = new ArrayList<>(); |
| | | int position = 0; |
| | | Double d = 0D; |
| | | List<PerformanceRankingWarpper> performanceRankingWarppers = null; |
| | | if(type == 1){//订单量 |
| | | performanceRankingWarppers = this.baseMapper.queryDriverRank(time, dayType); |
| | |
| | | performanceRankingWarppers = revenueService.queryDriverRank(2, time, dayType); |
| | | } |
| | | if(type == 3){//收入 |
| | | performanceRankingWarppers = revenueService.queryDriverRank(null, time, dayType); |
| | | performanceRankingWarppers = revenueService.queryDriverRank(1, time, dayType); |
| | | } |
| | | for (int i = 0; i < performanceRankingWarppers.size(); i++) { |
| | | PerformanceRankingWarpper performanceRankingWarpper = performanceRankingWarppers.get(i); |
| | | Double amountOfData = performanceRankingWarpper.getAmountOfData(); |
| | | if(amountOfData.compareTo(d) != 0){ |
| | | position++; |
| | | d = amountOfData; |
| | | } |
| | | if(position <= 10){ |
| | | list.add(performanceRankingWarpper); |
| | | } |
| | | if(performanceRankingWarpper.getDriverId().compareTo(driverId) == 0){ |
| | | position = i + 1; |
| | | break; |
| | | } |
| | | } |
| | | performanceSummaryWarpper.setPosition(position); |
| | | performanceSummaryWarpper.setList(list); |
| | | performanceSummaryWarpper.setList(performanceRankingWarppers.size() > 10 ? performanceRankingWarppers.subList(0, 10) : performanceRankingWarppers.subList(0, performanceRankingWarppers.size())); |
| | | return performanceSummaryWarpper; |
| | | } |
| | | |
| | |
| | | list.add(myAchievementWarpper); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 主动完成线下收款 |
| | | */ |
| | | @Override |
| | | public void completeCollection() { |
| | | this.baseMapper.completeCollection(); |
| | | } |
| | | } |