puzhibing
2023-05-31 0a6f905b50a88993da05b9b3114394fb91dbc7d0
修改bug
9个文件已修改
159 ■■■■■ 已修改文件
driver/guns-admin/src/main/java/com/agentdriving/driver/modular/system/service/IAccountChangeDetailService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/agentdriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/agentdriving/driver/modular/system/service/impl/OrderPositionServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/agentdriving/driver/modular/system/service/impl/OrderServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/THomePageController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TRevenueServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/webapp/WEB-INF/view/system/tSystemConfig/tSystemConfigPriceRules.html 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/webapp/static/modular/system/tSystemConfig/tSystemConfig.js 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/agentdriving/driver/modular/system/service/IAccountChangeDetailService.java
@@ -1,6 +1,7 @@
package com.agentdriving.driver.modular.system.service;
import com.agentdriving.driver.modular.system.model.AccountChangeDetail;
import com.agentdriving.driver.modular.system.model.Order;
import com.agentdriving.driver.modular.system.warpper.BalanceDetailWarpper;
import com.baomidou.mybatisplus.service.IService;
import com.agentdriving.driver.modular.system.warpper.CommissionDetailListWarpper;
@@ -62,5 +63,5 @@
    /**
     * 处理司机保险费用
     */
    void deductionInsurance();
    void deductionInsurance(Integer driverId);
}
driver/guns-admin/src/main/java/com/agentdriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java
@@ -2,6 +2,7 @@
import com.agentdriving.driver.modular.system.dao.AccountChangeDetailMapper;
import com.agentdriving.driver.modular.system.model.AccountChangeDetail;
import com.agentdriving.driver.modular.system.model.Order;
import com.agentdriving.driver.modular.system.util.UUIDUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@@ -110,142 +111,77 @@
     * 处理司机保险
     */
    @Override
    public void deductionInsurance() {
    public void deductionInsurance(Integer driverId) {
        SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 3));
        if(null == systemConfig){
            return;
        }
        JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
        Double num1 = jsonObject.getDouble("num1");
        List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2).eq("status", 1));
        for (Driver driver : drivers) {
        Driver driver = driverService.selectById(driverId);
            Double couponBalance = driver.getCouponBalance();
            Double backgroundBalance = driver.getBackgroundBalance();
            Double balance = driver.getBalance();
            Double commission = driver.getCommission();
            double all = couponBalance + backgroundBalance + balance + commission;
            if(num1 > all){
                continue;
        if(num1.compareTo(all) > 0){
            return;
            }
            double d = num1.doubleValue();
        Double old = driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission();
            if(backgroundBalance > 0 && backgroundBalance < d){
                AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                accountChangeDetail.setUserType(2);
                accountChangeDetail.setUserId(driver.getId());
                accountChangeDetail.setType(1);
                accountChangeDetail.setChangeType(8);
                accountChangeDetail.setOldData(driver.getBackgroundBalance());
                accountChangeDetail.setNewData(0D);
                accountChangeDetail.setExplain("收取保险费");
                accountChangeDetail.setCreateTime(new Date());
                this.insert(accountChangeDetail);
                d -= backgroundBalance;
                driver.setBackgroundBalance(0D);
            }
            if(backgroundBalance > 0 && backgroundBalance >= d){
                AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                accountChangeDetail.setUserType(2);
                accountChangeDetail.setUserId(driver.getId());
                accountChangeDetail.setType(1);
                accountChangeDetail.setChangeType(8);
                accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                driver.setBackgroundBalance(driver.getBackgroundBalance() - d);
                accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                accountChangeDetail.setExplain("收取保险费");
                accountChangeDetail.setCreateTime(new Date());
                this.insert(accountChangeDetail);
                d = 0;
            }
            if(d > 0){
                if(couponBalance > 0 && couponBalance < d){
                    AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                    accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                    accountChangeDetail.setUserType(2);
                    accountChangeDetail.setUserId(driver.getId());
                    accountChangeDetail.setType(1);
                    accountChangeDetail.setChangeType(8);
                    accountChangeDetail.setOldData(driver.getCouponBalance());
                    accountChangeDetail.setNewData(0D);
                    accountChangeDetail.setExplain("收取保险费");
                    accountChangeDetail.setCreateTime(new Date());
                    this.insert(accountChangeDetail);
                    d -= couponBalance;
                    driver.setCouponBalance(0D);
                }
                if(couponBalance > 0 && couponBalance >= d){
                    AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                    accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                    accountChangeDetail.setUserType(2);
                    accountChangeDetail.setUserId(driver.getId());
                    accountChangeDetail.setType(1);
                    accountChangeDetail.setChangeType(8);
                    accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    driver.setCouponBalance(driver.getCouponBalance() - d);
                    accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    accountChangeDetail.setExplain("收取保险费");
                    accountChangeDetail.setCreateTime(new Date());
                    this.insert(accountChangeDetail);
                    d = 0;
                }
            }
            if(d > 0){
                if(commission > 0 && commission < d){
                    AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                    accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                    accountChangeDetail.setUserType(2);
                    accountChangeDetail.setUserId(driver.getId());
                    accountChangeDetail.setType(1);
                    accountChangeDetail.setChangeType(8);
                    accountChangeDetail.setOldData(driver.getCommission());
                    accountChangeDetail.setNewData(0D);
                    accountChangeDetail.setExplain("收取保险费");
                    accountChangeDetail.setCreateTime(new Date());
                    this.insert(accountChangeDetail);
                    d -= commission;
                    driver.setCommission(0D);
                }
                if(commission > 0 && commission >= d){
                    AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                    accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                    accountChangeDetail.setUserType(2);
                    accountChangeDetail.setUserId(driver.getId());
                    accountChangeDetail.setType(1);
                    accountChangeDetail.setChangeType(8);
                    accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    driver.setCommission(driver.getCommission() - d);
                    accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    accountChangeDetail.setExplain("收取保险费");
                    accountChangeDetail.setCreateTime(new Date());
                    this.insert(accountChangeDetail);
                    d = 0;
                }
            }
            if(d > 0){
                if(balance > 0 && balance < d){
                    continue;
                d -= commission;
                driver.setBalance(0D);
                return;
                }
                if(balance > 0 && balance >= d){
                driver.setBalance(driver.getBalance() - d);
                d = 0;
            }
        }
                    AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                    accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                    accountChangeDetail.setUserType(2);
                    accountChangeDetail.setUserId(driver.getId());
                    accountChangeDetail.setType(1);
                    accountChangeDetail.setChangeType(8);
                    accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    driver.setBalance(driver.getBalance() - d);
        accountChangeDetail.setOldData(old);
                    accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    accountChangeDetail.setExplain("收取保险费");
                    accountChangeDetail.setCreateTime(new Date());
                    this.insert(accountChangeDetail);
                    d = 0;
                }
            }
            driverService.updateById(driver);
        }
    }
}
driver/guns-admin/src/main/java/com/agentdriving/driver/modular/system/service/impl/OrderPositionServiceImpl.java
@@ -59,14 +59,14 @@
            OrderPositionWarpper orderPositionWarpper = orderPositionWarppers.get(orderPositionWarppers.size() - 1);
            saveOrderMileage(driverPositionWarpper, orderPositionWarpper);
        }
        //大于50米才存储有效定位数据
        //大于100米才存储有效定位数据
        if(orderPositionWarppers.size() > 0){
            OrderPositionWarpper orderPositionWarpper1 = orderPositionWarppers.get(orderPositionWarppers.size() - 1);
            String fromLonLat = driverPositionWarpper.getLon() + "," + driverPositionWarpper.getLat();
            String toLonLat = orderPositionWarpper1.getLon() + "," + orderPositionWarpper1.getLat();
            Map<String, Double> distance = GeodesyUtil.getDistance(fromLonLat, toLonLat);
            Double wgs84 = distance.get("WGS84");
            if(wgs84 >= 50){
            if(wgs84 >= 100){
                OrderPositionWarpper orderPositionWarpper = new OrderPositionWarpper();
                BeanUtils.copyProperties(driverPositionWarpper, orderPositionWarpper);
                orderPositionWarpper.setInsertTime(new Date());
driver/guns-admin/src/main/java/com/agentdriving/driver/modular/system/service/impl/OrderServiceImpl.java
@@ -867,7 +867,7 @@
                Driver driver = driverService.selectById(order.getDriverId());
                driver.setServerStatus(1);
                driverService.updateById(driver);
                accountChangeDetailService.deductionInsurance();//扣减保险费
                accountChangeDetailService.deductionInsurance(order.getDriverId());//扣减保险费
                saveIntegral(order);
                break;
            case 401:
@@ -994,7 +994,7 @@
                }
                pushOrderInfoWarpper.setWaitTime(order.getWaitTime() + w);
                pushOrderInfoWarpper.setState(order.getState());
                pushOrderInfoWarpper.setActualMileage(Double.valueOf(order.getActualMileage() / 1000));
                pushOrderInfoWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                pushOrderInfoWarpper.setTravelTime(0);
                if(null != order.getStartTime()){
                    int travelTime = Double.valueOf((System.currentTimeMillis() - order.getStartTime().getTime()) / 60000).intValue();
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/THomePageController.java
@@ -652,9 +652,7 @@
            }
        }else {
            // 业绩排名 performanceTable
            // 查询广东全区域数据 查询广东所有的代理商
            List<TAgent> tAgentList = tAgentService.selectList(new EntityWrapper<TAgent>()
                    .eq("provinceCode", "440000"));
            List<TAgent> tAgentList = tAgentService.selectList(null);
            List<Integer> ids = tAgentList.stream().map(TAgent::getId).collect(Collectors.toList());
            if (1 == type){
                // 单量
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TOrderServiceImpl.java
@@ -151,6 +151,7 @@
        // 查询用户
        TAppUser tAppUser = tAppUserMapper.selectById(tOrder.getUserId());
        if(null != tAppUser){
        model.addAttribute("userName",tAppUser.getNickname());
        model.addAttribute("userPhone",tAppUser.getPhone());
        model.addAttribute("havDiscount",tAppUser.getHavDiscount());
@@ -159,6 +160,12 @@
            BigDecimal multiply = tOrder.getOrderMoney().multiply(new BigDecimal("0.1")).setScale(2);
            model.addAttribute("multiply",multiply);
        }
        }else{
            model.addAttribute("userName",tOrder.getUserName());
            model.addAttribute("userPhone",tOrder.getUserPhone());
            model.addAttribute("havDiscount", 0);
            model.addAttribute("multiply",0D);
        }
        // 查询司机
        TDriver tDriver = tDriverMapper.selectById(tOrder.getDriverId());
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TRevenueServiceImpl.java
@@ -153,5 +153,6 @@
            list = tRevenueMapper.getDataStatisticsIncomeOrCommissionByIds(ids,2,monthDate);
        }
        model.addAttribute("performanceResp",list);
        map.put("performanceResp",list);
    }
}
management/guns-admin/src/main/webapp/WEB-INF/view/system/tSystemConfig/tSystemConfigPriceRules.html
@@ -59,9 +59,9 @@
                            <div class="rulesForm" style="border: 1px solid #888888;padding-top: 10px;display: grid;margin: 10px 0px">
                                <div class="initialLevel col-sm-12 control-label form-group" id='time' >
                                    <span class="control-label" >时间段</span>
                                    <input class="control-label" id="num1" name="num1" type="text" value="${o.num1}" placeholder="00:00" style="height: 30px;width: 80px">
                                    <input class="control-label time-item" id="num1" name="num1" type="text" value="${o.num1}" placeholder="00:00" style="height: 30px;width: 80px" readonly>
                                    <span class="control-label" >——</span>
                                    <input class="control-label" id="num2" name="num2" type="text" value="${o.num2}" placeholder="00:00" style="height: 30px;width: 80px">
                                    <input class="control-label time-item" id="num2" name="num2" type="text" value="${o.num2}" placeholder="00:00" style="height: 30px;width: 80px" readonly>
                                    <span class="fa fa-remove" style='position: absolute;right: 20px;color: red;font-size: 20px;' onclick="TSystemConfig.delTime(this)"></span>
                                </div>
                                <div class="prices">
