puzhibing
2023-05-26 04ae1bf1c6b3f0498dfd180275a6d4255a8dce5e
修改bug
26个文件已修改
9335 ■■■■■ 已修改文件
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/OrderMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IOrderService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/BranchOfficeServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/CashWithdrawalServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderPositionServiceImpl.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/PushUtil.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/TaskUtil.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderPositionWarpper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/test/java/com/supersavedriving/driver/GunsApplicationTest.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/resources/application.yml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/guns-admin/src/main/webapp/WEB-INF/view/common/_right.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
super_save_driving.sql 8831 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Driver.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java 149 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/SystemConfigServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
user/guns-admin/src/main/resources/application.yml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user/guns-admin/src/main/resources/redis.properties 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zuul/src/main/java/com/sinata/zuul/util/applets/ChildChannelHandler.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zuul/src/main/java/com/sinata/zuul/util/applets/NettyWebSocketController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zuul/src/main/java/com/sinata/zuul/util/echo/NettyChannelMap.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zuul/src/main/java/com/sinata/zuul/util/echo/NettyServerController.java 73 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/OrderMapper.java
@@ -58,4 +58,10 @@
     * @return
     */
    List<PerformanceRankingWarpper> queryDriverRank(@Param("time") String time, @Param("dayType") Integer dayType);
    /**
     * 完成线下收款状态
     */
    void completeCollection();
}
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml
@@ -180,6 +180,7 @@
    <select id="queryDriverRank" resultType="com.supersavedriving.driver.modular.system.warpper.PerformanceRankingWarpper">
        select
        aa.driverId,
        @ROW :=@ROW + 1 as rank,
        aa.name,
        UNIX_TIMESTAMP(aa.createTime) * 1000 as createTime,
        aa.number as amountOfData
@@ -208,6 +209,11 @@
                </if>
            </if>
            group by a.driverId,b.`name`
        ) as aa order by aa.number desc
        ) as aa,( SELECT @ROW := 0 ) AS itable order by aa.number desc
    </select>
    <update id="completeCollection">
        update t_order set state = 108 where state = 107 and status = 1 and payType = 3
    </update>
</mapper>
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml
@@ -23,6 +23,7 @@
    <select id="queryDriverRank" resultType="com.supersavedriving.driver.modular.system.warpper.PerformanceRankingWarpper">
        select
        aa.driverId,
        @ROW :=@ROW + 1 as rank,
        aa.`name`,
        UNIX_TIMESTAMP(aa.createTime) * 1000 as createTime,
        aa.number as amountOfData
@@ -54,6 +55,6 @@
            </if>
        </if>
        group by a.userId,b.`name`
        ) as aa order by aa.number desc
        ) as aa,( SELECT @ROW := 0 ) AS itable order by aa.number desc
    </select>
</mapper>
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IOrderService.java
@@ -197,4 +197,10 @@
     * @throws Exception
     */
    List<MyAchievementWarpper> queryMyAchievement(Integer driverId, String time) throws Exception;
    /**
     * 主动完成线下收款
     */
    void completeCollection();
}
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java
@@ -151,9 +151,9 @@
                accountChangeDetail.setUserId(driver.getId());
                accountChangeDetail.setType(1);
                accountChangeDetail.setChangeType(8);
                accountChangeDetail.setOldData(driver.getBackgroundBalance());
                accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                driver.setBackgroundBalance(driver.getBackgroundBalance() - d);
                accountChangeDetail.setNewData(driver.getBackgroundBalance());
                accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                accountChangeDetail.setExplain("收取保险费");
                accountChangeDetail.setCreateTime(new Date());
                this.insert(accountChangeDetail);
@@ -183,9 +183,9 @@
                    accountChangeDetail.setUserId(driver.getId());
                    accountChangeDetail.setType(1);
                    accountChangeDetail.setChangeType(8);
                    accountChangeDetail.setOldData(driver.getCouponBalance());
                    accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    driver.setCouponBalance(driver.getCouponBalance() - d);
                    accountChangeDetail.setNewData(driver.getCouponBalance());
                    accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    accountChangeDetail.setExplain("收取保险费");
                    accountChangeDetail.setCreateTime(new Date());
                    this.insert(accountChangeDetail);
@@ -215,9 +215,9 @@
                    accountChangeDetail.setUserId(driver.getId());
                    accountChangeDetail.setType(1);
                    accountChangeDetail.setChangeType(8);
                    accountChangeDetail.setOldData(driver.getCommission());
                    accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    driver.setCommission(driver.getCommission() - d);
                    accountChangeDetail.setNewData(driver.getCommission());
                    accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    accountChangeDetail.setExplain("收取保险费");
                    accountChangeDetail.setCreateTime(new Date());
                    this.insert(accountChangeDetail);
