Explorar o código

1、车辆轨迹查询接口调整;
2、司机端新增查询统计接口;

zk %!s(int64=2) %!d(string=hai) anos
pai
achega
1763dddce6

+ 5 - 0
sckw-common/sckw-common-mongo/src/main/java/com/sckw/mongo/model/SckwWaybillOrder.java

@@ -203,6 +203,11 @@ public class SckwWaybillOrder{
      */
     private BigDecimal deficitAmount;
 
+    /**
+     * 亏吨扣款(自己承运总亏吨扣款)
+     */
+    private BigDecimal deficitPrice;
+
     /**
      * 合理损耗
      */

+ 1 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverController.java

@@ -156,6 +156,7 @@ public class KwfDriverController {
      **/
     @PostMapping("/findList")
     public HttpResult findList(@RequestBody HashMap params) throws SystemException {
+        params.put("entId", LoginUserHolder.getEntId());
         return HttpResult.ok(driverService.findList(params));
     }
 

+ 2 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfFleetController.java

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.easyexcel.RequestHolder;
 import com.sckw.excel.utils.ExcelUtil;
@@ -66,6 +67,7 @@ public class KwfFleetController {
      **/
     @PostMapping("/findList")
     public HttpResult findList(@RequestBody HashMap params) throws SystemException {
+        params.put("entId", LoginUserHolder.getEntId());
         return HttpResult.ok(fleetService.findList(params));
     }
 

+ 19 - 3
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java

@@ -160,6 +160,7 @@ public class KwfTruckController {
      **/
     @PostMapping("/findList")
     public HttpResult findList(@RequestBody HashMap params) throws SystemException {
+        params.put("entId", LoginUserHolder.getEntId());
         return HttpResult.ok(truckService.findList(params));
     }
 
@@ -262,10 +263,25 @@ public class KwfTruckController {
 
         List data = new ArrayList();
         for (KwfTruckVo truck:trucks) {
+            int bbb = new Random().nextInt(10) / 4;
             data.add(new HashMap(){{put("truckNo", truck.getTruckNo());
-                put("entId", truck.getEntId()); put("firmName",
-                        truck.getFirmName()); put("businessStatus", truck.getStatusName());
-                        put("runStatus", 0);}});
+                put("entId", truck.getEntId());
+                put("firmName", truck.getFirmName());
+                put("businessStatus", truck.getTruckNo().contains("1") ? 0 : 1);
+                put("runStatus", bbb == 0 ? 0 : bbb == 1 ? 1 : 2);}});
+        }
+
+        for (int i=0; i<5; i++) {
+            int index1 = i;
+            for (int j=0; j<10; j++) {
+                int aaa = new Random().nextInt(10) / 3;
+                int bbb = new Random().nextInt(10) / 4;
+                data.add(new HashMap(){{put("truckNo", "川A"+new Random().nextInt(100000));
+                    put("entId", "1000000" + index1);
+                    put("firmName", "物流企业"+ index1);
+                    put("businessStatus", aaa == 0 ? 0 : 1);
+                    put("runStatus", bbb == 0 ? 0 : bbb == 1 ? 1 : 2);}});
+            }
         }
 
         return HttpResult.ok(data);

+ 1 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfFleetService.java

@@ -81,7 +81,6 @@ public class KwfFleetService {
      * @date 2023/7/6
      **/
     public List<Map<String, Object>> findList(Map<String, Object> params) {
-        params.put("entId", LoginUserHolder.getEntId());
         return fleetDao.findList(params);
     }
 
@@ -94,7 +93,7 @@ public class KwfFleetService {
     public HttpResult add(KwfFleetDto params) {
         /**唯一性交易**/
         List<Map<String, Object>> fleets = fleetDao.findList(new HashMap(){{
-            put("name", params.getName()); put("entId", LoginUserHolder.getEntId());}});
+            put("wholeName", params.getName()); put("entId", LoginUserHolder.getEntId());}});
         if (!CollectionUtils.isEmpty(fleets)) {
             return HttpResult.error("车队班组已存在!");
         }

+ 4 - 1
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml

@@ -125,7 +125,10 @@
             and dre.ent_id = #{entId, jdbcType=VARCHAR}
         </if>
         <if test="name != null and name != ''">
-            and dr.name = #{name, jdbcType=VARCHAR}
+            and dr.name like concat('%',#{name},'%')
+        </if>
+        <if test="wholeName != null and wholeName != ''">
+            and fl.name =  #{wholeName, jdbcType=VARCHAR}
         </if>
         <if test="idcard != null and idcard != ''">
             and dr.idcard = #{idcard, jdbcType=VARCHAR}

+ 4 - 1
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfFleetMapper.xml

@@ -45,7 +45,10 @@
             and fl.ent_id = #{entId, jdbcType=VARCHAR}
         </if>
         <if test="name != null and name != ''">
-            and fl.name = #{name, jdbcType=VARCHAR}
+            and fl.name like concat('%',#{name},'%')
+        </if>
+        <if test="wholeName != null and wholeName != ''">
+            and fl.name = #{wholeName, jdbcType=VARCHAR}
         </if>
         <if test="contacts != null and contacts != ''">
             and fl.contacts = #{contacts, jdbcType=VARCHAR}

+ 52 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtWaybillOrderController.java

@@ -1,10 +1,17 @@
 package com.sckw.transport.controller;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.sckw.core.exception.SystemException;
+import com.sckw.core.model.page.PageHelperUtil;
+import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.model.ValiList;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.transport.model.dto.*;
+import com.sckw.transport.model.vo.WaybillOrderDriverVo;
 import com.sckw.transport.service.DriverService;
 import com.sckw.transport.service.KwtWaybillOrderService;
 import jakarta.validation.Valid;
@@ -12,7 +19,10 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author lfq
@@ -30,6 +40,48 @@ public class KwtWaybillOrderController {
     @Autowired
     private DriverService driverService;
 
+    /**
+     * @desc 统计司机任务数(待接单/出车/执行/完结)
+     * @author zk
+     * @date 2023/8/1
+     **/
+    @GetMapping("/findCountByDriver")
+    public HttpResult findCountByDriver(@RequestParam("driverId") Long driverId){
+        Map count = waybillOrderService.findStatisticsCountByDriver(driverId);
+        return HttpResult.ok(count);
+    }
+
+    /**
+     * @param params {driverId 司机ID, month月份}
+     * @desc 统计司机任务数(任务数/委派量/装货量/卸货量/亏吨量/亏吨扣款)
+     * @author zk
+     * @date 2023/8/1
+     **/
+    @PostMapping("/findSumByDriver")
+    public HttpResult findSumByDriver(@RequestBody Map params){
+        Map count = waybillOrderService.findStatisticsSumByDriver(params);
+        return HttpResult.ok(count);
+    }
+
+    /**
+     * @param params {driverId 司机ID, busStatus  1待接单/2出车/3执行/4完结, month月份}
+     * @desc 查询司机任务列表-待接单/出车/执行/完结
+     * @author zk
+     * @date 2023/8/1
+     **/
+    @PostMapping("/findWaybillOrderByDriver")
+    public HttpResult findWaybillOrderByDriver(@RequestBody Map params){
+        /**校验**/
+        if (StringUtils.isBlank(params.get("busStatus"))) {
+            return HttpResult.error("请选择业务状态!");
+        }
+        // 设置分页参数
+        PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
+        List<WaybillOrderDriverVo> list = waybillOrderService.findWaybillOrderByDriver(params);
+        PageResult pageResult = PageHelperUtil.getPageResult(new PageInfo<>(list));
+        return HttpResult.ok(pageResult);
+    }
+
     /**
      * 司机端 根据当前登录 id获取派给当前id的车辆运单
      * @return

+ 33 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtWaybillOrderMapper.java

@@ -6,6 +6,7 @@ import com.sckw.transport.model.KwtWaybillOrder;
 import com.sckw.transport.model.dto.OrderCarDTO;
 import com.sckw.transport.model.dto.WayBillDetailDTO;
 import com.sckw.transport.model.vo.WaybillCountVo;
+import com.sckw.transport.model.vo.WaybillOrderDriverVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -74,4 +75,36 @@ public interface KwtWaybillOrderMapper extends BaseMapper<KwtWaybillOrder> {
      * @date 2023/7/31
      **/
     WaybillCountVo findWaybillOrderCount(Map params);
+
+    /**
+     * @param driverId 司机ID
+     * @desc 统计司机任务数(待接单/出车/执行/完结)
+     * @author zk
+     * @date 2023/8/1
+     **/
+    Map<String, Object> findStatisticsCountByDriver(@Param("driverId") Long driverId);
+
+    /**
+     * @param params {driverId 司机ID, month月份}
+     * @desc 统计司机任务数(任务数/委派量/装货量/卸货量/亏吨量/亏吨扣款)
+     * @author zk
+     * @date 2023/8/1
+     **/
+    Map<String, Object> findStatisticsSumByDriver(Map params);
+
+    /**
+     * @param params {driverId 司机ID}
+     * @desc 查询司机任务列表-待接单
+     * @author zk
+     * @date 2023/8/1
+     **/
+    List<WaybillOrderDriverVo> findWaitWaybillOrderByDriver(Map params);
+
+    /**
+     * @param params {driverId 司机ID, busStatus 状态 2出车/3执行/4完结, month月份}
+     * @desc 查询司机任务列表-出车/执行/完结
+     * @author zk
+     * @date 2023/8/1
+     **/
+    List<WaybillOrderDriverVo> findOtherWaybillOrderByDriver(Map params);
 }

+ 150 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/WaybillOrderDriverVo.java

@@ -0,0 +1,150 @@
+package com.sckw.transport.model.vo;
+
+import lombok.Data;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author zk
+ * @desc 车辆运单-司机端任务列表
+ * @date 2023/8/1 0001
+ */
+@Data
+public class WaybillOrderDriverVo {
+
+    /**
+     * 主键
+     */
+    private Long wOrderId;
+
+    /**
+     * 编号
+     */
+    private String wOrderNo;
+
+    /**
+     * 主键
+     */
+    private Long lOrderId;
+
+    /**
+     * 物流订单编号
+     */
+    private String lOrderNo;
+
+    /**
+     * 循环/趟次
+     */
+    private Integer type;
+
+    /**
+     * 承运企业主键ID
+     */
+    private Long carrierEntId;
+
+    /**
+     * 承运企业名称
+     */
+    private String carrierFirmName;
+
+    /**
+     * 商品名称
+     */
+    private String goodsName;
+
+    /**
+     * 计划结束时间
+     */
+    private Date endTime;
+
+    /**
+     * 计划开始时间
+     */
+    private Date startTime;
+
+    /**
+     * 已委托量
+     */
+    private BigDecimal entrustAmount;
+
+    /**
+     * 装货地址名称
+     */
+    private Integer loadName;
+
+    /**
+     * 装货所在地区
+     */
+    private Integer loadCityCode;
+
+    /**
+     * 装货所属区域名称
+     */
+    private String loadCityName;
+
+    /**
+     * 装货详细地址
+     */
+    private String loadDetailAddress;
+
+    /**
+     * 卸货地址名称
+     */
+    private Integer unloadName;
+
+    /**
+     * 卸货所在地区
+     */
+    private Integer unloadCityCode;
+
+    /**
+     * 卸货所属区域名称
+     */
+    private String unloadCityName;
+
+    /**
+     * 卸货详细地址
+     */
+    private String unloadDetailAddress;
+
+    /**
+     * 装货重量
+     */
+    private BigDecimal loadAmount;
+
+    /**
+     * 卸货重量
+     */
+    private BigDecimal unloadAmount;
+
+    /**
+     * 亏吨重量
+     */
+    private BigDecimal deficitAmount;
+
+    /**
+     * 亏吨扣款(自己承运总亏吨扣款)
+     */
+    private BigDecimal deficitPrice;
+
+    /**
+     * 车牌号
+     */
+    private String truckNo;
+
+    /**
+     * 单据状态
+     */
+    private String status;
+
+    /**
+     * 创建人姓名
+     */
+    private String createByName;
+
+    /**
+     * 派车时间-创建时间
+     */
+    private Date createTime;
+
+}

+ 96 - 5
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java

@@ -1,8 +1,13 @@
 package com.sckw.transport.service;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.enums.CarWaybillEnum;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
+import com.sckw.core.model.page.PageHelperUtil;
+import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
@@ -11,19 +16,25 @@ import com.sckw.mongo.enums.BusinessTypeEnum;
 import com.sckw.mongo.model.SckwLogisticsOrder;
 import com.sckw.mongo.model.SckwWaybillOrder;
 import com.sckw.stream.model.SckwBusSum;
+import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import com.sckw.system.api.model.dto.res.SysDictResDto;
+import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import com.sckw.transport.dao.*;
 import com.sckw.transport.model.*;
 import com.sckw.transport.model.dto.*;
 import com.sckw.transport.model.vo.WaybillCountVo;
+import com.sckw.transport.model.vo.WaybillOrderDriverVo;
 import jakarta.annotation.Resource;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cloud.stream.function.StreamBridge;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author zk
@@ -55,6 +66,72 @@ public class KwtWaybillOrderService {
     KwtLogisticsOrderCirculateMapper logisticsOrderCirculateDao;
     @Resource
     private StreamBridge streamBridge;
+    @DubboReference(version = "2.0.0", group = "design", check = false)
+    private RemoteSystemService remoteSystemService;
+
+
+    /**
+     * @param driverId 司机ID
+     * @desc 统计司机任务数(待接单/出车/执行/完结)
+     * @author zk
+     * @date 2023/8/1
+     **/
+    public Map findStatisticsCountByDriver(Long driverId){
+        return waybillOrderDao.findStatisticsCountByDriver(driverId);
+    }
+
+    /**
+     * @param params {driverId 司机ID, month月份}
+     * @desc 统计司机任务数(任务数/委派量/装货量/卸货量/亏吨量/亏吨扣款)
+     * @author zk
+     * @date 2023/8/1
+     **/
+    public Map findStatisticsSumByDriver(Map params){
+        return waybillOrderDao.findStatisticsSumByDriver(params);
+    }
+
+    /**
+     * @param params {driverId 司机ID, busStatus  1待接单/2出车/3执行/4完结, month月份}
+     * @desc 统计司机任务数(任务数/委派量/装货量/卸货量/亏吨量/亏吨扣款)
+     * @author zk
+     * @date 2023/8/1
+     **/
+    public List<WaybillOrderDriverVo> findWaybillOrderByDriver(Map params){
+        /**参数处理**/
+        //业务状态busStatus  1待接单/2出车/3执行/4完结
+        Integer busStatus = Integer.parseInt(StringUtils.objectStr(params.get("busStatus")));
+        Object driverId = StringUtils.isBlank(params.get("driverId")) ? LoginUserHolder.getUserId() : params.get("driverId");
+        params.put("driverId", driverId);
+        // 设置分页参数
+        PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
+
+        /**数据查询**/
+        List<WaybillOrderDriverVo> waybillOrders = new ArrayList();
+        if (busStatus == 1) {
+            //查询司机任务列表-待接单
+            waybillOrders = waybillOrderDao.findWaitWaybillOrderByDriver(params);
+        } else {
+            //查询司机任务列表-出车/执行/完结
+            waybillOrders = waybillOrderDao.findOtherWaybillOrderByDriver(params);
+        }
+
+        /**数据组装**/
+        List<Long> entIds = new ArrayList<>();
+        for (WaybillOrderDriverVo waybillOrder:waybillOrders) {
+            entIds.add(waybillOrder.getCarrierEntId());
+        }
+        //企业数据集
+        entIds = entIds.stream().distinct().collect(Collectors.toList());
+        Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
+        for (WaybillOrderDriverVo waybillOrder:waybillOrders) {
+            EntCacheResDto ent = ents == null ? null : ents.get(waybillOrder.getCarrierEntId());
+            waybillOrder.setCarrierFirmName(ent != null ? ent.getFirmName() : null);
+        }
+        return waybillOrders;
+    }
+
+
+
 
     /**
      * @param params
@@ -690,6 +767,13 @@ public class KwtWaybillOrderService {
             if (circulate.getWOrderId() != null) {
                 return HttpResult.error("车辆循环运单不能接单!");
             }
+            //承运单信息
+            KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(circulate.getLOrderId());
+            //剩余未派量=上级委派量-分包量-下级委派量
+            BigDecimal residue = logisticsOrder.getAmount().subtract(logisticsOrder.getEntrustAmount()).subtract(logisticsOrder.getSubcontractAmount());
+            if (logisticsOrder.getStatus() != LogisticsOrderEnum.IN_TRANSIT.getCode() || residue.compareTo(new BigDecimal(Global.AMOUNT)) >= 0) {
+                return HttpResult.error("已不能接单!");
+            }
 
             /**获取基础信息**/
             //装货地址
@@ -720,8 +804,6 @@ public class KwtWaybillOrderService {
             setWaybillOrderTrack(circulate, waybillOrder.getId());
 
             /**2更新承运订单信息**/
-            //承运单信息
-            KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(waybillOrder.getLOrderId());
             //承运订单已委派量:承运订单历史委派量+当前运单委派量
             BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? new BigDecimal(Global.AMOUNT) : logisticsOrder.getEntrustAmount();
             logisticsOrder.setEntrustAmount(entrustAmount.add(waybillOrder.getEntrustAmount()));
@@ -1301,11 +1383,20 @@ public class KwtWaybillOrderService {
             for (KwtLogisticsOrderCirculate circulate:circulates) {
                 circulate.setStatus(Global.NUMERICAL_ONE);
                 logisticsOrderCirculateDao.updateById(circulate);
+
+                //车辆订单-Mongodb数据更新
+                SckwWaybillOrder wOrder = new SckwWaybillOrder();
+                wOrder.set_id(circulate.getId());
+                KwtWaybillOrder waybillOrder = new KwtWaybillOrder();
+                waybillOrder.setStatus(CarWaybillEnum.REVOKED.getCode());
+                waybillOrder.setUpdateTime(circulate.getUpdateTime());
+                waybillOrder.setUpdateBy(circulate.getUpdateBy());
+                editSckwWaybillOrder(wOrder, waybillOrder, 2);
             }
         }
 
         //车辆运单统计
-        /**1-4Mongodb数据更新**/
+        /**1-5Mongodb数据更新**/
         //车辆运单统计
         Map queryParams = new HashMap();
         queryParams.put("lOrderId", logisticsOrder.getId());
@@ -1313,7 +1404,7 @@ public class KwtWaybillOrderService {
         queryParams.put("upperlOrderId", logisticsOrder.getId());
         waybillCount = waybillOrderDao.findWaybillOrderCount(queryParams);
 
-        //2承运订单
+        //承运订单
         SckwLogisticsOrder lOrder = new SckwLogisticsOrder();
         lOrder.setLoadTime(waybillCount.getLoadTime());
         lOrder.setUnloadTime(waybillCount.getUnloadTime());

+ 135 - 0
sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderMapper.xml

@@ -176,6 +176,7 @@
             and FIND_IN_SET(id, #{belowlOrderId, jdbcType=VARCHAR})
         </if>
     </select>
+
     <select id="selectWaybillOrderCarListGroupByTruckNo" resultType="com.sckw.transport.model.dto.OrderCarDTO">
         SELECT
         a.truck_no AS truckNo,
@@ -198,4 +199,138 @@
         a.truck_no
         limit #{page},#{pageSize}
     </select>
+
+    <select id="findStatisticsCountByDriver" resultType="java.util.Map" >
+        select
+            tabA.total + tabB.total as waitTotal, tabC.total departureTotal, tabD.total executeTotal, tabE.total endTotal
+        from
+        (
+            SELECT
+                count(1) total, 0 indexNum
+            FROM kwt_logistics_order_circulate loc
+            LEFT JOIN kwt_logistics_order lo on lo.id = loc.l_order_id
+            where loc.del_flag = 0 and lo.del_flag = 0 and loc.status = 0 and loc.w_order_id is null
+            and loc.driver_id = #{driverId, jdbcType=BIGINT}
+        ) tabA
+        left join
+        (
+            SELECT
+                count(1) total, 0 indexNum
+            FROM kwt_waybill_order wo
+            LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
+            where wo.del_flag = 0 and lo.del_flag = 0 and wo.status = 1
+            and wo.driver_id = #{driverId, jdbcType=BIGINT}
+        ) tabB on tabB.indexNum = tabA.indexNum
+        left join
+        (
+            SELECT
+                count(1) total, 0 indexNum
+            FROM kwt_waybill_order wo
+            LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
+            where wo.del_flag = 0 and lo.del_flag = 0 and wo.status = 2
+            and wo.driver_id = #{driverId, jdbcType=BIGINT}
+        ) tabC on tabC.indexNum = tabA.indexNum
+        left join
+        (
+            SELECT
+                count(1) total, 0 indexNum
+            FROM kwt_waybill_order wo
+            LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
+            where wo.del_flag = 0 and lo.del_flag = 0 and wo.status in (3, 4, 5, 6)
+            and wo.driver_id = #{driverId, jdbcType=BIGINT}
+        ) tabD on tabD.indexNum = tabA.indexNum
+        left join
+        (
+            SELECT
+                count(1) total, 0 indexNum
+            FROM kwt_waybill_order wo
+            LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
+            where wo.del_flag = 0 and lo.del_flag = 0 and wo.status in (7, 8, 9, 10, 11, 12)
+            and wo.driver_id = #{driverId, jdbcType=BIGINT}
+        ) tabE on tabE.indexNum = tabA.indexNum
+    </select>
+
+    <select id="findStatisticsSumByDriver" resultType="java.util.Map"  parameterType="java.util.Map">
+        SELECT
+            count(1) total, IFNULL(sum(wo.entrust_amount), 0.0) entrustAmount, IFNULL(sum(wo.load_amount), 0.0) loadAmount,
+            IFNULL(sum(wo.unload_amount), 0.0) unloadAmount, IFNULL(sum(wo.deficit_amount), 0.0) deficitAmount,
+            IFNULL(sum(wo.deficit_price), 0.0) deficitPrice
+        FROM kwt_waybill_order wo
+        LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
+        where wo.del_flag = 0 and lo.del_flag = 0
+        <if test="busStatus != null and busStatus == 4">
+            and wo.status in (7, 8, 9, 10, 11, 12)
+        </if>
+        <if test="driverId != null and driverId != ''">
+            and wo.driver_id = #{driverId, jdbcType=BIGINT}
+        </if>
+        <if test="month != null and month != ''">
+            and LEFT(wo.create_time, 7) = #{month, jdbcType=TIMESTAMP}
+        </if>
+    </select>
+
+    <select id="findWaitWaybillOrderByDriver" resultType="com.sckw.transport.model.vo.WaybillOrderDriverVo" parameterType="java.util.Map">
+        SELECT * from (
+            SELECT
+                wo.id wOrderId, wo.w_order_no wOrderNo, wo.l_order_id lOrderId, lo.l_order_no lOrderNo, wo.type,
+                wo.ent_id carrierEntId, 'xxxxx' carrierFirmName, log.goods_name goodsName, wo.start_time startTime,
+                wo.end_time endTime, wo.entrust_amount entrustAmount, woa1.name loadName, woa1.city_code loadCityCode,
+                woa1.city_name loadCityName, woa1.detail_address loadDetailAddress, woa2.name unloadName, woa2.city_code unloadCityCode,
+                woa2.city_name unloadCityName, woa2.detail_address unloadDetailAddress, wo.load_amount loadAmount, wo.unload_amount unloadAmount,
+                wo.deficit_amount deficitAmount, wo.deficit_price deficitPrice, wo.truck_no truckNo, wo.status, wo.create_time createTime
+            FROM kwt_waybill_order wo
+            LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
+            LEFT JOIN kwt_waybill_order_address woa1 on woa1.w_order_id = wo.id and woa1.type = 1
+            LEFT JOIN kwt_waybill_order_address woa2 on woa2.w_order_id = wo.id and woa2.type = 2
+            LEFT JOIN kwt_logistics_order_goods log on log.l_order_id = wo.l_order_id
+            where wo.del_flag = 0 and lo.del_flag = 0 and wo.status = 1
+            and wo.driver_id = #{driverId, jdbcType=BIGINT}
+            UNION
+            SELECT
+                loc.id wOrderId, null wOrderNo, loc.l_order_id lOrderId, lo.l_order_no lOrderNo, loc.type,
+                loc.ent_id carrierEntId, 'xxxxx' carrierFirmName, log.goods_name goodsName, loc.start_time startTime,
+                loc.end_time endTime, loc.entrust_amount entrustAmount, woa1.name loadName, woa1.city_code loadCityCode,
+                woa1.city_name loadCityName, woa1.detail_address loadDetailAddress, woa2.name unloadName, woa2.city_code unloadCityCode,
+                woa2.city_name unloadCityName, woa2.detail_address unloadDetailAddress, null loadAmount, null unloadAmount,
+                null deficitAmount, null deficitPrice, loc.truck_no truckNo, 1 status, loc.update_time createTime
+            FROM kwt_logistics_order_circulate loc
+            LEFT JOIN kwt_logistics_order lo on lo.id = loc.l_order_id
+            LEFT JOIN kwt_waybill_order_address woa1 on woa1.w_order_id = lo.id and woa1.type = 1
+            LEFT JOIN kwt_waybill_order_address woa2 on woa2.w_order_id = lo.id and woa2.type = 2
+            LEFT JOIN kwt_logistics_order_goods log on log.l_order_id = loc.l_order_id
+            where loc.del_flag = 0 and lo.del_flag = 0 and loc.status = 0 and loc.w_order_id is null
+            and loc.driver_id = #{driverId, jdbcType=BIGINT}
+        ) tab order by createTime desc
+    </select>
+
+    <select id="findOtherWaybillOrderByDriver" resultType="com.sckw.transport.model.vo.WaybillOrderDriverVo" parameterType="java.util.Map">
+        SELECT
+            wo.id wOrderId, wo.w_order_no wOrderNo, wo.l_order_id lOrderId, lo.l_order_no lOrderNo, wo.type,
+            wo.ent_id carrierEntId, 'xxxxx' carrierFirmName, log.goods_name goodsName, wo.start_time startTime,
+            wo.end_time endTime, wo.entrust_amount entrustAmount, woa1.name loadName, woa1.city_code loadCityCode,
+            woa1.city_name loadCityName, woa1.detail_address loadDetailAddress, woa2.name unloadName, woa2.city_code unloadCityCode,
+            woa2.city_name unloadCityName, woa2.detail_address unloadDetailAddress, wo.load_amount loadAmount, wo.unload_amount unloadAmount,
+            wo.deficit_amount deficitAmount, wo.deficit_price deficitPrice, wo.truck_no truckNo, wo.status, wo.create_time createTime
+        FROM kwt_waybill_order wo
+        LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
+        LEFT JOIN kwt_waybill_order_address woa1 on woa1.w_order_id = wo.id and woa1.type = 1
+        LEFT JOIN kwt_waybill_order_address woa2 on woa2.w_order_id = wo.id and woa2.type = 2
+        LEFT JOIN kwt_logistics_order_goods log on log.l_order_id = wo.l_order_id
+        where wo.del_flag = 0 and lo.del_flag = 0
+        <if test="driverId != null and driverId != ''">
+            and wo.driver_id = #{driverId, jdbcType=BIGINT}
+        </if>
+        <if test="busStatus != null and busStatus == 2">
+            and wo.status = 2
+        </if>
+        <if test="busStatus != null and busStatus == 3">
+            and wo.status in (3, 4, 5, 6)
+        </if>
+        <if test="busStatus != null and busStatus == 4">
+            and wo.status in (7, 8, 9, 10, 11, 12)
+        </if>
+        <if test="month != null and month != ''">
+            and LEFT(wo.create_time, 7) = #{month, jdbcType=TIMESTAMP}
+        </if>
+    </select>
 </mapper>