Răsfoiți Sursa

承运订单/托运订单/数据权限过滤

lengfaqiang 2 ani în urmă
părinte
comite
e7faa5374e

+ 17 - 4
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/AcceptCarriageOrderController.java

@@ -12,10 +12,7 @@ import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.config.easyexcel.RequestHolder;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.transport.model.dto.*;
-import com.sckw.transport.model.param.AcceptCarriageOrderQuery;
-import com.sckw.transport.model.param.ContractParam;
-import com.sckw.transport.model.param.DriverParam;
-import com.sckw.transport.model.param.LogisticsOrderParam;
+import com.sckw.transport.model.param.*;
 import com.sckw.transport.model.vo.execlVo.AcceptCarriageOrderExcelVo;
 import com.sckw.transport.service.AcceptCarriageOrderService;
 import com.sckw.transport.service.TransportCommonService;
@@ -402,4 +399,20 @@ public class AcceptCarriageOrderController {
             return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
         }
     }
+
+    /**
+     * 工作台-物流运输数据统计-承运
+     *
+     * @return
+     */
+    @RequestMapping(value = "/workbenchLogisticsOrderStatistics", method = RequestMethod.POST)
+    public HttpResult workbenchLogisticsOrderStatistics(@RequestBody LogisticsOrderStatisticsParam logisticsOrderStatistics) {
+        log.info("工作台-物流运输数据统计-承运 {}", JSONObject.toJSONString(logisticsOrderStatistics));
+        try {
+            return acceptCarriageOrderService.workbenchLogisticsOrderStatistics(logisticsOrderStatistics);
+        } catch (Exception e) {
+            log.error("工工作台-承运业务统计-承运 error:{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
 }

+ 2 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/ConsignOrderController.java

@@ -334,13 +334,13 @@ public class ConsignOrderController {
 
 
     /**
-     * 工作台-物流运输数据统计
+     * 工作台-物流运输数据统计-托运业务
      *
      * @return
      */
     @RequestMapping(value = "/workbenchLogisticsOrderStatistics", method = RequestMethod.POST)
     public HttpResult workbenchLogisticsOrderStatistics(@RequestBody LogisticsOrderStatisticsParam logisticsOrderStatistics) {
-        log.info("工作台-物流运输数据统计 {}", JSONObject.toJSONString(logisticsOrderStatistics));
+        log.info("工作台-物流运输数据统计-托运业务 {}", JSONObject.toJSONString(logisticsOrderStatistics));
         try {
             return consignOrderService.workbenchLogisticsOrderStatistics(logisticsOrderStatistics);
         } catch (Exception e) {

+ 3 - 3
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/enterpriseApp/AppConsignController.java

@@ -47,17 +47,17 @@ public class AppConsignController {
     }
 
     /**
-     * 企业app托运订单详情统计
+     * 企业app托运订单详情统计-统计车辆运单
      * @param orderId
      * @return
      */
     @RequestMapping(name = "企业app托运订单详情统计", path = "/statisticsConsignByOrderId", method = RequestMethod.GET)
     public HttpResult statisticsConsignByOrderId(@NotBlank(message = "订单id不能为空") @RequestParam("orderId") String orderId) {
-        log.info("企业app托运订单详情统计 query :{}",orderId);
+        log.info("企业app托运订单详情统计-统计车辆运单 query :{}",orderId);
         try {
             return HttpResult.ok(waybillOrderService.statisticsByOrderId(orderId,"1"));
         } catch (Exception e) {
-            log.error("企业app托运订单详情统计失败  query:{}, error:{}", orderId, e.getMessage(), e);
+            log.error("企业app托运订单详情统计失败-统计车辆运单  query:{}, error:{}", orderId, e.getMessage(), e);
             return HttpResult.error(e.getMessage());
         }
     }

+ 116 - 18
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java

@@ -31,12 +31,15 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
      * @param logisticsOrderParam 查询参数
      * @param dictValue           字典id
      * @param entId               托运角色
-     * @param dictValue           承运角色
+     * @param ids                 承运角色
+     * @param orderStatusList     单据状态
      * @return
      */
     List<LogisticsOrderVO> selectLogisticOrderData(@Param("logisticsOrderParam") LogisticsOrderParam logisticsOrderParam,
                                                    @Param("dictValue") String dictValue, @Param("entId") Long entId,
-                                                   @Param("ids") List<Long> ids);
+                                                   @Param("ids") List<Long> ids,
+                                                   @Param("orderStatusList") List<Integer> orderStatusList
+    );
 
 
     /**
@@ -93,7 +96,8 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
      */
     Long selectLogisticOrderCount(@Param("logisticsOrderParam") LogisticsOrderParam logisticsOrderParam,
                                   @Param("dictValue") String dictValue, @Param("entId") Long entId,
-                                  @Param("ids") List<Long> ids
+                                  @Param("ids") List<Long> ids,
+                                  @Param("orderStatusList") List<Integer> orderStatusList
     );
 
     Map<String, String> getRejectReason(@Param("id") String id, @Param("status") Integer status);
@@ -132,7 +136,7 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
      * @param ids
      * @return
      */
-    List<LogisticsOrderDTO> selectLogisticOrderList(@Param("ids") List<String> ids);
+    List<LogisticsOrderDTO> selectLogisticOrderList(@Param("ids") List<String> ids,@Param("status") Integer status);
 
     /**
      * 通过物流订单id获取统计数据
@@ -241,6 +245,24 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
                                                          @Param("idsList") List<Long> idsList
     );
 
+    /**
+     * 托运数据查询
+     *
+     * @param query
+     * @param orderList
+     * @param type
+     * @param entId
+     * @return
+     */
+    List<ConsignOrderVO> selectConsignLogisticsOrderListByConsign(@Param("query") ConsignOrderQuery query,
+                                                                  @Param("orderList") List<Integer> orderList,
+                                                                  @Param("type") String type,
+                                                                  @Param("entId") Long entId,
+                                                                  @Param("contactsIds") List<Long> contactsIds,
+                                                                  @Param("userIds") List<Long> userIds,
+                                                                  @Param("idsList") List<Long> idsList
+    );
+
     /**
      * 首页查询导出
      *
@@ -274,6 +296,25 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
                                                     @Param("idsList") List<Long> idsList
     );
 
+    /**
+     * 承运订单
+     *
+     * @param query
+     * @param orderList   单据状态
+     * @param type        代表承运或者托运
+     * @param entId       企业id
+     * @param contactsIds 联系人id
+     * @return
+     */
+    List<TableTops> countLogisticsOrderListByAcceptCarriageStatus(@Param("query") AcceptCarriageOrderQuery query,
+                                                                  @Param("orderList") List<Integer> orderList,
+                                                                  @Param("type") String type,
+                                                                  @Param("entId") Long entId,
+                                                                  @Param("contactsIds") List<Long> contactsIds,
+                                                                  @Param("userIds") List<Long> userIds,
+                                                                  @Param("idsList") List<Long> idsList
+    );
+
 
     /**
      * @param query
@@ -309,23 +350,21 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
     Integer statisticsLogisticsByTopEntIdAndOrderStatus(@Param("topEntId") Long topEntId, @Param("orderList") List<Integer> orderList);
 
     /**
-     *
      * @param statusList 单据状态集合
-     * @param dateStart 开始时间
-     * @param dateEnd   结束时间
-     * @param topId 顶级企业id
-     * @param unitType  企业类型【1托运2承运】
+     * @param dateStart  开始时间
+     * @param dateEnd    结束时间
+     * @param topId      顶级企业id
+     * @param unitType   企业类型【1托运2承运】
      * @return
      */
     StatisticsByOrderVO selectAcceptCarriageFinishOrder(@Param("statusList") List<Integer> statusList, @Param("dateStart") String dateStart, @Param("dateEnd") String dateEnd, @Param("topId") Long topId, @Param("unitType") Integer unitType);
 
     /**
-     *
      * @param statusList 单据状态集合
-     * @param dateStart 开始时间
-     * @param dateEnd   结束时间
-     * @param topId 顶级企业id
-     * @param unitType  企业类型【1托运2承运】
+     * @param dateStart  开始时间
+     * @param dateEnd    结束时间
+     * @param topId      顶级企业id
+     * @param unitType   企业类型【1托运2承运】
      * @return
      */
     StatisticsByOrderVO selectAcceptCarriageAwaitFinishOrder(@Param("statusList") List<Integer> statusList, @Param("dateStart") String dateStart, @Param("dateEnd") String dateEnd, @Param("topId") Long topId, @Param("unitType") Integer unitType);
@@ -333,14 +372,73 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
 
     StatisticsByOrderVO selectStatisticsByOrder(@Param("statusList") List<Integer> statusList, @Param("dateStart") String dateStart, @Param("dateEnd") String dateEnd, @Param("topId") Long topId, @Param("unitType") Integer unitType);
 
-    List<LogisticsOrderStatisticsVO> workbenchLogisticsOrderStatisticsByMonth(@Param("id") Long id, @Param("statusList") List<Integer> statusList,@Param("type") Integer type, @Param("dateStart") String dateStart, @Param("dateEnd") String dateEnd);
+    List<LogisticsOrderStatisticsVO> workbenchLogisticsOrderStatisticsByMonth(@Param("id") Long id, @Param("statusList") List<Integer> statusList, @Param("type") Integer type, @Param("dateStart") String dateStart, @Param("dateEnd") String dateEnd);
 
 
-    List<LogisticsOrderStatisticsVO> workbenchLogisticsOrderStatisticsByDays(@Param("id") Long id, @Param("statusList") List<Integer> statusList,@Param("type") Integer type, @Param("dateStart") String dateStart, @Param("dateEnd") String dateEnd);
+    List<LogisticsOrderStatisticsVO> workbenchLogisticsOrderStatisticsByDays(@Param("id") Long id, @Param("statusList") List<Integer> statusList, @Param("type") Integer type, @Param("dateStart") String dateStart, @Param("dateEnd") String dateEnd);
 
     List<com.sckw.transport.model.dto.LogisticsOrderDTO> selectOrderListByTradeOrderIds(@Param("tradeOrderIds") List<Long> tradeOrderIds, @Param("unitType") String unitType);
 
+    /**
+     * 承运订单数据查询
+     *
+     * @param query
+     * @param orderList
+     * @param type
+     * @param entId
+     * @param contactsIds
+     * @param userIds
+     * @param idsList
+     * @return
+     */
+    List<AcceptCarriageOrderVO> selectLogisticsOrderListByAcceptCarriage(@Param("query") AcceptCarriageOrderQuery query,
+                                                                         @Param("orderList") List<Integer> orderList,
+                                                                         @Param("type") String type,
+                                                                         @Param("entId") Long entId,
+                                                                         @Param("contactsIds") List<Long> contactsIds,
+                                                                         @Param("userIds") List<Long> userIds,
+                                                                         @Param("idsList") List<Long> idsList
+
+    );
 
-//    List<TableTops> countAppLogisticsOrderListByStatus(@Param("type") String type,@Param("entId") Long entId
-//    );
+    /**
+     * 托运订单数据查询
+     *
+     * @param query
+     * @param orderList
+     * @param type
+     * @param entId
+     * @param contactsIds
+     * @param userIds
+     * @param idsList
+     * @return
+     */
+    List<AcceptCarriageOrderVO> selectLogisticsOrderListByConsign(
+            @Param("query") AcceptCarriageOrderQuery query,
+            @Param("orderList") List<Integer> orderList,
+            @Param("type") String type,
+            @Param("entId") Long entId,
+            @Param("contactsIds") List<Long> contactsIds,
+            @Param("userIds") List<Long> userIds,
+            @Param("idsList") List<Long> idsList
+    );
+
+    /**
+     * 托运订单数据统计
+     *
+     * @param query
+     * @param orderList   单据状态
+     * @param type        代表承运或者托运
+     * @param entId       企业id
+     * @param contactsIds 联系人id
+     * @return
+     */
+    List<TableTops> countLogisticsOrderListByConsignStatus(@Param("query") AcceptCarriageOrderQuery query,
+                                                           @Param("orderList") List<Integer> orderList,
+                                                           @Param("type") String type,
+                                                           @Param("entId") Long entId,
+                                                           @Param("contactsIds") List<Long> contactsIds,
+                                                           @Param("userIds") List<Long> userIds,
+                                                           @Param("idsList") List<Long> idsList
+    );
 }

+ 63 - 4
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java

@@ -1,5 +1,7 @@
 package com.sckw.transport.service;
 
+import cn.hutool.core.date.DateField;
+import cn.hutool.core.date.DateTime;
 import cn.hutool.core.util.ArrayUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
@@ -50,6 +52,7 @@ import com.sckw.transport.model.*;
 import com.sckw.transport.model.dto.*;
 import com.sckw.transport.model.param.AcceptCarriageOrderQuery;
 import com.sckw.transport.model.param.DriverParam;
+import com.sckw.transport.model.param.LogisticsOrderStatisticsParam;
 import com.sckw.transport.model.vo.*;
 import com.sckw.transport.model.vo.execlVo.AcceptCarriageOrderExcelVo;
 import jakarta.annotation.Resource;
@@ -65,11 +68,14 @@ import org.springframework.util.ObjectUtils;
 
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
+import java.text.ParseException;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.sckw.excel.utils.DateUtil.DEF_DATE_FORMAT;
+
 /**
  * @author lfdc
  * @description 承运订单service
@@ -2317,7 +2323,7 @@ public class AcceptCarriageOrderService {
         if (StringUtils.isNotBlank(query.getIds())) {
             idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
         }
-        List<AcceptCarriageOrderVO> list = logisticsOrderMapper.selectLogisticsOrderList(query, orderList, type, entId, longList, longList,idsList);
+        List<AcceptCarriageOrderVO> list = logisticsOrderMapper.selectLogisticsOrderListByAcceptCarriage(query, orderList, type, entId, longList, longList, idsList);
         PageInfo<AcceptCarriageOrderVO> pageInfo = new PageInfo<>(list);
         if (CollectionUtils.isEmpty(list)) {
             return PageRes.build(pageInfo, list);
@@ -2436,7 +2442,7 @@ public class AcceptCarriageOrderService {
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
         List<Long> idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
-        List<TableTops> list = logisticsOrderMapper.countLogisticsOrderListByStatus(query, orderList, type, entId, longList, longList,idsList);
+        List<TableTops> list = logisticsOrderMapper.countLogisticsOrderListByAcceptCarriageStatus(query, orderList, type, entId, longList, longList, idsList);
         List<TableTops> arrayList = new ArrayList<>();
         arrayList.addAll(list);
         /**补全数据状态不齐的情况*/
@@ -2560,7 +2566,7 @@ public class AcceptCarriageOrderService {
         List<Long> longs = LoginUserHolder.getAuthUserIdList();
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
-        List<AcceptCarriageOrderVO> list = logisticsOrderMapper.selectLogisticsOrderList(query, orderList, type, entId, longList, longList,idsList);
+        List<AcceptCarriageOrderVO> list = logisticsOrderMapper.selectLogisticsOrderListByAcceptCarriage(query, orderList, type, entId, longList, longList, idsList);
         /**计费方式*/
         Map<String, String> chargingDictData = getDictData(DictTypeEnum.CHARGING_TYPE.getType());
         /**结算周期*/
@@ -2630,7 +2636,7 @@ public class AcceptCarriageOrderService {
                         }
                     }
                 } catch (Exception e) {
-                    log.error("tradeOrderInfoService.getOrderDetailById error id:{}.errorMessage:{}",vo.getTOrderId(),e.getMessage(),e);
+                    log.error("tradeOrderInfoService.getOrderDetailById error id:{}.errorMessage:{}", vo.getTOrderId(), e.getMessage(), e);
                 }
             }
             carriageOrderExcelVo.setSubcontractAmount(Objects.isNull(vo.getSubcontractAmount()) ? null : df.format(vo.getSubcontractAmount()) + priceType.get(vo.getPriceType()));
@@ -2759,4 +2765,57 @@ public class AcceptCarriageOrderService {
         httpResult.setData(vo);
         return httpResult;
     }
+
+    /**
+     * 工作台-物流运输数据统计
+     *
+     * @return
+     */
+    public HttpResult workbenchLogisticsOrderStatistics(LogisticsOrderStatisticsParam logisticsOrderStatistics) {
+//        List<String> stringList = StringUtils.splitStrToList(logisticsOrderStatistics.getTypes(), String.class);
+        EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(LoginUserHolder.getEntId());
+        if (entCacheResDto == null) {
+            return HttpResult.ok();
+        }
+        Long id = entCacheResDto.getId();
+        //获取完结的单据-排除掉不做统计中的数据
+        List<Integer> statusList = new ArrayList<>();
+        statusList.add(LogisticsOrderEnum.TO_BE_PLANNED.getCode());
+        statusList.add(LogisticsOrderEnum.PENDING_ORDER.getCode());
+        statusList.add(LogisticsOrderEnum.WAIT_DELIVERY.getCode());
+        statusList.add(LogisticsOrderEnum.IN_TRANSIT.getCode());
+        statusList.add(LogisticsOrderEnum.HAVE_FINISHED.getCode());
+        statusList.add(LogisticsOrderEnum.HAVE_RECONCILED.getCode());
+        statusList.add(LogisticsOrderEnum.HAVE_ALREADY_SETTLED.getCode());
+
+        /**1.目前只统计承运单位属性的数据
+         * 2.月统计->默认当前往前推12个月
+         * 3.日统计->默认当前往前推30天*/
+        if (String.valueOf(NumberConstant.THREE).equals(logisticsOrderStatistics.getDateType())) {
+            //本月
+            //开始时间
+            DateTime dateTime = cn.hutool.core.date.DateUtil.truncate(new Date(), DateField.MONTH);
+            LocalDateTime localDateTime = dateTime.toLocalDateTime().minusMonths(11);
+            String dateStart = cn.hutool.core.date.DateUtil.format(localDateTime, DEF_DATE_FORMAT);
+            //结束时间
+            String dateEnd = cn.hutool.core.date.DateUtil.format(dateTime, DEF_DATE_FORMAT);
+
+            List<LogisticsOrderStatisticsVO> list = logisticsOrderMapper.workbenchLogisticsOrderStatisticsByMonth(id, statusList, OrderTypeEnum.ACCEPT_CARRIAGE_ORDER.getType(), dateStart, dateEnd);
+            return HttpResult.ok(list);
+        } else if (String.valueOf(NumberConstant.ONE).equals(logisticsOrderStatistics.getDateType())) {
+            //开始时间
+            String format = cn.hutool.core.date.DateUtil.format(LocalDateTime.now(), DEF_DATE_FORMAT);
+            String dateStart = null;
+            try {
+                dateStart = DateUtil.getThirtyDaysDate(format, 29);
+            } catch (ParseException e) {
+                throw new RuntimeException(e);
+            }
+            //结束时间
+            String dateEnd = DateUtil.getLastWeekDateEndToString(0);
+            List<LogisticsOrderStatisticsVO> list = logisticsOrderMapper.workbenchLogisticsOrderStatisticsByDays(id, statusList, OrderTypeEnum.ACCEPT_CARRIAGE_ORDER.getType(), dateStart, dateEnd);
+            return HttpResult.ok(list);
+        }
+        return null;
+    }
 }