@@ -235,9 +235,9 @@
                    accountChangeDetail.setUserId(driver.getId());
                    accountChangeDetail.setType(1);
                    accountChangeDetail.setChangeType(8);
                    accountChangeDetail.setOldData(driver.getBalance());
                    accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    driver.setBalance(driver.getBalance() - d);
                    accountChangeDetail.setNewData(driver.getBalance());
                    accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    accountChangeDetail.setExplain("收取保险费");
                    accountChangeDetail.setCreateTime(new Date());
                    this.insert(accountChangeDetail);
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/BranchOfficeServiceImpl.java
@@ -34,8 +34,8 @@
        List<OpenCityWarpper> district = new ArrayList<>();
        for (BranchOffice branchOffice : branchOffices) {
            OpenCityWarpper openCityWarpper = new OpenCityWarpper();
            openCityWarpper.setCode(branchOffice.getDistrictCode());
            openCityWarpper.setName(branchOffice.getDistrictName());
            openCityWarpper.setCode(null != branchOffice.getDistrictCode() ? branchOffice.getDistrictCode() : branchOffice.getCityCode());
            openCityWarpper.setName(null != branchOffice.getDistrictName() ? branchOffice.getDistrictName() : branchOffice.getCityName());
            district.add(openCityWarpper);
        }
        return district;
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/CashWithdrawalServiceImpl.java
@@ -75,15 +75,15 @@
        accountChangeDetail.setType(1);
        accountChangeDetail.setChangeType(type == 1 ? 4 : 6);
        if(type == 1){
            accountChangeDetail.setOldData(driver.getBalance());
            accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
            driver.setBalance(driver.getBalance() - money);
            accountChangeDetail.setNewData(driver.getBalance());
            accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
            accountChangeDetail.setExplain("账户余额提现");
        }
        if(type == 2){
            accountChangeDetail.setOldData(driver.getCommission());
            accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
            driver.setCommission(driver.getCommission() - money);
            accountChangeDetail.setNewData(driver.getCommission());
            accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
            accountChangeDetail.setExplain("佣金余额提现");
        }
        driverService.updateById(driver);
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java
@@ -98,6 +98,9 @@
    @Autowired
    private RongYunUtil rongYunUtil;
    @Autowired
    private PushUtil pushUtil;
    /**
@@ -162,7 +165,10 @@
        String code = driverRegisterWarpper.getCode();
        BranchOffice branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("districtCode", code).eq("status", 1));
        if(null == branchOffice){
            throw new Exception("该区域无服务商");
            branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("cityCode", code).eq("status", 1));
            if(null == branchOffice){
                throw new Exception("该区域无服务商");
            }
        }
        driver.setBranchOfficeId(branchOffice.getId());
        driver.setAgentId(branchOffice.getAgentId());
@@ -313,13 +319,21 @@
                usernamePasswordToken, simpleAuthenticationInfo);
        if (passwordTrueFlag) {
            String token = JwtTokenUtil.generateToken(phone);
            String token = JwtTokenUtil.generateToken(phone + System.currentTimeMillis());
            String key = token;
            if(token.length() > 16){
                key = token.substring(token.length() - 16);
            }
            redisUtil.setStrValue(key, driver.getId().toString(), 7 * 24 * 60 * 60);//7天
            redisUtil.setStrValue("DRIVER_" + phone, key, 7 * 24 * 60 * 60);//7天
            //下线
            for (int i = 0; i < 5; i++) {
                Integer code = pushUtil.pushOffline(driver.getId(), 2);
                if(200 == code){
                    break;
                }
            }
            return token;
        }
        return "";
@@ -545,8 +559,8 @@
        Driver driver = this.selectById(uid);
        DriverInfoWarpper driverInfo = new DriverInfoWarpper();
        BeanUtils.copyProperties(driver, driverInfo);
        driverInfo.setBalance(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
        driverInfo.setWithdrawBalance(driver.getBalance());
        driverInfo.setBalance(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
        YouTuiDriver youTuiDriver = youTuiDriverService.selectOne(new EntityWrapper<YouTuiDriver>().eq("driverId", uid)
                .eq("state", 2).last(" and failureTime > now() order by failureTime limit 0, 1"));
        if(null != youTuiDriver){
@@ -707,9 +721,9 @@
                                accountChangeDetail.setType(1);
                                accountChangeDetail.setCreateTime(new Date());
                                accountChangeDetail.setExplain("余额充值");
                                accountChangeDetail.setOldData(driver1.getBalance());
                                accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                driver1.setBalance(driver1.getBalance() + amount);
                                accountChangeDetail.setNewData(driver1.getBalance());
                                accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                DriverServiceImpl.this.updateById(driver1);
                                accountChangeDetailService.saveData(accountChangeDetail);
@@ -760,9 +774,9 @@
        accountChangeDetail.setType(1);
        accountChangeDetail.setCreateTime(new Date());
        accountChangeDetail.setExplain("余额充值");
        accountChangeDetail.setOldData(driver1.getBalance());
        accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
        driver1.setBalance(driver1.getBalance() + rechargeRecord1.getAmount());
        accountChangeDetail.setNewData(driver1.getBalance());
        accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
        this.updateById(driver1);
        accountChangeDetailService.saveData(accountChangeDetail);
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderPositionServiceImpl.java
@@ -49,7 +49,7 @@
    public void saveOrderPosition(DriverPositionWarpper driverPositionWarpper) throws Exception {
        Integer orderId = driverPositionWarpper.getOrderId();
        Integer orderType = driverPositionWarpper.getOrderType();
        File file = new File(filePath + orderId + "_" + orderType + ".json");
        File file = new File(filePath + orderId + ".json");
        if(!file.exists()){
            file.getParentFile().mkdirs();
            file.createNewFile();
@@ -59,14 +59,29 @@
            OrderPositionWarpper orderPositionWarpper = orderPositionWarppers.get(orderPositionWarppers.size() - 1);
            saveOrderMileage(driverPositionWarpper, orderPositionWarpper);
        }
        OrderPositionWarpper orderPositionWarpper = new OrderPositionWarpper();
        BeanUtils.copyProperties(driverPositionWarpper, orderPositionWarpper);
        orderPositionWarpper.setInsertTime(new Date());
        orderPositionWarppers.add(orderPositionWarpper);
        //大于50米才存储有效定位数据
        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){
                OrderPositionWarpper orderPositionWarpper = new OrderPositionWarpper();
                BeanUtils.copyProperties(driverPositionWarpper, orderPositionWarpper);
                orderPositionWarpper.setInsertTime(new Date());
                orderPositionWarppers.add(orderPositionWarpper);
            }
        }else{
            OrderPositionWarpper orderPositionWarpper = new OrderPositionWarpper();
            BeanUtils.copyProperties(driverPositionWarpper, orderPositionWarpper);
            orderPositionWarpper.setInsertTime(new Date());
            orderPositionWarppers.add(orderPositionWarpper);
        }
        //写入相应的文件
        PrintWriter out = new PrintWriter(new FileWriter(file));
        out.write(JSON.toJSONString(driverPositionWarpper));
        out.write(JSON.toJSONString(orderPositionWarppers));
        out.flush();
        out.close();
    }
@@ -86,6 +101,7 @@
        Integer num = map.get(order.getId().toString());
        if(50 < wgs84){
            order.setActualMileage(order.getActualMileage() + wgs84.intValue());
            orderService.updateById(order);
            map.put(order.getId().toString(), 0);
            if(order.getState() == 401){//定位变动,自动开始服务
@@ -98,11 +114,10 @@
                    e.printStackTrace();
                }
            }
        }
        if(50 >= wgs84 && 12 <= (null == num ? 0 : num)){//1分钟(5秒上传一次数据)
            Integer integer = map.get(order.getId().toString());
            map.put(order.getId().toString(), integer++);
            map.put(order.getId().toString(), null == integer ? 0 : integer++);
            //进入等待状态
            ProcessOperationsWarpper processOperationsWarpper = new ProcessOperationsWarpper();
            processOperationsWarpper.setOrderId(order.getId());
@@ -112,11 +127,10 @@
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if(50 >= wgs84 && 12 > (null == num ? 0 : num)){
            Integer integer = map.get(order.getId().toString());
            map.put(order.getId().toString(), integer++);
            map.put(order.getId().toString(), null == integer ? 0 : integer++);
        }
    }
@@ -133,8 +147,9 @@
    @Override
    public List<OrderPositionWarpper> queryPosition(Integer orderId, Integer orderType) throws Exception {
        //将数据存储到文件中
        File file = new File(filePath + orderId + "_" + orderType + ".txt");
        File file = new File(filePath + orderId + ".json");
        if(!file.exists()){
            System.err.println("不存在");
            return new ArrayList<>();
        }
        //读取文件(字符流)
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java
@@ -136,7 +136,7 @@
         */
        int count = this.selectCount(new EntityWrapper<Order>().eq("userPhone", addOrderWarpper.getPhone()).eq("status", 1).in("state", Arrays.asList(101, 102, 103, 104, 105, 106, 201)));
        if(count > 0){
            return ResultUtil.error("该用户还有未完成的订单");
            return ResultUtil.error("该用户还有未完成的订单", "");
        }
        Driver driver = driverService.selectById(uid);
        DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", uid).eq("status", 1));
