Преглед на файлове

Merge remote-tracking branch 'origin/dev' into dev

czh преди 2 години
родител
ревизия
4f80723f15
променени са 15 файла, в които са добавени 1737 реда и са изтрити 17 реда
  1. 40 0
      sckw-common/sckw-common-mongo/src/main/java/com/sckw/mongo/enums/MessageTypeEnum.java
  2. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/AcceptCarriageOrderController.java
  3. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/ConsignOrderController.java
  4. 113 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/operationManagement/ManagementLogisticsOrderController.java
  5. 32 5
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java
  6. 86 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/param/ManagementLogisticsOrderQuery.java
  7. 293 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/ManagementLogsiticsOrderVO.java
  8. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/execlVo/AcceptCarriageOrderExcelVo.java
  9. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/execlVo/ConsignOrderExcelVo.java
  10. 405 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/execlVo/ManagementLogisticsOrderExcelVo.java
  11. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java
  12. 9 5
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/CommonService.java
  13. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ConsignOrderService.java
  14. 540 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ManagementLogisticsOrderService.java
  15. 213 1
      sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

+ 40 - 0
sckw-common/sckw-common-mongo/src/main/java/com/sckw/mongo/enums/MessageTypeEnum.java

@@ -0,0 +1,40 @@
+package com.sckw.mongo.enums;
+
+/**
+ * @author lfdc
+ * @description 消息类型枚举
+ * @date 2023-07-10 13:07:05
+ */
+public enum MessageTypeEnum {
+
+    SMS_MESSAGE_TYPE("短信消费","sckw-sms", "发送短信定义"),
+    MQ_MESSAGE_TYPE("消息消费","sckw-message", "消息消费定义"),
+
+    ;
+
+    private final String name;
+
+    private final String value;
+    /**
+     * 字段含义解释
+     */
+    private final String desc;
+
+    MessageTypeEnum(String name, String value, String desc) {
+        this.name = name;
+        this.value = value;
+        this.desc = desc;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+}

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

@@ -16,7 +16,7 @@ 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.vo.execlvo.AcceptCarriageOrderExcelVo;
+import com.sckw.transport.model.vo.execlVo.AcceptCarriageOrderExcelVo;
 import com.sckw.transport.service.AcceptCarriageOrderService;
 import com.sckw.transport.service.TransportCommonService;
 import jakarta.servlet.http.HttpServletResponse;

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

@@ -17,7 +17,7 @@ import com.sckw.transport.model.dto.StopOrderTakingDTO;
 import com.sckw.transport.model.param.AcceptCarriageOrderQuery;
 import com.sckw.transport.model.param.ConsignOrderQuery;
 import com.sckw.transport.model.param.DriverParam;
-import com.sckw.transport.model.vo.execlvo.ConsignOrderExcelVo;
+import com.sckw.transport.model.vo.execlVo.ConsignOrderExcelVo;
 import com.sckw.transport.service.ConsignOrderService;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;

+ 113 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/operationManagement/ManagementLogisticsOrderController.java

@@ -0,0 +1,113 @@
+package com.sckw.transport.controller.operationManagement;
+
+import com.alibaba.fastjson.JSONObject;
+import com.sckw.core.model.page.PageRes;
+import com.sckw.core.web.constant.HttpStatus;
+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.param.ManagementLogisticsOrderQuery;
+import com.sckw.transport.model.vo.execlVo.ManagementLogisticsOrderExcelVo;
+import com.sckw.transport.service.ManagementLogisticsOrderService;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
+import lombok.RequiredArgsConstructor;
+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.List;
+
+/**
+ * @author lfdc
+ * @description 运营管理端-物流订单controller
+ * @date 2023-09-11 09:06:07
+ */
+@Slf4j
+@Validated
+@RestController
+@RequiredArgsConstructor
+@RequestMapping(value = "/kwtManagementLogisticsOrder")
+public class ManagementLogisticsOrderController {
+
+    @Autowired
+    ManagementLogisticsOrderService managementLogisticsOrderService;
+
+
+    /**
+     * 运营管理端-物流订单-首页条件查询
+     *
+     * @param query 查询参数
+     * @return
+     */
+    @RequestMapping(value = "/select", method = RequestMethod.POST)
+    public HttpResult selectLogisticsOrder(@Valid @RequestBody ManagementLogisticsOrderQuery query) {
+        log.error("运营管理端-物流订单-首页条件查询 :{}", JSONObject.toJSONString(query));
+        try {
+            PageRes result = managementLogisticsOrderService.selectLogisticsOrder(query);
+            return HttpResult.ok(result);
+        } catch (Exception e) {
+            log.error("运营管理端-物流订单-首页条件查询 查询失败:{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
+
+    /**
+     * 运营管理端-物流订单-top统计
+     *
+     * @param query 查询参数
+     * @return
+     */
+    @RequestMapping(value = "/statistics", method = RequestMethod.POST)
+    public HttpResult statisticsLogisticsOrder(@Valid @RequestBody ManagementLogisticsOrderQuery query) {
+        log.error("运营管理端-物流订单-top统计 查询 :{}", JSONObject.toJSONString(query));
+        try {
+            HttpResult result = managementLogisticsOrderService.statisticsLogisticsOrder(query);
+            return result;
+        } catch (Exception e) {
+            log.error("运营管理端-物流订单-top统计 失败 :{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
+    /**
+     * 运营管理端-物流订单-导出
+     *
+     * @param query 查询参数
+     * @return
+     */
+    @RequestMapping(value = "/export", method = RequestMethod.POST)
+    public HttpResult exportLogisticsOrder(@Validated @RequestBody ManagementLogisticsOrderQuery query) {
+        log.error("运营管理端-物流订单-导出 query :{}", JSONObject.toJSONString(query));
+        HttpServletResponse response = RequestHolder.getResponse();
+        List<ManagementLogisticsOrderExcelVo> list = managementLogisticsOrderService.exportLogisticsOrder(query);
+        if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
+            ExcelUtil.download(response, ManagementLogisticsOrderExcelVo.class, list);
+            return null;
+        }
+        return HttpResult.ok("没有可导出的数据");
+    }
+
+
+    /**
+     * 运营端-物流订单-获取订单详情
+     *
+     * @param orderId
+     * @return
+     */
+    @RequestMapping(value = "/getOrderDetail", method = RequestMethod.GET)
+    public HttpResult getOrderDetail(@RequestParam("orderId") @NotBlank(message = "订单id不能为空") String orderId,
+                                     @RequestParam("orderNo") @NotBlank(message = "订单编号不能为空") String orderNo) {
+        log.info("运营端-物流订单-获取订单详情参数:单据id:{},单据编号:{}", orderId, orderNo);
+        try {
+            return managementLogisticsOrderService.getOrderDetail(orderId, orderNo);
+        } catch (Exception e) {
+            log.error("运营端-物流订单-获取订单详情失败:error :单据id:{},单据编号:{} errorMessage:{}", orderId, orderNo, e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
+}

+ 32 - 5
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java

@@ -6,12 +6,9 @@ import com.sckw.transport.api.model.dto.AddressResDTO;
 import com.sckw.transport.api.model.dto.LogisticsOrderDTO;
 import com.sckw.transport.api.model.vo.LogisticsOrderVO;
 import com.sckw.transport.model.KwtLogisticsOrder;
-import com.sckw.transport.model.param.AcceptCarriageOrderQuery;
-import com.sckw.transport.model.param.ConsignOrderQuery;
-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.*;
-import com.sckw.transport.model.vo.execlvo.AcceptCarriageOrderExcelVo;
+import com.sckw.transport.model.vo.execlVo.AcceptCarriageOrderExcelVo;
 import com.sckw.transport.model.vo.AcceptCarriageOrderVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -210,6 +207,20 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
                                                          @Param("userIds") List<Long> userIds
     );
 
+
+    /**
+     * @param query
+     * @param orderList
+     * @param entId
+     * @return
+     */
+    List<ManagementLogsiticsOrderVO> selectManagementLogisticsOrderList(@Param("query") ManagementLogisticsOrderQuery query,
+                                                         @Param("orderList") List<Integer> orderList,
+                                                         @Param("entId") Long entId,
+                                                         @Param("contactsIds") List<Long> contactsIds,
+                                                         @Param("userIds") List<Long> userIds
+    );
+
     /**
      * @param query
      * @param orderList
@@ -257,6 +268,22 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
                                                     @Param("userIds") List<Long> userIds
     );
 
+
+
+    /**
+     * @param query
+     * @param orderList 单据状态
+     * @param entId 企业id
+     * @param contactsIds 联系人id
+     * @return
+     */
+    List<TableTops> countManagementLogisticsOrderListByStatus(@Param("query") ManagementLogisticsOrderQuery query,
+                                                    @Param("orderList") List<Integer> orderList,
+                                                    @Param("entId") Long entId,
+                                                    @Param("contactsIds") List<Long> contactsIds,
+                                                    @Param("userIds") List<Long> userIds
+    );
+
     /**
      * 物流订单号+状态统计数量
      *

+ 86 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/param/ManagementLogisticsOrderQuery.java

@@ -0,0 +1,86 @@
+package com.sckw.transport.model.param;
+
+import com.sckw.core.model.page.PageRequest;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author lfdc
+ * @description 管理运营端-物流订单条件查询
+ * @date 2023-06-26 17:06:25
+ */
+@Data
+public class ManagementLogisticsOrderQuery extends PageRequest implements Serializable {
+
+    /**
+     * 数据id-主要用于订单导出
+     */
+    private String ids;
+    /**
+     * 计费方式
+     */
+    private String billingMode;
+    /**
+     * 计划结束时间(起)
+     */
+    private String endBeginDateTime;
+
+    /**
+     * 计划结束时间(止)
+     */
+    private String endOverDateTime;
+    /**
+     * 关键字搜索
+     */
+    private String keywords;
+    /**
+     * 装货地址code
+     */
+    private String loadAddressCode;
+//    /**
+//     * 装货地址
+//     */
+//    private String loadAddress;
+    /**
+     * 装货地址等级
+     */
+    private Integer loadAddressLevel;
+
+    /**
+     * 计划开始时间(起)
+     */
+    private String startBeginDateTime;
+
+    /**
+     * 计划开始时间(止)
+     */
+    private String startOverDateTime;
+
+    /**
+     * 创建时间(起)
+     */
+    private String createStartTime;
+
+    /**
+     * 创建时间(止)
+     */
+    private String createEndTime;
+
+    /**
+     * 单据状态
+     */
+    private String status;
+    /**
+     * 卸货地址code
+     */
+    private String unloadAddressCode;
+//    /**
+//     * 卸货地址
+//     */
+//    private String unloadAddress;
+    /**
+     * 卸货地址等级
+     */
+    private Integer unloadAddressLevel;
+}

+ 293 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/ManagementLogsiticsOrderVO.java

@@ -0,0 +1,293 @@
+package com.sckw.transport.model.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * @author lfdc
+ * @description 承运订单VO
+ * @date 2023-06-27 10:06:30
+ */
+@Data
+public class ManagementLogsiticsOrderVO /*extends PageRequest*/ {
+    /**
+     * 结算周期
+     */
+    private String accountsCycle;
+    /**
+     * 结算周期
+     */
+    private String accountsCycleLabel;
+    /**
+     * 发起人
+     */
+    private String appointor;
+
+    /**
+     * 创建人id
+     */
+    private Long createBy;
+    /**
+     * 计费方式
+     */
+    private String billingMode;
+
+    /**
+     * 计费方式
+     */
+    private String billingModeLabel;
+
+    /**
+     * 承运单位ID
+     */
+    private String carrierCompanyId;
+    /**
+     * 承运单位
+     */
+    private String carrierCompany;
+    /**
+     * 承运联系人
+     */
+    private String carrierContacts;
+//    /**
+//     * 承运订单
+//     */
+//    private String carrierOrder;
+    /**
+     * 承运联系电话
+     */
+    private String carrierPhone;
+    /**
+     * 分配承运量
+     */
+    private BigDecimal carryingCapacity;
+
+    /**
+     * 托运单位id
+     */
+    private String consignCompanyId;
+    /**
+     * 托运单位
+     */
+    private String consignCompany;
+    /**
+     * 托运联系人
+     */
+    private String consignContacts;
+    /**
+     * 托运联系电话
+     */
+    private String consignPhone;
+    /**
+     * 合同
+     */
+    private String contract;
+    /**
+     * 扣亏货值/元/吨
+     */
+    private BigDecimal deficitAmount;
+    /**
+     * 货物名称
+     */
+    private String goodsName;
+    /**
+     * 装货地点
+     */
+    private String loadAddress;
+    /**
+     * 装货区域名称
+     */
+    private String loadCityName;
+    /**
+     * 数据库id
+     */
+    @JsonProperty("lOrderId")
+    private String lOrderId;
+    /**
+     * 托运订单号
+     */
+    @JsonProperty("lOrderNo")
+    private String lOrderNo;
+
+    /**
+     * 贸易订单id
+     */
+    @JsonProperty("tOrderId")
+    private String tOrderId;
+    /**
+     *  贸易订单编号
+     */
+    @JsonProperty("tOrderNo")
+    private String tOrderNo;
+
+    /**
+     * 合理损耗
+     */
+    private BigDecimal loss;
+    /**
+     * 合理损耗单位
+     */
+    private String lossUnit;
+    /**
+     * 计划时间
+     */
+//    private String plannedDateTime;
+    /**
+     * 运价
+     */
+    private BigDecimal price;
+
+    /**
+     * 运价
+     */
+    private String priceType;
+
+    /**
+     * 运价
+     */
+    private String priceLabel;
+    /**
+     * 收货联系人
+     */
+    private String receiveGoodsContacts;
+    /**
+     * 计划收货时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private LocalDate receiveGoodsDateTime;
+    /**
+     * 收货电话
+     */
+    private String receiveGoodsPhone;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 发货联系人
+     */
+    private String shipmentsContacts;
+    /**
+     * 计划发货时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private LocalDate shipmentsDateTime;
+    /**
+     * 发货电话
+     */
+    private String shipmentsPhone;
+    /**
+     * 签约方式
+     */
+    private String signing;
+
+    /**
+     * 签约方式
+     */
+    private String signingLabel;
+    /**
+     * 状态
+     */
+    private Integer status;
+    /**
+     * 状态
+     */
+    private String statusLabel;
+    /**
+     * 卸货地点
+     */
+    private String unloadAddress;
+    /**
+     * 卸货区域名称
+     */
+    private String unloadCityName;
+//    /**
+//     * 关联承运订单号
+//     */
+//    @JsonProperty("wOrderNo")
+//    private String wOrderNo;
+
+    private String createTime;
+
+    private String updateTime;
+
+    /**
+     * 发货单位
+     */
+    private String shipmentsUnitEntId;
+
+    /**
+     * 发货单位
+     */
+    private String shipmentsUnit;
+
+    /**
+     * 收货单位
+     */
+    private String receiveGoodsUnitEntId;
+
+    /**
+     * 收货单位
+     */
+    private String receiveGoodsUnit;
+
+    /**
+     * 商品价值(扣亏货值)
+     */
+    private BigDecimal goodsPrice;
+
+    /**
+     * 商品价值(扣亏货值)单位
+     */
+    private String goodsPriceUnit;
+
+    /**
+     * 装货量
+     */
+    private BigDecimal loadAmount;
+
+    /**
+     *总装货量
+     */
+    private BigDecimal totalLoadAmount;
+
+    /**
+     * 剩余量
+     */
+    private BigDecimal ignoreAmount;
+
+    /**
+     * 待分配量(amount-subcontract_amount-entrust_amount)
+     */
+    private BigDecimal waitDistributionAmount;
+
+    /**
+     * 分包量(给下游承运商分包的量)
+     */
+    private BigDecimal subcontractAmount;
+
+    /**
+     * 已委托量(自己承运,给下游司机分配的量)
+     */
+    private BigDecimal entrustAmount;
+
+
+    /**
+     * 卸货量
+     */
+    private BigDecimal unloadAmount;
+
+    /**
+     * 卸货量
+     */
+    private BigDecimal totalUnloadAmount;
+
+    /**
+     * 订单主体企业id
+     */
+    private  Long entId;
+}

+ 1 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/execlvo/AcceptCarriageOrderExcelVo.java → sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/execlVo/AcceptCarriageOrderExcelVo.java

@@ -1,4 +1,4 @@
-package com.sckw.transport.model.vo.execlvo;
+package com.sckw.transport.model.vo.execlVo;
 
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;

+ 1 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/execlvo/ConsignOrderExcelVo.java → sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/execlVo/ConsignOrderExcelVo.java

@@ -1,4 +1,4 @@
-package com.sckw.transport.model.vo.execlvo;
+package com.sckw.transport.model.vo.execlVo;
 
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;

+ 405 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/execlVo/ManagementLogisticsOrderExcelVo.java

@@ -0,0 +1,405 @@
+package com.sckw.transport.model.vo.execlVo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.sckw.excel.annotation.ExcelContext;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * @author lfdc
+ * @description 运营端-物流订单导出vo
+ * @date 2023-09-11 09:06:30
+ */
+@Data
+@ExcelContext(fileName = "托运订单列表", sheetName = "托运订单列表")
+public class ManagementLogisticsOrderExcelVo implements Serializable {
+    /**
+     * 结算周期
+     */
+    @ExcelProperty(value = "结算周期")
+    private String accountsCycleLabel;
+
+    /**
+     * 发起人
+     */
+    @ExcelProperty(value = "发起人")
+    private String appointor;
+
+    /**
+     * 计费方式
+     */
+    @ExcelProperty(value = "计费方式")
+    private String billingModeLabel;
+
+    /**
+     * 承运单位
+     */
+    @ExcelProperty(value = "承运单位")
+    private String carrierCompany;
+    /**
+     * 承运联系人
+     */
+    @ExcelProperty(value = "承运联系人")
+    private String carrierContacts;
+    /**
+     * 承运联系电话
+     */
+    @ExcelProperty(value = "承运联系电话")
+    private String carrierPhone;
+    /**
+     * 分配承运量
+     */
+    @ExcelProperty(value = "承运量")
+    private BigDecimal carryingCapacity;
+
+    /**
+     * 托运单位
+     */
+    @ExcelProperty(value = "托运单位")
+    private String consignCompany;
+    /**
+     * 托运联系人
+     */
+    @ExcelProperty(value = "托运联系人")
+    private String consignContacts;
+    /**
+     * 托运联系电话
+     */
+    @ExcelProperty(value = "托运联系电话")
+    private String consignPhone;
+    /**
+     * 合同
+     */
+    @ExcelProperty(value = "合同")
+    private String contract;
+
+    /**
+     * 扣亏货值/元/吨
+     */
+    @ExcelProperty(value = "扣亏货值")
+    private BigDecimal deficitAmount;
+    /**
+     * 货物名称
+     */
+    @ExcelProperty(value = "货物名称")
+    private String goodsName;
+    /**
+     * 装货地点
+     */
+    @ExcelProperty(value = "装货地点")
+    private String loadAddress;
+
+    /**
+     * 承运订单号
+     */
+    @JsonProperty("lOrderNo")
+    @ExcelProperty(value = "托运订单号")
+    private String lOrderNo;
+
+    /**
+     *  贸易订单编号
+     */
+    @JsonProperty("tOrderNo")
+    @ExcelProperty(value = "贸易订单编号")
+    private String tOrderNo;
+
+    /**
+     * 合理损耗单位
+     */
+    @ExcelProperty(value = "合理损耗")
+    private String lossUnitLabel;
+
+    /**
+     * 运价
+     */
+    @ExcelProperty(value = "运价")
+    private String priceLabel;
+
+    /**
+     * 收货联系人
+     */
+    @ExcelProperty(value = "收货联系人")
+    private String receiveGoodsContacts;
+
+    /**
+     * 计划收货时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @ExcelProperty(value = "计划收货时间")
+    private LocalDate receiveGoodsDateTime;
+
+    /**
+     * 收货电话
+     */
+    @ExcelProperty(value = "收货电话")
+    private String receiveGoodsPhone;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+    /**
+     * 发货联系人
+     */
+    @ExcelProperty(value = "发货联系人")
+    private String shipmentsContacts;
+
+    /**
+     * 计划发货时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @ExcelProperty(value = "计划发货时间")
+    private LocalDate shipmentsDateTime;
+
+    /**
+     * 发货电话
+     */
+    @ExcelProperty(value = "发货电话")
+    private String shipmentsPhone;
+
+    /**
+     * 签约方式
+     */
+    @ExcelProperty(value = "签约方式")
+    private String signingLabel;
+
+    /**
+     * 状态
+     */
+    @ExcelProperty(value = "状态")
+    private String statusLabel;
+
+    /**
+     * 卸货地点
+     */
+    @ExcelProperty(value = "卸货地点")
+    private String unloadAddress;
+
+    @ExcelProperty(value = "创建时间")
+    private String createTime;
+
+    @ExcelProperty(value = "修改时间")
+    private String updateTime;
+
+    /**
+     * 发货单位
+     */
+    @ExcelProperty(value = "发货单位")
+    private String shipmentsUnit;
+
+    /**
+     * 收货单位
+     */
+    @ExcelProperty(value = "收货单位")
+    private String receiveGoodsUnit;
+
+    /**
+     * 商品价值(扣亏货值)
+     */
+    @ExcelProperty(value = "扣亏货值")
+    private String goodsPriceLabel;
+
+    /**
+     * 装货量
+     */
+    @ExcelProperty(value = "装货量")
+    private String loadAmount;
+
+
+    /**
+     * 待分配量(amount-subcontract_amount-entrust_amount)
+     */
+    @ExcelProperty(value = "待分配量")
+    private String waitDistributionAmount;
+
+    /**
+     * 分包量(给下游承运商分包的量)
+     */
+    @ExcelProperty(value = "分包量")
+    private String subcontractAmount;
+
+    /**
+     * 已委托量(自己承运,给下游司机分配的量)
+     */
+    @ExcelProperty(value = "已委托量")
+    private String entrustAmount;
+
+    /**
+     * 卸货量
+     */
+    @ExcelProperty(value = "卸货量")
+    private String unloadAmount;
+
+//    /**
+//     * 结算周期
+//     */
+//    @ExcelProperty(value = "结算周期")
+//    private String accountsCycle;
+//    /**
+//     * 发起人
+//     */
+//    @ExcelProperty(value = "发起人")
+//    private String appointor;
+//    /**
+//     * 计费方式
+//     */
+//    @ExcelProperty(value = "计费方式")
+//    private String billingMode;
+//    /**
+//     * 承运单位
+//     */
+//    @ExcelProperty(value = "承运单位")
+//    private String carrierCompany;
+//    /**
+//     * 承运联系人
+//     */
+//    @ExcelProperty(value = "承运联系人")
+//    private String carrierContacts;
+//    /**
+//     * 承运订单
+//     */
+//    @ExcelProperty(value = "承运订单")
+//    private String carrierOrder;
+//    /**
+//     * 承运联系电话
+//     */
+//    @ExcelProperty(value = "承运联系电话")
+//    private String carrierPhone;
+//    /**
+//     * 分配承运量
+//     */
+//    @ExcelProperty(value = "分配承运量")
+//    private String carryingCapacity;
+//    /**
+//     * 托运单位
+//     */
+//    @ExcelProperty(value = "托运单位")
+//    private String consignCompany;
+//    /**
+//     * 托运联系人
+//     */
+//    @ExcelProperty(value = "托运联系人")
+//    private String consignContacts;
+//    /**
+//     * 托运联系电话
+//     */
+//    @ExcelProperty(value = "托运联系电话")
+//    private String consignPhone;
+//    /**
+//     * 合同
+//     */
+//    @ExcelProperty(value = "合同")
+//    private String contract;
+//    /**
+//     * 扣亏货值/元/吨
+//     */
+//    @ExcelProperty(value = "扣亏货值/元/吨")
+//    private String deficitAmount;
+//    /**
+//     * 货物名称
+//     */
+//    @ExcelProperty(value = "货物名称")
+//    private String goodsName;
+//    /**
+//     * 装货地点
+//     */
+//    @ExcelProperty(value = "装货地点")
+//    private String loadAddress;
+//    /**
+//     * 数据库id
+//     */
+//    private String lOrderId;
+//    /**
+//     * 托运订单号
+//     */
+//    @ExcelProperty(value = "托运订单号")
+//    private String lOrderNo;
+//    /**
+//     * 合理损耗
+//     */
+//    @ExcelProperty(value = "合理损耗")
+//    private String loss;
+//    /**
+//     * 计划时间
+//     */
+//    @ExcelProperty(value = "计划时间")
+//    private String plannedDateTime;
+//    /**
+//     * 运价
+//     */
+//    @ExcelProperty(value = "运价")
+//    private String price;
+//    /**
+//     * 收货联系人
+//     */
+//    @ExcelProperty(value = "收货联系人")
+//    private String receiveGoodsContacts;
+//    /**
+//     * 计划收货时间
+//     */
+//    @ExcelProperty(value = "计划收货时间")
+//    private String receiveGoodsDateTime;
+//    /**
+//     * 收货电话
+//     */
+//    @ExcelProperty(value = "收货电话")
+//    private String receiveGoodsPhone;
+//    /**
+//     * 备注
+//     */
+//    @ExcelProperty(value = "备注")
+//    private String remark;
+//    /**
+//     * 发货联系人
+//     */
+//    @ExcelProperty(value = "发货联系人")
+//    private String shipmentsContacts;
+//    /**
+//     * 计划发货时间
+//     */
+//    @ExcelProperty(value = "计划发货时间")
+//    private String shipmentsDateTime;
+//    /**
+//     * 发货电话
+//     */
+//    @ExcelProperty(value = "发货电话")
+//    private String shipmentsPhone;
+//    /**
+//     * 签约方式
+//     */
+//    @ExcelProperty(value = "签约方式")
+//    private String signing;
+//    /**
+//     * 状态
+//     */
+//    @ExcelProperty(value = "状态")
+//    private String status;
+//    /**
+//     * 卸货地点
+//     */
+//    @ExcelProperty(value = "卸货地点")
+//    private String unloadAddress;
+//    /**
+//     * 关联承运订单号
+//     */
+//    @ExcelProperty(value = "关联承运订单号")
+//    private String wOrderNo;
+//    /**
+//     * 创建时间
+//     */
+//    @ExcelProperty(value = "创建时间")
+//    private String createTime;
+//    /**
+//     * 修改时间
+//     */
+//    @ExcelProperty(value = "修改时间")
+//    private String updateTime;
+
+}

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

@@ -49,7 +49,7 @@ 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.vo.*;
-import com.sckw.transport.model.vo.execlvo.AcceptCarriageOrderExcelVo;
+import com.sckw.transport.model.vo.execlVo.AcceptCarriageOrderExcelVo;
 import com.sckw.transport.model.vo.AcceptCarriageOrderVO;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;

+ 9 - 5
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/CommonService.java

@@ -270,8 +270,8 @@ public class CommonService {
                     .setUserInfos(userInfos)
                     .setCreateBy(LoginUserHolder.getUserId());
             log.info("发起物流托运-[贸易订单物流托运确认/承运订单分包托运确认]-创建人:{}", JSON.toJSONString(msg));
-
-            sendMessageLogistics(checkUnit, carriageUnit, map);
+            streamBridge.send("sckw-message", JSON.toJSONString(msg));
+//            sendMessageLogistics(checkUnit, carriageUnit, map);
         }
 
     }
@@ -298,6 +298,7 @@ public class CommonService {
                 .setUserInfos(userInfoList)
                 .setCreateBy(LoginUserHolder.getUserId());
         log.info("发起物流托运-[贸易订单物流托运确认/承运订单分包托运确认]-[承运方]-业务联系人:{}", JSON.toJSONString(sckwMessage));
+        streamBridge.send("sckw-message", JSON.toJSONString(sckwMessage));
 
         //给业务联系人发消息[托运方]
         List<UserInfo> list = new ArrayList<>();
@@ -363,7 +364,7 @@ public class CommonService {
                     .setUserInfos(userInfos)
                     .setCreateBy(LoginUserHolder.getUserId());
             log.info("托运订单/承运订单自建物流订单-创建人:{}", JSON.toJSONString(msg));
-
+            streamBridge.send("sckw-message", JSON.toJSONString(msg));
             sendMessageNewLogisticsOrder(checkUnit, map,MessageEnum.NEW_LOGISTICS_ORDER,consignLogisticsOrderUrl);
             sendMessageNewLogisticsOrder(carriageUnit, map,MessageEnum.NEW_CARRIAGE_ORDER,carriageLogisticsOrderUrl);
         }
@@ -393,6 +394,7 @@ public class CommonService {
                 .setUserInfos(userInfoList)
                 .setCreateBy(LoginUserHolder.getUserId());
         log.info("托运订单/承运订单自建物流订单-业务联系人:{}", JSON.toJSONString(sckwMessage));
+        streamBridge.send("sckw-message", JSON.toJSONString(sckwMessage));
 
     }
 
@@ -478,8 +480,8 @@ public class CommonService {
                     .setUserInfos(userInfos)
                     .setCreateBy(LoginUserHolder.getUserId());
             log.info(MessageEnum.getDesc(consignMessageEnum)+"-创建人:{}", JSON.toJSONString(msg));
-
-            sendMessagePublicLogistics(consignUnit, carriageUnit, map,consignMessageEnum);
+            streamBridge.send("sckw-message", JSON.toJSONString(msg));
+//            sendMessagePublicLogistics(consignUnit, carriageUnit, map,consignMessageEnum);
         }
     }
 
@@ -499,6 +501,8 @@ public class CommonService {
                 .setUserInfos(userInfoList)
                 .setCreateBy(LoginUserHolder.getUserId());
         log.info(MessageEnum.getDesc(consignMessageEnum)+"-[承运方]-业务联系人:{}", JSON.toJSONString(sckwMessage));
+        streamBridge.send("sckw-message", JSON.toJSONString(sckwMessage));
+
 
         //给业务联系人发消息[托运方]
         List<UserInfo> list = new ArrayList<>();

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

@@ -47,7 +47,7 @@ import com.sckw.transport.model.param.AcceptCarriageOrderQuery;
 import com.sckw.transport.model.param.ConsignOrderQuery;
 import com.sckw.transport.model.param.DriverParam;
 import com.sckw.transport.model.vo.*;
-import com.sckw.transport.model.vo.execlvo.ConsignOrderExcelVo;
+import com.sckw.transport.model.vo.execlVo.ConsignOrderExcelVo;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;

+ 540 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ManagementLogisticsOrderService.java

@@ -0,0 +1,540 @@
+package com.sckw.transport.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.sckw.contract.api.RemoteContractService;
+import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
+import com.sckw.core.common.enums.NumberConstant;
+import com.sckw.core.common.enums.enums.DictEnum;
+import com.sckw.core.common.enums.enums.DictTypeEnum;
+import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.enums.LogisticsOrderEnum;
+import com.sckw.core.model.page.PageRes;
+import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.constant.HttpStatus;
+import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.core.web.response.HttpResult;
+import com.sckw.mongo.model.TableTops;
+import com.sckw.order.api.dubbo.TradeOrderInfoService;
+import com.sckw.order.api.model.OrderDetailRes;
+import com.sckw.order.api.model.UnitInfoDetailRes;
+import com.sckw.system.api.RemoteSystemService;
+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.param.ManagementLogisticsOrderQuery;
+import com.sckw.transport.model.vo.ManagementLogsiticsOrderVO;
+import com.sckw.transport.model.vo.OrderDetailVO;
+import com.sckw.transport.model.vo.execlVo.ManagementLogisticsOrderExcelVo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author lfdc
+ * @description 运营管理端service
+ * @date 2023-09-11 09:09:09
+ */
+@Slf4j
+@Service
+public class ManagementLogisticsOrderService {
+
+    @Autowired
+    CommonService commonService;
+
+    @Autowired
+    KwtLogisticsOrderMapper logisticsOrderMapper;
+
+    @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
+    RemoteSystemService remoteSystemService;
+    @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
+    TradeOrderInfoService tradeOrderInfoService;
+
+    @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
+    RemoteContractService remoteContractService;
+
+    @Autowired
+    public KwtLogisticsOrderGoodsMapper logisticsOrderGoodsMapper;
+
+    @Autowired
+    public KwtLogisticsOrderContractMapper logisticsOrderContractMapper;
+
+    @Autowired
+    public KwtLogisticsOrderAddressMapper logisticsOrderAddressMapper;
+
+    @Autowired
+    public KwtLogisticsOrderTrackMapper logisticsOrderTrackMapper;
+
+    @Autowired
+    public KwtLogisticsOrderUnitMapper logisticsOrderUnitMapper;
+
+    @Autowired
+    public KwtWaybillOrderMapper waybillOrderMapper;
+
+    /**
+     * @param query
+     * @return
+     */
+    public PageRes selectLogisticsOrder(ManagementLogisticsOrderQuery query) {
+        Long entId = LoginUserHolder.getEntId();
+        PageHelper.startPage(query.getPage(), query.getPageSize());
+        List<Integer> orderList = new ArrayList<>();
+        if (StringUtils.isNotBlank(query.getStatus())) {
+            if (String.valueOf(NumberConstant.SEVEN).equals(query.getStatus())) {
+                orderList.add(LogisticsOrderEnum.REJECT_ORDER.getCode());
+                orderList.add(LogisticsOrderEnum.CANCEL_ORDER.getCode());
+            } else {
+                orderList.add(Integer.valueOf(query.getStatus()));
+            }
+        }
+        //装卸货地址
+        String loadCode = query.getLoadAddressCode();
+        if (StringUtils.isNotBlank(loadCode)) {
+            switch (query.getLoadAddressLevel()) {
+                case 1 -> query.setLoadAddressCode(
+                        loadCode.substring(0, 2).trim());
+                case 2 -> query.setLoadAddressCode(
+                        loadCode.substring(0, 4).trim());
+                case 3 -> query.setLoadAddressCode(loadCode);
+            }
+        }
+        String unloadCode = query.getUnloadAddressCode();
+        if (StringUtils.isNotBlank(unloadCode)) {
+            switch (query.getUnloadAddressLevel()) {
+                case 1 -> query.setUnloadAddressCode(
+                        loadCode.substring(0, 2).trim());
+                case 2 -> query.setUnloadAddressCode(
+                        loadCode.substring(0, 4).trim());
+                case 3 -> query.setUnloadAddressCode(loadCode);
+            }
+        }
+        List<Long> longs = LoginUserHolder.getAuthUserIdList();
+        longs.add(LoginUserHolder.getUserId());
+        List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
+//        LoginUserHolder.getIsMain()
+        List<ManagementLogsiticsOrderVO> list = logisticsOrderMapper.selectManagementLogisticsOrderList(query, orderList, entId, longList, longList);
+        PageInfo<ManagementLogsiticsOrderVO> pageInfo = new PageInfo<>(list);
+        if (CollectionUtils.isEmpty(list)) {
+            return PageRes.build(pageInfo, list);
+        }
+//        List<AcceptCarriageOrderVO> detailRes = new ArrayList<>();
+        /**计量单位*/
+        Map<String, String> unitTypeDictData = commonService.getDictData(DictTypeEnum.UNIT_TYPE.getType());
+        /**运价方式*/
+        Map<String, String> priceDictData = commonService.getDictData(DictTypeEnum.PRICE_TYPE.getType());
+        /**计费方式*/
+        Map<String, String> chargingDictData = commonService.getDictData(DictTypeEnum.CHARGING_TYPE.getType());
+        /**结算周期*/
+        Map<String, String> settlementDictData = commonService.getDictData(DictTypeEnum.SETTLEMENT_CYCLE.getType());
+        /**签约方式*/
+        Map<String, String> signingWay = commonService.getDictData(DictTypeEnum.SIGNING_TYPE.getType());
+        /**合理损耗*/
+//        Map<String, String> taxRateTypeDictData = getDictData(DictTypeEnum.TAX_RATE_TYPE.getType());
+        Map<Long, UserCacheResDto> longUserMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
+        if (CollectionUtils.isNotEmpty(list)) {
+            List<Long> collect = list.stream().map(ManagementLogsiticsOrderVO::getCreateBy).collect(Collectors.toList());
+            if (CollectionUtils.isNotEmpty(collect)) {
+                longUserMap = remoteSystemService.queryUserCacheMapByIds(collect);
+            }
+        }
+        for (ManagementLogsiticsOrderVO vo : list) {
+            vo.setAccountsCycleLabel(settlementDictData.get(vo.getAccountsCycle()));
+            vo.setAppointor(longUserMap.get(vo.getCreateBy()) == null ? null : longUserMap.get(vo.getCreateBy()).getName());
+            vo.setBillingModeLabel(chargingDictData.get(vo.getBillingMode()));
+            vo.setSigningLabel(signingWay.get(vo.getSigning()));
+            vo.setStatusLabel(LogisticsOrderEnum.getName(vo.getStatus()));
+            vo.setLoadAddress(vo.getLoadCityName() + vo.getLoadAddress());
+            vo.setUnloadAddress(vo.getUnloadCityName() + vo.getUnloadAddress());
+            if (vo.getTOrderId() != null) {
+                OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.valueOf(vo.getTOrderId()));
+                if (orderDetailRes != null) {
+                    List<UnitInfoDetailRes> unitInfo = orderDetailRes.getUnitInfo();
+                    for (UnitInfoDetailRes detailRes : unitInfo) {
+                        if (String.valueOf(NumberConstant.ONE).equals(detailRes.getUnitType())) {
+                            vo.setShipmentsUnitEntId(String.valueOf(detailRes.getEntId()));
+                            vo.setShipmentsUnit(detailRes.getFirmName());
+                        } else {
+                            vo.setReceiveGoodsUnitEntId(String.valueOf(detailRes.getEntId()));
+                            vo.setReceiveGoodsUnit(detailRes.getFirmName());
+                        }
+                    }
+                }
+            }
+            vo.setWaitDistributionAmount(vo.getCarryingCapacity().subtract(vo.getSubcontractAmount()).subtract(vo.getEntrustAmount()));
+            String tOrderId = vo.getTOrderId();
+            if (StringUtils.isNotBlank(tOrderId)) {
+                OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(Long.parseLong(tOrderId));
+                if (orderDetailById != null) {
+                    List<UnitInfoDetailRes> unitInfo = orderDetailById.getUnitInfo();
+                    if (CollectionUtils.isNotEmpty(unitInfo)) {
+                        for (UnitInfoDetailRes detailRes : unitInfo) {
+                            if ("1".equals(detailRes.getUnitType())) {
+                                vo.setReceiveGoodsUnit(detailRes.getFirmName());
+                                vo.setReceiveGoodsUnitEntId(detailRes.getEntId() == null ? null : detailRes.getEntId().toString());
+                            }
+                            if ("2".equals(detailRes.getUnitType())) {
+                                vo.setShipmentsUnit(detailRes.getFirmName());
+                                vo.setShipmentsUnitEntId(detailRes.getEntId() == null ? null : detailRes.getEntId().toString());
+                            }
+                        }
+                    }
+                }
+            }
+
+        }
+        return PageRes.build(pageInfo, list);
+    }
+
+    public HttpResult statisticsLogisticsOrder(ManagementLogisticsOrderQuery query) {
+        Long entId = LoginUserHolder.getEntId();
+        List<Integer> orderList = new ArrayList<>();
+        if (StringUtils.isNotBlank(query.getStatus())) {
+            if (String.valueOf(NumberConstant.EIGHT).equals(query.getStatus())) {
+                orderList.add(LogisticsOrderEnum.REJECT_ORDER.getCode());
+                orderList.add(LogisticsOrderEnum.CANCEL_ORDER.getCode());
+            } else {
+                orderList.add(Integer.valueOf(query.getStatus()));
+            }
+        }
+        //装卸货地址
+        String loadCode = query.getLoadAddressCode();
+        if (StringUtils.isNotBlank(loadCode)) {
+            switch (query.getLoadAddressLevel()) {
+                case 1 -> query.setLoadAddressCode(
+                        loadCode.substring(0, 2).trim());
+                case 2 -> query.setLoadAddressCode(
+                        loadCode.substring(0, 4).trim());
+                case 3 -> query.setLoadAddressCode(loadCode);
+            }
+        }
+        String unloadCode = query.getUnloadAddressCode();
+        if (StringUtils.isNotBlank(unloadCode)) {
+            switch (query.getUnloadAddressLevel()) {
+                case 1 -> query.setUnloadAddressCode(
+                        loadCode.substring(0, 2).trim());
+                case 2 -> query.setUnloadAddressCode(
+                        loadCode.substring(0, 4).trim());
+                case 3 -> query.setUnloadAddressCode(loadCode);
+            }
+        }
+        List<Long> longs = LoginUserHolder.getAuthUserIdList();
+        longs.add(LoginUserHolder.getUserId());
+        List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
+        List<TableTops> list = logisticsOrderMapper.countManagementLogisticsOrderListByStatus(query, orderList, entId, longList, longList);
+        List<TableTops> arrayList = new ArrayList<>();
+        arrayList.addAll(list);
+        /**补全数据状态不齐的情况*/
+        arrayList = commonService.packageReturnStatistics(list, arrayList);
+        // 查询结果
+        Map<String, Object> map = new HashMap<>(NumberConstant.SIXTEEN);
+        map.put("tableTop", arrayList);
+        // 查询结果
+        return HttpResult.ok(map);
+    }
+
+    public List<ManagementLogisticsOrderExcelVo> exportLogisticsOrder(ManagementLogisticsOrderQuery query) {
+        Long entId = LoginUserHolder.getEntId();
+//        PageHelper.startPage(query.getPage(), query.getPageSize());
+        List<Integer> orderList = new ArrayList<>();
+        if (StringUtils.isNotBlank(query.getStatus())) {
+            if (String.valueOf(NumberConstant.SEVEN).equals(query.getStatus())) {
+                orderList.add(LogisticsOrderEnum.REJECT_ORDER.getCode());
+                orderList.add(LogisticsOrderEnum.CANCEL_ORDER.getCode());
+            } else {
+                orderList.add(Integer.valueOf(query.getStatus()));
+            }
+        }
+        //装卸货地址
+        String loadCode = query.getLoadAddressCode();
+        if (StringUtils.isNotBlank(loadCode)) {
+            switch (query.getLoadAddressLevel()) {
+                case 1 -> query.setLoadAddressCode(
+                        loadCode.substring(0, 2).trim());
+                case 2 -> query.setLoadAddressCode(
+                        loadCode.substring(0, 4).trim());
+                case 3 -> query.setLoadAddressCode(loadCode);
+            }
+        }
+        String unloadCode = query.getUnloadAddressCode();
+        if (StringUtils.isNotBlank(unloadCode)) {
+            switch (query.getUnloadAddressLevel()) {
+                case 1 -> query.setUnloadAddressCode(
+                        loadCode.substring(0, 2).trim());
+                case 2 -> query.setUnloadAddressCode(
+                        loadCode.substring(0, 4).trim());
+                case 3 -> query.setUnloadAddressCode(loadCode);
+            }
+        }
+        List<Long> longs = LoginUserHolder.getAuthUserIdList();
+        longs.add(LoginUserHolder.getUserId());
+        List<Long> longList = longs.stream().distinct().collect(Collectors.toList());
+        List<ManagementLogsiticsOrderVO> list = logisticsOrderMapper.selectManagementLogisticsOrderList(query, orderList, entId, longList, longList);
+        /**计费方式*/
+        Map<String, String> chargingDictData = commonService.getDictData(DictTypeEnum.CHARGING_TYPE.getType());
+        /**结算周期*/
+        Map<String, String> settlementDictData = commonService.getDictData(DictTypeEnum.SETTLEMENT_CYCLE.getType());
+        /**签约方式*/
+        Map<String, String> signingWay = commonService.getDictData(DictTypeEnum.SIGNING_TYPE.getType());
+        /**合理损耗单位*/
+        Map<String, String> taxRate = commonService.getDictData(DictTypeEnum.TAX_RATE_TYPE.getType());
+        /**运价方式*/
+        Map<String, String> priceType = commonService.getDictData(DictTypeEnum.PRICE_TYPE.getType());
+        Map<Long, UserCacheResDto> longUserMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
+        if (CollectionUtils.isNotEmpty(list)) {
+            List<Long> collect = list.stream().map(ManagementLogsiticsOrderVO::getCreateBy).collect(Collectors.toList());
+            if (CollectionUtils.isNotEmpty(collect)) {
+                longUserMap = remoteSystemService.queryUserCacheMapByIds(collect);
+            }
+        }
+        List<ManagementLogisticsOrderExcelVo> exportList = new ArrayList<>();
+        for (ManagementLogsiticsOrderVO vo : list) {
+            ManagementLogisticsOrderExcelVo managementLogisticsOrderExcelVo = new ManagementLogisticsOrderExcelVo();
+            BeanUtils.copyProperties(vo, managementLogisticsOrderExcelVo);
+            managementLogisticsOrderExcelVo.setPriceLabel(vo.getPrice() == null ? null : vo.getPrice().toString() + priceType.get(vo.getPriceType()));
+            managementLogisticsOrderExcelVo.setLossUnitLabel(vo.getLoss() == null ? null : vo.getLoss().toString() + taxRate.get(vo.getLossUnit()));
+            managementLogisticsOrderExcelVo.setGoodsPriceLabel(vo.getGoodsPrice() == null ? null : vo.getGoodsPrice().toString() + priceType.get(vo.getGoodsPriceUnit()));
+            managementLogisticsOrderExcelVo.setAccountsCycleLabel(settlementDictData.get(vo.getAccountsCycle()));
+            managementLogisticsOrderExcelVo.setAppointor(longUserMap.get(vo.getCreateBy()) == null ? null : longUserMap.get(vo.getCreateBy()).getName());
+            managementLogisticsOrderExcelVo.setBillingModeLabel(chargingDictData.get(vo.getBillingMode()));
+            managementLogisticsOrderExcelVo.setSigningLabel(signingWay.get(vo.getSigning()));
+            managementLogisticsOrderExcelVo.setStatusLabel(LogisticsOrderEnum.getName(vo.getStatus()));
+            managementLogisticsOrderExcelVo.setLoadAddress(vo.getLoadCityName() + vo.getLoadAddress());
+            managementLogisticsOrderExcelVo.setUnloadAddress(vo.getUnloadCityName() + vo.getUnloadAddress());
+            if (vo.getTOrderId() != null) {
+                OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.valueOf(vo.getTOrderId()));
+                if (orderDetailRes != null) {
+                    List<UnitInfoDetailRes> unitInfo = orderDetailRes.getUnitInfo();
+                    for (UnitInfoDetailRes detailRes : unitInfo) {
+                        if (String.valueOf(NumberConstant.ONE).equals(detailRes.getUnitType())) {
+                            managementLogisticsOrderExcelVo.setShipmentsUnit(detailRes.getFirmName());
+                        } else {
+                            managementLogisticsOrderExcelVo.setReceiveGoodsUnit(detailRes.getFirmName());
+                        }
+                    }
+                }
+            }
+            BigDecimal subtract = vo.getCarryingCapacity().subtract(vo.getSubcontractAmount()).subtract(vo.getEntrustAmount());
+            DecimalFormat df = new DecimalFormat("0.00");
+            managementLogisticsOrderExcelVo.setWaitDistributionAmount(subtract == null ? null : df.format(subtract));
+            String tOrderId = vo.getTOrderId();
+            if (StringUtils.isNotBlank(tOrderId)) {
+                OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(Long.parseLong(tOrderId));
+                if (orderDetailById != null) {
+                    List<UnitInfoDetailRes> unitInfo = orderDetailById.getUnitInfo();
+                    if (CollectionUtils.isNotEmpty(unitInfo)) {
+                        for (UnitInfoDetailRes detailRes : unitInfo) {
+                            if ("1".equals(detailRes.getUnitType())) {
+                                managementLogisticsOrderExcelVo.setReceiveGoodsUnit(detailRes.getFirmName());
+                            }
+                            if ("2".equals(detailRes.getUnitType())) {
+                                managementLogisticsOrderExcelVo.setShipmentsUnit(detailRes.getFirmName());
+                            }
+                        }
+                    }
+                }
+            }
+            managementLogisticsOrderExcelVo.setSubcontractAmount(Objects.isNull(vo.getSubcontractAmount()) ? null : df.format(vo.getSubcontractAmount()) + priceType.get(vo.getPriceType()));
+            managementLogisticsOrderExcelVo.setEntrustAmount(Objects.isNull(vo.getEntrustAmount()) ? null : df.format(vo.getEntrustAmount()) + priceType.get(vo.getPriceType()));
+            managementLogisticsOrderExcelVo.setLoadAmount(Objects.isNull(vo.getLoadAmount()) ? null : df.format(vo.getLoadAmount()) + priceType.get(vo.getPriceType()));
+            managementLogisticsOrderExcelVo.setUnloadAmount(Objects.isNull(vo.getUnloadAmount()) ? null : df.format(vo.getUnloadAmount()) + priceType.get(vo.getPriceType()));
+            exportList.add(managementLogisticsOrderExcelVo);
+        }
+        return exportList;
+    }
+
+    public HttpResult getOrderDetail(String orderIdStr, String orderNo) {
+        HttpResult httpResult = new HttpResult();
+        httpResult.setCode(HttpStatus.SUCCESS_CODE);
+        List<Long> orderIds = StringUtils.splitStrToList(orderIdStr, Long.class);
+        Long orderId = orderIds.get(0);
+        KwtLogisticsOrder logisticsOrder = logisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
+                        .eq(KwtLogisticsOrder::getId, orderId)
+                        .eq(StringUtils.isNotBlank(orderNo), KwtLogisticsOrder::getLOrderNo, orderNo)
+                /**.eq(KwtLogisticsOrder::getEntId, LoginUserHolder.getEntId())*/);
+        if (logisticsOrder == null) {
+            log.info("运营端-物流订单-获取订单详情参数:单据id:{},单据编号:{}", orderId, orderNo);
+            throw new RuntimeException("查无单据");
+
+        }
+        KwtLogisticsOrderContract contract = logisticsOrderContractMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderContract>()
+                .eq(StringUtils.isNotBlank(orderId), KwtLogisticsOrderContract::getLOrderId, orderId));
+        KwtLogisticsOrderUnit unitOne = logisticsOrderUnitMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderUnit>()
+                .eq(StringUtils.isNotBlank(orderId), KwtLogisticsOrderUnit::getLOrderId, orderId)
+                .eq(KwtLogisticsOrderUnit::getUnitType, NumberConstant.ONE));
+        KwtLogisticsOrderUnit unitTwo = logisticsOrderUnitMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderUnit>()
+                .eq(StringUtils.isNotBlank(orderId), KwtLogisticsOrderUnit::getLOrderId, orderId)
+                .eq(KwtLogisticsOrderUnit::getUnitType, NumberConstant.TWO));
+        KwtLogisticsOrderAddress loadOrderAddress = logisticsOrderAddressMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderAddress>()
+                .eq(StringUtils.isNotBlank(orderId), KwtLogisticsOrderAddress::getLOrderId, orderId)
+                .eq(KwtLogisticsOrderAddress::getAddressType, NumberConstant.ONE));
+        KwtLogisticsOrderAddress unloadOrderAddress = logisticsOrderAddressMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderAddress>()
+                .eq(StringUtils.isNotBlank(orderId), KwtLogisticsOrderAddress::getLOrderId, orderId)
+                .eq(KwtLogisticsOrderAddress::getAddressType, NumberConstant.TWO));
+        KwtLogisticsOrderGoods orderGoods = logisticsOrderGoodsMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderGoods>()
+                .eq(StringUtils.isNotBlank(logisticsOrder.getId()), KwtLogisticsOrderGoods::getLOrderId, logisticsOrder.getId()));
+        OrderDetailVO orderDetailVO = new OrderDetailVO();
+        orderDetailVO.setId(String.valueOf(logisticsOrder.getId()));
+        if (contract != null) {
+            orderDetailVO.setContractId(contract.getContractId() == null ? null : String.valueOf(contract.getContractId()));
+            //todo 接口调用合同服务查询合同信息
+            List<Long> list = new ArrayList<>(NumberConstant.SIXTEEN);
+            list.add(contract.getContractId());
+            Map<Long, ContractCommonInfoResDto> contractBaseInfo = remoteContractService.queryContractBaseInfo(list);
+            if (CollectionUtils.isNotEmpty(contractBaseInfo) && !ObjectUtils.isEmpty(contractBaseInfo.get(contract.getContractId()))) {
+                orderDetailVO.setContractName(contractBaseInfo.get(contract.getContractId()).getContactName());
+                orderDetailVO.setContractNo(contractBaseInfo.get(contract.getContractId()).getContractCode());
+                orderDetailVO.setSigningWay(contractBaseInfo.get(contract.getContractId()).getSigningWay());
+            }
+        }
+        if (unitOne != null) {
+            orderDetailVO.setConsignCompanyId(unitOne.getId());
+            orderDetailVO.setConsignCompany(unitOne.getFirmName());
+            orderDetailVO.setConsignContacts(unitOne.getContacts());
+            orderDetailVO.setConsignPhone(unitOne.getPhone());
+            orderDetailVO.setCollectionCompany(unitOne.getFirmName());
+        }
+        if (unitTwo != null) {
+            orderDetailVO.setCarrierCompanyId(unitTwo.getId());
+            orderDetailVO.setCarrierCompany(unitTwo.getFirmName());
+            orderDetailVO.setCarrierContacts(unitTwo.getContacts());
+            orderDetailVO.setCarrierPhone(unitTwo.getPhone());
+        }
+        orderDetailVO.setGoodsId(String.valueOf(orderGoods == null ? null : orderGoods.getGoodsId()));
+        orderDetailVO.setGoodsName(orderGoods == null ? null : orderGoods.getGoodsName());
+        orderDetailVO.setNumber(logisticsOrder.getAmount() == null ? null : logisticsOrder.getAmount());
+        orderDetailVO.setPrice(logisticsOrder.getPrice() == null ? null : logisticsOrder.getPrice());
+        orderDetailVO.setLoss(logisticsOrder.getLoss() == null ? null : logisticsOrder.getLoss());
+        orderDetailVO.setDeduct(logisticsOrder.getGoodsPrice() == null ? null : logisticsOrder.getGoodsPrice());
+        orderDetailVO.setLoadName(loadOrderAddress.getName());
+        orderDetailVO.setLoadAddress(loadOrderAddress.getCityName());
+        orderDetailVO.setLoadContacts(loadOrderAddress.getContacts());
+        orderDetailVO.setLoadPhone(loadOrderAddress.getPhone());
+        orderDetailVO.setLoadAddressDetail(loadOrderAddress.getDetailAddress());
+        orderDetailVO.setUnloadName(unloadOrderAddress.getName());
+        orderDetailVO.setUnloadAddress(unloadOrderAddress.getCityName());
+        orderDetailVO.setUnloadContacts(unloadOrderAddress.getContacts());
+        orderDetailVO.setUnloadPhone(unloadOrderAddress.getPhone());
+        orderDetailVO.setUnloadAddressDetail(unloadOrderAddress.getDetailAddress());
+        orderDetailVO.setSettlementCycle(logisticsOrder.getSettlementCycle() == null ? null : String.valueOf(logisticsOrder.getSettlementCycle()));
+        if (logisticsOrder.getSettlementCycle() != null) {
+            Map<String, SysDictResDto> dtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.SETTLEMENT_CYCLE.getType());
+            orderDetailVO.setSettlementCycleLabel(dtoMap.isEmpty() ? null :
+                    (dtoMap.get(String.valueOf(logisticsOrder.getSettlementCycle())) == null ? null : dtoMap.get(String.valueOf(logisticsOrder.getSettlementCycle())).getLabel()));
+        }
+        orderDetailVO.setBillingMode(logisticsOrder.getBillingMode());
+        if (logisticsOrder.getBillingMode() != null) {
+            Map<String, SysDictResDto> dictResDtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.CHARGING_TYPE.getType());
+            orderDetailVO.setBillingModeLabel(dictResDtoMap.isEmpty() ? null :
+                    (dictResDtoMap.get(logisticsOrder.getBillingMode()) == null ? null : dictResDtoMap.get(logisticsOrder.getBillingMode()).getLabel()));
+        }
+        orderDetailVO.setScheduleStartTime(logisticsOrder.getStartTime() == null ? null : logisticsOrder.getStartTime());
+        orderDetailVO.setScheduleEndTime(logisticsOrder.getEndTime() == null ? null : logisticsOrder.getEndTime());
+        if (logisticsOrder.getBillingMode().equals(String.valueOf(NumberConstant.ONE))) {
+            orderDetailVO.setPerformanceAmount(logisticsOrder.getTotalLoadAmount() == null ? null : logisticsOrder.getTotalLoadAmount());
+        } else if (logisticsOrder.getBillingMode().equals(String.valueOf(NumberConstant.TWO))) {
+            orderDetailVO.setPerformanceAmount(logisticsOrder.getUnloadAmount() == null ? null : logisticsOrder.getUnloadAmount());
+        }
+//        orderDetailVO.setPerformanceAmount(logisticsOrder.getLoadAmount() == null ? null : logisticsOrder.getLoadAmount());
+        orderDetailVO.setTotalLoadAmount(logisticsOrder.getTotalLoadAmount() == null ? new BigDecimal("0.00") : logisticsOrder.getTotalLoadAmount());
+        orderDetailVO.setTotalUnloadAmount(logisticsOrder.getTotalUnloadAmount() == null ? new BigDecimal("0.00") : logisticsOrder.getTotalUnloadAmount());
+        orderDetailVO.setCreateTime(logisticsOrder.getCreateTime());
+        orderDetailVO.setPayment(logisticsOrder.getPayment());
+        if (logisticsOrder.getPayment() != null) {
+            Map<String, SysDictResDto> dictResDtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.TRADE_TYPE.getType());
+            if (dictResDtoMap.isEmpty()) {
+                orderDetailVO.setPaymentLabel(null);
+            } else {
+                if (dictResDtoMap.get(logisticsOrder.getPayment().toString()) != null) {
+                    orderDetailVO.setPaymentLabel(dictResDtoMap.get(logisticsOrder.getPayment().toString()).getLabel());
+                }
+            }
+        }
+        if (orderDetailVO.getSigningWay() != null) {
+            Map<String, SysDictResDto> dictResDtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.SIGNING_TYPE.getType());
+            if (dictResDtoMap.isEmpty()) {
+                orderDetailVO.setPaymentLabel(null);
+            } else {
+                if (dictResDtoMap.get(String.valueOf(orderDetailVO.getSigningWay())) != null) {
+                    orderDetailVO.setSigningWayLabel(dictResDtoMap.get(orderDetailVO.getSigningWay().toString()).getLabel());
+                }
+            }
+        }
+        if (logisticsOrder.getGoodsPriceUnit() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), logisticsOrder.getGoodsPriceUnit());
+            orderDetailVO.setDeductLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
+        if (logisticsOrder.getLossUnit() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.TAX_RATE_TYPE.getType(), logisticsOrder.getLossUnit());
+            orderDetailVO.setLossLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
+        if (logisticsOrder.getUnit() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.UNIT_TYPE.getType(), logisticsOrder.getUnit());
+            orderDetailVO.setNumberLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
+        if (logisticsOrder.getPriceType() != null) {
+            SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), String.valueOf(logisticsOrder.getPriceType()));
+            orderDetailVO.setPriceLabel(sysDictResDto == null ? null : sysDictResDto.getLabel());
+        }
+        orderDetailVO.setRemark(logisticsOrder.getRemark());
+        /**亏吨量/吨->装货量-卸货量
+         * 合理损耗值=装货量*合理损耗
+         扣亏量/吨->亏吨量-合理损耗值
+         罚款值 扣亏量/吨*扣亏货值
+         总运价:
+         按照装货量 运输运价*装货量
+         按照卸货量 卸货量*运输单价-罚款值
+         按照趟次=运输运价
+         */
+        //合理损耗
+        BigDecimal loss = logisticsOrder.getLoss() == null ? new BigDecimal("0.00") : logisticsOrder.getLoss();
+
+        Integer status = logisticsOrder.getStatus();
+        List<Integer> orderStatusFinish = new ArrayList<>();
+        orderStatusFinish.add(LogisticsOrderEnum.HAVE_FINISHED.getCode());
+        orderStatusFinish.add(LogisticsOrderEnum.HAVE_RECONCILED.getCode());
+        orderStatusFinish.add(LogisticsOrderEnum.HAVE_ALREADY_SETTLED.getCode());
+        /**根据当前单据状态进行订单金额计算*/
+        if (orderStatusFinish.contains(status)) {
+            /**亏吨量/吨->装货量-卸货量
+             扣亏量/吨->亏吨量-合理损耗值
+             扣亏量/吨->亏吨量-合理损耗值(装货量*合理损耗)*/
+            BigDecimal loadAmount = logisticsOrder.getLoadAmount() == null ? new BigDecimal("0.00") : logisticsOrder.getLoadAmount();
+            BigDecimal unloadAmount = logisticsOrder.getUnloadAmount() == null ? new BigDecimal("0.00") : logisticsOrder.getUnloadAmount();
+            //运价
+            BigDecimal price = logisticsOrder.getPrice() == null ? new BigDecimal("0.00") : logisticsOrder.getPrice();
+            //亏吨量
+            BigDecimal defectiveWeighNumber = loadAmount.subtract(unloadAmount);
+            //合理损耗值
+            BigDecimal lossAmount = loadAmount.multiply(loss);
+            //扣亏量/吨
+            BigDecimal deductWeighNumber = defectiveWeighNumber.subtract(lossAmount);
+            if (deductWeighNumber.compareTo(new BigDecimal("0")) < 0) {
+                deductWeighNumber = new BigDecimal("0.00");
+            }
+            //罚款值
+            BigDecimal fineValue = (logisticsOrder.getGoodsPrice() == null ? new BigDecimal("0.00") : logisticsOrder.getGoodsPrice()).multiply(deductWeighNumber);
+            if (DictEnum.CHARGING_TYPE_1.getValue().equals(logisticsOrder.getBillingMode())) {
+                orderDetailVO.setOrderAmount(price.multiply(loadAmount));
+            } else if (DictEnum.CHARGING_TYPE_2.getValue().equals(logisticsOrder.getBillingMode())) {
+                orderDetailVO.setOrderAmount(unloadAmount.multiply(price).subtract(fineValue));
+            } else if (DictEnum.CHARGING_TYPE_3.getValue().equals(logisticsOrder.getBillingMode())) {
+                orderDetailVO.setOrderAmount(price);
+            }
+        } else {
+            orderDetailVO.setOrderAmount(logisticsOrder.getAmount().multiply(logisticsOrder.getPrice()));
+        }
+        httpResult.setData(orderDetailVO);
+        return httpResult;
+    }
+}