+ 8 - 5
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ConsignOrderService.java

@@ -1652,7 +1652,7 @@ public class ConsignOrderService {
         if (StringUtils.isNotBlank(query.getIds())) {
             idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
         }
-        List<AcceptCarriageOrderVO> list = kwtLogisticsOrderMapper.selectLogisticsOrderList(query, orderList, type, entId, longList, longList,idsList);
+        List<AcceptCarriageOrderVO> list = kwtLogisticsOrderMapper.selectLogisticsOrderListByConsign(query, orderList, type, entId, longList, longList,idsList);
         PageInfo<AcceptCarriageOrderVO> pageInfo = new PageInfo<>(list);
         if (CollectionUtils.isEmpty(list)) {
             return PageRes.build(pageInfo, list);
@@ -1771,7 +1771,8 @@ public class ConsignOrderService {
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
         List<Long> idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
-        List<TableTops> list = kwtLogisticsOrderMapper.countLogisticsOrderListByStatus(query, orderList, type, entId, longList, longList,idsList);
+//        List<TableTops> list = kwtLogisticsOrderMapper.countLogisticsOrderListByStatus(query, orderList, type, entId, longList, longList,idsList);
+        List<TableTops> list = kwtLogisticsOrderMapper.countLogisticsOrderListByConsignStatus(query, orderList, type, entId, longList, longList,idsList);
         List<TableTops> arrayList = new ArrayList<>();
         arrayList.addAll(list);
         /**补全数据状态不齐的情况*/
@@ -1866,7 +1867,9 @@ public class ConsignOrderService {
         longs.add(LoginUserHolder.getUserId());
         List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
         List<Long> idsList = StringUtils.splitStrToList(query.getIds(), Long.class);
-        List<ConsignOrderVO> list = kwtLogisticsOrderMapper.selectConsignLogisticsOrderList(query, orderList, type, entId, longList, longList,idsList);
+//        List<ConsignOrderVO> list = kwtLogisticsOrderMapper.selectConsignLogisticsOrderList(query, orderList, type, entId, longList, longList,idsList);
+        List<ConsignOrderVO> list = kwtLogisticsOrderMapper.selectConsignLogisticsOrderListByConsign(query, orderList, type, entId, longList, longList,idsList);
+//        List<ConsignOrderVO> list = kwtLogisticsOrderMapper.selectLogisticsOrderListByConsign(query, orderList, type, entId, longList, longList,idsList);
         /**计费方式*/
         Map<String, String> chargingDictData = commonService.getDictData(DictTypeEnum.CHARGING_TYPE.getType());
         /**结算周期*/
@@ -2114,7 +2117,7 @@ public class ConsignOrderService {
             //结束时间
             String dateEnd = cn.hutool.core.date.DateUtil.format(dateTime, DEF_DATE_FORMAT);
 
-            List<LogisticsOrderStatisticsVO> list = kwtLogisticsOrderMapper.workbenchLogisticsOrderStatisticsByMonth(id, statusList, OrderTypeEnum.ACCEPT_CARRIAGE_ORDER.getType(), dateStart, dateEnd);
+            List<LogisticsOrderStatisticsVO> list = kwtLogisticsOrderMapper.workbenchLogisticsOrderStatisticsByMonth(id, statusList, OrderTypeEnum.CONSIGN_ORDER.getType(), dateStart, dateEnd);
             return HttpResult.ok(list);
         } else if (String.valueOf(NumberConstant.ONE).equals(logisticsOrderStatistics.getDateType())) {
             //开始时间
@@ -2127,7 +2130,7 @@ public class ConsignOrderService {
             }
             //结束时间
             String dateEnd = DateUtil.getLastWeekDateEndToString(0);
-            List<LogisticsOrderStatisticsVO> list = kwtLogisticsOrderMapper.workbenchLogisticsOrderStatisticsByDays(id, statusList, OrderTypeEnum.ACCEPT_CARRIAGE_ORDER.getType(), dateStart, dateEnd);
+            List<LogisticsOrderStatisticsVO> list = kwtLogisticsOrderMapper.workbenchLogisticsOrderStatisticsByDays(id, statusList, OrderTypeEnum.CONSIGN_ORDER.getType(), dateStart, dateEnd);
             return HttpResult.ok(list);
         }
         return null;

+ 7 - 3
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/TransportCommonService.java

@@ -519,10 +519,12 @@ public class TransportCommonService {
         if (entCacheResDto != null) {
             ids.add(entCacheResDto.getId());
         }
+        List<Integer> orderStatusList = new ArrayList<>();
+        orderStatusList.add(LogisticsOrderEnum.HAVE_FINISHED.getCode());
         ids = ids.stream().distinct().collect(Collectors.toList());
         logisticsOrderParam.setPage((logisticsOrderParam.getPage() - 1) * logisticsOrderParam.getPageSize());
-        List<LogisticsOrderVO> list = logisticsOrderMapper.selectLogisticOrderData(logisticsOrderParam, dictValue, LoginUserHolder.getEntId(), ids);
-        Long count = logisticsOrderMapper.selectLogisticOrderCount(logisticsOrderParam, dictValue, LoginUserHolder.getEntId(), ids);
+        List<LogisticsOrderVO> list = logisticsOrderMapper.selectLogisticOrderData(logisticsOrderParam, dictValue, LoginUserHolder.getEntId(), ids,orderStatusList);
+        Long count = logisticsOrderMapper.selectLogisticOrderCount(logisticsOrderParam, dictValue, LoginUserHolder.getEntId(), ids,orderStatusList);
         /**计量单位*/
         Map<String, String> unitTypeDictData = getDictData(DictTypeEnum.UNIT_TYPE.getType());
         /**运价方式*/
@@ -657,6 +659,8 @@ public class TransportCommonService {
                 logisticsOrderDTO.setLossUnitLabel(taxRateTypeDictData.get(logisticsOrderDTO.getLossUnit()));
                 logisticsOrderDTO.setAmountLabel(unitTypeDictData.get(logisticsOrderDTO.getUnit()));
                 logisticsOrderDTO.setIgnoreAmountLabel(unitTypeDictData.get(logisticsOrderDTO.getUnit()));
+                logisticsOrderDTO.setLoadAmount(logisticsOrderDTO.getTotalLoadAmount());
+                logisticsOrderDTO.setUnloadAmount(logisticsOrderDTO.getTotalUnloadAmount());
                 if (logisticsOrderDTO.getTOrderId() != null) {
                     try {
                         OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.valueOf(logisticsOrderDTO.getTOrderId()));
@@ -675,7 +679,7 @@ public class TransportCommonService {
                             }
                         }
                     } catch (Exception e) {
-                        log.error("tradeOrderInfoService.getOrderDetailById error id:{},errorMessage:{}",logisticsOrderDTO.getTOrderId(),e.getMessage(),e);
+                        log.error("tradeOrderInfoService.getOrderDetailById error id:{},errorMessage:{}", logisticsOrderDTO.getTOrderId(), e.getMessage(), e);
                     }
                 }
 //                logisticsOrderDTO.setCount(waybillOrderMapper.selectCount(new LambdaQueryWrapper<KwtWaybillOrder>().eq(KwtWaybillOrder::getLOrderId, logisticsOrderDTO.getLOrderId())));

+ 1 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/dubbo/TransportDubboServiceImpl.java

@@ -123,7 +123,7 @@ public class TransportDubboServiceImpl implements TransportDubboService {
      */
     @Override
     public List<LogisticsOrderDTO> getAcceptCarriageOrderList(List<String> ids) {
-        List<LogisticsOrderDTO> list = logisticsOrderMapper.selectLogisticOrderList(ids);
+        List<LogisticsOrderDTO> list = logisticsOrderMapper.selectLogisticOrderList(ids,LogisticsOrderEnum.HAVE_FINISHED.getCode());
         /**计量单位*/
         Map<String, String> unitTypeDictData = getDictData(DictTypeEnum.UNIT_TYPE.getType());
         /**运价方式*/

+ 712 - 8
sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

@@ -304,6 +304,12 @@
             <if test="logisticsOrderParam.endTime != null and logisticsOrderParam.endTime !=''">
                 AND a.end_time &lt;= #{logisticsOrderParam.endTime}
             </if>
+            <if test="orderStatusList != null and orderStatusList.size()>0">
+                and a.status in
+                <foreach collection="orderStatusList" separator="," open="(" close=")" item="item" >
+                    #{item,jdbcType=INTEGER}
+                </foreach>
+            </if>
         </where>
         ORDER BY a.create_time DESC
         <if test="logisticsOrderParam.page != null and logisticsOrderParam.pageSize != null ">
@@ -350,6 +356,12 @@
             <if test="logisticsOrderParam.endTime != null and logisticsOrderParam.endTime !=''">
                 AND a.end_time &lt;= #{logisticsOrderParam.endTime}
             </if>
+            <if test="orderStatusList != null  and orderStatusList.size()>0">
+                and a.status in
+                <foreach collection="orderStatusList" item="item" close=")" open="(" separator=",">
+                    #{item,jdbcType=INTEGER}
+                </foreach>
+            </if>
         </where>
         ORDER BY a.create_time DESC
     </select>
@@ -632,6 +644,7 @@
                 </foreach>
             </if>
         </where>
+        and a.status = #{status,jdbcType=INTEGER}
         ORDER BY a.create_time DESC
     </select>
 
@@ -868,6 +881,8 @@
         d.top_ent_id AS consignTopEntId,
         d.firm_name AS consignCompany,
         d.contacts AS consignContacts,
+        d.contacts_id AS consignContactsId,
+        e.contacts_id AS carrierContactsId,
         d.phone AS consignPhone,
         e.ent_id AS carrierCompanyId,
         e.firm_name AS carrierCompany,
@@ -892,15 +907,237 @@
         c.lat AS unloadLat,
         c.lng AS unloadLng,
         f.contract_name as contract
-        <!--        ,-->
-        <!--            a.del_flag,-->
-        <!--            b.del_flag,-->
-        <!--            c.del_flag,-->
-        <!--            d.del_flag,-->
-        <!--            e.del_flag,-->
-        <!--            f.del_flag,-->
-        <!--            g.del_flag-->
+        ,a.del_flag as delFlag
+    </sql>
+
+    <sql id="Query_Column_List_Accept_Carriage">
+        a.id AS lOrderId,
+        a.l_order_no AS lOrderNo,
+        a.t_order_id AS tOrderId,
+        a.t_order_no AS tOrderNo,
+        a.loss AS loss,
+        a.loss_unit AS lossUnit,
+        a.settlement_cycle AS accountsCycle,
+        a.billing_mode AS billingMode,
+        a.amount AS carryingCapacity,
+        a.goods_price AS goodsPrice,
+        a.goods_price_unit AS goodsPriceUnit,
+        a.`status` AS status,
+        a.settlement_cycle AS settlementCycle,
+        a.price AS price,
+        a.price_type AS priceType,
+        a.type AS type,
+        a.unit AS unit,
+        a.subcontract_amount AS subcontractAmount,
+        a.entrust_amount AS entrustAmount,
+        a.unload_amount AS unloadAmount,
+        a.load_amount AS loadAmount,
+        a.ignore_amount AS ignoreAmount,
+        a.deficit_amount AS deficitAmount,
+        a.deficit_price AS deficitPrice,
+        a.total_load_amount AS totalLoadAmount,
+        a.total_unload_amount AS totalUnloadAmount,
+        a.payment AS payment,
+        a.tax_rate AS taxRate,
+        a.ent_id AS entId,
+        a.create_by AS createBy,
+        a.create_time AS createTime,
+        a.update_by AS updateBy,
+        a.update_time AS updateTime,
+        a.start_time AS shipmentsDateTime,
+        a.end_time AS receiveGoodsDateTime,
+        a.remark AS remark,
+        g.goods_id AS goodsId,
+        g.goods_name AS goodsName,
+        g.goods_type AS goodsType,
+        f.contract_id AS contractId,
+        f.contract_no AS contractNo,
+        f.signing_way AS signing,
+        d.ent_id AS consignCompanyId,
+        d.top_ent_id AS consignTopEntId,
+        d.firm_name AS consignCompany,
+        d.contacts AS consignContacts,
+        d.contacts_id AS consignContactsId,
+        e.contacts_id AS carrierContactsId,
+        d.phone AS consignPhone,
+        e.ent_id AS carrierCompanyId,
+        e.firm_name AS carrierCompany,
+        e.top_ent_id AS carrierTopEntId,
+        e.contacts AS carrierContacts,
+        e.phone AS carrierPhone,
+        b.`name` AS loadName,
+        b.address_type AS loadType,
+        b.city_name AS loadCityName,
+        b.city_code AS loadCityCode,
+        b.detail_address AS loadAddress,
+        b.contacts AS shipmentsContacts,
+        b.phone AS shipmentsPhone,
+        b.lat AS loadLat,
+        b.lng AS loadLng,
+        c.address_type AS unloadType,
+        c.contacts AS receiveGoodsContacts,
+        c.phone AS receiveGoodsPhone,
+        c.city_name AS unloadCityName,
+        c.city_code AS unloadCityCode,
+        c.detail_address AS unloadAddress,
+        c.lat AS unloadLat,
+        c.lng AS unloadLng,
+        f.contract_name as contract
+        ,a.del_flag as delFlag,
+        case when a.ent_id = e.top_ent_id then 1 ELSE 2 end as createType
+    </sql>
+
+    <sql id="Query_Column_List_Cogsign">
+        a.id AS lOrderId,
+        a.l_order_no AS lOrderNo,
+        a.t_order_id AS tOrderId,
+        a.t_order_no AS tOrderNo,
+        a.loss AS loss,
+        a.loss_unit AS lossUnit,
+        a.settlement_cycle AS accountsCycle,
+        a.billing_mode AS billingMode,
+        a.amount AS carryingCapacity,
+        a.goods_price AS goodsPrice,
+        a.goods_price_unit AS goodsPriceUnit,
+        a.`status` AS status,
+        a.settlement_cycle AS settlementCycle,
+        a.price AS price,
+        a.price_type AS priceType,
+        a.type AS type,
+        a.unit AS unit,
+        a.subcontract_amount AS subcontractAmount,
+        a.entrust_amount AS entrustAmount,
+        a.unload_amount AS unloadAmount,
+        a.load_amount AS loadAmount,
+        a.ignore_amount AS ignoreAmount,
+        a.deficit_amount AS deficitAmount,
+        a.deficit_price AS deficitPrice,
+        a.total_load_amount AS totalLoadAmount,
+        a.total_unload_amount AS totalUnloadAmount,
+        a.payment AS payment,
+        a.tax_rate AS taxRate,
+        a.ent_id AS entId,
+        a.create_by AS createBy,
+        a.create_time AS createTime,
+        a.update_by AS updateBy,
+        a.update_time AS updateTime,
+        a.start_time AS shipmentsDateTime,
+        a.end_time AS receiveGoodsDateTime,
+        a.remark AS remark,
+        g.goods_id AS goodsId,
+        g.goods_name AS goodsName,
+        g.goods_type AS goodsType,
+        f.contract_id AS contractId,
+        f.contract_no AS contractNo,
+        f.signing_way AS signing,
+        d.ent_id AS consignCompanyId,
+        d.top_ent_id AS consignTopEntId,
+        d.firm_name AS consignCompany,
+        d.contacts AS consignContacts,
+        d.contacts_id AS consignContactsId,
+        e.contacts_id AS carrierContactsId,
+        d.phone AS consignPhone,
+        e.ent_id AS carrierCompanyId,
+        e.firm_name AS carrierCompany,
+        e.top_ent_id AS carrierTopEntId,
+        e.contacts AS carrierContacts,
+        e.phone AS carrierPhone,
+        b.`name` AS loadName,
+        b.address_type AS loadType,
+        b.city_name AS loadCityName,
+        b.city_code AS loadCityCode,
+        b.detail_address AS loadAddress,
+        b.contacts AS shipmentsContacts,
+        b.phone AS shipmentsPhone,
+        b.lat AS loadLat,
+        b.lng AS loadLng,
+        c.address_type AS unloadType,
+        c.contacts AS receiveGoodsContacts,
+        c.phone AS receiveGoodsPhone,
+        c.city_name AS unloadCityName,
+        c.city_code AS unloadCityCode,
+        c.detail_address AS unloadAddress,
+        c.lat AS unloadLat,
+        c.lng AS unloadLng,
+        f.contract_name as contract
+                ,a.del_flag as delFlag,
+        case when a.ent_id = d.top_ent_id then 1 ELSE 2 end as createType
+    </sql>
+
+    <sql id="New_Query_Column_List">
+        lOrderId,
+        lOrderNo,
+        tOrderId,
+        tOrderNo,
+        loss,
+        lossUnit,
+        accountsCycle,
+        billingMode,
+        carryingCapacity,
+        goodsPrice,
+        goodsPriceUnit,
+        STATUS,
+        settlementCycle,
+        price,
+        priceType,
+        type,
+        unit,
+        subcontractAmount,
+        entrustAmount,
+        unloadAmount,
+        loadAmount,
+        ignoreAmount,
+        deficitAmount,
+        deficitPrice,
+        totalLoadAmount,
+        totalUnloadAmount,
+        payment,
+        taxRate,
+        entId,
+        createBy,
+        createTime,
+        updateBy,
+        updateTime,
+        shipmentsDateTime,
+        receiveGoodsDateTime,
+        remark,
+        goodsId,
+        goodsName,
+        goodsType,
+        contractId,
+        contractNo,
+        signing,
+        consignCompanyId,
+        consignTopEntId,
+        consignCompany,
+        consignContacts,
+        consignPhone,
+        carrierCompanyId,
+        carrierCompany,
+        carrierTopEntId,
+        carrierContacts,
+        carrierPhone,
+        loadName,
+        loadType,
+        loadCityName,
+        loadCityCode,
+        loadAddress,
+        shipmentsContacts,
+        shipmentsPhone,
+        loadLat,
+        loadLng,
+        unloadType,
+        receiveGoodsContacts,
+        receiveGoodsPhone,
+        unloadCityName,
+        unloadCityCode,
+        unloadAddress,
+        unloadLat,
+        unloadLng,
+        contract,
+        createType
     </sql>
+
     <select id="selectLogisticsOrderList" resultType="com.sckw.transport.model.vo.AcceptCarriageOrderVO">
         SELECT
         <include refid="Query_Column_List">
@@ -1811,4 +2048,471 @@
         ) B
         ON  A.date= B.date_time;
     </select>
+    <select id="selectLogisticsOrderListByAcceptCarriage"
+            resultType="com.sckw.transport.model.vo.AcceptCarriageOrderVO">
+        SELECT <include refid="New_Query_Column_List"></include> FROM (
+        SELECT
+        <include refid="Query_Column_List_Accept_Carriage">
+        </include>
+        FROM
+        kwt_logistics_order a
+        LEFT JOIN kwt_logistics_order_address b ON a.id = b.l_order_id
+        AND b.address_type = 1 AND b.del_flag = 0
+        LEFT JOIN kwt_logistics_order_address c ON a.id = c.l_order_id
+        AND c.address_type = 2 AND c.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit d ON a.id = d.l_order_id
+        AND d.unit_type = 1 AND d.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit e ON a.id = e.l_order_id
+        AND e.unit_type = 2
+        LEFT JOIN kwt_logistics_order_goods g ON a.id = g.l_order_id AND g.del_flag = 0
+        LEFT JOIN kwt_logistics_order_contract f ON a.id = f.l_order_id AND f.del_flag = 0
+        <where>
+            a.del_flag = 0
+            <if test="query.keywords != null and query.keywords != ''">
+                and (
+                a.t_order_no like concat('%',#{query.keywords},'%')
+                or a.l_order_no like concat('%',#{query.keywords},'%')
+                or d.firm_name like concat('%',#{query.keywords},'%')
+                or e.firm_name like concat('%',#{query.keywords},'%')
+                or g.goods_name like concat('%',#{query.keywords},'%'))
+            </if>
+            <if test="orderList != null and orderList.size() > 0 ">
+                and a.status in
+                <foreach collection="orderList" item="status" open="(" close=")" separator=",">
+                    #{status}
+                </foreach>
+            </if>
+            <if test="idsList != null and idsList.size()>0">
+                and a.id in
+                <foreach collection="idsList" close=")" open="(" separator="," item="item">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="query.endBeginDateTime != null and query.endBeginDateTime != '' ">
+                and DATE( a.end_time) <![CDATA[ >= ]]> #{query.endBeginDateTime}
+            </if>
+            <if test="query.endOverDateTime != null and query.endOverDateTime != '' ">
+                and DATE( a.end_time ) <![CDATA[ <= ]]> #{query.endOverDateTime}
+            </if>
+            <if test="query.startBeginDateTime != null and query.startBeginDateTime != '' ">
+                and DATE( a.start_time) <![CDATA[ >= ]]> #{query.startBeginDateTime}
+            </if>
+            <if test="query.startOverDateTime != null and query.startOverDateTime != '' ">
+                and DATE( a.start_time ) <![CDATA[ <= ]]> #{query.startOverDateTime}
+            </if>
+            <if test="query.createStartTime != null and query.createStartTime != '' ">
+                and a.create_time &gt;=#{query.createStartTime}
+            </if>
+            <if test="query.createEndTime != null and query.createEndTime != ''">
+                and a.create_time &lt;=#{query.createEndTime}
+            </if>
+            <if test="query.loadAddressCode != null and query.loadAddressCode != ''">
+                and b.city_code = #{query.loadAddressCode}
+            </if>
+            <if test="query.unloadAddressCode != null and query.unloadAddressCode != ''">
+                and c.city_code = #{query.unloadAddressCode}
+            </if>
+            <if test="query.billingMode != null and query.billingMode != ''">
+                and a.billing_mode =#{query.billingMode}
+            </if>
+        </where>
+        ORDER BY a.create_time DESC
+        ) tab
+        <where>
+            tab.delFlag = 0
+            AND ((
+            tab.createType = 1
+            and tab.entId = #{entId}
+            <if test="userIds != null and userIds.size()>0">
+                AND tab.createBy IN
+                <foreach collection="userIds" open="(" close=")" item="item" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            )
+            OR (
+            tab.carrierTopEntId = #{entId}
+            <if test="contactsIds != null and contactsIds.size()>0">
+                AND tab.carrierContactsId IN
+                <foreach collection="contactsIds" separator="," item="item" close=")" open="(">
+                    #{item}
+                </foreach>
+            </if>
+            ))
+        </where>
+    </select>
+    <select id="selectLogisticsOrderListByConsign" resultType="com.sckw.transport.model.vo.AcceptCarriageOrderVO">
+        SELECT <include refid="New_Query_Column_List"></include> FROM (
+        SELECT
+        <include refid="Query_Column_List_Cogsign">
+        </include>
+        FROM
+        kwt_logistics_order a
+        LEFT JOIN kwt_logistics_order_address b ON a.id = b.l_order_id
+        AND b.address_type = 1 AND b.del_flag = 0
+        LEFT JOIN kwt_logistics_order_address c ON a.id = c.l_order_id
+        AND c.address_type = 2 AND c.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit d ON a.id = d.l_order_id
+        AND d.unit_type = 1 AND d.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit e ON a.id = e.l_order_id
+        AND e.unit_type = 2
+        LEFT JOIN kwt_logistics_order_goods g ON a.id = g.l_order_id AND g.del_flag = 0
+        LEFT JOIN kwt_logistics_order_contract f ON a.id = f.l_order_id AND f.del_flag = 0
+        <where>
+            a.del_flag = 0
+            <if test="query.keywords != null and query.keywords != ''">
+                and (
+                a.t_order_no like concat('%',#{query.keywords},'%')
+                or a.l_order_no like concat('%',#{query.keywords},'%')
+                or d.firm_name like concat('%',#{query.keywords},'%')
+                or e.firm_name like concat('%',#{query.keywords},'%')
+                or g.goods_name like concat('%',#{query.keywords},'%'))
+            </if>
+            <if test="orderList != null and orderList.size() > 0 ">
+                and a.status in
+                <foreach collection="orderList" item="status" open="(" close=")" separator=",">
+                    #{status}
+                </foreach>
+            </if>
+            <if test="idsList != null and idsList.size()>0">
+                and a.id in
+                <foreach collection="idsList" close=")" open="(" separator="," item="item">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="query.endBeginDateTime != null and query.endBeginDateTime != '' ">
+                and DATE( a.end_time) <![CDATA[ >= ]]> #{query.endBeginDateTime}
+            </if>
+            <if test="query.endOverDateTime != null and query.endOverDateTime != '' ">
+                and DATE( a.end_time ) <![CDATA[ <= ]]> #{query.endOverDateTime}
+            </if>
+            <if test="query.startBeginDateTime != null and query.startBeginDateTime != '' ">
+                and DATE( a.start_time) <![CDATA[ >= ]]> #{query.startBeginDateTime}
+            </if>
+            <if test="query.startOverDateTime != null and query.startOverDateTime != '' ">
+                and DATE( a.start_time ) <![CDATA[ <= ]]> #{query.startOverDateTime}
+            </if>
+            <if test="query.createStartTime != null and query.createStartTime != '' ">
+                and a.create_time &gt;=#{query.createStartTime}
+            </if>
+            <if test="query.createEndTime != null and query.createEndTime != ''">
+                and a.create_time &lt;=#{query.createEndTime}
+            </if>
+            <if test="query.loadAddressCode != null and query.loadAddressCode != ''">
+                and b.city_code = #{query.loadAddressCode}
+            </if>
+            <if test="query.unloadAddressCode != null and query.unloadAddressCode != ''">
+                and c.city_code = #{query.unloadAddressCode}
+            </if>
+            <if test="query.billingMode != null and query.billingMode != ''">
+                and a.billing_mode =#{query.billingMode}
+            </if>
+        </where>
+        ORDER BY a.create_time DESC
+        ) tab
+        <where>
+            tab.delFlag = 0
+            AND ((
+            tab.createType = 1
+            and tab.entId = #{entId}
+            <if test="userIds != null and userIds.size()>0">
+                AND tab.createBy IN
+                <foreach collection="userIds" open="(" close=")" item="item" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            )
+            OR (
+            tab.consignTopEntId = #{entId}
+            <if test="contactsIds != null and contactsIds.size()>0">
+                AND tab.consignContactsId IN
+                <foreach collection="contactsIds" separator="," item="item" close=")" open="(">
+                    #{item}
+                </foreach>
+            </if>
+            ))
+        </where>
+        ORDER BY tab.createTime DESC
+    </select>
+    <select id="countLogisticsOrderListByConsignStatus" resultType="com.sckw.mongo.model.TableTops">
+        select  status AS value ,
+        COUNT(status) AS total  FROM (
+        SELECT
+        <include refid="Query_Column_List_Cogsign">
+        </include>
+        FROM
+        kwt_logistics_order a
+        LEFT JOIN kwt_logistics_order_address b ON a.id = b.l_order_id
+        AND b.address_type = 1 AND b.del_flag = 0
+        LEFT JOIN kwt_logistics_order_address c ON a.id = c.l_order_id
+        AND c.address_type = 2 AND c.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit d ON a.id = d.l_order_id
+        AND d.unit_type = 1 AND d.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit e ON a.id = e.l_order_id
+        AND e.unit_type = 2
+        LEFT JOIN kwt_logistics_order_goods g ON a.id = g.l_order_id AND g.del_flag = 0
+        LEFT JOIN kwt_logistics_order_contract f ON a.id = f.l_order_id AND f.del_flag = 0
+        <where>
+            a.del_flag = 0
+            <if test="query.keywords != null and query.keywords != ''">
+                and (
+                a.t_order_no like concat('%',#{query.keywords},'%')
+                or a.l_order_no like concat('%',#{query.keywords},'%')
+                or d.firm_name like concat('%',#{query.keywords},'%')
+                or e.firm_name like concat('%',#{query.keywords},'%')
+                or g.goods_name like concat('%',#{query.keywords},'%'))
+            </if>
+            <if test="orderList != null and orderList.size() > 0 ">
+                and a.status in
+                <foreach collection="orderList" item="status" open="(" close=")" separator=",">
+                    #{status}
+                </foreach>
+            </if>
+            <if test="idsList != null and idsList.size()>0">
+                and a.id in
+                <foreach collection="idsList" close=")" open="(" separator="," item="item">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="query.endBeginDateTime != null and query.endBeginDateTime != '' ">
+                and DATE( a.end_time) <![CDATA[ >= ]]> #{query.endBeginDateTime}
+            </if>
+            <if test="query.endOverDateTime != null and query.endOverDateTime != '' ">
+                and DATE( a.end_time ) <![CDATA[ <= ]]> #{query.endOverDateTime}
+            </if>
+            <if test="query.startBeginDateTime != null and query.startBeginDateTime != '' ">
+                and DATE( a.start_time) <![CDATA[ >= ]]> #{query.startBeginDateTime}
+            </if>
+            <if test="query.startOverDateTime != null and query.startOverDateTime != '' ">
+                and DATE( a.start_time ) <![CDATA[ <= ]]> #{query.startOverDateTime}
+            </if>
+            <if test="query.createStartTime != null and query.createStartTime != '' ">
+                and a.create_time &gt;=#{query.createStartTime}
+            </if>
+            <if test="query.createEndTime != null and query.createEndTime != ''">
+                and a.create_time &lt;=#{query.createEndTime}
+            </if>
+            <if test="query.loadAddressCode != null and query.loadAddressCode != ''">
+                and b.city_code = #{query.loadAddressCode}
+            </if>
+            <if test="query.unloadAddressCode != null and query.unloadAddressCode != ''">
+                and c.city_code = #{query.unloadAddressCode}
+            </if>
+            <if test="query.billingMode != null and query.billingMode != ''">
+                and a.billing_mode =#{query.billingMode}
+            </if>
+        </where>
+        ORDER BY a.create_time DESC
+        ) tab
+        <where>
+            tab.delFlag = 0
+            AND ((
+            tab.createType = 1
+            and tab.entId = #{entId}
+            <if test="userIds != null and userIds.size()>0">
+                AND tab.createBy IN
+                <foreach collection="userIds" open="(" close=")" item="item" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            )
+            OR (
+            tab.consignTopEntId = #{entId}
+            <if test="contactsIds != null and contactsIds.size()>0">
+                AND tab.consignContactsId IN
+                <foreach collection="contactsIds" separator="," item="item" close=")" open="(">
+                    #{item}
+                </foreach>
+            </if>
+            ))
+        </where>
+        group by status
+    </select>
+    <select id="countLogisticsOrderListByAcceptCarriageStatus" resultType="com.sckw.mongo.model.TableTops">
+        SELECT status as value,
+            COUNT( status ) AS total  FROM (
+        SELECT
+        <include refid="Query_Column_List_Accept_Carriage">
+        </include>
+        FROM
+        kwt_logistics_order a
+        LEFT JOIN kwt_logistics_order_address b ON a.id = b.l_order_id
+        AND b.address_type = 1 AND b.del_flag = 0
+        LEFT JOIN kwt_logistics_order_address c ON a.id = c.l_order_id
+        AND c.address_type = 2 AND c.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit d ON a.id = d.l_order_id
+        AND d.unit_type = 1 AND d.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit e ON a.id = e.l_order_id
+        AND e.unit_type = 2
+        LEFT JOIN kwt_logistics_order_goods g ON a.id = g.l_order_id AND g.del_flag = 0
+        LEFT JOIN kwt_logistics_order_contract f ON a.id = f.l_order_id AND f.del_flag = 0
+        <where>
+            a.del_flag = 0
+            <if test="query.keywords != null and query.keywords != ''">
+                and (
+                a.t_order_no like concat('%',#{query.keywords},'%')
+                or a.l_order_no like concat('%',#{query.keywords},'%')
+                or d.firm_name like concat('%',#{query.keywords},'%')
+                or e.firm_name like concat('%',#{query.keywords},'%')
+                or g.goods_name like concat('%',#{query.keywords},'%'))
+            </if>
+            <if test="orderList != null and orderList.size() > 0 ">
+                and a.status in
+                <foreach collection="orderList" item="status" open="(" close=")" separator=",">
+                    #{status}
+                </foreach>
+            </if>
+            <if test="idsList != null and idsList.size()>0">
+                and a.id in
+                <foreach collection="idsList" close=")" open="(" separator="," item="item">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="query.endBeginDateTime != null and query.endBeginDateTime != '' ">
+                and DATE( a.end_time) <![CDATA[ >= ]]> #{query.endBeginDateTime}
+            </if>
+            <if test="query.endOverDateTime != null and query.endOverDateTime != '' ">
+                and DATE( a.end_time ) <![CDATA[ <= ]]> #{query.endOverDateTime}
+            </if>
+            <if test="query.startBeginDateTime != null and query.startBeginDateTime != '' ">
+                and DATE( a.start_time) <![CDATA[ >= ]]> #{query.startBeginDateTime}
+            </if>
+            <if test="query.startOverDateTime != null and query.startOverDateTime != '' ">
+                and DATE( a.start_time ) <![CDATA[ <= ]]> #{query.startOverDateTime}
+            </if>
+            <if test="query.createStartTime != null and query.createStartTime != '' ">
+                and a.create_time &gt;=#{query.createStartTime}
+            </if>
+            <if test="query.createEndTime != null and query.createEndTime != ''">
+                and a.create_time &lt;=#{query.createEndTime}
+            </if>
+            <if test="query.loadAddressCode != null and query.loadAddressCode != ''">
+                and b.city_code = #{query.loadAddressCode}
+            </if>
+            <if test="query.unloadAddressCode != null and query.unloadAddressCode != ''">
+                and c.city_code = #{query.unloadAddressCode}
+            </if>
+            <if test="query.billingMode != null and query.billingMode != ''">
+                and a.billing_mode =#{query.billingMode}
+            </if>
+        </where>
+        ORDER BY a.create_time DESC
+        ) tab
+        <where>
+            tab.delFlag = 0
+            AND ((
+            tab.createType = 1
+            and tab.entId = #{entId}
+            <if test="userIds != null and userIds.size()>0">
+                AND tab.createBy IN
+                <foreach collection="userIds" open="(" close=")" item="item" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            )
+            OR (
+            tab.carrierTopEntId = #{entId}
+            <if test="contactsIds != null and contactsIds.size()>0">
+                AND tab.carrierContactsId IN
+                <foreach collection="contactsIds" separator="," item="item" close=")" open="(">
+                    #{item}
+                </foreach>
+            </if>
+            ))
+        </where>
+        group by status
+    </select>
+    <select id="selectConsignLogisticsOrderListByConsign" resultType="com.sckw.transport.model.vo.ConsignOrderVO">
+        SELECT <include refid="New_Query_Column_List"></include> FROM (
+        SELECT
+        <include refid="Query_Column_List_Cogsign">
+        </include>
+        FROM
+        kwt_logistics_order a
+        LEFT JOIN kwt_logistics_order_address b ON a.id = b.l_order_id
+        AND b.address_type = 1 AND b.del_flag = 0
+        LEFT JOIN kwt_logistics_order_address c ON a.id = c.l_order_id
+        AND c.address_type = 2 AND c.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit d ON a.id = d.l_order_id
+        AND d.unit_type = 1 AND d.del_flag = 0
+        LEFT JOIN kwt_logistics_order_unit e ON a.id = e.l_order_id
+        AND e.unit_type = 2
+        LEFT JOIN kwt_logistics_order_goods g ON a.id = g.l_order_id AND g.del_flag = 0
+        LEFT JOIN kwt_logistics_order_contract f ON a.id = f.l_order_id AND f.del_flag = 0
+        <where>
+            a.del_flag = 0
+            <if test="query.keywords != null and query.keywords != ''">
+                and (
+                a.t_order_no like concat('%',#{query.keywords},'%')
+                or a.l_order_no like concat('%',#{query.keywords},'%')
+                or d.firm_name like concat('%',#{query.keywords},'%')
+                or e.firm_name like concat('%',#{query.keywords},'%')
+                or g.goods_name like concat('%',#{query.keywords},'%'))
+            </if>
+            <if test="orderList != null and orderList.size() > 0 ">
+                and a.status in
+                <foreach collection="orderList" item="status" open="(" close=")" separator=",">
+                    #{status}
+                </foreach>
+            </if>
+            <if test="idsList != null and idsList.size()>0">
+                and a.id in
+                <foreach collection="idsList" close=")" open="(" separator="," item="item">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="query.endBeginDateTime != null and query.endBeginDateTime != '' ">
+                and DATE( a.end_time) <![CDATA[ >= ]]> #{query.endBeginDateTime}
+            </if>
+            <if test="query.endOverDateTime != null and query.endOverDateTime != '' ">
+                and DATE( a.end_time ) <![CDATA[ <= ]]> #{query.endOverDateTime}
+            </if>
+            <if test="query.startBeginDateTime != null and query.startBeginDateTime != '' ">
+                and DATE( a.start_time) <![CDATA[ >= ]]> #{query.startBeginDateTime}
+            </if>
+            <if test="query.startOverDateTime != null and query.startOverDateTime != '' ">
+                and DATE( a.start_time ) <![CDATA[ <= ]]> #{query.startOverDateTime}
+            </if>
+            <if test="query.createStartTime != null and query.createStartTime != '' ">
+                and a.create_time &gt;=#{query.createStartTime}
+            </if>
+            <if test="query.createEndTime != null and query.createEndTime != ''">
+                and a.create_time &lt;=#{query.createEndTime}
+            </if>
+            <if test="query.loadAddressCode != null and query.loadAddressCode != ''">
+                and b.city_code = #{query.loadAddressCode}
+            </if>
+            <if test="query.unloadAddressCode != null and query.unloadAddressCode != ''">
+                and c.city_code = #{query.unloadAddressCode}
+            </if>
+            <if test="query.billingMode != null and query.billingMode != ''">
+                and a.billing_mode =#{query.billingMode}
+            </if>
+        </where>
+        ORDER BY a.create_time DESC
+        ) tab
+        <where>
+            tab.delFlag = 0
+            AND ((
+            tab.createType = 1
+            and tab.entId = #{entId}
+            <if test="userIds != null and userIds.size()>0">
+                AND tab.createBy IN
+                <foreach collection="userIds" open="(" close=")" item="item" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            )
+            OR (
+            tab.consignTopEntId = #{entId}
+            <if test="contactsIds != null and contactsIds.size()>0">
+                AND tab.consignContactsId IN
+                <foreach collection="contactsIds" separator="," item="item" close=")" open="(">
+                    #{item}
+                </foreach>
+            </if>
+            ))
+        </where>
+        ORDER BY tab.createTime DESC
+    </select>
 </mapper>