@@ -168,7 +168,7 @@
        if(ToolUtil.isNotEmpty(addOrderWarpper.getEndAddress())){
            Map<String, String> distance = MapUtil.getDistance(order.getStartLng() + "," + order.getStartLat(), order.getEndLng() + "," + order.getEndLat(), 1);
            if(null == distance){
                return ResultUtil.error("获取预估距离出错");
                return ResultUtil.error("获取预估距离出错", "");
            }
            d = Double.valueOf(distance.get("distance")) / 1000;
            order.setEstimatedMileage(d);
@@ -929,7 +929,11 @@
                    pushOrderInfoWarpper.setDriverLat(split[1]);
                    pushOrderInfoWarpper.setDriverLng(split[0]);
                }
                pushOrderInfoWarpper.setWaitTime(order.getWaitTime());
                int w = 0;
                if(null != order.getStartWaitTime()){
                    w = Double.valueOf((System.currentTimeMillis() - order.getStartWaitTime().getTime()) / 60000).intValue();
                }
                pushOrderInfoWarpper.setWaitTime(order.getWaitTime() + w);
                pushOrderInfoWarpper.setState(order.getState());
                pushOrderInfoWarpper.setActualMileage(Double.valueOf(order.getActualMileage() / 1000));
                pushOrderInfoWarpper.setTravelTime(0);
@@ -1147,13 +1151,8 @@
        Order order = this.selectById(orderId);
        order.setState(state);
        // TODO: 2023/5/18 临时
        payType = 1;
        if(state == 108){
            payType = 2;
        }
        if(payType == 2 && state == 107){
            order.setPayType(3);
            Coupon coupon = userToCouponService.queryCoupon(order.getUserId(), order.getOrderMoney());
            if(null != coupon){
                order.setCouponId(coupon.getId());
@@ -1163,7 +1162,6 @@
        }
        if(payType == 2 && state == 108){
            order.setPayType(3);
            order.setPayTime(new Date());
            if(null != order.getCouponId()){
                UserToCoupon userToCoupon = userToCouponService.selectById(order.getCouponId());
@@ -1181,13 +1179,13 @@
                    accountChangeDetail.setUserType(2);
                    accountChangeDetail.setUserId(order.getDriverId());
                    accountChangeDetail.setCreateTime(new Date());
                    accountChangeDetail.setOldData(driver.getCouponBalance());
                    accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    accountChangeDetail.setType(1);
                    accountChangeDetail.setChangeType(7);
                    accountChangeDetail.setOrderId(order.getId());
                    accountChangeDetail.setExplain("优惠券收入");
                    driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount());
                    accountChangeDetail.setNewData(driver.getCouponBalance());
                    accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                    driverService.updateById(driver);
                    accountChangeDetailService.insert(accountChangeDetail);
                }
@@ -1247,11 +1245,11 @@
                            accountChangeDetail.setUserId(driver1.getId());
                            accountChangeDetail.setType(1);
                            accountChangeDetail.setChangeType(5);
                            accountChangeDetail.setOldData(driver1.getCommission());
                            accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                            accountChangeDetail.setExplain("订单分佣收入");
                            accountChangeDetail.setCreateTime(new Date());
                            driver1.setCommission(driver1.getCommission() + num1);
                            accountChangeDetail.setNewData(driver1.getCommission());
                            accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                            driverService.updateById(driver1);
                            accountChangeDetailService.saveData(accountChangeDetail);
@@ -1294,11 +1292,11 @@
                                    accountChangeDetail.setUserId(driver1.getId());
                                    accountChangeDetail.setType(1);
                                    accountChangeDetail.setChangeType(5);
                                    accountChangeDetail.setOldData(driver1.getCommission());
                                    accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                    accountChangeDetail.setExplain("订单分佣收入");
                                    accountChangeDetail.setCreateTime(new Date());
                                    driver1.setCommission(driver1.getCommission() + num5);
                                    accountChangeDetail.setNewData(driver1.getCommission());
                                    accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                    driverService.updateById(driver1);
                                    accountChangeDetailService.saveData(accountChangeDetail);
                                    num3 = (num3 >= num5 ? num3 - num5 : 0);
@@ -1320,11 +1318,11 @@
                                    accountChangeDetail.setUserId(driver2.getId());
                                    accountChangeDetail.setType(1);
                                    accountChangeDetail.setChangeType(5);
                                    accountChangeDetail.setOldData(driver2.getCommission());
                                    accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission());
                                    accountChangeDetail.setExplain("订单分佣收入");
                                    accountChangeDetail.setCreateTime(new Date());
                                    driver2.setCommission(driver2.getCommission() + num6);
                                    accountChangeDetail.setNewData(driver2.getCommission());
                                    accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission());
                                    driverService.updateById(driver2);
                                    accountChangeDetailService.saveData(accountChangeDetail);
                                    num3 = (num3 >= num6 ? num3 - num6 : 0);
@@ -1346,11 +1344,11 @@
                                    accountChangeDetail.setUserId(driver3.getId());
                                    accountChangeDetail.setType(1);
                                    accountChangeDetail.setChangeType(5);
                                    accountChangeDetail.setOldData(driver3.getCommission());
                                    accountChangeDetail.setOldData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission());
                                    accountChangeDetail.setExplain("订单分佣收入");
                                    accountChangeDetail.setCreateTime(new Date());
                                    driver3.setCommission(driver3.getCommission() + num7);
                                    accountChangeDetail.setNewData(driver3.getCommission());
                                    accountChangeDetail.setNewData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission());
                                    driverService.updateById(driver3);
                                    accountChangeDetailService.saveData(accountChangeDetail);
                                    num3 = (num3 >= num7 ? num3 - num7 : 0);
@@ -1375,11 +1373,11 @@
                                    accountChangeDetail.setUserId(driver1.getId());
                                    accountChangeDetail.setType(1);
                                    accountChangeDetail.setChangeType(5);
                                    accountChangeDetail.setOldData(driver1.getCommission());
                                    accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                    accountChangeDetail.setExplain("订单分佣收入");
                                    accountChangeDetail.setCreateTime(new Date());
                                    driver1.setCommission(driver1.getCommission() + num3_);
                                    accountChangeDetail.setNewData(driver1.getCommission());
                                    accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                    driverService.updateById(driver1);
                                    accountChangeDetailService.saveData(accountChangeDetail);
                                    num3 = (num3 >= num3_ ? num3 - num3_ : 0);
@@ -1401,11 +1399,11 @@
                                    accountChangeDetail.setUserId(driver2.getId());
                                    accountChangeDetail.setType(1);
                                    accountChangeDetail.setChangeType(5);
                                    accountChangeDetail.setOldData(driver2.getCommission());
                                    accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission());
                                    accountChangeDetail.setExplain("订单分佣收入");
                                    accountChangeDetail.setCreateTime(new Date());
                                    driver2.setCommission(driver2.getCommission() + num4);
                                    accountChangeDetail.setNewData(driver2.getCommission());
                                    accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission());
                                    driverService.updateById(driver2);
                                    accountChangeDetailService.saveData(accountChangeDetail);
                                    num3 = (num3 >= num4 ? num3 - num4 : 0);
@@ -1430,11 +1428,11 @@
                                accountChangeDetail.setUserId(driver1.getId());
                                accountChangeDetail.setType(1);
                                accountChangeDetail.setChangeType(5);
                                accountChangeDetail.setOldData(driver1.getCommission());
                                accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                accountChangeDetail.setExplain("订单分佣收入");
                                accountChangeDetail.setCreateTime(new Date());
                                driver1.setCommission(driver1.getCommission() + num2_);
                                accountChangeDetail.setNewData(driver1.getCommission());
                                accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                driverService.updateById(driver1);
                                accountChangeDetailService.saveData(accountChangeDetail);
                                num3 = (num3 >= num2_ ? num3 - num2_ : 0);
