zhibing.pu
2024-07-25 b3b7d3ae4789eb3d4d4bbadccd03d79adb28cb1a
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
@@ -11,6 +11,7 @@
import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService;
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.dao.UserActivityDiscount1Mapper;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.*;
@@ -30,6 +31,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
@@ -105,6 +107,9 @@
    
    @Autowired
    private IUserRedPacketRecordService userRedPacketRecordService;
    @Resource
    private UserActivityDiscount1Mapper userActivityDiscount1Mapper;
    /**
     * 获取正在进行中的订单
@@ -663,7 +668,7 @@
                    userId = orderPrivateCar.getUserId();
                    state = orderPrivateCar.getState();
                    if(null != driverId){
                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "");
                    }
                    break;
                case 2:
@@ -672,7 +677,7 @@
                    userId = orderTaxi.getUserId();
                    state = orderTaxi.getState();
                    if(null != driverId){
                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "");
                    }
                    break;
                case 3:
@@ -683,7 +688,7 @@
                    if(orderCrossCity.getPayMoney() == null && state == 10){//支付的情况才推送取消
                        break;
                    }else{
                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "");
                    }
                    break;
                case 4:
@@ -694,7 +699,7 @@
                    if(orderLogistics.getPayMoney() == null && state == 10){//支付的情况才推送取消
                        break;
                    }else{
                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "");
                    }
                    break;
                case 5:
@@ -705,11 +710,11 @@
                    if(orderLogistics1.getPayMoney() == null && state == 10){//支付的情况才推送取消
                        break;
                    }else{
                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0);
                        pushUtil.pushOrderState(2, driverId, id, orderType, state, 0, "");
                    }
                    break;
            }
            pushUtil.pushOrderState(1, userId, id, orderType, state, 0);
            pushUtil.pushOrderState(1, userId, id, orderType, state, 0, "");
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
@@ -1053,7 +1058,21 @@
                case 1:
                    map = orderPrivateCarService.queryBalance(orderId, uid);
                    OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
                    payMoney = orderPrivateCar.getPayMoney();
                    payMoney = orderPrivateCar.getOrderMoney();
                    UserActivityDiscount1 query = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId());
                    if(null != query){
                        Integer orderNum=orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query.getId()).last(" and to_days(getoffTime) = to_days(now())"));
                        if(query.getDistance()*1000>orderPrivateCar.getMileage() && query.getOrderNum()>orderNum){
                            Double special = query.getSpecial();
                            orderPrivateCar.setDiscount(special);
                            Double orderMoney = orderPrivateCar.getOrderMoney();
                            double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
                            if(orderMoney.compareTo(v) > 0){
                                payMoney = v;
                            }
                        }
                    }
                    break;
//                case 2:
//                    map = orderTaxiService.queryBalance(orderId, uid);
@@ -1064,7 +1083,20 @@
                case 4:
                    map = orderLogisticsService.queryBalance(orderId, uid);
                    OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId);
                    payMoney = orderLogistics.getPayMoney();
                    payMoney = orderLogistics.getOrderMoney();
                    UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId());
                    if(null != query2){
                        Integer orderNum=orderLogisticsService.selectCount(new EntityWrapper<OrderLogistics>().eq("userId",orderLogistics.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())"));
                        if(query2.getDistance()*1000>orderLogistics.getMileage() && query2.getOrderNum()>orderNum){
                            Double special = query2.getLogistics();
                            orderLogistics.setDiscount(special);
                            Double orderMoney = orderLogistics.getOrderMoney();
                            double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
                            if(orderMoney.compareTo(v) > 0){
                                payMoney = v;
                            }
                        }
                    }
                    break;
//                case 5:
//                    map = orderLogisticsService.queryBalance(orderId, uid);
@@ -1077,7 +1109,7 @@
                map.put("deductionAmount", 0D);
            }else{
                Double deductionAmount = new BigDecimal(payMoney).multiply(redEnvelopePaymentSettings.getDeductionRatio().divide(new BigDecimal(100))).doubleValue();
                map.put("deductionAmount", deductionAmount);
                map.put("deductionAmount", aDouble.compareTo(deductionAmount) >= 0 ? deductionAmount : aDouble);
            }
            return ResultUtil.success(map);
        }catch (Exception e){