zhibing.pu
2024-04-10 e47a578e0caace7c23b38aecf16c378eb75ff963
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -181,8 +181,8 @@
            d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));
            c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
        }
        incomeService.saveData(1, orderLogistics.getCompanyId(), 2, orderLogistics.getId(), orderLogistics.getType(), d.doubleValue());
        incomeService.saveData(2, orderLogistics.getDriverId(), 2, orderLogistics.getId(), orderLogistics.getType(), c.doubleValue());
//        incomeService.saveData(1, orderLogistics.getCompanyId(), 2, orderLogistics.getId(), orderLogistics.getType(), d.doubleValue());
//        incomeService.saveData(2, orderLogistics.getDriverId(), 2, orderLogistics.getId(), orderLogistics.getType(), c.doubleValue());
        driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
        driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
        driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
@@ -229,6 +229,7 @@
            String travelTime_ = map.get("travelTime_").toString();
            map.put("travelTime_", DateUtil.conversionFormat1(language, travelTime_));
        }
        map.put("cancelUser", language == 1 ? "用户" : language == 2 ? "The client" : "Le client");
        return map;
    }
@@ -312,6 +313,7 @@
                        d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));
                        c = new BigDecimal(orderLogistics.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
                    }
                    incomeService.saveData(1, orderLogistics.getCompanyId(), 2, orderLogistics.getId(), 4, d.doubleValue());
                    incomeService.saveData(2, orderLogistics.getDriverId(), 2, orderLogistics.getId(), 4, c.doubleValue());
                    Driver driver = driverService.selectById(orderLogistics.getDriverId());
@@ -333,6 +335,32 @@
                        }
                    }
                    Driver driver = driverService.selectById(orderLogistics.getDriverId());
                    if(null != orderLogistics.getCouponMoney() && 0 < orderLogistics.getCouponMoney()){
                        Double money = orderLogistics.getCouponMoney();
                        incomeService.saveData(2, orderLogistics.getDriverId(), 5, orderLogistics.getId(), orderLogistics.getType(), money);
                        driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                        driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                        driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                        driverService.updateById(driver);
                    }
                    if(null != orderLogistics.getDiscountMoney() && 0 < orderLogistics.getDiscountMoney()){
                        Double money = orderLogistics.getDiscountMoney();
                        incomeService.saveData(2, orderLogistics.getDriverId(), 6, orderLogistics.getId(), orderLogistics.getType(), money);
                        driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                        driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                        driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                        driverService.updateById(driver);
                    }
                    if(null != orderLogistics.getRedPacketMoney() && 0 < orderLogistics.getRedPacketMoney()){
                        Double money = orderLogistics.getRedPacketMoney();
                        incomeService.saveData(2, orderLogistics.getDriverId(), 7, orderLogistics.getId(), orderLogistics.getType(), money);
                        driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                        driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                        driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                        driverService.updateById(driver);
                    }
                    Company company = companyService.selectById(orderLogistics.getCompanyId());