@@ -1464,11 +1462,11 @@
            accountChangeDetail.setType(1);
            accountChangeDetail.setChangeType(9);
            accountChangeDetail.setOrderId(order.getId());
            accountChangeDetail.setOldData(driver.getBalance());
            accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
            accountChangeDetail.setExplain("线下收款服务费支出");
            accountChangeDetail.setCreateTime(new Date());
            driver.setBalance(driver.getBalance() - n);
            accountChangeDetail.setNewData(driver.getBalance());
            accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
            driverService.updateById(driver);
            accountChangeDetailService.saveData(accountChangeDetail);
        }
@@ -1521,9 +1519,7 @@
        List<Integer> state = Arrays.asList(107, 108, 109);
        int count = this.selectCount(new EntityWrapper<Order>().eq("driverId", driverId).in("state", state).eq("status", 1));
        performanceSummaryWarpper.setTotalOrder(count);
        List<PerformanceRankingWarpper> list = new ArrayList<>();
        int position = 0;
        Double d = 0D;
        List<PerformanceRankingWarpper> performanceRankingWarppers = null;
        if(type == 1){//订单量
            performanceRankingWarppers = this.baseMapper.queryDriverRank(time, dayType);
@@ -1532,24 +1528,17 @@
            performanceRankingWarppers = revenueService.queryDriverRank(2, time, dayType);
        }
        if(type == 3){//收入
            performanceRankingWarppers = revenueService.queryDriverRank(null, time, dayType);
            performanceRankingWarppers = revenueService.queryDriverRank(1, time, dayType);
        }
        for (int i = 0; i < performanceRankingWarppers.size(); i++) {
            PerformanceRankingWarpper performanceRankingWarpper = performanceRankingWarppers.get(i);
            Double amountOfData = performanceRankingWarpper.getAmountOfData();
            if(amountOfData.compareTo(d) != 0){
                position++;
                d = amountOfData;
            }
            if(position <= 10){
                list.add(performanceRankingWarpper);
            }
            if(performanceRankingWarpper.getDriverId().compareTo(driverId) == 0){
                position = i + 1;
                break;
            }
        }
        performanceSummaryWarpper.setPosition(position);
        performanceSummaryWarpper.setList(list);
        performanceSummaryWarpper.setList(performanceRankingWarppers.size() > 10 ? performanceRankingWarppers.subList(0, 10) : performanceRankingWarppers.subList(0, performanceRankingWarppers.size()));
        return performanceSummaryWarpper;
    }
@@ -1632,4 +1621,13 @@
        list.add(myAchievementWarpper);
        return list;
    }
    /**
     * 主动完成线下收款
     */
    @Override
    public void completeCollection() {
        this.baseMapper.completeCollection();
    }
}
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/PushUtil.java
@@ -34,7 +34,7 @@
     * @param id
     * @param type
     */
    public void pushOffline(Integer id, Integer type){
    public Integer pushOffline(Integer id, Integer type){
        JSONObject msg = new JSONObject();
        msg.put("code", 200);
        msg.put("msg", "SUCCESS");
@@ -53,10 +53,7 @@
        HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers);
        String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class);
        JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class);
        if(jsonObject1.getIntValue("code") != 200){
            logger.debug(jsonObject1.getString("msg"));
            System.err.println(jsonObject1.getString("msg"));
        }
        return jsonObject1.getIntValue("code");
    }
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/TaskUtil.java
@@ -3,6 +3,7 @@
import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService;
import com.supersavedriving.driver.modular.system.service.IDriverService;
import com.supersavedriving.driver.modular.system.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -20,6 +21,9 @@
    @Autowired
    private IAccountChangeDetailService accountChangeDetailService;
    @Autowired
    private IOrderService orderService;
@@ -29,7 +33,7 @@
    @Scheduled(fixedRate = 1000 * 60)
    public void taskMinute(){
        try {
            orderService.completeCollection();
        } catch (Exception e) {
            e.printStackTrace();
        }
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderPositionWarpper.java
@@ -24,11 +24,11 @@
    /**
     * 经度
     */
    private String lon;
    private Double lon;
    /**
     * 纬度
     */
    private String lat;
    private Double lat;
    /**
     * 方向角
     */
driver/guns-admin/src/test/java/com/supersavedriving/driver/GunsApplicationTest.java
@@ -7,6 +7,7 @@
//import com.supersavedriving.driver.modular.system.util.ResultUtil;
//import com.supersavedriving.driver.modular.system.util.juhe.WeatherCityInfo;
//import com.supersavedriving.driver.modular.system.util.juhe.WeatherUtil;
//import com.supersavedriving.driver.modular.system.warpper.PerformanceSummaryWarpper;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.beans.BeanUtils;
@@ -25,6 +26,6 @@
//
//    @Test
//    public void test() throws Exception {
//        ResultUtil resultUtil = orderService.rejectionOrder(1, 1L);
//        PerformanceSummaryWarpper performanceSummaryWarpper = orderService.queryPerformanceSummary(1, 1, "2023年", 3);
//    }
//}
management/guns-admin/src/main/resources/application.yml
@@ -2,8 +2,8 @@
  port: 8010
guns:
  swagger-open: true              #是否开启swagger (true/false)
  kaptcha-open: true             #是否开启登录时验证码 (true/false)
  swagger-open: false              #是否开启swagger (true/false)
  kaptcha-open: false             #是否开启登录时验证码 (true/false)
  spring-session-open: false      #是否开启spring session,如果是多机环境需要开启(true/false)
  session-invalidate-time: 1800     #session失效时间(只在单机环境下生效,多机环境在SpringSessionConfig类中配置) 单位:秒
  session-validation-interval: 900  #多久检测一次失效的session(只在单机环境下生效) 单位:秒
@@ -60,8 +60,8 @@
  datasource:
    url: jdbc:mysql://192.168.110.80:3306/super_save_driving?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
    username: root
#    password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj
    password: 123456
    password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj
#    password: 123456
    db-name: super_save_driving #用来搜集数据库的所有表
    filters: wall,mergeStat
management/guns-admin/src/main/webapp/WEB-INF/view/common/_right.html
@@ -4,7 +4,7 @@
            <div class="navbar-header"><a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                <form role="search" class="navbar-form-custom" method="post" action="search_results.html">
                    <div class="form-group">
                        <input type="text" placeholder="超省代驾后台管理系统 …" class="form-control" name="top-search" id="top-search" value="超省新代驾后台管理系统" disabled>
                        <input type="text" placeholder="超省新代驾后台管理系统 …" class="form-control" name="top-search" id="top-search" value="超省新代驾后台管理系统" disabled>
                    </div>
                </form>
                <h3 style="float: right;line-height: 50px;color: red;">${passwordHint}</h3>
super_save_driving.sql
Diff too large
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Driver.java
@@ -247,4 +247,9 @@
     */
    @TableField("merchantIDCode")
    private String merchantIDCode;
    /**
     * 是否打开下单二维码
     */
    @TableField("openOrderQRCode")
    private Integer openOrderQRCode;
}
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java
@@ -166,7 +166,7 @@
            }
            if(nearbyDriverWarppers.size() > 0){
                NearbyDriverWarpper nearbyDriverWarpper = nearbyDriverWarppers.get(0);
                Map<String, String> distance = MapUtil.getDistance(nearbyDriverWarpper.getLonLat(), estimatedCosts.getLng() + "," + estimatedCosts.getLat(), 1);
                Map<String, String> distance = MapUtil.getDistance(nearbyDriverWarpper.getLonLat(), estimatedCosts.getStartLng() + "," + estimatedCosts.getStartLat(), 1);
                if(null != distance){
                    distance.get("distance");//距离(M)
                    String duration = distance.get("duration");//时间(S)
@@ -449,18 +449,19 @@
        for (Integer i = 0; i < travelOrder.getDriverNum(); i++) {
            order.setId(null);
            order.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3));
            this.insert(order);
            //推送状态
            pushUtil.pushOrderStatus(uid, 1, order.getId(), order.getState());
            if(null != order.getDriverId()){
                PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper();
                pushOrderInfoWarpper.setId(order.getId());
                pushOrderInfoWarpper.setState(order.getState());
                pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper);
            }else{
                //推单
                pushOrder(order);
            boolean insert = this.insert(order);
            if(insert){
                //推送状态
                pushUtil.pushOrderStatus(uid, 1, order.getId(), order.getState());
                if(null != order.getDriverId()){
                    PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper();
                    pushOrderInfoWarpper.setId(order.getId());
                    pushOrderInfoWarpper.setState(order.getState());
                    pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper);
                }else{
                    //推单
                    pushOrder(order.getId());
                }
            }
        }
        return ResultUtil.success(order.getId());
