Просмотр исходного кода

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

xucaiqin 2 лет назад
Родитель
Сommit
9ffdb2c8f2
16 измененных файлов с 881 добавлено и 110 удалено
  1. 408 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/DateUtils.java
  2. 77 4
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java
  3. 39 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/GpsByTruckNoDto.java
  4. 0 50
      sckw-modules/sckw-report/src/main/java/com/sckw/report/enums/CarWaybillEnum.java
  5. 1 1
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwTransportService.java
  6. 24 3
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtWaybillOrderController.java
  7. 38 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/LogisticsConsignmentController.java
  8. 8 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java
  9. 10 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtWaybillOrderMapper.java
  10. 10 10
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/OrderFinishDTO.java
  11. 26 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/OrderFinishVO.java
  12. 11 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java
  13. 157 5
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java
  14. 5 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/TransportCommonService.java
  15. 15 0
      sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml
  16. 52 35
      sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderMapper.xml

+ 408 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/DateUtils.java

@@ -0,0 +1,408 @@
+package com.sckw.core.utils;
+
+import cn.hutool.core.date.DateUtil;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.*;
+
+/**
+ * 日期处理
+ * @author
+ */
+public class DateUtils extends DateUtil {
+    /**
+     * 时间格式(yyyy-MM-dd)
+     */
+    public final static String DATE_PATTERN = "yyyy-MM-dd";
+    /**
+     * 时间格式(yyyy-MM-dd HH:mm:ss)
+     */
+    public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
+
+    public static String FORMAT2 = "yyyy-MM-dd HH:mm:ss";
+
+    public static String FORMAT3 = "yyyyMMddHHmmss";
+
+    public static String FORMAT4 = "yyMMddHHmmss";
+
+    public static String FORMAT5 = "yyMMddHHmmssSSS";
+
+    public static String FORMAT6 = "yyyyMMdd";
+
+    public static String FORMAT7 = "yyyy-MM-dd HH:mm";
+
+    public static String FORMAT8 = "yyMMdd";
+
+    public static String FORMAT9 = "yyyy/MM/dd";
+
+    public static String FORMAT10 = "yyyy-MM";
+
+    public static int THIRTEEN = 13;
+
+    /**
+     * 获取时间
+     *
+     * @return 返回当前时间
+     */
+    public static Date getDate() {
+        return new Date();
+    }
+
+    public static String getCurrentTime() {
+        Date day = new Date();
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        System.out.println(df.format(day));
+        return df.format(day);
+    }
+
+    public static String getCurrentTime(String format) {
+        Date day = new Date();
+        SimpleDateFormat df = new SimpleDateFormat(format);
+        System.out.println(df.format(day));
+        return df.format(day);
+    }
+
+    /**
+     * 获取时间
+     *
+     * @param timeStamp 时间戳
+     * @return Date
+     */
+    public static Date getDate(Long timeStamp) {
+        if (timeStamp == null || timeStamp <= 0) {
+            return null;
+        }
+        return new Date(timeStamp);
+    }
+
+    /**
+     * 日期格式化 日期格式为:yyyy-MM-dd
+     *
+     * @param date 日期
+     * @return 返回yyyy-MM-dd格式日期
+     */
+    public static String format(Date date) {
+        return format(date, DATE_PATTERN);
+    }
+
+    /**
+     * 日期格式化 日期格式为:yyyy-MM-dd
+     *
+     * @param date    日期
+     * @param pattern 格式,如:DateUtils.DATE_TIME_PATTERN
+     * @return 返回yyyy-MM-dd格式日期
+     */
+    public static String format(Date date, String pattern) {
+        if (date != null) {
+            SimpleDateFormat df = new SimpleDateFormat(pattern);
+            return df.format(date);
+        }
+        return null;
+    }
+
+    /**
+     * @param date
+     * @return String    返回类型
+     * @Title: getYear
+     * @Description: TODO(获取YYYY格式)
+     */
+    public static String getYear(Date date) {
+        return format(date, "yyyy");
+    }
+
+    /**
+     * @param date
+     * @return String    返回类型
+     * @Title: getMonth
+     * @Description: 获取月(获取MM格式)
+     */
+    public static String getMonth(Date date) {
+        return format(date, "MM");
+    }
+
+    /**
+     * @param date
+     * @return String    返回类型
+     * @Title: getTheDay
+     * @Description: 获取日期的天(dd格式)
+     */
+    public static String getTheDay(Date date) {
+        return format(date, "dd");
+    }
+
+    /**
+     * 方法描述:将时间转换为制定格式的日期时间字符串
+     * @param date
+     * @return
+     */
+    public static String dateToString(Date date, String pattern) {
+        SimpleDateFormat df;
+        String returnValue = "";
+
+        if (date != null) {
+            df = new SimpleDateFormat(pattern);
+            returnValue = df.format(date);
+        }
+        return (returnValue);
+    }
+
+    /**
+     * @param beginDateStr
+     * @param endDateStr
+     * @return long    返回类型
+     * @Title: getDaySub
+     * @Description: TODO(功能描述 : 时间相减得到天数)
+     */
+    public static long getDaySub(String beginDateStr, String endDateStr) {
+        long day = 0;
+        SimpleDateFormat format = new SimpleDateFormat(
+                "yyyy-MM-dd");
+        Date beginDate = null;
+        Date endDate = null;
+
+        try {
+            beginDate = format.parse(beginDateStr);
+            endDate = format.parse(endDateStr);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        day = (endDate.getTime() - beginDate.getTime()) / (24 * 60 * 60 * 1000);
+        // System.out.println("相隔的天数="+day);
+
+        return day;
+    }
+
+    /**
+     * 10位13位时间戳转String 格式(2018-10-15 16:03:27) 日期
+     *
+     * @param timestamp
+     * @param simpleDateFormatType 时间戳类型("yyyy-MM-dd HH:mm:ss")
+     * @return
+     */
+    public static String numberDateFormat(String timestamp, String simpleDateFormatType) {
+        SimpleDateFormat sdf = new SimpleDateFormat(simpleDateFormatType);//要转换的时间格式
+        String date = null;
+        if (timestamp.length() == THIRTEEN) {
+            date = sdf.format(Long.parseLong(timestamp));
+        } else {
+            date = sdf.format(Long.parseLong(timestamp) * 1000);
+        }
+        return date;
+    }
+
+    /**
+     * 10位13位时间戳转Date
+     *
+     * @param timestamp            参数时间戳
+     * @param simpleDateFormatType 时间戳类型("yyyy-MM-dd HH:mm:ss")
+     * @return
+     */
+    public static Date numberDateFormatToDate(String timestamp, String simpleDateFormatType) {
+        SimpleDateFormat sdf = new SimpleDateFormat(simpleDateFormatType);//要转换的时间格式
+        Date date = null;
+        try {
+            if (timestamp.length() == THIRTEEN) {
+                date = sdf.parse(sdf.format(Long.parseLong(timestamp)));
+            } else {
+                date = sdf.parse(sdf.format(Long.parseLong(timestamp) * 1000));
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+
+    /**
+     * Date转10位13位时间戳
+     *
+     * @param date 参数date
+     * @param n    需要转换成几位时间戳
+     * @return
+     */
+    public static String numberDateFormatToDate(Date date, int n) {
+        String result = null;
+        if (n == THIRTEEN) {
+            result = String.valueOf(date.getTime());
+        } else {
+            result = String.valueOf(date.getTime() / 1000);
+        }
+        return result;
+    }
+
+    /**
+     * @Author:Bernie
+     * @Params: seconds 秒数
+     * @Description: 通过秒数转换为时分秒
+     * @Date: 2019/7/18 0018 16:46
+     */
+    public static String getTimeBySecond(long seconds) {
+        long days = seconds / 86400;//转换天数
+        seconds = seconds % 86400;//剩余秒数
+        long hours = seconds / 3600;//转换小时数
+        seconds = seconds % 3600;//剩余秒数
+        long minutes = seconds / 60;//转换分钟
+        seconds = seconds % 60;//剩余秒数
+        if (0 < days) {
+            return days + "天," + hours + "小时," + minutes + "分," + seconds + "秒";
+        } else {
+            return (hours == 0 ? "00" : (hours >= 10 ? hours : "0" + hours)) + ":" + (minutes == 0 ? "00" : (minutes >= 10 ? minutes : "0" + minutes)) + ":" + (seconds == 0 ? "00" : (seconds >= 10 ? seconds : "0" + seconds)) + "秒";
+        }
+
+    }
+
+    /**
+     * @return java.lang.String
+     * @Description 转换iso格式
+     * @Author CHENJUN
+     * @Date 2020/7/10 14:49
+     * @params [isoDate]
+     */
+    public static long getDateFromISO(String isoDate) {
+        DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+//        DateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            return sdf.parse(isoDate).getTime();
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    public static long getDateFromDate(String date) {
+        DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        DateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            return sdf.parse(date).getTime();
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    public static int getDifference(String start, String end) {
+        SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd");
+        /*天数差*/
+        Date fromDate1 = null, toDate1 = null;
+        try {
+            fromDate1 = simpleFormat.parse(start);
+            toDate1 = simpleFormat.parse(end);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        long from1 = fromDate1.getTime();
+        long to1 = toDate1.getTime();
+        int days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+        System.out.println("两个时间之间的天数差为:" + days);
+        return days;
+    }
+
+    /**
+     * @return 以小数格式显示的小时
+     * @Description 将毫秒转换成以小数格式显示的小时
+     * @Author SuiYingying
+     * @Date 2021/12/24 14:49
+     * @params time 毫秒格式的时间
+     */
+    public static String getHoursForLong(Long time) {
+        float newTime;
+        time = time / 1000;
+        newTime = (float) time % (1000 * 60 * 60 * 24) / (1000 * 60 * 60);
+        newTime = newTime * 1000;
+        return String.format("%.5f", newTime);
+    }
+
+
+    public static void main(String[] ager) throws InterruptedException {
+
+    }
+
+    /**
+     * ltf 获取
+     * 获取指定日期所在周的周一
+     * @param date
+     * @return
+     */
+    public static Date getFirstDayOfWeek(Date date) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(date);
+        if (c.get(Calendar.DAY_OF_WEEK) == 1) {
+            c.add(Calendar.DAY_OF_MONTH, -1);
+        }
+        c.add(Calendar.DATE, c.getFirstDayOfWeek() - c.get(Calendar.DAY_OF_WEEK) + 1);
+        return c.getTime();
+    }
+    /**
+     * 获取startDate日期后month月的日期
+     * @param startDate 开始日期
+     * @param month  几个月后
+     * @author wenzhang
+     * @return
+     */
+    public static Date getMonthDate(Date startDate, int month){
+        LocalDateTime localDateTime = startDate.toInstant()
+                .atZone(ZoneId.systemDefault() )
+                .toLocalDateTime().plusMonths(month);
+        Date date = Date.from(localDateTime.atZone( ZoneId.systemDefault()).toInstant());
+        return date;
+    }
+
+    /**
+     *
+     * @param days
+     * @author wenzhang
+     * @return
+     */
+    public static Date getDateAdd(int days){
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar c = Calendar.getInstance();
+        c.add(Calendar.DAY_OF_MONTH, days);
+        return c.getTime();
+
+    }
+
+    /**
+     * 计算两个日期的月数
+     * @param startDate
+     * @param endDate
+     * @return
+     */
+    public static int getMonthSpace(String startDate, String endDate) throws Exception {
+        int monthCount = 0;
+        Calendar startCalendar = Calendar.getInstance();
+        Calendar endCalendar = Calendar.getInstance();
+        startCalendar.setTime(new SimpleDateFormat("yyyy-MM-dd").parse(startDate));
+        endCalendar.setTime(new SimpleDateFormat("yyyy-MM-dd").parse(endDate));
+
+        int year = endCalendar.get(Calendar.YEAR) - startCalendar.get(Calendar.YEAR);
+        int month = endCalendar.get(Calendar.MONTH) - startCalendar.get(Calendar.MONTH);
+        int day = Math.abs(endCalendar.get(Calendar.DATE) - startCalendar.get(Calendar.DATE));
+
+        if (year == 0 && month == 0){
+            startCalendar.set(Calendar.DATE, 1);
+            endCalendar.set(Calendar.DATE, 1);
+            endCalendar.roll(Calendar.DATE, -1);
+            if (day == (endCalendar.get(Calendar.DATE) - startCalendar.get(Calendar.DATE))) {
+                monthCount = 1;// 两日期间满一个月
+            } else {
+                monthCount = 0;// 两日期间不足一个月
+            }
+        } else if (year != 0 && month == 0) {// 年份不同月份相同
+            if (startCalendar.get(Calendar.DATE) < endCalendar.get(Calendar.DATE)) {// 两日期间的天数,小于等于当月
+                monthCount = 1;
+            }
+            monthCount += year * 12 + month;
+        } else {
+            if (startCalendar.get(Calendar.DATE) >= endCalendar.get(Calendar.DATE)) {// 起始日期DATE 大于等于结束日期DATE
+                monthCount = year * 12 + month;
+            } else {
+                monthCount = year * 12 + month + 1;
+            }
+        }
+
+        return monthCount;
+    }
+
+}

+ 77 - 4
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java

@@ -1,5 +1,6 @@
 package com.sckw.fleet.controller;
 
+import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
@@ -7,6 +8,8 @@ import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
+import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.DateUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
@@ -20,12 +23,9 @@ import com.sckw.fleet.service.KwfTruckService;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @author zk
@@ -233,4 +233,77 @@ public class KwfTruckController {
         return truckService.transportLicenseEdit(params);
     }
 
+    /**
+     * @param params {truckNo 車牌號}
+     * @description 车辆查询(业务关联+归属车辆)
+     * @author zk
+     * @date 2023/7/26
+     **/
+    @PostMapping("/findTruck")
+    public HttpResult findTruck(@RequestBody Map params) {
+        params.put("entId", LoginUserHolder.getEntId());
+        List<KwfTruckVo> trucks = truckService.findPage(params);
+
+        List data = new ArrayList();
+        for (KwfTruckVo truck:trucks) {
+            data.add(new HashMap(){{put("truckNo", truck.getTruckNo());
+                put("entId", truck.getEntId()); put("firmName",
+                        truck.getFirmName()); put("businessStatus", truck.getStatusName());
+                        put("runStatus", 0);}});
+        }
+
+        return HttpResult.ok(data);
+    }
+
+    /**
+     * @param truckNos 車牌號集
+     * @description 车辆查询GPS(业务关联 + 归属车辆)
+     * @author zk
+     * @date 2023/7/26
+     **/
+    @PostMapping("/findTruckGps")
+    public HttpResult findTruckGps(@RequestBody List<String> truckNos) {
+        if (CollectionUtils.isEmpty(truckNos)) {
+            return HttpResult.ok();
+        }
+
+        List data = new ArrayList();
+        for (String truckNo:truckNos) {
+            data.add(new HashMap(){{
+                put("truckNo", truckNo);
+                put("speed", new Random().nextInt(100));
+                put("lng", "30."+new Random().nextInt(1000000));
+                put("lat", "103."+new Random().nextInt(1000000));
+                put("gpsTime", DateUtils.getCurrentTime());}});
+        }
+        return HttpResult.ok(data);
+    }
+
+    /**
+     * @param params {truckNos 車牌號集, startTime 開始實際, endTime 結束時間}
+     * @description 车辆查询GPS(通过车牌号查询)
+     * @author zk
+     * @date 2023/7/26
+     **/
+    @PostMapping("/findGpsByTruckNo")
+    public HttpResult findGpsByTruckNo(@RequestBody @Valid GpsByTruckNoDto params) {
+        Long hours = (params.getEndTime().getTime() - params.getStartTime().getTime()) /1000/60;
+        List data = new ArrayList();
+        data.add(new HashMap(){{put("truckNo", params.getTruckNo()); put("speed", 95.0);
+            put("lng", "30.60513"); put("lat", "104.05079");
+            put("gpsTime", DateUtils.format(params.getStartTime(), DateUtils.DATE_TIME_PATTERN));}});
+        for (long i=0; i<hours; i++) {
+            data.add(new HashMap(){{
+                put("truckNo", params.getTruckNo());
+                put("speed", new Random().nextInt(100));
+                put("lng", "30."+new Random().nextInt(1000000));
+                put("lat", "103."+new Random().nextInt(1000000));
+                put("gpsTime", DateUtils.getCurrentTime());}});
+        }
+        data.add(new HashMap(){{put("truckNo", params.getTruckNo()); put("speed", 95.0);
+            put("lng", "29.524931"); put("lat", "103.734587");
+            put("gpsTime", DateUtils.format(params.getEndTime(), DateUtils.DATE_TIME_PATTERN));}});
+        return HttpResult.ok(data);
+    }
+
 }

+ 39 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/GpsByTruckNoDto.java

@@ -0,0 +1,39 @@
+package com.sckw.fleet.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.util.Date;
+
+/**
+ * @author zk
+ * @desc TODO
+ * @date 2023/7/26 0026
+ */
+@Data
+public class GpsByTruckNoDto {
+
+    /**
+     *車牌號集
+     */
+    @NotBlank(message = "车牌号不能为空!")
+    private String truckNo;
+
+    /**
+     *開始實際
+     */
+    @NotNull(message = "开始时间不能为空!")
+    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date startTime;
+
+    /**
+     *結束時間
+     */
+    @NotNull(message = "结束时间不能为空!")
+    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date endTime;
+}

+ 0 - 50
sckw-modules/sckw-report/src/main/java/com/sckw/report/enums/CarWaybillEnum.java

@@ -1,50 +0,0 @@
-package com.sckw.report.enums;
-
-public enum CarWaybillEnum {
-    PENDING_ORDER(1, "pendingOrder", "1", "待接单"),
-    PENDING_VEHICLE(2, "pendingVehicle", "2", "待出车"),
-    EXIT_COMPLETED(3, "exitCompleted", "3", "已出车"),
-    WAIT_LOADING(4, "waitLoading", "4", "到达装货点"),
-    COMPLETION_LOADING(5, "completionLoading", "5", "已装货"),
-    WAIT_UNLOADING(6, "waitUnloading", "6", "到达卸货点"),
-    COMPLETION_UNLOADING(7, "completionUnloading", "7", "已卸货"),
-    APPROVAL_COMPLETED(8, "approvalCompleted", "8", "已核单"),
-    REJECT_ORDER(9, "rejectOrder", "9", "拒接单");
-
-    private final Integer code;
-    private final String value;
-    private final String status;
-    private final String destination;
-
-    public Integer getCode() {
-        return code;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public String getStatus() {
-        return status;
-    }
-
-    public String getDestination() {
-        return destination;
-    }
-
-    CarWaybillEnum(Integer code, String value, String status, String destination) {
-        this.code = code;
-        this.value = value;
-        this.status = status;
-        this.destination = destination;
-    }
-
-    public static String getLogisticsOrderValue(Integer code) {
-        for (CarWaybillEnum waybillEnum : CarWaybillEnum.values()) {
-            if (waybillEnum.getCode().equals(code)) {
-                return waybillEnum.getValue();
-            }
-        }
-        return null;
-    }
-}

+ 1 - 1
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwTransportService.java

@@ -1,6 +1,7 @@
 package com.sckw.report.service;
 
 import com.sckw.core.common.enums.NumberConstant;
+import com.sckw.core.model.enums.CarWaybillEnum;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
@@ -12,7 +13,6 @@ import com.sckw.mongo.model.SckwLogisticsOrder;
 import com.sckw.mongo.model.SckwWaybillOrder;
 import com.sckw.mongo.model.TableTops;
 import com.sckw.report.dao.SckwLogisticsOrderRepository;
-import com.sckw.report.enums.CarWaybillEnum;
 import com.sckw.report.service.param.WaybillOrderQuery;
 import com.sckw.report.service.vo.CarWaybillVo;
 import com.sckw.report.service.vo.WaybillsCountVo;

+ 24 - 3
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtWaybillOrderController.java

@@ -1,7 +1,6 @@
 package com.sckw.transport.controller;
 
 import com.sckw.core.utils.CollectionUtils;
-import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.model.ValiList;
 import com.sckw.core.web.response.HttpResult;
@@ -64,7 +63,7 @@ public class KwtWaybillOrderController {
     }
 
     /**
-     * 承运订单更换司机
+     * 承运订单-更换司机
      * @param dto
      * @return
      */
@@ -79,7 +78,7 @@ public class KwtWaybillOrderController {
     }
 
     /**
-     * 承运订单更换车辆
+     * 承运订单-更换车辆
      * @param dto
      * @return
      */
@@ -140,6 +139,28 @@ public class KwtWaybillOrderController {
         return waybillOrderService.refuseSendCar(params);
     }
 
+    /**
+     * @param params {}
+     * @description 确认出车
+     * @author zk
+     * @date 2023/7/26
+     **/
+    @PostMapping("/confirmDeparture")
+    public HttpResult confirmDeparture(@RequestBody @Valid ConfirmRefuseSendCarDto params){
+        return waybillOrderService.confirmSendCar(params);
+    }
+
+    /**
+     * @param params {}
+     * @description 拒绝出车
+     * @author zk
+     * @date 2023/7/26
+     **/
+    @PostMapping("/confirmDeparture")
+    public HttpResult refuseDeparture(@RequestBody @Valid ConfirmRefuseSendCarDto params){
+        return waybillOrderService.refuseSendCar(params);
+    }
+
 
 
     //取消派车(未接单前)

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

@@ -6,8 +6,10 @@ import com.sckw.core.web.response.HttpResult;
 import com.sckw.transport.model.dto.OrderFinishDTO;
 import com.sckw.transport.model.param.LogisticsConsignmentParam;
 import com.sckw.transport.service.LogisticsConsignmentService;
+import io.seata.spring.annotation.GlobalTransactional;
 import jakarta.validation.Valid;
 import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -76,7 +78,7 @@ public class LogisticsConsignmentController {
      */
     @Validated
     @RequestMapping(value = "/purchaseCancelConsign", method = RequestMethod.POST)
-//    @GlobalTransactional(name = "default_tx_group")
+    @GlobalTransactional(name = "default_tx_group")
     public HttpResult purchaseCancelConsign(@RequestParam("ids") @NotBlank(message = "单据不能为空") List<String> ids) {
         log.info("采购订单-托运订单列表-撤销托运:{}", JSONObject.toJSONString(ids));
         try {
@@ -109,6 +111,23 @@ public class LogisticsConsignmentController {
         }
     }
 
+    /**
+     * 采购订单-托运订单列表-订单完结-数据查询
+     * @param orderId   物流订单id
+     * @return
+     */
+    @Validated
+    @RequestMapping(value = "/selectPurchaseOrderFinish", method = RequestMethod.GET)
+    public HttpResult selectPurchaseOrderFinish(@RequestParam("orderId") @NotNull(message = "数据id不能为空") String orderId) {
+        log.info("采购订单-托运订单列表-订单完结-数据查询 传递参数信息:{}", orderId);
+        try {
+            return logisticsConsignmentService.selectOrderFinishVo(orderId, "1");
+        } catch (Exception e) {
+            log.error("采购订单-托运订单列表-订单完结-数据查询 error :{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
     /**
      * 采购订单-托运订单列表-完结订单
      * @param OrderFinishDTO
@@ -189,7 +208,7 @@ public class LogisticsConsignmentController {
      * @return
      */
     @RequestMapping(value = "/sellCancelConsign", method = RequestMethod.GET)
-//    @GlobalTransactional(name = "default_tx_group")
+    @GlobalTransactional(name = "default_tx_group")
     public HttpResult sellCancelConsign(@RequestParam("ids") @NotBlank(message = "单据id不能为空") List<String> ids) {
         log.info("销售订单-车辆列表 传递参数信息:{}", JSONObject.toJSONString(ids));
         try {
@@ -200,6 +219,23 @@ public class LogisticsConsignmentController {
         }
     }
 
+    /**
+     * 销售订单-托运订单列表-订单完结-数据查询
+     * @param orderId   物流订单id
+     * @return
+     */
+    @Validated
+    @RequestMapping(value = "/selectSellOrderFinish", method = RequestMethod.GET)
+    public HttpResult selectSellOrderFinish(@RequestParam("orderId") @NotNull(message = "数据id不能为空") String orderId) {
+        log.info("销售订单-托运订单列表-订单完结-数据查询 传递参数信息:{}", orderId);
+        try {
+            return logisticsConsignmentService.selectOrderFinishVo(orderId, "2");
+        } catch (Exception e) {
+            log.error("销售订单-托运订单列表-订单完结-数据查询 error :{}", e.getMessage(), e);
+            return HttpResult.error(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
+    }
+
     /**
      * 销售订单-托运订单列表-完结订单
      * @param orderFinishDTO

+ 8 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java

@@ -7,6 +7,7 @@ import com.sckw.transport.model.KwtLogisticsOrder;
 import com.sckw.transport.model.param.DriverParam;
 import com.sckw.transport.model.param.LogisticsOrderParam;
 import com.sckw.transport.model.vo.DriverListVo;
+import com.sckw.transport.model.vo.OrderFinishVO;
 import com.sckw.transport.model.vo.SubcontractConsignmentVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -92,4 +93,11 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
      * @return
      */
     List<LogisticsOrderVO> selectLogisticOrderList(@Param("ids") List<String> ids);
+
+    /**
+     * 通过物流订单id获取统计数据
+     * @param orderId
+     * @return
+     */
+    OrderFinishVO selectOrderFinishData(@Param("orderId") String orderId);
 }

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

@@ -39,6 +39,7 @@ public interface KwtWaybillOrderMapper extends BaseMapper<KwtWaybillOrder> {
 
     /**
      * 根据司机id+运单状态获取物流订单id
+     *
      * @param id
      * @param status
      * @return
@@ -47,9 +48,18 @@ public interface KwtWaybillOrderMapper extends BaseMapper<KwtWaybillOrder> {
 
     /**
      * 根基运单ID查询关联数据
+     *
      * @param id
      * @return
      */
     WayBillDetailDTO selectWaybillRelate(@Param("id") Long id);
 
+    /**
+     * 通过物流订单id+车辆运单状态查询是否存在处理中的数据
+     *
+     * @param id
+     * @param statusList
+     * @return
+     */
+    int selectDataByLorderId(@Param("id") String id, @Param("statusList") List<Integer> statusList);
 }

+ 10 - 10
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/OrderFinishDTO.java

@@ -24,19 +24,19 @@ public class OrderFinishDTO {
     @Length(max = 200,message = "单据编号长度错误最大长度:{max}")
     private String remark;
     /**
-     * 
+     * 装货
      */
 
-    @Digits(integer = 10, fraction=2, message = "量格式错误")
-    @DecimalMin(value = "0.00", message = "总量最小值不能低于0.00元")
+    @Digits(integer = 10, fraction=2, message = "装货量格式错误")
+    @DecimalMin(value = "0.00", message = "装货量最小值不能低于0.00")
 //    @DecimalMax(value = "10.00", message = "资金最大值不能高于10.00元")
-    @NotNull(message = "量不可为空")
-    private BigDecimal amount;
+    @NotNull(message = "装货量不可为空")
+    private BigDecimal loadAmount;
     /**
-     * 交付
+     * 卸货
      */
-    @Digits(integer = 10, fraction=2, message = "交付量格式错误")
-    @DecimalMin(value = "0.00", message = "交付量最小值不能低于0.00元")
-    @NotNull(message = "交付量不可为空")
-    private BigDecimal entrustAmount;
+    @Digits(integer = 10, fraction=2, message = "卸货量格式错误")
+    @DecimalMin(value = "0.00", message = "卸货量最小值不能低于0.00")
+    @NotNull(message = "卸货量不可为空")
+    private BigDecimal unloadAmount;
 }

+ 26 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/OrderFinishVO.java

@@ -0,0 +1,26 @@
+package com.sckw.transport.model.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author lfdc
+ * @description 完结订单数据展示返回vo
+ * @date 2023-07-26 08:07:50
+ */
+@Data
+public class OrderFinishVO {
+    /**
+     * 总运单次数
+     */
+    private Integer number;
+    /**
+     * 总卸货量
+     */
+    private BigDecimal unloadAmount;
+    /**
+     * 总装货量
+     */
+    private BigDecimal loadAmount;
+}

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

@@ -723,6 +723,7 @@ public class AcceptCarriageOrderService {
                     logisticsOrderCirculateMapper.update(null, new LambdaUpdateWrapper<KwtLogisticsOrderCirculate>()
                             .set(KwtLogisticsOrderCirculate::getStatus, NumberConstant.ONE)
                             .eq(KwtLogisticsOrderCirculate::getWOrderId, wOrderId));
+//                    /**更新MongoDB*/
                     jsonObject.put("status", HttpStatus.SUCCESS_CODE);
                     jsonObject.put("message", "停止接单成功");
                 }
@@ -783,6 +784,16 @@ public class AcceptCarriageOrderService {
             orderTrack.setUpdateBy(LoginUserHolder.getUserId());
             orderTrack.setUpdateTime(new Date());
             waybillOrderTrackMapper.insert(orderTrack);
+            /**修改mongodb*/
+            //mongodb更新订单状态
+            SckwWaybillOrder updateParam = new SckwWaybillOrder();
+            updateParam.setWOrderId(Long.parseLong(id)).setStatus(CarWaybillEnum.REVOKED.getCode())
+                    .setUpdateBy(LoginUserHolder.getUserId()).setUpdateByName(LoginUserHolder.getUserName()).setUpdateTime(new Date());
+            SckwBusSum busSum = new SckwBusSum();
+            busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
+            busSum.setMethod(2);
+            busSum.setObject(updateParam);
+            streamBridge.send("sckw-busSum", com.alibaba.fastjson2.JSON.toJSONString(busSum));
             result.put("status", HttpStatus.SUCCESS_CODE);
             result.put("message", "取消成功");
         }

+ 157 - 5
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java

@@ -3,9 +3,11 @@ package com.sckw.transport.service;
 import cn.hutool.core.util.ArrayUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.sckw.core.common.enums.NumberConstant;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
+import com.sckw.core.model.enums.CarWaybillEnum;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.CollectionUtils;
@@ -32,6 +34,7 @@ import com.sckw.transport.model.dto.LogisticsOrderDTO;
 import com.sckw.transport.model.dto.OrderCarDTO;
 import com.sckw.transport.model.dto.OrderFinishDTO;
 import com.sckw.transport.model.param.LogisticsConsignmentParam;
+import com.sckw.transport.model.vo.OrderFinishVO;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -670,7 +673,7 @@ public class LogisticsConsignmentService {
              */
             KwtLogisticsOrder kwtLogisticsOrder = kwtLogisticsOrderMapper.selectOne(new LambdaUpdateWrapper<KwtLogisticsOrder>()
                     .eq(KwtLogisticsOrder::getId, s));
-            if (kwtLogisticsOrder == null || (!String.valueOf(LogisticsOrderEnum.PENDING_ORDER.getCode()).equals(kwtLogisticsOrder.getStatus()))) {
+            if (kwtLogisticsOrder == null || (!LogisticsOrderEnum.PENDING_ORDER.getStatus().equals(String.valueOf(kwtLogisticsOrder.getStatus())))) {
                 log.info("物流订单单据id:{}", s);
                 jsonObject.put("message", "单据状态异常或单据不存在");
                 jsonObject.put("status", HttpStatus.GLOBAL_EXCEPTION_CODE);
@@ -715,7 +718,7 @@ public class LogisticsConsignmentService {
         } else {
             throw new RuntimeException("完结订单-单据类型异常!");
         }
-        return null;
+        return HttpResult.ok("完结订单-成功");
     }
 
     /**
@@ -725,9 +728,65 @@ public class LogisticsConsignmentService {
      */
     private void sellOrderFinish(OrderFinishDTO orderFinishDTO) {
         /** 订单完结 物流运单状态为【待派车】、【运输中】可操作*/
-        /**完结拦截 必须车辆运单无正在运输中的单据才能完结*/
-        /**完结订单 不做页面填写数量与数据库数量进行计算验证*/
-
+        /**完结拦截 必须车辆运单无正在运输中的单据才能完结 状态有 待接单之后已核弹之前的状态 都不能完结*/
+        /**完结订单 不做页面填写数量与数据库数量进行计算验证-直接获取页面填写数据进行保存处理*/
+        //物流订单id
+        String id = orderFinishDTO.getId();
+        KwtLogisticsOrder logisticsOrder = kwtLogisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
+                .eq(KwtLogisticsOrder::getId, id));
+        if (logisticsOrder == null) {
+            throw new RuntimeException("采购订单-完结订单-物流单据不存在!");
+        }
+        /**订单状态验证*/
+        if (!LogisticsOrderEnum.WAIT_DELIVERY.getStatus().equals(String.valueOf(logisticsOrder.getStatus()))
+                && !LogisticsOrderEnum.IN_TRANSIT.getStatus().equals(String.valueOf(logisticsOrder.getStatus()))) {
+            throw new RuntimeException("当前运单并不属于【待派车】,【运输中】状态");
+        }
+        /**完结拦截*/
+        List<Integer> statusList = new ArrayList<>();
+        statusList.add(CarWaybillEnum.PENDING_VEHICLE.getCode());
+        statusList.add(CarWaybillEnum.EXIT_COMPLETED.getCode());
+        statusList.add(CarWaybillEnum.WAIT_LOADING.getCode());
+        statusList.add(CarWaybillEnum.COMPLETION_LOADING.getCode());
+        statusList.add(CarWaybillEnum.WAIT_UNLOADING.getCode());
+        statusList.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
+        int count = waybillOrderMapper.selectDataByLorderId(id, statusList);
+        if (count > NumberConstant.ZERO) {
+            throw new RuntimeException("检测您现在有运单正在执行中,该订单目前不可完结,请先将运单执行完毕");
+        }
+        /**单据完结修改状态以及数据*/
+        logisticsOrder.setStatus(LogisticsOrderEnum.HAVE_FINISHED.getCode());
+        logisticsOrder.setLoadAmount(orderFinishDTO.getLoadAmount());
+        logisticsOrder.setUnloadAmount(orderFinishDTO.getUnloadAmount());
+        logisticsOrder.setCreateBy(LoginUserHolder.getUserId());
+        logisticsOrder.setUpdateTime(new Date());
+        logisticsOrder.setRemark(orderFinishDTO.getRemark());
+        kwtLogisticsOrderMapper.updateById(logisticsOrder);
+        KwtLogisticsOrderTrack track = new KwtLogisticsOrderTrack();
+        track.setId(new IdWorker(NumberConstant.ONE).nextId());
+        track.setLOrderId(logisticsOrder.getId());
+        track.setStatus(LogisticsOrderEnum.HAVE_FINISHED.getCode());
+        track.setCreateTime(new Date());
+        track.setRemark(orderFinishDTO.getRemark());
+        track.setCreateBy(LoginUserHolder.getUserId());
+        track.setUpdateBy(LoginUserHolder.getUserId());
+        track.setUpdateTime(new Date());
+        kwtLogisticsOrderTrackMapper.insert(track);
+        /**单据完结修改Mongodb*/
+        SckwLogisticsOrder updateParam = new SckwLogisticsOrder();
+        updateParam.setLOrderId(Long.parseLong(id))
+                .setStatus(LogisticsOrderEnum.HAVE_FINISHED.getStatus())
+                .setUpdateBy(LoginUserHolder.getUserId())
+                .setUpdateByName(LoginUserHolder.getUserName())
+                .setUpdateTime(new Date())
+                .setLoadAmount(orderFinishDTO.getLoadAmount())
+                .setUnloadAmount(orderFinishDTO.getUnloadAmount())
+        ;
+        SckwBusSum busSum = new SckwBusSum();
+        busSum.setBusSumType(BusinessTypeEnum.LOGISTICS_ORDER_TYPE.getName());
+        busSum.setMethod(2);
+        busSum.setObject(updateParam);
+        streamBridge.send("sckw-busSum", com.alibaba.fastjson2.JSON.toJSONString(busSum));
     }
 
     /**
@@ -736,6 +795,99 @@ public class LogisticsConsignmentService {
      * @param orderFinishDTO
      */
     private void purchaseOrderFinish(OrderFinishDTO orderFinishDTO) {
+        /** 订单完结 物流运单状态为【待派车】、【运输中】可操作*/
+        /**完结拦截 必须车辆运单无正在运输中的单据才能完结 状态有 待接单之后已核弹之前的状态 都不能完结*/
+        /**完结订单 不做页面填写数量与数据库数量进行计算验证-直接获取页面填写数据进行保存处理*/
+        //物流订单id
+        String id = orderFinishDTO.getId();
+        KwtLogisticsOrder logisticsOrder = kwtLogisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
+                .eq(KwtLogisticsOrder::getId, id));
+        if (logisticsOrder == null) {
+            throw new RuntimeException("采购订单-完结订单-物流单据不存在!");
+        }
+        /**订单状态验证*/
+        if (!LogisticsOrderEnum.WAIT_DELIVERY.getStatus().equals(String.valueOf(logisticsOrder.getStatus()))
+                && !LogisticsOrderEnum.IN_TRANSIT.getStatus().equals(String.valueOf(logisticsOrder.getStatus()))) {
+            throw new RuntimeException("当前运单并不属于【待派车】,【运输中】状态");
+        }
+        /**完结拦截*/
+        List<Integer> statusList = new ArrayList<>();
+        statusList.add(CarWaybillEnum.PENDING_VEHICLE.getCode());
+        statusList.add(CarWaybillEnum.EXIT_COMPLETED.getCode());
+        statusList.add(CarWaybillEnum.WAIT_LOADING.getCode());
+        statusList.add(CarWaybillEnum.COMPLETION_LOADING.getCode());
+        statusList.add(CarWaybillEnum.WAIT_UNLOADING.getCode());
+        statusList.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
+        int count = waybillOrderMapper.selectDataByLorderId(id, statusList);
+        if (count > NumberConstant.ZERO) {
+            throw new RuntimeException("检测您现在有运单正在执行中,该订单目前不可完结,请先将运单执行完毕");
+        }
+        /**单据完结修改状态以及数据*/
+        logisticsOrder.setStatus(LogisticsOrderEnum.HAVE_FINISHED.getCode());
+        logisticsOrder.setLoadAmount(orderFinishDTO.getLoadAmount());
+        logisticsOrder.setUnloadAmount(orderFinishDTO.getUnloadAmount());
+        logisticsOrder.setCreateBy(LoginUserHolder.getUserId());
+        logisticsOrder.setUpdateTime(new Date());
+        logisticsOrder.setRemark(orderFinishDTO.getRemark());
+        kwtLogisticsOrderMapper.updateById(logisticsOrder);
+        KwtLogisticsOrderTrack track = new KwtLogisticsOrderTrack();
+        track.setId(new IdWorker(NumberConstant.ONE).nextId());
+        track.setLOrderId(logisticsOrder.getId());
+        track.setStatus(LogisticsOrderEnum.HAVE_FINISHED.getCode());
+        track.setCreateTime(new Date());
+        track.setRemark(orderFinishDTO.getRemark());
+        track.setCreateBy(LoginUserHolder.getUserId());
+        track.setUpdateBy(LoginUserHolder.getUserId());
+        track.setUpdateTime(new Date());
+        kwtLogisticsOrderTrackMapper.insert(track);
+        /**单据完结修改Mongodb*/
+        SckwLogisticsOrder updateParam = new SckwLogisticsOrder();
+        updateParam.setLOrderId(Long.parseLong(id))
+                .setStatus(LogisticsOrderEnum.HAVE_FINISHED.getStatus())
+                .setUpdateBy(LoginUserHolder.getUserId())
+                .setUpdateByName(LoginUserHolder.getUserName())
+                .setUpdateTime(new Date())
+                .setLoadAmount(orderFinishDTO.getLoadAmount())
+                .setUnloadAmount(orderFinishDTO.getUnloadAmount())
+        ;
+        SckwBusSum busSum = new SckwBusSum();
+        busSum.setBusSumType(BusinessTypeEnum.LOGISTICS_ORDER_TYPE.getName());
+        busSum.setMethod(2);
+        busSum.setObject(updateParam);
+        streamBridge.send("sckw-busSum", com.alibaba.fastjson2.JSON.toJSONString(busSum));
+    }
 
+    /**
+     * 采购订单/销售订单-托运订单列表-订单完结-数据查询
+     *
+     * @param orderId 物流订单id
+     * @param type    1采购订单2销售订单
+     * @return
+     */
+    public HttpResult selectOrderFinishVo(String orderId, String type) {
+        HttpResult httpResult = new HttpResult();
+        httpResult.setCode(HttpStatus.SUCCESS_CODE);
+        if (String.valueOf(NumberConstant.ONE).equals(type)) {
+            httpResult = selectOrderFinishData(orderId);
+        } else if (String.valueOf(NumberConstant.TWO).equals(type)) {
+            httpResult = selectOrderFinishData(orderId);
+        } else {
+            httpResult.setCode(HttpStatus.SUCCESS_CODE);
+            httpResult.setMsg("订单完结查询,类型错误!");
+        }
+        return httpResult;
+    }
+
+    /**
+     * 采购订单/销售订单-托运订单列表-订单完结-数据查询
+     *
+     * @param orderId 物流订单id
+     * @return
+     */
+    private HttpResult selectOrderFinishData(String orderId) {
+        HttpResult httpResult = new HttpResult();
+        OrderFinishVO orderFinishVO = kwtLogisticsOrderMapper.selectOrderFinishData(orderId);
+        httpResult.setData(orderFinishVO);
+        return httpResult;
     }
 }

+ 5 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/TransportCommonService.java

@@ -300,6 +300,11 @@ public class TransportCommonService {
         return result;
     }
 
+    /**
+     * 对账管理-运费收款对账界面查询接口
+     * @param logisticsOrderParam
+     * @return
+     */
     public HttpResult getAcceptCarriageOrder(LogisticsOrderParam logisticsOrderParam) {
         SysDictResDto sysDictResDto = remoteSystemService.queryDictByTypeAndValue(logisticsOrderParam.getPaymentType(), logisticsOrderParam.getPayment());
         Long dictId = sysDictResDto.getId();

+ 15 - 0
sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

@@ -358,4 +358,19 @@
         </where>
         ORDER BY a.create_time DESC
     </select>
+
+    <select id="selectOrderFinishData" resultType="com.sckw.transport.model.vo.OrderFinishVO">
+        SELECT COUNT(a.id) AS number,
+        SUM(IFNULL(a.load_amount, 0)) as loadAmount,
+        SUM(IFNULL(a.unload_amount, 0)) AS unloadAmount
+        FROM kwt_waybill_order a
+        LEFT JOIN kwt_logistics_order b ON b.id = a.l_order_id
+        AND a.del_flag = 0
+        AND b.del_flag = 0
+        <where>
+            <if test="orderId != null and orderId != ''">
+                and b.id=#{orderId}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 52 - 35
sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderMapper.xml

@@ -33,16 +33,16 @@
     update_time, del_flag,start_time,end_time
     </sql>
     <select id="selectWaybillOrderCarList" resultType="com.sckw.transport.model.dto.OrderCarDTO">
-        SELECT a.id               as wOrderId,
-               a.w_order_no       as wOrderNo,
-               a.driver_id        as driverId,
-               a.driver_name      as driverName,
-               a.driver_phone     as driverPhone,
-               a.driver_idcard    as driverIdcard,
-               a.l_order_id       as lOrderId,
-               b.l_order_no       as lOrderNo,
-               b.t_order_id       as tOrderId,
-               b.t_order_no       as tOrderNo
+        SELECT a.id            as wOrderId,
+               a.w_order_no    as wOrderNo,
+               a.driver_id     as driverId,
+               a.driver_name   as driverName,
+               a.driver_phone  as driverPhone,
+               a.driver_idcard as driverIdcard,
+               a.l_order_id    as lOrderId,
+               b.l_order_no    as lOrderNo,
+               b.t_order_id    as tOrderId,
+               b.t_order_no    as tOrderNo
         FROM kwt_waybill_order a
                  LEFT JOIN kwt_logistics_order b ON a.l_order_id = b.id
         WHERE a.del_flag = '0'
@@ -80,34 +80,30 @@
         group by lOrderId
     </select>
     <select id="getWaybillData" resultType="com.sckw.transport.model.vo.WaybillDetailVO">
-
     </select>
 
     <select id="selectWaybillRelate" resultType="com.sckw.transport.model.dto.WayBillDetailDTO">
-        SELECT
-            `order`.`id` AS `wOrderId`,
-            `order`.`w_order_no` AS `wOrderNo`,
-            `order`.`truck_no` AS `truckNo`,
-            `order`.`entrust_amount` AS `entrustAmount`,
-            `order`.`truck_id` AS `truckId`,
-            `order`.`driver_id` AS `driverId`,
-            `order`.`driver_name` AS `driverName`,
-            `order`.`driver_phone` AS `driverPhone`,
-            `order`.`driver_idcard` AS `driverIdcard`,
-            `order`.`type`,
-            `order`.`start_time` AS `startTime`,
-            `order`.`end_time` AS `endTime`,
-            `order`.`create_by` AS `createBy`,
-            `logistics`.`id` AS `lOrderId`,
-            `logistics`.`l_order_no` AS `lOrderNo`,
-            `logistics`.`price_type` AS `priceType`,
-            `goods`.`goods_name` AS goodsName
-        FROM
-            `kwt_waybill_order` `order`
-                LEFT JOIN `kwt_logistics_order` `logistics` ON `logistics`.`id` = `order`.`l_order_id`
-                LEFT JOIN `kwt_logistics_order_goods` `goods` ON `goods`.`l_order_id` = `order`.`l_order_id`
-        WHERE
-            `order`.`id` = #{id,jdbcType=BIGINT}
+        SELECT `order`.`id`             AS `wOrderId`,
+               `order`.`w_order_no`     AS `wOrderNo`,
+               `order`.`truck_no`       AS `truckNo`,
+               `order`.`entrust_amount` AS `entrustAmount`,
+               `order`.`truck_id`       AS `truckId`,
+               `order`.`driver_id`      AS `driverId`,
+               `order`.`driver_name`    AS `driverName`,
+               `order`.`driver_phone`   AS `driverPhone`,
+               `order`.`driver_idcard`  AS `driverIdcard`,
+               `order`.`type`,
+               `order`.`start_time`     AS `startTime`,
+               `order`.`end_time`       AS `endTime`,
+               `order`.`create_by`      AS `createBy`,
+               `logistics`.`id`         AS `lOrderId`,
+               `logistics`.`l_order_no` AS `lOrderNo`,
+               `logistics`.`price_type` AS `priceType`,
+               `goods`.`goods_name`     AS goodsName
+        FROM `kwt_waybill_order` `order`
+                 LEFT JOIN `kwt_logistics_order` `logistics` ON `logistics`.`id` = `order`.`l_order_id`
+                 LEFT JOIN `kwt_logistics_order_goods` `goods` ON `goods`.`l_order_id` = `order`.`l_order_id`
+        WHERE `order`.`id` = #{id,jdbcType=BIGINT}
     </select>
 
     <select id="statistics" resultType="com.sckw.mongo.model.TableTops">
@@ -128,4 +124,25 @@
             </if>
         </where>
     </select>
+
+    <select id="selectDataByLorderId" resultType="int">
+        SELECT
+        COUNT(b.id)
+        FROM
+        kwt_waybill_order a
+        LEFT JOIN kwt_logistics_order b ON a.l_order_id = b.id
+        AND a.del_flag = 0
+        AND b.del_flag = 0
+        <where>
+            <if test="id != null and id !=''">
+                and b.id = #{id}
+            </if>
+            <if test="statusList != null and statusList.size() >0">
+                AND a.`status` IN
+                <foreach collection="statusList" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
 </mapper>