@@ -352,7 +380,7 @@
                    if(d.compareTo(new BigDecimal(0)) > 0){
                        SettlementDetail settlementDetail = new SettlementDetail();
                        settlementDetail.setOrderId(orderId);
                        settlementDetail.setOrderType(1);
                        settlementDetail.setOrderType(4);
                        settlementDetail.setDriverId(orderLogistics.getDriverId());
                        settlementDetail.setOrderMoney(sum);
                        settlementDetail.setPrice(d.doubleValue());
@@ -363,24 +391,33 @@
                        if(null != settlementAllocation){
                            JSONObject jsonObject = JSON.parseObject(settlementAllocation.getContent());
                            Double maxPrice = jsonObject.getDouble("maxPrice");
                            List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", orderLogistics.getDriverId()).isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')"));
                            BigDecimal total = new BigDecimal(0);
                            for (SettlementDetail detail : settlementDetailList) {
                                total = total.add(new BigDecimal(detail.getPrice()));
                            }
                            if(maxPrice.compareTo(total.doubleValue()) <= 0){
                                SettlementRecord settlementRecord = new SettlementRecord();
                                settlementRecord.setDay(new Date());
                                settlementRecord.setDriverId(orderLogistics.getDriverId());
                                settlementRecord.setType(1);
                                settlementRecord.setPaymentStatus(1);
                                settlementRecord.setPayMoney(sum);
                                settlementRecord.setInsertTime(new Date());
                                settlementRecordService.insert(settlementRecord);
                            Integer type = jsonObject.getInteger("type");
                            if(type == 1){
                                List<SettlementDetail> settlementDetailList = settlementDetailService.selectList(new EntityWrapper<SettlementDetail>().eq("driverId", orderLogistics.getDriverId()).isNull("settlementRecordId").last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(createTime, '%Y-%m-%d')"));
                                BigDecimal total = new BigDecimal(0);
                                for (SettlementDetail detail : settlementDetailList) {
                                    detail.setSettlementRecordId(settlementRecord.getId());
                                    settlementDetailService.updateById(detail);
                                    total = total.add(new BigDecimal(detail.getPrice()));
                                }
                                if(maxPrice.compareTo(total.doubleValue()) <= 0){
                                    SettlementRecord settlementRecord = settlementRecordService.selectOne(new EntityWrapper<SettlementRecord>().eq("driverId", orderLogistics.getDriverId())
                                            .eq("type", type).eq("paymentStatus", 1).last(" and day = DATE_FORMAT(now(), '%Y-%m-%d')"));
                                    if(null == settlementRecord){
                                        settlementRecord = new SettlementRecord();
                                        settlementRecord.setDay(new Date());
                                        settlementRecord.setDriverId(orderLogistics.getDriverId());
                                        settlementRecord.setType(type);
                                        settlementRecord.setPaymentStatus(1);
                                        settlementRecord.setPayMoney(total.doubleValue());
                                        settlementRecord.setInsertTime(new Date());
                                        settlementRecordService.insert(settlementRecord);
                                    }else{
                                        settlementRecord.setPayMoney(total.doubleValue());
                                        settlementRecordService.updateById(settlementRecord);
                                    }
                                    for (SettlementDetail detail : settlementDetailList) {
                                        detail.setSettlementRecordId(settlementRecord.getId());
                                        settlementDetailService.updateById(detail);
                                    }
                                }
                            }
                        }
@@ -451,34 +488,34 @@
                    Element title_chinese = document.getElementById("title_chinese");
                    title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney());
                    Element xcf_chinese = document.getElementById("xcf_chinese");
                    xcf_chinese.text("GHS " + orderLogistics.getOrderMoney());
                    xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_chinese = document.getElementById("yhq_chinese");
                        yhq_chinese.text("GHS -" + orderLogistics.getCouponMoney());
                        yhq_chinese.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element yhq_chinese_div = document.getElementById("yhq_chinese_div");
                        yhq_chinese_div.remove();
                    }
                    if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){
                        Element zk_chinese = document.getElementById("zk_chinese");
                        zk_chinese.text("GHS -" + orderLogistics.getDiscountMoney());
                        zk_chinese.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element zk_chinese_div = document.getElementById("zk_chinese_div");
                        zk_chinese_div.remove();
                    }
                    if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){
                        Element hb_chinese = document.getElementById("hb_chinese");
                        hb_chinese.text("GHS -" + orderLogistics.getRedPacketMoney());
                        hb_chinese.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element hb_chinese_div = document.getElementById("hb_chinese_div");
                        hb_chinese_div.remove();
                    }
                    Element xj_chinese = document.getElementById("xj_chinese");
                    xj_chinese.text("GHS " + orderLogistics.getPayMoney());
                    xj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element pay_type_chinese = document.getElementById("pay_type_chinese");
                    pay_type_chinese.text(payTypeChinese);
                    Element pay_money_chinese = document.getElementById("pay_money_chinese");
                    pay_money_chinese.text("GHS " + orderLogistics.getPayMoney());
                    pay_money_chinese.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element pdf_chinese = document.getElementById("pdf_chinese");
                    pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4");
                    Element lost_item_chinese = document.getElementById("lost_item_chinese");
@@ -490,7 +527,7 @@
                    Elements driver_chinese = document.getElementsByClass("driver_chinese");
                    for (int i = 0; i < driver_chinese.size(); i++) {
                        Element element = driver_chinese.get(i);
                        element.text(driver.getFirstName() + "." + driver.getLastName());
                        element.text(" " + driver.getFirstName() + "." + driver.getLastName());
                    }
                    Element cp_chinese = document.getElementById("cp_chinese");
                    cp_chinese.text("车牌:" + car.getCarLicensePlate());