@@ -471,9 +472,9 @@
    /**
     * 订单推送逻辑
     * @param order
     */
    public void pushOrder(Order order){
    public void pushOrder(Long orderId){
        Order order = this.selectById(orderId);
        /**
         * 1.先找最大推单范围内的优推司机 -》 距离最近
         * 没有1 - 》
@@ -515,7 +516,7 @@
                    continue;
                }
                Driver driver1 = driverService.selectById(youTuiDriver.getDriverId());
                if(driver1.getServerStatus() == 2){
                if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1){
                    continue;
                }
                Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat());
@@ -549,13 +550,14 @@
                driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList());
                if(driverIds.size() > 0){
                    List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2).eq("serverStatus", 1).eq("status", 1).in("id", driverIds));
                    List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2)
                            .eq("serverStatus", 1).eq("openOrderQRCode", 0).eq("status", 1).in("id", driverIds));
                    if(drivers.size() == 0){
                        continue;
                    }
                    Integer integral = null;
                    Double score = null;
                    Integer integral = null;//积分
                    Double score = null;//评分
                    Double d = null;
                    for (Driver driver1 : drivers) {
                        String value = redisUtil.getValue("DRIVER" + driver1.getId());
@@ -566,19 +568,27 @@
                            integral = driver1.getIntegral();
                            score = driver1.getScore();
                            driver = driver1.getId();
                            Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat());
                            Double wgs84 = distance.get("WGS84");
                            d = wgs84;
                            continue;
                        }
                        if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) < 0){//积分相同对比评分
                            integral = driver1.getIntegral();
                            score = driver1.getScore();
                            driver = driver1.getId();
                            Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat());
                            Double wgs84 = distance.get("WGS84");
                            d = wgs84;
                            continue;
                        }
                        if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) == 0){//积分相同/评分相同对比距离
                            Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat());
                            Double wgs84 = distance.get("WGS84");
                            if(d == null || d.compareTo(wgs84) > 0){
                            if(d.compareTo(wgs84) > 0){
                                d = wgs84;
                                integral = driver1.getIntegral();
                                score = driver1.getScore();
                                driver = driver1.getId();
                                continue;
                            }
@@ -742,22 +752,6 @@
        BeanUtils.copyProperties(order, orderPriceWarpper);
        orderPriceWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
        orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue());
        if(null == order.getPayTime()){
            AppUser appUser = appUserService.selectById(uid);
            orderPriceWarpper.setBalance(appUser.getAccountBalance());
            Double orderMoney = order.getOrderMoney();
            //先算优惠券
            Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney);
            if(null != coupon){
                orderMoney = orderMoney - coupon.getCouponPreferentialAmount();
                orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount());
                orderPriceWarpper.setCouponId(coupon.getId());
            }
            orderPriceWarpper.setDiscount(0D);
            orderPriceWarpper.setDiscountAmount(0D);
            orderPriceWarpper.setPayType(1);//微信支付
            orderPriceWarpper.setPayMoney(orderMoney);
        }
        return orderPriceWarpper;
    }
@@ -785,10 +779,15 @@
        orderPriceWarpper.setPayType(1);//微信支付
        Double orderMoney = order.getOrderMoney();
        //先算优惠券
        Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney);
        if(null != coupon && null == couponId){
            orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount());
            orderPriceWarpper.setCouponId(coupon.getId());
//        Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney);
//        if(null != coupon && null == couponId){
//            orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount());
//            orderPriceWarpper.setCouponId(coupon.getId());
//        }
        if(payType == 1 && null == couponId && appUser.getHavDiscount() == 1 && balance.compareTo(orderMoney) >= 0){//使用余额抵扣
            orderPriceWarpper.setDiscount(9D);
            orderPriceWarpper.setDiscountAmount(new BigDecimal(orderMoney * 0.1).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
            orderMoney = new BigDecimal(orderMoney * 0.9).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
        }
        if(null != couponId){
            UserToCoupon userToCoupon = userToCouponService.selectById(couponId);
@@ -797,20 +796,16 @@
            orderPriceWarpper.setDiscountedPrice(coupon1.getCouponPreferentialAmount());
            orderPriceWarpper.setCouponId(couponId);
        }
        if(payType == 1 && appUser.getHavDiscount() == 1 && balance >= orderMoney){//使用余额抵扣
            orderPriceWarpper.setDiscount(9D);
            orderPriceWarpper.setDiscountAmount(new BigDecimal(orderMoney * 0.1).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
            orderMoney = new BigDecimal(orderMoney * 0.9).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
        }
        if(payType == 0){//不使用余额抵扣
            orderPriceWarpper.setPayType(1);
        }
        if(payType == 1 && balance >= orderMoney){//使用余额抵扣
        if(payType == 1 && balance.compareTo(orderMoney) >= 0){//使用余额抵扣
            orderPriceWarpper.setPayType(2);
        }
        if(payType == 1 && balance < orderMoney){//使用余额抵扣部分
        if(payType == 1 && balance.compareTo(orderMoney) < 0){//使用余额抵扣部分
            orderPriceWarpper.setPayType(4);
        }
        orderPriceWarpper.setPayMoney(orderMoney);
        return orderPriceWarpper;
    }
@@ -958,13 +953,13 @@
                accountChangeDetail.setUserType(2);
                accountChangeDetail.setUserId(order.getDriverId());
                accountChangeDetail.setCreateTime(new Date());
                accountChangeDetail.setOldData(driver.getCouponBalance());
                accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                accountChangeDetail.setType(1);
                accountChangeDetail.setChangeType(7);
                accountChangeDetail.setOrderId(order.getId());
                accountChangeDetail.setExplain("优惠券收入");
                driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount());
                accountChangeDetail.setNewData(driver.getCouponBalance());
                accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                driverService.updateById(driver);
                accountChangeDetailService.insert(accountChangeDetail);
            }
@@ -1286,13 +1281,13 @@
            accountChangeDetail.setUserType(2);
            accountChangeDetail.setUserId(order.getDriverId());
            accountChangeDetail.setCreateTime(new Date());
            accountChangeDetail.setOldData(driver.getCouponBalance());
            accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
            accountChangeDetail.setType(1);
            accountChangeDetail.setChangeType(7);
            accountChangeDetail.setOrderId(order.getId());
            accountChangeDetail.setExplain("优惠券收入");
            driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount());
            accountChangeDetail.setNewData(driver.getCouponBalance());
            accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
            driverService.updateById(driver);
            accountChangeDetailService.insert(accountChangeDetail);
@@ -1457,11 +1452,11 @@
                            accountChangeDetail.setUserId(driver1.getId());
                            accountChangeDetail.setType(1);
                            accountChangeDetail.setChangeType(5);
                            accountChangeDetail.setOldData(driver1.getCommission());
                            accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                            accountChangeDetail.setExplain("订单分佣收入");
                            accountChangeDetail.setCreateTime(new Date());
                            driver1.setCommission(driver1.getCommission() + num1);
                            accountChangeDetail.setNewData(driver1.getCommission());
                            accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                            driverService.updateById(driver1);
                            accountChangeDetailService.saveData(accountChangeDetail);
@@ -1478,17 +1473,17 @@
                    }
                    //开始处理层级抽佣
                    if(null != driver.getInviterType() && driver.getInviterType() == 2){
                    if(null != driver & null != driver.getInviterType() && driver.getInviterType() == 2){
                        Driver driver1 = driverService.selectById(driver.getInviterId());//一级司机
                        if(null != driver1.getInviterType() && driver1.getInviterType() == 2){
                        if(null != driver1 && null != driver1.getInviterType() && driver1.getInviterType() == 2){
                            Driver driver2 = driverService.selectById(driver1.getInviterId());//二级司机
                            if(null != driver2.getInviterType() && driver2.getInviterType() == 2){
                            if(null != driver2 && null != driver2.getInviterType() && driver2.getInviterType() == 2){
                                Driver driver3 = driverService.selectById(driver2.getInviterId());//三级级司机
                                Double num5 = jsonObject1.getDouble("num5");
                                Double num6 = jsonObject1.getDouble("num6");
                                Double num7 = jsonObject1.getDouble("num7");
                                num5 = (num3 >= num5 ? num5 : num3);
                                if(num5 > 0){
                                if(num5 > 0 && null != driver1){
                                    Revenue revenue = new Revenue();
                                    revenue.setType(2);
                                    revenue.setUserType(2);
@@ -1504,17 +1499,17 @@
                                    accountChangeDetail.setUserId(driver1.getId());
                                    accountChangeDetail.setType(1);
                                    accountChangeDetail.setChangeType(5);
                                    accountChangeDetail.setOldData(driver1.getCommission());
                                    accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                    accountChangeDetail.setExplain("订单分佣收入");
                                    accountChangeDetail.setCreateTime(new Date());
                                    driver1.setCommission(driver1.getCommission() + num5);
                                    accountChangeDetail.setNewData(driver1.getCommission());
                                    accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                    driverService.updateById(driver1);
                                    accountChangeDetailService.saveData(accountChangeDetail);
                                    num3 = (num3 >= num5 ? num3 - num5 : 0);
                                }
                                num6 = (num3 >= num6 ? num6 : num3);
                                if(num6 > 0){
                                if(num6 > 0 && null != driver2){
                                    Revenue revenue = new Revenue();
                                    revenue.setType(2);
                                    revenue.setUserType(2);
@@ -1530,17 +1525,17 @@
                                    accountChangeDetail.setUserId(driver2.getId());
                                    accountChangeDetail.setType(1);
                                    accountChangeDetail.setChangeType(5);
                                    accountChangeDetail.setOldData(driver2.getCommission());
                                    accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission());
                                    accountChangeDetail.setExplain("订单分佣收入");
                                    accountChangeDetail.setCreateTime(new Date());
                                    driver2.setCommission(driver2.getCommission() + num6);
                                    accountChangeDetail.setNewData(driver2.getCommission());
                                    accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission());
                                    driverService.updateById(driver2);
                                    accountChangeDetailService.saveData(accountChangeDetail);
                                    num3 = (num3 >= num6 ? num3 - num6 : 0);
                                }
                                num7 = (num3 >= num7 ? num7 : num3);
                                if(num7 > 0){
                                if(num7 > 0 && null != driver3){
                                    Revenue revenue = new Revenue();
                                    revenue.setType(2);
                                    revenue.setUserType(2);
@@ -1556,11 +1551,11 @@
                                    accountChangeDetail.setUserId(driver3.getId());
                                    accountChangeDetail.setType(1);
                                    accountChangeDetail.setChangeType(5);
                                    accountChangeDetail.setOldData(driver3.getCommission());
                                    accountChangeDetail.setOldData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission());
                                    accountChangeDetail.setExplain("订单分佣收入");
                                    accountChangeDetail.setCreateTime(new Date());
                                    driver3.setCommission(driver3.getCommission() + num7);
                                    accountChangeDetail.setNewData(driver3.getCommission());
                                    accountChangeDetail.setNewData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission());
                                    driverService.updateById(driver3);
                                    accountChangeDetailService.saveData(accountChangeDetail);
                                    num3 = (num3 >= num7 ? num3 - num7 : 0);
@@ -1569,7 +1564,7 @@
                                Double num3_ = jsonObject1.getDouble("num3");
                                Double num4 = jsonObject1.getDouble("num4");
                                num3_ = (num3 >= num3_ ? num3_ : num3);
                                if(num3_ > 0){
                                if(num3_ > 0 && null != driver1){
                                    Revenue revenue = new Revenue();
                                    revenue.setType(2);
                                    revenue.setUserType(2);
@@ -1585,17 +1580,17 @@
                                    accountChangeDetail.setUserId(driver1.getId());
                                    accountChangeDetail.setType(1);
                                    accountChangeDetail.setChangeType(5);
                                    accountChangeDetail.setOldData(driver1.getCommission());
                                    accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                    accountChangeDetail.setExplain("订单分佣收入");
                                    accountChangeDetail.setCreateTime(new Date());
                                    driver1.setCommission(driver1.getCommission() + num3_);
                                    accountChangeDetail.setNewData(driver1.getCommission());
                                    accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                    driverService.updateById(driver1);
                                    accountChangeDetailService.saveData(accountChangeDetail);
                                    num3 = (num3 >= num3_ ? num3 - num3_ : 0);
                                }
                                num4 = (num3 >= num4 ? num4 : num3);
                                if(num4 > 0){
                                if(num4 > 0 && null != driver2){
                                    Revenue revenue = new Revenue();
                                    revenue.setType(2);
                                    revenue.setUserType(2);
@@ -1611,11 +1606,11 @@
                                    accountChangeDetail.setUserId(driver2.getId());
                                    accountChangeDetail.setType(1);
                                    accountChangeDetail.setChangeType(5);
                                    accountChangeDetail.setOldData(driver2.getCommission());
                                    accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission());
                                    accountChangeDetail.setExplain("订单分佣收入");
                                    accountChangeDetail.setCreateTime(new Date());
                                    driver2.setCommission(driver2.getCommission() + num4);
                                    accountChangeDetail.setNewData(driver2.getCommission());
                                    accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission());
                                    driverService.updateById(driver2);
                                    accountChangeDetailService.saveData(accountChangeDetail);
                                    num3 = (num3 >= num4 ? num3 - num4 : 0);
@@ -1624,7 +1619,7 @@
                        }else{
                            Double num2_ = jsonObject1.getDouble("num2");
                            num2_ = (num3 >= num2_ ? num2_ : num3);
                            if(num2_ > 0){
                            if(num2_ > 0 && null != driver1){
                                Revenue revenue = new Revenue();
                                revenue.setType(2);
                                revenue.setUserType(2);
@@ -1640,11 +1635,11 @@
                                accountChangeDetail.setUserId(driver1.getId());
                                accountChangeDetail.setType(1);
                                accountChangeDetail.setChangeType(5);
                                accountChangeDetail.setOldData(driver1.getCommission());
                                accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                accountChangeDetail.setExplain("订单分佣收入");
                                accountChangeDetail.setCreateTime(new Date());
                                driver1.setCommission(driver1.getCommission() + num2_);
                                accountChangeDetail.setNewData(driver1.getCommission());
                                accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission());
                                driverService.updateById(driver1);
                                accountChangeDetailService.saveData(accountChangeDetail);
                                num3 = (num3 >= num2_ ? num3 - num2_ : 0);
@@ -1652,7 +1647,7 @@
                        }
                    }
                    //处理代理商抽佣
                    if(num3 > 0){
                    if(num3 > 0 && null != driver){
                        Revenue revenue = new Revenue();
                        revenue.setType(1);
                        revenue.setUserType(3);
@@ -1682,14 +1677,14 @@
        accountChangeDetail.setType(1);
        accountChangeDetail.setChangeType(1);
        accountChangeDetail.setOrderId(order.getId());
        accountChangeDetail.setOldData(driver.getBalance() + driver.getCouponBalance());
        accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
        accountChangeDetail.setExplain("订单收入");
        accountChangeDetail.setCreateTime(new Date());
        driver.setBalance(driver.getBalance() + payMoney);
        if(null != order.getCouponId()){
            driver.setCouponBalance(driver.getCouponBalance() + order.getDiscountedPrice());
        }
        accountChangeDetail.setNewData(driver.getBalance() + driver.getCouponBalance());
        accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
        driverService.updateById(driver);
        accountChangeDetailService.saveData(accountChangeDetail);
    }
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/SystemConfigServiceImpl.java
@@ -85,7 +85,7 @@
            Map<String, Object> map = new HashMap<>();
            map.put("waitTime", num1 + "分钟/" + num2 + "元");
            map.put("exceedWaitTime", "超出" + num3 + "分钟,收取" + num4 + "元/分钟");
            map.put("badWeather", num5 + "公里内加收" + num6 + "元,超过" + num7 + "公里按照订单单价的" + num8 + "倍计费,最高收取" + num9 + "元");
            map.put("badWeather", "雨天、恶劣天气时代驾里程在" + num5 + "公里内加" + num6 + "元/单,达" + num7 + "公里或以上的订单按总价加" + num8 + "倍计费,封顶加" + num9 + "元");
            priceRulesWarpper.setAdditionalFee(JSON.toJSONString(map));
        }
        return priceRulesWarpper;
user/guns-admin/src/main/resources/application.yml
@@ -13,8 +13,8 @@
  application:
    name: user-server
  profiles:
    active: dev
#    active: produce
#    active: dev
    active: produce
  mvc:
    static-path-pattern: /static/**
    view:
@@ -55,8 +55,8 @@
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/super_save_driving?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
#    password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj
    password: 123456
    password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj
#    password: 123456
    db-name: guns #用来搜集数据库的所有表
    filters: wall,mergeStat
@@ -130,8 +130,8 @@
spring:
  data:
    mongodb:
#      uri: mongodb://root:CEtyLdKjPk0yeHNo@127.0.0.1:27017/admin
      uri: mongodb://127.0.0.1:27017/admin
      uri: mongodb://root:CEtyLdKjPk0yeHNo@127.0.0.1:27017/admin
#      uri: mongodb://127.0.0.1:27017/admin
#  mallbook 调起接口参数配置
user/guns-admin/src/main/resources/redis.properties
@@ -2,19 +2,19 @@
# RedisÊý¾Ý¿âË÷Òý£¨Ä¬ÈÏΪ0£©
spring.redis.database=0
## Redis·þÎñÆ÷µØÖ·
#spring.redis.host=127.0.0.1
## Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú
#spring.redis.port=16379
## Redis·þÎñÆ÷Á¬½ÓÃÜÂ루ĬÈÏΪ¿Õ£©
#spring.redis.password=cKsEeyffDXG5PzNg8CIbrWxFluXrCprZ
# Redis·þÎñÆ÷µØÖ·
spring.redis.host=127.0.0.1
# Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú
spring.redis.port=6379
spring.redis.port=16379
# Redis·þÎñÆ÷Á¬½ÓÃÜÂ루ĬÈÏΪ¿Õ£©
spring.redis.password=123456
spring.redis.password=cKsEeyffDXG5PzNg8CIbrWxFluXrCprZ
## Redis·þÎñÆ÷µØÖ·
#spring.redis.host=127.0.0.1
## Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú
#spring.redis.port=6379
## Redis·þÎñÆ÷Á¬½ÓÃÜÂ루ĬÈÏΪ¿Õ£©
#spring.redis.password=123456
# Á¬½Ó³Ø×î´óÁ¬½ÓÊý£¨Ê¹ÓøºÖµ±íʾûÓÐÏÞÖÆ£©
spring.redis.jedis.pool.max-active=1024
zuul/src/main/java/com/sinata/zuul/util/applets/ChildChannelHandler.java
@@ -14,13 +14,13 @@
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
//        String path = "C:\\Program Files\\Apache Software Foundation\\Tomcat 8.5\\cert\\SHA256withRSA_lzhyc.cn.pfx";
//        String path = "/usr/local/server/apache-tomcat-80/conf/cert/6064978_okyueche.com.pfx";
//        SSLContext sslContext = createSSLContext.createSSLContext("PKCS12"
//                , path, "lio03Bb9");
//        //SSLEngine 此类允许使用ssl安全套接层协议进行安全通信
//        SSLEngine engine = sslContext.createSSLEngine();
//        engine.setUseClientMode(false);
//        socketChannel.pipeline().addLast("ssl", new SslHandler(engine));
        String path = "/usr/local/server/app/cert/tomcat/scs1680576839056_chaoshengdaijia.com_server.jks";
        SSLContext sslContext = createSSLContext.createSSLContext("JKS"
                , path, "Zf3^5v6OoWmOVgeQ");
        //SSLEngine 此类允许使用ssl安全套接层协议进行安全通信
        SSLEngine engine = sslContext.createSSLEngine();
        engine.setUseClientMode(false);
        socketChannel.pipeline().addLast("ssl", new SslHandler(engine));
        // 设置30秒没有读到数据,则触发一个READER_IDLE事件。
        // pipeline.addLast(new IdleStateHandler(30, 0, 0));
zuul/src/main/java/com/sinata/zuul/util/applets/NettyWebSocketController.java
@@ -85,7 +85,7 @@
                    if (StringUtil.isNotEmpty(token)) {
                        String token_ = redisUtil.getValue("USER_Applets_" + userId1);//获取缓存中最新的数据
                        if (StringUtil.isNotEmpty(token_) && !token.equals(token_)) {//不在同一设备上登录,向其他设备发送数据
                            ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(0, 23));
                            ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(token_.length() - 16));
                            JSONObject msg_ = new JSONObject();
                            msg_.put("code", 200);
                            msg_.put("msg", "SUCCESS");
@@ -99,7 +99,7 @@
                                }
                            }, 5000);
                        }
                        NettyChannelMap.update_(token.substring(0, 23), ctx);//存储单点登录的通道
                        NettyChannelMap.update_(token.substring(token.length() - 16), ctx);//存储单点登录的通道
                        NettyChannelMap.update("Applets" + userId1, ctx);
                        redisUtil.setStrValue("USER_Applets_" + userId1, token);
                    }
zuul/src/main/java/com/sinata/zuul/util/echo/NettyChannelMap.java
@@ -78,6 +78,9 @@
     */
    @SuppressWarnings("rawtypes")
    public static synchronized void remove(ChannelHandlerContext value) {
        if(null == value){
            return;
        }
        Set<String> strings = map.keySet();
        for(String key : strings){
            ChannelHandlerContext channelHandlerContext = map.get(key);
zuul/src/main/java/com/sinata/zuul/util/echo/NettyServerController.java
@@ -7,6 +7,7 @@
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelId;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -86,11 +87,6 @@
            }
            JSONObject jsonCon = JSONObject.parseObject(jsonMsg.get("data").toString());
            if(null != ctx && ctx.channel().isActive()){
                jsonMsg.put("method", Method.pong);
                sendMsgToClient(ctx, jsonMsg.toJSONString());
            }
            //心跳
            if(method.equals(Method.ping)) {
                Integer type = jsonCon.getInteger("type");
@@ -106,21 +102,24 @@
                        if(StringUtil.isNotEmpty(token)){
                            String token_ = redisUtil.getValue("USER_APP_"+ userId1);//获取缓存中最新的数据
                            if(StringUtil.isNotEmpty(token_) && !token.equals(token_)){//不在同一设备上登录,向其他设备发送数据
                                ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(0, 23));
                                ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(token_.length() - 16));
                                JSONObject msg_ = new JSONObject();
                                msg_.put("code", 200);
                                msg_.put("msg", "SUCCESS");
                                msg_.put("method", "OFFLINE");
                                msg_.put("data", new Object());
                                this.sendMsgToClient(data_, msg_.toJSONString());//给当前通道发送消息
                                new Timer().schedule(new TimerTask() {
                                    @Override
                                    public void run() {
                                        NettyChannelMap.remove_(data_);
                                    }
                                }, 5000);
                                boolean b = this.sendMsgToClient(data_, msg_.toJSONString());//给当前通道发送消息
                                if(b){
                                    NettyChannelMap.remove_(data_);
                                }
//                                new Timer().schedule(new TimerTask() {
//                                    @Override
//                                    public void run() {
//                                        NettyChannelMap.remove_(data_);
//                                    }
//                                }, 5000);
                            }
                            NettyChannelMap.update_(token.substring(0, 23), ctx);
                            NettyChannelMap.update_(token.substring(token.length() - 16), ctx);
                            NettyChannelMap.update("USER" + userId1, ctx);
                            redisUtil.setStrValue("USER_APP_" + userId1, token);
                        }
@@ -132,33 +131,36 @@
                    }else{
                        //确保账号在单个设备上登录
                        if(StringUtil.isNotEmpty(token)){//APP端登录的操作
                            String token_ = redisUtil.getValue("DRIVER_" + userId1);//缓存中拿最新数据
                            if(StringUtil.isNotEmpty(token_) && !token.equals(token_)){//不在同一设备上登录,向当前设备发送数据
                                ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(0, 23));
                                JSONObject msg_ = new JSONObject();
                                msg_.put("code", 200);
                                msg_.put("msg", "SUCCESS");
                                msg_.put("method", "OFFLINE");
                                msg_.put("data", new Object());
                                this.sendMsgToClient(data_, msg_.toJSONString());//给当前通道发送消息
                                new Timer().schedule(new TimerTask() {
                                    @Override
                                    public void run() {
                                        NettyChannelMap.remove_(data_);
                                    }
                                }, 5000);
                            }
//                            String token_ = redisUtil.getValue("DRIVER_" + userId1);//缓存中拿最新数据
//                            if(StringUtil.isNotEmpty(token_) && !token.equals(token_)){//不在同一设备上登录,向当前设备发送数据
//                                ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(token_.length() - 16));
//                                if(null != data_){
//                                    JSONObject msg_ = new JSONObject();
//                                    msg_.put("code", 200);
//                                    msg_.put("msg", "SUCCESS");
//                                    msg_.put("method", "OFFLINE");
//                                    msg_.put("data", new Object());
//                                    boolean b = this.sendMsgToClient(data_, msg_.toJSONString());//给当前通道发送消息
//                                    if(b){
//                                        NettyChannelMap.remove_(data_);
//                                    }
//                                }
//                            }
                            NettyChannelMap.update("DRIVER" + userId1, ctx);
                            NettyChannelMap.update_(token.substring(0, 23), ctx);
                            NettyChannelMap.update_(token.substring(token.length() - 16), ctx);
                            redisUtil.setStrValue("DRIVER_" + userId1, token);
                        }
                        //存储通讯通道
                        //存储通讯通道
                        if(null != ctx && ctx.channel().isActive()){
                            NettyChannelMap.update("DRIVER" + userId1, ctx);
                        }
                    }
                }
                if(null != ctx && ctx.channel().isActive()){
                    jsonMsg.put("method", Method.pong);
                    sendMsgToClient(ctx, jsonMsg.toJSONString());
                }
            }
            //司机上传位置
            if(method.equals(Method.location)){
@@ -212,7 +214,7 @@
     * @param msg
     * @author TaoNingBo
     */
    public static void sendMsgToClient(ChannelHandlerContext ctx, String msg) {
    public static boolean sendMsgToClient(ChannelHandlerContext ctx, String msg) {
        if (ctx != null && ctx.channel().isActive()) {
            ByteBuf buffer = Unpooled.copiedBuffer((msg).getBytes());
            ChannelFuture sync;
@@ -232,7 +234,9 @@
                    if(b){
                        NettyChannelMap.remove(ctx);
                    }
                    return true;
                }
                return sync.isSuccess();
            } catch (Exception e) {
                System.err.println("推送发生异常,记录:"+msg);
                NettyChannelMap.remove(ctx);
@@ -244,6 +248,7 @@
            System.err.println("推送失败,长连接不存在");
            NettyChannelMap.remove(ctx);
        }
        return false;
    }
//    **链接断开 将推送消息记录