+ 213 - 1
sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

@@ -962,6 +962,116 @@
         ORDER BY a.create_time DESC
         <!--               ,a.create_time-->
     </select>
+
+
+
+
+    <select id="selectManagementLogisticsOrderList" resultType="com.sckw.transport.model.vo.ManagementLogsiticsOrderVO">
+        SELECT
+        <include refid="Query_Column_List">
+        </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="type == 1">
+                and (d.top_ent_id = #{entId} or d.ent_id = #{entId})
+                <!--                AND (-->
+                <!--                a.ent_id = #{entId}-->
+                <!--                <if test="userIds != null and userIds.size()>0">-->
+                <!--                    AND a.create_by IN-->
+                <!--                    <foreach collection="userIds" open="(" close=")" item="item" separator=",">-->
+                <!--                        #{item}-->
+                <!--                    </foreach>-->
+                <!--                </if>-->
+                <!--                )-->
+                <!--                OR (-->
+                <!--                d.top_ent_id = #{entId}-->
+                <!--                <if test="contactsIds != null and contactsIds.size()>0">-->
+                <!--                    AND d.contacts_id IN-->
+                <!--                    <foreach collection="contactsIds" separator="," item="item" close=")" open="(">-->
+                <!--                        #{item}-->
+                <!--                    </foreach>-->
+                <!--                </if>-->
+                <!--                 )-->
+            </if>
+            <if test="type == 2">
+                and (e.top_ent_id = #{entId} or e.ent_id = #{entId})
+                <!--                AND (-->
+                <!--                a.ent_id = #{entId}-->
+                <!--                <if test="userIds != null and userIds.size()>0">-->
+                <!--                    AND a.create_by IN-->
+                <!--                    <foreach collection="userIds" open="(" close=")" item="item" separator=",">-->
+                <!--                        #{item}-->
+                <!--                    </foreach>-->
+                <!--                </if>-->
+                <!--                )-->
+                <!--                OR (-->
+                <!--                d.top_ent_id = #{entId}-->
+                <!--                <if test="contactsIds != null and contactsIds.size()>0">-->
+                <!--                    AND d.contacts_id IN-->
+                <!--                    <foreach collection="contactsIds" separator="," item="item" close=")" open="(">-->
+                <!--                        #{item}-->
+                <!--                    </foreach>-->
+                <!--                </if>-->
+                <!--                )-->
+            </if>
+            <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="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
+        <!--               ,a.create_time-->
+    </select>
+
     <select id="countLogisticsOrderListByStatus" resultType="com.sckw.mongo.model.TableTops">
         SELECT
         a.`status` AS value ,
@@ -1063,6 +1173,108 @@
         </where>
         group by a.status
     </select>
+
+    <select id="countManagementLogisticsOrderListByStatus" resultType="com.sckw.mongo.model.TableTops">
+        SELECT
+        a.`status` AS value ,
+        COUNT(a.`status`) AS total
+        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="type == 1">
+                and (d.top_ent_id = #{entId} or d.ent_id = #{entId})
+                <!--                AND (-->
+                <!--                a.ent_id = #{entId}-->
+                <!--                <if test="userIds != null and userIds.size()>0">-->
+                <!--                    AND a.create_by IN-->
+                <!--                    <foreach collection="userIds" open="(" close=")" item="item" separator=",">-->
+                <!--                        #{item}-->
+                <!--                    </foreach>-->
+                <!--                </if>-->
+                <!--                )-->
+                <!--                OR (-->
+                <!--                d.top_ent_id = #{entId}-->
+                <!--                <if test="contactsIds != null and contactsIds.size()>0">-->
+                <!--                    AND d.contacts_id IN-->
+                <!--                    <foreach collection="contactsIds" separator="," item="item" close=")" open="(">-->
+                <!--                        #{item}-->
+                <!--                    </foreach>-->
+                <!--                </if>-->
+                <!--                )-->
+            </if>
+            <if test="type == 2">
+                and (e.top_ent_id = #{entId} or e.ent_id = #{entId})
+                <!--                AND (-->
+                <!--                a.ent_id = #{entId}-->
+                <!--                <if test="userIds != null and userIds.size()>0">-->
+                <!--                    AND a.create_by IN-->
+                <!--                    <foreach collection="userIds" open="(" close=")" item="item" separator=",">-->
+                <!--                        #{item}-->
+                <!--                    </foreach>-->
+                <!--                </if>-->
+                <!--                )-->
+                <!--                OR (-->
+                <!--                d.top_ent_id = #{entId}-->
+                <!--                <if test="contactsIds != null and contactsIds.size()>0">-->
+                <!--                    AND d.contacts_id IN-->
+                <!--                    <foreach collection="contactsIds" separator="," item="item" close=")" open="(">-->
+                <!--                        #{item}-->
+                <!--                    </foreach>-->
+                <!--                </if>-->
+                <!--                )-->
+            </if>
+            <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="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>
+        </where>
+        group by a.status
+    </select>
     <select id="selectCountByLorderId" resultType="java.lang.Integer">
         SELECT COUNT(id)
         FROM kwt_waybill_order
@@ -1110,7 +1322,7 @@
     </select>
 
     <select id="selectLogisticsOrderListExport"
-            resultType="com.sckw.transport.model.vo.execlvo.AcceptCarriageOrderExcelVo">
+            resultType="com.sckw.transport.model.vo.execlVo.AcceptCarriageOrderExcelVo">
         SELECT
         <include refid="Query_Column_List">
         </include>