@@ -511,34 +548,34 @@
                    Element title_english = document.getElementById("title_english");
                    title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip ");
                    Element xcf_english = document.getElementById("xcf_english");
                    xcf_english.text("GHS " + orderLogistics.getOrderMoney());
                    xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_english = document.getElementById("yhq_english");
                        yhq_english.text("GHS -" + orderLogistics.getCouponMoney());
                        yhq_english.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element yhq_english_div = document.getElementById("yhq_english_div");
                        yhq_english_div.remove();
                    }
                    if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){
                        Element zk_english = document.getElementById("zk_english");
                        zk_english.text("GHS -" + orderLogistics.getDiscountMoney());
                        zk_english.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element zk_english_div = document.getElementById("zk_english_div");
                        zk_english_div.remove();
                    }
                    if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){
                        Element hb_english = document.getElementById("hb_english");
                        hb_english.text("GHS -" + orderLogistics.getRedPacketMoney());
                        hb_english.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element hb_english_div = document.getElementById("hb_english_div");
                        hb_english_div.remove();
                    }
                    Element xj_english = document.getElementById("xj_english");
                    xj_english.text("GHS " + orderLogistics.getPayMoney());
                    xj_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element pay_type_english = document.getElementById("pay_type_english");
                    pay_type_english.text(payTypeEnglish);
                    Element pay_money_english = document.getElementById("pay_money_english");
                    pay_money_english.text("GHS " + orderLogistics.getPayMoney());
                    pay_money_english.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element pdf_english = document.getElementById("pdf_english");
                    pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4");
                    Element lost_item_english = document.getElementById("lost_item_english");
@@ -550,7 +587,7 @@
                    Elements driver_english = document.getElementsByClass("driver_english");
                    for (int i = 0; i < driver_english.size(); i++) {
                        Element element = driver_english.get(i);
                        element.text(driver.getFirstName() + "." + driver.getLastName());
                        element.text(" " + driver.getFirstName() + "." + driver.getLastName());
                    }
                    Element cp_english = document.getElementById("cp_english");
                    cp_english.text("Number Plate:" + car.getCarLicensePlate());
@@ -571,34 +608,34 @@
                    Element title_french = document.getElementById("title_french");
                    title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le ");
                    Element xcf_french = document.getElementById("xcf_french");
                    xcf_french.text("GHS " + orderLogistics.getOrderMoney());
                    xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_french = document.getElementById("yhq_french");
                        yhq_french.text("GHS -" + orderLogistics.getCouponMoney());
                        yhq_french.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element yhq_french_div = document.getElementById("yhq_french_div");
                        yhq_french_div.remove();
                    }
                    if(null != orderLogistics.getDiscountMoney() && orderLogistics.getDiscountMoney() > 0){
                        Element zk_french = document.getElementById("zk_french");
                        zk_french.text("GHS -" + orderLogistics.getDiscountMoney());
                        zk_french.text("GHS -" + new BigDecimal(orderLogistics.getDiscountMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element zk_french_div = document.getElementById("zk_french_div");
                        zk_french_div.remove();
                    }
                    if(null != orderLogistics.getRedPacketMoney() && orderLogistics.getRedPacketMoney() > 0){
                        Element hb_french = document.getElementById("hb_french");
                        hb_french.text("GHS -" + orderLogistics.getRedPacketMoney());
                        hb_french.text("GHS -" + new BigDecimal(orderLogistics.getRedPacketMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element hb_french_div = document.getElementById("hb_french_div");
                        hb_french_div.remove();
                    }
                    Element xj_french = document.getElementById("xj_french");
                    xj_french.text("GHS " + orderLogistics.getPayMoney());
                    xj_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element pay_type_french = document.getElementById("pay_type_french");
                    pay_type_french.text(payTypeFrench);
                    Element pay_money_french = document.getElementById("pay_money_french");
                    pay_money_french.text("GHS " + orderLogistics.getPayMoney());
                    pay_money_french.text("GHS " + new BigDecimal(orderLogistics.getPayMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element pdf_french = document.getElementById("pdf_french");
                    pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=4");
                    Element lost_item_french = document.getElementById("lost_item_french");
@@ -610,7 +647,7 @@
                    Elements driver_french = document.getElementsByClass("driver_french");
                    for (int i = 0; i < driver_french.size(); i++) {
                        Element element = driver_french.get(i);
                        element.text(driver.getFirstName() + "." + driver.getLastName());
                        element.text(" " + driver.getFirstName() + "." + driver.getLastName());
                    }
                    Element cp_french = document.getElementById("cp_french");
                    cp_french.text("Plaque: GS " + car.getCarLicensePlate());