@@ -162,20 +162,16 @@
<script src="${ctxPath}/static/modular/system/tSystemConfig/tSystemConfig.js"></script>
<script src="${ctxPath}/static/modular/system/tSystemConfig/tSystemConfig_info.js"></script>
<script type="text/javascript">
    // laydate.render({
    //     elem: 'input[name=num1]',
    //     type: 'time',
    //     format: 'HH:mm',
    //     range: false,
    //     lang:'zn'
    // });
    // laydate.render({
    //     elem: 'input[name=num2]',
    //     type: 'time',
    //     format: 'HH:mm',
    //     range: false,
    //     lang:'zn'
    // });
    lay('.time-item').each(function(){
        laydate.render({
            elem: this,
            type: 'time',
            format: 'HH:mm',
            range: false,
            lang:'zn',
            trigger: 'click'
        });
    });
    var elem1 = document.querySelector(".js-switch1");
    var init1 = new Switchery(elem1);
management/guns-admin/src/main/webapp/static/modular/system/tSystemConfig/tSystemConfig.js
@@ -289,9 +289,9 @@
        "                                <div class=\"initialLevel col-sm-12 control-label form-group\" id='time' >\n" +
        "                                    <span class=\"control-label\" >时间段</span>\n" +
        "                                    <input class=\"control-label\" id=\"num1\" name=\"num1\" type=\"text\" placeholder=\"00:00\" style=\"height: 30px;width: 80px\">\n" +
        "                                    <input class=\"control-label time-item\" id=\"num1\" name=\"num1\" type=\"text\" placeholder=\"00:00\" style=\"height: 30px;width: 80px\" readonly>\n" +
        "                                    <span class=\"control-label\" >——</span>\n" +
        "                                    <input class=\"control-label\" id=\"num2\" name=\"num2\" type=\"text\" placeholder=\"00:00\" style=\"height: 30px;width: 80px\">\n" +
        "                                    <input class=\"control-label time-item\" id=\"num2\" name=\"num2\" type=\"text\" placeholder=\"00:00\" style=\"height: 30px;width: 80px\" readonly>\n" +
        "                                    <span class=\"fa fa-remove\" style='position: absolute;right: 20px;color: red;font-size: 20px;' onclick=\"TSystemConfig.delTime(this)\"></span>\n" +
        "                                </div>\n" +
        "<div class='prices'>\n" +
@@ -322,6 +322,16 @@
        "</div>"
    $("#rules").append($(a))
    lay('.time-item').each(function(){
        laydate.render({
            elem: this,
            type: 'time',
            format: 'HH:mm',
            range: false,
            lang:'zn',
            trigger: 'click'
        });
    });
}