Pu Zhibing
2024-12-13 73b750200f25df08aa64124da49e7461f9de6653
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/transfer/server/impl/OrderTransferServiceImpl.java
@@ -261,7 +261,7 @@
        }
        OrderTransferCar orderPrivateCar = new OrderTransferCar();
        orderPrivateCar.setType(type);
        orderPrivateCar.setType(1);
        orderPrivateCar.setUserId(uid);
        orderPrivateCar.setServerCarModelId(serverCarModelId);
        orderPrivateCar.setOrderNum(this.getOrderNum());
@@ -321,7 +321,7 @@
                    driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1));
            orderPrivateCar.setState(2);
            orderPrivateCar.setCarId(driver.getCarId());
            CarService query1 = carServiceMapper.query(1, driver.getCarId());
            CarService query1 = carServiceMapper.query(7, driver.getCarId());
            orderPrivateCar.setServerCarModelId(query1.getServerCarModelId());
            orderPrivateCar.setSnatchOrderTime(new Date());
@@ -358,13 +358,16 @@
            }).start();
        }
        System.err.println("===="+orderPrivateCar.getState());
        //推单操作
        if(orderPrivateCar.getState() == 1){
            this.pushOrder(orderPrivateCar);
        }
        System.err.println("===="+orderPrivateCar.getState());
        //添加消息
        systemNoticeService.addSystemNotice(1, "您的专车订单已下单成功,我们正在为您指派司机,请稍后!", orderPrivateCar.getUserId(), 1);
        systemNoticeService.addSystemNotice(1, "您的接送机订单已下单成功,我们正在为您指派司机,请稍后!", orderPrivateCar.getUserId(), 1);
        BaseWarpper baseWarpper = new BaseWarpper();
        baseWarpper.setId(orderPrivateCar.getId());
@@ -556,9 +559,9 @@
            return ResultUtil.error("获取数据失败,订单信息有误");
        }
        double amount = 0;
        CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 7, orderPrivateCar.getCompanyId());
        CancleOrder query = cancleOrderService.query(orderPrivateCar.getType(), 7, orderPrivateCar.getCompanyId());
        if(null != orderPrivateCar.getDriverId() &&
                (orderPrivateCar.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况
                (orderPrivateCar.getSnatchOrderTime().getTime()-8L * 60 * 60 * 1000 + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况
            if(null != query){
                amount += query.getMoney();
            }
@@ -592,9 +595,23 @@
                orderPrivateCar.setState(10);
                this.updateById(orderPrivateCar);
        }else {
            CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 7, orderPrivateCar.getCompanyId());
            CancleOrder query = cancleOrderService.query(1, 7, orderPrivateCar.getCompanyId());
            if (null != query) {
                if ((orderPrivateCar.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < System.currentTimeMillis() && query.getMoney().compareTo(0D) > 0) {//收费的情况
                long snatchTimeMs = orderPrivateCar.getSnatchOrderTime().getTime() - 8 * 60 * 60 * 1000;
                long futureTimeMs = snatchTimeMs + query.getMinuteNum() * 60 * 1000;
                long currentTimeMs = System.currentTimeMillis();
                if (futureTimeMs < currentTimeMs){
                    System.out.printf("1111111111");
                }
                if (query.getMoney().compareTo(0D) > 0){
                    System.out.printf("22222222222");
                }
                if ((orderPrivateCar.getSnatchOrderTime().getTime() - 8 * 60 * 60 * 1000 + query.getMinuteNum() * 60 * 1000) < System.currentTimeMillis() && query.getMoney().compareTo(0D) > 0) {//收费的情况
                    orderPrivateCar.setState(12);
                    this.updateById(orderPrivateCar);
                    integer = orderCancelService.saveData(id, 7, reason, remark, null, query.getMoney(), 1, 1, uid);
@@ -668,7 +685,7 @@
            orderCancel = orderCancelService.selectById(cancleId);
        }
        CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 7, orderPrivateCar.getCompanyId());
        CancleOrder query = cancleOrderService.query(orderPrivateCar.getType(), 7, orderPrivateCar.getCompanyId());
        if(null != query){
            if(payType == 1){//微信支付
@@ -812,7 +829,7 @@
                        if(state > 1){
                            break;
                        }
                        if(i == querys.size() && state == 1){
                        if(i == 3 && state == 1){
                            pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 7);
                            orderIds.remove(orderPrivateCar.getId());
                        }
@@ -858,7 +875,7 @@
        UserInfo userInfo = userInfoService.selectById(uid);
        map.put("balance", userInfo.getBalance());
        OrderTransferCar orderPrivateCar = this.selectById(orderId);
        int i = userCouponRecordService.queryAvailable(uid, orderPrivateCar.getCompanyId(), 1, 1, orderPrivateCar.getOrderMoney());
        int i = userCouponRecordService.queryAvailable(uid, orderPrivateCar.getCompanyId(), 1, 7, orderPrivateCar.getOrderMoney());
        i = i + userCouponRecordService.queryAvailable(uid, orderPrivateCar.getCompanyId(), 1, 0, orderPrivateCar.getOrderMoney());
        map.put("coupon", i);
        return map;
@@ -867,7 +884,7 @@
    @Override
    public List<Map<String, Object>> queryCoupon(Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception {
        OrderTransferCar orderPrivateCar = this.selectById(orderId);
        List<Map<String, Object>> list = userCouponRecordService.queryCoupon(uid, orderPrivateCar.getCompanyId(), 1, 1, orderPrivateCar.getOrderMoney(), pageNum, size);
        List<Map<String, Object>> list = userCouponRecordService.queryCoupon(uid, orderPrivateCar.getCompanyId(), 1, 7, orderPrivateCar.getOrderMoney(), pageNum, size);
        List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(uid, orderPrivateCar.getCompanyId(), 1, 0, orderPrivateCar.getOrderMoney(), pageNum, size);
        list.addAll(list1);
        return list;
@@ -902,7 +919,7 @@
            if(userCouponRecord.getState() == 3){
                return ResultUtil.error("优惠券已过期");
            }
            if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 1){
            if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 7){
                return ResultUtil.error("优惠券不能用于此类型订单");
            }
            if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){
@@ -925,7 +942,7 @@
        //计算折扣
        UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId());
        if(null != query2){
            Double special = query2.getSpecial();
            Double special = query2.getTaxi();
            orderPrivateCar.setDiscount(special);
            double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
            if(orderMoney.compareTo(v) > 0){
@@ -1003,14 +1020,14 @@
            //添加已收入明细
            Company company = companyService.selectById(orderPrivateCar.getCompanyId());
            Double speMoney = company.getSpeMoney();
            Double speMoney = company.getTransferMoney();
            BigDecimal d = null;//企业收入
            BigDecimal c = null;//司机收入
            if(company.getIsSpeFixedOrProportional() == 2){//固定
            if(company.getIsTransferFixedOrProportional()!=null&&company.getIsTransferFixedOrProportional() == 2){//固定
                d = new BigDecimal(speMoney);
                c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机
            }
            if(company.getIsSpeFixedOrProportional() == 1){//比例
            if(company.getIsTransferFixedOrProportional()!=null&&company.getIsTransferFixedOrProportional() == 1){//比例
                Double price = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getDurationMoney() + orderPrivateCar.getLongDistanceMoney();
                d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))).setScale(2, BigDecimal.ROUND_HALF_EVEN);
                c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);