zhibing.pu
2024-08-27 d1cc28c9fd86017f4a0a9013554bf1602fef8bc8
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderPrivateCarController.java
@@ -15,12 +15,10 @@
import com.stylefeng.guns.core.util.SinataUtil;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.controller.util.PushUtil;
import com.stylefeng.guns.modular.system.controller.util.TextToSpeechUtil;
import com.stylefeng.guns.modular.system.dao.OrderCancelMapper;
import com.stylefeng.guns.modular.system.dao.TSystemPriceMapper;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.ChinaMobileUtil;
import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil;
import com.stylefeng.guns.modular.system.util.HttpRequestUtil;
import com.stylefeng.guns.modular.system.util.PushURL;
@@ -206,12 +204,14 @@
        TOrderPrivateCar orderPrivateCar = tOrderPrivateCarService.selectById(id);
        orderPrivateCar.setAbnormalMoney(orderPrivateCar.getOrderMoney());
        orderPrivateCar.setOrderMoney(money);
        orderPrivateCar.setPayMoney(money);
        orderPrivateCar.setState(7);
        orderPrivateCar.setIsDispute(1);
        orderPrivateCar.updateById();
        return SUCCESS_TIP;
    }
    @Resource
    private ITUserService userService;
    @RequestMapping(value = "/frozenOrder")
    @ResponseBody
    public Object frozenOrder(@RequestParam Integer tOrderPrivateCarId) throws Exception {
@@ -219,9 +219,23 @@
        //添加已收入明细
        TDriver tDriver = driverService.selectById(orderPrivateCar.getDriverId());
        orderPrivateCar = this.setMoney(orderPrivateCar, 0D, 0D);//计算费用
        //添加已收入明细
        TCompany company = companyService.selectById(orderPrivateCar.getCompanyId());
        Double taxi = company.getSpeMoney().doubleValue();
        Integer language =tDriver.getLanguage();
        BigDecimal d = null;//企业收入
        BigDecimal c = null;//司机收入
        if(company.getIsSpeFixedOrProportional() == 2){//固定
            d = new BigDecimal(taxi);
            c = orderPrivateCar.getOrderMoney().subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
        }
        if(company.getIsSpeFixedOrProportional() == 1){//比例
            Double price = orderPrivateCar.getStartMoney().doubleValue() + orderPrivateCar.getMileageMoney().doubleValue() + orderPrivateCar.getWaitMoney().doubleValue()+ orderPrivateCar.getDurationMoney().doubleValue() + orderPrivateCar.getLongDistanceMoney().doubleValue();
            d = new BigDecimal(price).multiply(new BigDecimal(taxi).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN);
            c = orderPrivateCar.getOrderMoney().subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
        }
        if(orderPrivateCar.getIsFrozen()==1){
            TDriver driver = driverService.selectById(orderPrivateCar.getDriverId());
            driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).subtract(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
@@ -256,14 +270,14 @@
                        orderPrivateCar1.setState(8);
                        orderPrivateCar1.setIsFree(2);
                        //添加已收入明细
                        TCompany company = companyService.selectById(orderPrivateCar1.getCompanyId());
                        BigDecimal speMoney = company.getSpeMoney();
                        TCompany tCompany = companyService.selectById(orderPrivateCar1.getCompanyId());
                        BigDecimal speMoney = tCompany.getSpeMoney();
                        if(company.getIsSpeFixedOrProportional() == 2){//固定
                        if(tCompany.getIsSpeFixedOrProportional() == 2){//固定
                            d = speMoney;
                            c = orderPrivateCar1.getOrderMoney().subtract(d);//只有出行金额参与抽成,其余归属司机
                        }
                        if(company.getIsSpeFixedOrProportional() == 1){//比例
                        if(tCompany.getIsSpeFixedOrProportional() == 1){//比例
                            BigDecimal price = orderPrivateCar1.getStartMoney().add(orderPrivateCar1.getMileageMoney()).add(new BigDecimal(orderPrivateCar1.getWaitMoney())).add(orderPrivateCar1.getDurationMoney()).add(orderPrivateCar1.getLongDistanceMoney());
                            d = price.multiply(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN));
                            c = orderPrivateCar1.getOrderMoney().subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
@@ -294,11 +308,11 @@
                orderPrivateCar1.setState(7);
            }
            Map<String, String> map = chinaMobileUtil.midAxbUnBindSend(orderPrivateCar1.getBindId(),orderPrivateCar1.getTelX());
            if(String.valueOf(map.get("code")).equals("200")){
                orderPrivateCar1.setTelX("");
                orderPrivateCar1.setBindId("");
            }
//            Map<String, String> map = chinaMobileUtil.midAxbUnBindSend(orderPrivateCar1.getBindId(),orderPrivateCar1.getTelX());
//            if(String.valueOf(map.get("code")).equals("200")){
//                orderPrivateCar1.setTelX("");
//                orderPrivateCar1.setBindId("");
//            }
            tOrderPrivateCarService.updateById(orderPrivateCar1);
@@ -335,18 +349,16 @@
            new Thread(new Runnable() {
                @Override
                public void run() {
                    pushUtil.frozenOrder(finalOrderPrivateCar.getDriverId(),2);
                    pushUtil.pushOrderState(2, finalOrderPrivateCar.getDriverId(), finalOrderPrivateCar.getId(), 1, 7, 0, "");
                }
            }).start();
        }
        orderPrivateCar.setIsFrozen(orderPrivateCar.getIsFrozen()==1?2:1);
        orderPrivateCar.setState(7);
        tOrderPrivateCarService.updateAllColumnById(orderPrivateCar);
        return SUCCESS_TIP;
    }
    @Autowired
    private ChinaMobileUtil chinaMobileUtil;
    @Autowired
    private PushUtil pushUtil;
    @Autowired
@@ -581,7 +593,7 @@
        if(orderPrivateCar.getIsplatPay()==2){
            return "error";
        }
    //添加已收入明细
        //添加已收入明细
        TCompany company = companyService.selectById(orderPrivateCar.getCompanyId());
        Double taxi = company.getSpeMoney().doubleValue();
        BigDecimal d = null;//企业收入
@@ -603,6 +615,9 @@
        driver.setBalance((null != driver.getBalance() ? driver.getBalance() : BigDecimal.ZERO).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN));
        driverService.updateById(driver);
        orderPrivateCar.setIsplatPay(2);
        orderPrivateCar.setPayManner(1);
        orderPrivateCar.setState(8);
        orderPrivateCar.setPayMoney(orderPrivateCar.getOrderMoney());
        tOrderPrivateCarService.updateAllColumnById(orderPrivateCar);
        return SUCCESS_TIP;
    }