Răsfoiți Sursa

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

lengfaqiang 2 ani în urmă
părinte
comite
64f0055423
97 a modificat fișierele cu 3296 adăugiri și 390 ștergeri
  1. 4 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/CarWaybillEnum.java
  2. 1 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/page/PageRes.java
  3. 134 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/DateUtils.java
  4. 31 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/OrderUtils.java
  5. 344 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/request/HttpClientUtil.java
  6. 56 11
      sckw-common/sckw-common-stream/src/main/java/com/sckw/stream/enums/MessageEnum.java
  7. 0 24
      sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/CashItem.java
  8. 10 0
      sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/WalletDto.java
  9. 10 1
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/dubbo/TransportDubboService.java
  10. 36 0
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/RWaybillOrderDto.java
  11. 128 0
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/vo/RWaybillOrderVo.java
  12. 1 1
      sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TestController.java
  13. 5 0
      sckw-modules/sckw-fleet/pom.xml
  14. 1 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfFleetController.java
  15. 11 35
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java
  16. 16 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java
  17. 1 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTruckDto.java
  18. 54 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckGpsVo.java
  19. 38 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckMonitorVo.java
  20. 0 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfFleetService.java
  21. 303 10
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  22. 22 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml
  23. 2 0
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/ManageApplication.java
  24. 3 2
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/controller/KwmAddressController.java
  25. 27 0
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/CommonBusinessService.java
  26. 18 2
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java
  27. 12 0
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java
  28. 10 0
      sckw-modules/sckw-message/src/main/java/com/sckw/message/dao/KwmMessageMapper.java
  29. 3 0
      sckw-modules/sckw-message/src/main/java/com/sckw/message/model/vo/req/StatisticsMessagesReqVO.java
  30. 12 0
      sckw-modules/sckw-message/src/main/java/com/sckw/message/service/KwmMessageService.java
  31. 20 10
      sckw-modules/sckw-message/src/main/java/com/sckw/message/service/MessageService.java
  32. 53 26
      sckw-modules/sckw-message/src/main/resources/mapper/KwmMessageMapper.xml
  33. 4 5
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/OrderCheckDTO.java
  34. 60 77
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java
  35. 155 4
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/WalletController.java
  36. 13 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpWalletRefundMapper.java
  37. 33 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/job/AsyncPool.java
  38. 117 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpWalletRefund.java
  39. 54 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/CashEnum.java
  40. 9 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/PayCenterEnum.java
  41. 53 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/RefundEnum.java
  42. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/common/BusinessNo.java
  43. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/common/Page.java
  44. 6 5
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/CashPage.java
  45. 3 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/PrePayIndexPage.java
  46. 19 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/PrePayWalletPage.java
  47. 2 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/RecordPage.java
  48. 22 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashCount.java
  49. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashDetail.java
  50. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashDetailItem.java
  51. 37 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashItem.java
  52. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Channel.java
  53. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Detail.java
  54. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Filter.java
  55. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Freeze.java
  56. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/LogItem.java
  57. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/MemberCreate.java
  58. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/MemberRes.java
  59. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Money.java
  60. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Operate.java
  61. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/OperateDown.java
  62. 4 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Order.java
  63. 2 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PatchPay.java
  64. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PayIndex.java
  65. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PayRecord.java
  66. 2 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PayRecordPage.java
  67. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PrePayIndex.java
  68. 48 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PrePayWallet.java
  69. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Record.java
  70. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/RrePayDetail.java
  71. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Tips.java
  72. 21 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Wallet.java
  73. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/WalletInfo.java
  74. 42 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/WalletOverview.java
  75. 7 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/CashPageReq.java
  76. 41 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePay.java
  77. 23 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayCheck.java
  78. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayPage.java
  79. 41 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/Refund.java
  80. 4 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/RefundReq.java
  81. 41 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/TransferReq.java
  82. 27 6
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/FundVo.java
  83. 34 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/MorePageRes.java
  84. 3 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/WalletDetail.java
  85. 136 12
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/PayCenterService.java
  86. 437 83
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/WalletService.java
  87. 67 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/task/RefundTask.java
  88. 29 0
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpWalletRefundMapper.xml
  89. 25 9
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/CommonService.java
  90. 10 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java
  91. 1 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java
  92. 14 3
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtWaybillOrderController.java
  93. 11 3
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtWaybillOrderMapper.java
  94. 83 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/WaybillOrderTicketV1Dto.java
  95. 80 9
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java
  96. 39 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/dubbo/TransportDubboServiceImpl.java
  97. 49 5
      sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderMapper.xml

+ 4 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/CarWaybillEnum.java

@@ -57,6 +57,10 @@ public enum CarWaybillEnum {
      * 已核单-不通过
      */
     APPROVAL_NO_PASS(12, "revoked", "12", "审核不通过"),
+    /**
+     * 已核单-不通过
+     */
+    APPROVAL_IN(13, "approvalIn", "13", "单证更新审核中"),
     ;
 
     private final Integer code;

+ 1 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/page/PageRes.java

@@ -102,7 +102,7 @@ public class PageRes<T> {
         tPageRes.setPage(page);
         tPageRes.setPageSize(pageSize);
         tPageRes.setSize(list.size());
-        tPageRes.setPages(list.size() / pageSize);
+        tPageRes.setPages(list.size() / pageSize + 1);
         tPageRes.setList(list.stream().skip((long) (page - 1) * pageSize).limit(pageSize).toList());
         return tPageRes;
     }

+ 134 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/DateUtils.java

@@ -90,6 +90,16 @@ public class DateUtils extends DateUtil {
         return format(date, DATE_PATTERN);
     }
 
+    /**
+     * 日期格式化 日期格式为:yyyy-MM-dd HH:mm:ss
+     *
+     * @param date 日期
+     * @return 返回yyyy-MM-dd格式日期
+     */
+    public static String formatV1(Date date) {
+        return format(date, DATE_TIME_PATTERN);
+    }
+
     /**
      * 日期格式化 日期格式为:yyyy-MM-dd
      *
@@ -106,6 +116,25 @@ public class DateUtils extends DateUtil {
     }
 
 
+    /**
+     * 日期格式化 日期格式为:yyyy-MM-dd
+     *
+     * @param date    日期
+     * @return 返回yyMMdd格式日期
+     */
+    public static Date formatDate(String date) {
+        try {
+            if (date != null) {
+                SimpleDateFormat df = new SimpleDateFormat(DATE_TIME_PATTERN);
+                return df.parse(date);
+            }
+        } catch (Exception e){
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+
     /**
      * 日期格式化 日期格式为:yyyy-MM-dd
      *
@@ -365,9 +394,113 @@ public class DateUtils extends DateUtil {
         return Duration.between(now, nextDay).getSeconds();
     }
 
+    /**
+     * 对日期的【秒】进行加/减
+     *
+     * @param date    日期
+     * @param seconds 秒数,负数为减
+     * @return 加/减几秒后的日期
+     */
+    public static Date addDateSeconds(Date date, int seconds) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MINUTE, seconds);
+        return cal.getTime();
+    }
 
-    public static void main(String[] ager) throws InterruptedException {
+    /**
+     * 对日期的【分钟】进行加/减
+     * @param date    日期
+     * @param minutes 分钟数,负数为减
+     * @return 加/减几分钟后的日期
+     */
+    public static Date addDateMinutes(Date date, int minutes) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MINUTE, minutes);
+        return cal.getTime();
+    }
+
+    /**
+     * 对日期的【小时】进行加/减
+     * @param date  日期
+     * @param hours 小时数,负数为减
+     * @return 加/减几小时后的日期
+     */
+    public static Date addDateHours(Date date, int hours) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.HOUR, hours);
+        return cal.getTime();
+    }
+
+    /**
+     * 对日期的【天】进行加/减
+     * @param date 日期
+     * @param days 天数,负数为减
+     * @return 加/减几天后的日期
+     */
+    public static Date addDateDays(Date date, int days) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.DATE, days);
+        return cal.getTime();
+    }
+
+    /**
+     * 对日期的【周】进行加/减
+     * @param date  日期
+     * @param weeks 周数,负数为减
+     * @return 加/减几周后的日期
+     */
+    public static Date addDateWeeks(Date date, int weeks) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.DATE, weeks * 7);
+        return cal.getTime();
+    }
+
+    /**
+     * 对日期的【月】进行加/减
+     * @param date   日期
+     * @param months 月数,负数为减
+     * @return 加/减几月后的日期
+     */
+    public static Date addDateMonths(Date date, int months) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MONTH, months);
+        return cal.getTime();
+    }
+
+    /**
+     * 对日期的【年】进行加/减
+     * @param date  日期
+     * @param years 年数,负数为减
+     * @return 加/减几年后的日期
+     */
+    public static Date addDateYears(Date date, int years) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.YEAR, years);
+        return cal.getTime();
+    }
 
+    /**
+     * 时间比较大小
+     * @param date1  日期
+     * @param date2 年数,负数为减
+     * @return -1 date1小于date2、0 date1等于date2、1 date1大于date2
+     */
+    public static int compareTo(Date date1, Date date2) {
+        return date1.compareTo(date2);
+    }
+
+    public static void main(String[] ager) throws InterruptedException {
+        Date newTime = new Date();
+        Date time = addDateMinutes(new Date(), 10);
+        int result = newTime.compareTo(time);
+        System.out.println(result);
     }
 
     /**

+ 31 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/OrderUtils.java

@@ -0,0 +1,31 @@
+package com.sckw.core.utils;
+
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLong;
+
+@Component
+public class OrderUtils {
+    private static final String ORDER_DATE_FORMAT = "yyyyMMddHHmmss";
+    private static final int ORDER_NUMBER_WIDTH = 4;
+    private static final SimpleDateFormat sdf = new SimpleDateFormat(ORDER_DATE_FORMAT);
+    private static final ConcurrentHashMap<String, AtomicLong> orderCounters = new ConcurrentHashMap<>();
+    private static String currentDateStr = "";
+
+    public static String generateOrderNo(String prefix) {
+        String currentDateString = sdf.format(new Date());
+        if (!currentDateString.equals(currentDateStr)) {
+            orderCounters.put(prefix, new AtomicLong(0));
+            currentDateStr = currentDateString;
+        }
+        // 获取或创建与前缀相关联的订单号计数器
+        AtomicLong counter = orderCounters.computeIfAbsent(prefix, key -> new AtomicLong(0));
+        // 自增并获取当前订单号
+        long orderId = counter.incrementAndGet();
+        // 格式化订单号
+        return String.format("%s%s%0" + ORDER_NUMBER_WIDTH + "d", prefix, currentDateString, orderId);
+    }
+}

+ 344 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/request/HttpClientUtil.java

@@ -0,0 +1,344 @@
+package com.sckw.core.web.request;
+
+import com.alibaba.fastjson.JSON;
+import com.sckw.core.model.constant.Global;
+import com.sckw.core.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.conn.HttpHostConnectException;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @desc http请求工具类
+ * @Author dengyinghui
+ * @Date 2018年02月03日
+ */
+@Slf4j
+public class HttpClientUtil {
+
+    private static final String UTF_8 = "UTF-8";
+
+    /**
+     * POST请求
+     *
+     * @param url 请求地址
+     * @return 返回结果
+     * @Date 2018年02月03日
+     */
+    public static String post(String url) throws ClientProtocolException, IOException {
+        return post(url, Global.EMPTY_STRING);
+    }
+
+    /**
+     * POST请求
+     * @param url    请求地址
+     * @param params 请求参数
+     * @return 返回结果
+     * @Date 2018年02月03日
+     */
+    public static String post(String url, Map<String, Object> params) throws ClientProtocolException, IOException {
+        HttpPost httpPost = new HttpPost(url);
+        List<NameValuePair> pairs = null;
+        if (params != null && params.size() > 0) {
+            pairs = covertParams2Nvps(params);
+            try {
+                httpPost.setEntity(new UrlEncodedFormEntity(pairs, UTF_8));
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return handlerRequest(httpPost);
+    }
+
+    /**
+     * POST请求
+     * @param url    请求地址
+     * @param body 请求参数
+     * @param headsMap 请求参数
+     * @return 返回结果
+     * @Date 2018年02月03日
+     */
+    public static String postBody(String url, String body, Map<String, Object> headsMap) {
+        int successCode = 200;
+        log.debug("start:");
+        // 实例化httpClient
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        // 实例化post方法
+        HttpPost httpPost = new HttpPost(url);
+        //头
+        httpPost.setHeader("Content-Type", "application/json");
+        if (headsMap != null && !headsMap.isEmpty()) {
+            for (String key : headsMap.keySet()) {
+                httpPost.setHeader(key, (String) headsMap.get(key));
+            }
+        }
+        log.debug("initheader");
+        // 结果
+        CloseableHttpResponse response = null;
+        String content = null;
+        try {
+            log.debug("initbody");
+            // 将参数给post方法
+            if (body != null) {
+                StringEntity stringEntity = new StringEntity(body, "UTF-8");
+                httpPost.setEntity(stringEntity);
+            }
+            log.info(httpPost.toString());
+            // 执行post方法
+            response = httpclient.execute(httpPost);
+            log.info(response.getEntity().toString());
+            try {
+                content = EntityUtils.toString(response.getEntity(), "UTF-8");
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("HttpClientUtil.postBody:", e.getMessage());
+            } finally {
+                response.close();
+            }
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                httpclient.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return content;
+    }
+
+    /**
+     * POST请求
+     * @param url  请求地址
+     * @param data 字符参数参数
+     * @return 返回结果
+     * @Date 2018年02月03日
+     */
+    public static String post(String url, String data) {
+        HttpPost httpPost = new HttpPost(url);
+        httpPost.setHeader("Content-Type", "application/json");
+        try {
+            if (!StringUtils.validatorEmpty(data)) {
+                httpPost.setEntity(new StringEntity(data, UTF_8));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        CloseableHttpResponse response = null;
+        String content = null;
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        try {
+            response = httpclient.execute(httpPost);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        try {
+            try {
+                content = EntityUtils.toString(response.getEntity(), "UTF-8");
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return content;
+    }
+
+
+    /**
+     * GET请求
+     * @param url 请求地址
+     * @return 返回结果
+     * @Date 2018年02月03日
+     */
+    public static String get(String url) throws ClientProtocolException, IOException {
+        return get(url, null);
+    }
+
+    /**
+     * GET请求
+     * @param url    请求地址
+     * @param params 请求参数
+     * @return 返回结果
+     * @Date 2018年02月03日
+     */
+    public static String get(String url, Map<String, Object> params) throws ClientProtocolException, HttpHostConnectException, IOException {
+        URIBuilder ub = new URIBuilder();
+        ub.setPath(url);
+        if (params != null && params.size() > 0) {
+            List<NameValuePair> pairs = covertParams2Nvps(params);
+            ub.setParameters(pairs);
+        }
+        HttpGet httpGet = null;
+        try {
+            httpGet = new HttpGet(ub.build());
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return handlerRequest(httpGet);
+    }
+
+    /**
+     * 封装请求参数
+     * @param params 请求参数
+     * @return 返回结果
+     * @Date 2018年02月03日
+     */
+    private static List<NameValuePair> covertParams2Nvps(Map<String, Object> params) {
+        List<NameValuePair> pairs = new ArrayList<NameValuePair>();
+        for (Map.Entry<String, Object> param : params.entrySet()) {
+            pairs.add(new BasicNameValuePair(param.getKey(), String.valueOf(param.getValue())));
+        }
+        return pairs;
+    }
+
+    /**
+     * 处理Http请求
+     * @param httpRequestBase
+     * @return 返回结果
+     * @Date 2018年02月03日
+     */
+    private static String handlerRequest(HttpRequestBase httpRequestBase) throws ClientProtocolException, IOException {
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = httpClient.execute(httpRequestBase);
+        HttpEntity entity = response.getEntity();
+        if (entity != null) {
+            String result = EntityUtils.toString(entity, UTF_8);
+            response.close();
+            return result;
+        }
+        return null;
+    }
+
+    public static String postBody(String url, String body) {
+        int successCode = 200;
+        // 实例化httpClient
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        // 实例化post方法
+        HttpPost httpPost = new HttpPost(url);
+        // 结果
+        CloseableHttpResponse response = null;
+        String content = null;
+        httpPost.setHeader("Content-Type", "application/json");
+        httpPost.setHeader("token", null);
+        httpPost.setHeader("type", "pc");
+        httpPost.setHeader("version", "5");
+        try {
+            // 将参数给post方法
+            if (body != null) {
+                StringEntity stringEntity = new StringEntity(body, "UTF-8");
+                httpPost.setEntity(stringEntity);
+            }
+            // 执行post方法
+            response = httpclient.execute(httpPost);
+            try {
+                content = EntityUtils.toString(response.getEntity(), "UTF-8");
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("HttpClientUtil.postBody:", e.getMessage());
+            } finally {
+                response.close();
+            }
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                httpclient.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return content;
+    }
+
+    /**
+     * GET请求
+     * @param url    请求地址
+     * @return 返回结果
+     * @Date 2018年02月03日
+     */
+    public static String getBody(String url) {
+        // 实例化httpClient
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        // 实例化post方法
+        //HttpPost httpPost = new HttpPost(url);
+        HttpGet httpGet = new HttpGet(url);
+        // 结果
+        CloseableHttpResponse response = null;
+        String content = null;
+        httpGet.setHeader("Content-Type", "application/json");
+        try {
+            // 执行post方法
+            int successCode = 200;
+            response = httpclient.execute(httpGet);
+            try {
+                content = EntityUtils.toString(response.getEntity(), "UTF-8");
+            } finally {
+                response.close();
+            }
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                httpclient.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return content;
+    }
+
+    /**
+     * POST请求
+     * @param url    请求地址
+     * @param params 请求参数
+     * @return 返回结果
+     * @Date 2018年02月03日
+     */
+    public static String postByMapString(String url, Map<String, String> params) throws ClientProtocolException, IOException {
+        HttpPost httpPost = new HttpPost(url);
+        List<NameValuePair> pairs = null;
+        if (params != null && params.size() > 0) {
+            pairs = new ArrayList<>();
+            for (Map.Entry<String, String> param : params.entrySet()) {
+                pairs.add(new BasicNameValuePair(param.getKey(), param.getValue()));
+            }
+            try {
+                httpPost.setEntity(new UrlEncodedFormEntity(pairs, UTF_8));
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return handlerRequest(httpPost);
+    }
+
+
+}

+ 56 - 11
sckw-common/sckw-common-stream/src/main/java/com/sckw/stream/enums/MessageEnum.java

@@ -15,58 +15,103 @@ public enum MessageEnum {
      * 上架商品
      */
     PRODUCT_ON_SHELVES("SYSTEM", "SYSTEM_PRODUCT_ON_SHELVES", "商品已上架",
-            "贵司的商品:${productName},已上架至商城中,请确认相关信息","terminal,ios,android"),
+            "贵司的商品:${productName},已上架至商城中,请确认相关信息", "terminal,ios,android"),
     /**
      * 下架商品
      */
     PRODUCT_REMOVED_SHELVES("SYSTEM", "SYSTEM_PRODUCT_REMOVED_SHELVES", "商品已下架",
-            "贵司的商品:${productName},已从商城中下架了,请确认相关信息","terminal,ios,android"),
+            "贵司的商品:${productName},已从商城中下架了,请确认相关信息", "terminal,ios,android"),
     /**
      * 采发起采购下单
      */
     ORDER_INITIATE_PURCHASE("BUSINESS", "BUSINESS_ORDER_INITIATE_PURCHASE", "发起采购下单",
-            "贵司发起了对【${firmName}】的商品采购申请,请留意后续消息;订单号:${orderNo}","terminal,ios,android"),
+            "贵司发起了对【${firmName}】的商品采购申请,请留意后续消息;订单号:${orderNo}", "terminal,ios,android"),
     /**
      * 有新的待受理订单
      */
     ORDER_NEW_PENDING("BUSINESS", "BUSINESS_ORDER_NEW_PENDING", "有新的待受理订单",
-                                   "【${firmName}】发起采购申请,请及时进行受理;订单号:${orderNo}","terminal,ios,android"),
+            "【${firmName}】发起采购申请,请及时进行受理;订单号:${orderNo}", "terminal,ios,android"),
     /**
      * 发起代客下单
      */
     ORDER_INITIATE_SALE("BUSINESS", "BUSINESS_ORDER_INITIATE_SALE", "发起代客下单",
-                           "贵司已代【${firmName}】发起了商品采购,请及时联系往来单位;订单号:${orderNo}","terminal,ios,android"),
+            "贵司已代【${firmName}】发起了商品采购,请及时联系往来单位;订单号:${orderNo}", "terminal,ios,android"),
     /**
      * 有新的代客下单信息
      */
     ORDER_NEW_VALET_MSG("BUSINESS", "BUSINESS_ORDER_NEW_VALET_MSG", "有新的代客下单信息",
-            "【${firmName}】代您发起了商品采购,请确认;订单号:${orderNo}","terminal,ios,android"),
+            "【${firmName}】代您发起了商品采购,请确认;订单号:${orderNo}", "terminal,ios,android"),
     /**
      * 驳回采购订单
      */
     ORDER_REJECT_VALET("BUSINESS", "BUSINESS_ORDER_REJECT_VALET", "驳回采购订单",
-            "贵司驳回了【${firmName}】的采购申请,请及时通知采购单位;订单号:${orderNo}","terminal,ios,android"),
+            "贵司驳回了【${firmName}】的采购申请,请及时通知采购单位;订单号:${orderNo}", "terminal,ios,android"),
     /**
      * 采购订单被驳回
      */
     ORDER_REJECT_PURCHASE("BUSINESS", "BUSINESS_ORDER_REJECT_PURCHASE", "采购订单被驳回",
-            "您的采购申请被【${firmName}】驳回,请及时查看;订单号:${orderNo}","terminal,ios,android"),
+            "您的采购申请被【${firmName}】驳回,请及时查看;订单号:${orderNo}", "terminal,ios,android"),
     /**
      * 司机拒绝接单
      */
     WAYBILL_REFUSE_SENDCAR_TRIP("BUSINESS", "BUSINESS_WAYBILL_REFUSE_SENDCAR_TRIP", "司机拒绝接单",
-            "贵司指派的运单被拒绝接单了,请及时确认;运单号:${orderNo},司机:${driverName}","terminal,ios,android"),
+            "贵司指派的运单被拒绝接单了,请及时确认;运单号:${orderNo},司机:${driverName}", "terminal,ios,android"),
     /**
      * 司机拒绝接单
      */
     WAYBILL_REFUSE_SENDCAR_CIRCULATE("BUSINESS", "BUSINESS_WAYBILL_REFUSE_SENDCAR_CIRCULATE", "司机拒绝接单",
-            "贵司指派的运单被拒绝接单了,请及时确认;承运单号:${orderNo},司机:${driverName}","terminal,ios,android"),
+            "贵司指派的运单被拒绝接单了,请及时确认;承运单号:${orderNo},司机:${driverName}", "terminal,ios,android"),
 
     /**
      * 司机拒绝出车
      */
     WAYBIL_CONFIRM_DEPARTURE("BUSINESS", "BUSINESS_WAYBIL_CONFIRM_DEPARTURE", "司机拒绝出车",
-            "贵司的运单被拒绝出车了,请及时确认;运单号:${orderNo},司机:${driverName}","terminal,ios,android"),
+            "贵司的运单被拒绝出车了,请及时确认;运单号:${orderNo},司机:${driverName}", "terminal,ios,android"),
+
+
+    /**
+     * 发起企业资质审核
+     */
+    ENT_CERTIFICATE("BUSINESS", "ENT_CERTIFICATE", "发起企业资质审核", "贵司发起了针对【${entName}】的资质认证,已提交至审核部门,请留意后续消息;发起人:${createByName}", "terminal,ios,android"),
+
+    /**
+     * 资质审核通过
+     */
+    ENT_CERTIFICATE_PASS("BUSINESS", "ENT_CERTIFICATE_PASS", "企业资质审核通过", "贵司提交的【${entName}】资质认证,已审核通过;审核人员:${createByName}", "terminal,ios,android"),
+
+    /**
+     * 资质审核驳回
+     */
+    ENT_CERTIFICATE_REFUSED("BUSINESS", "ENT_CERTIFICATE_REFUSED", "企业资质审核驳回", "贵司提交的【${entName}】资质认证,已被审核驳回,请查看驳回原因并及时修改;审核人员:${createByName}", "terminal,ios,android"),
+
+    /**
+     * 发起主体单位资质审核
+     */
+    ENT_DEPT_CERTIFICATE("BUSINESS", "ENT_DEPT_CERTIFICATE", "发起主体单位资质审核", "贵司发起了针对【${entName}】的资质认证,已提交至审核部门,请留意后续消息;发起人:${createByName}", "terminal,ios,android"),
+
+    /**
+     * 主体单位资质审核通过
+     */
+    ENT_DEPT_CERTIFICATE_PASS("BUSINESS", "ENT_DEPT_CERTIFICATE_PASS", "主体单位资质审核通过", "贵司提交的【${entName}】资质认证,已审核通过;审核人员:${createByName}", "terminal,ios,android"),
+
+    /**
+     * 主体单位资质审核驳回
+     */
+    ENT_DEPT_CERTIFICATE_REFUSED("BUSINESS", "ENT_DEPT_CERTIFICATE_REFUSED", "主体单位资质审核驳回", "贵司提交的【${entName}】资质认证,已被审核驳回,请查看驳回原因并及时修改;审核人员:${createByName}", "terminal,ios,android"),
+
+
+    /**
+     * 发起合作申请
+     */
+    SUBMIT_COOPERATE("BUSINESS", "SUBMIT_COOPERATE", "发起合作申请", "贵司发起了与【${entName}】的合作申请,请留意后续消息;发起人:${createByName}", "terminal,ios,android"),
+
+    /**
+     * 合作申请待审核
+     */
+    COOPERATE_WAIT_APPROVAL("BUSINESS", "COOPERATE_WAIT_APPROVAL", "合作申请待审核", "【${entName}】对贵司发起了企业合作申请,请前往确认", "terminal,ios,android"),
+
+
+
     ;
 
     /**

+ 0 - 24
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/CashItem.java

@@ -1,24 +0,0 @@
-package com.sckw.payment.api.model.dto;
-
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.io.Serial;
-import java.io.Serializable;
-
-/**
- * @author xucaiqin
- * @date 2023-07-25 15:19:14
- */
-@NoArgsConstructor
-@Data
-public class CashItem implements Serializable {
-    @Serial
-    private static final long serialVersionUID = 856945436214113979L;
-    private String orderNo;
-    private Integer status;
-    private Integer money;
-    private Integer balance;
-    private String remarks;
-    private String createTime;
-}

+ 10 - 0
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/WalletDto.java

@@ -52,4 +52,14 @@ public class WalletDto implements Serializable {
      * 线上可用余额(分)
      */
     private Long money;
+    /**
+     * 充值中金额
+     */
+    @JSONField(name = "charging_money")
+    private Long chargingMoney;
+    /**
+     * 提现中金额
+     */
+    @JSONField(name = "withdrawing_money")
+    private Long withdrawingMoney;
 }

+ 10 - 1
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/dubbo/TransportDubboService.java

@@ -4,10 +4,11 @@ import com.sckw.core.web.response.HttpResult;
 import com.sckw.transport.api.model.dto.AccountCheckingBindDTO;
 import com.sckw.transport.api.model.dto.AddressResDTO;
 import com.sckw.transport.api.model.dto.LogisticsOrderDTO;
+import com.sckw.transport.api.model.dto.RWaybillOrderDto;
 import com.sckw.transport.api.model.param.ContractSignLogisticsParam;
 import com.sckw.transport.api.model.param.LogisticsOrderParam;
 import com.sckw.transport.api.model.vo.KwtLogisticsOrderVO;
-
+import com.sckw.transport.api.model.vo.RWaybillOrderVo;
 import java.util.List;
 import java.util.Map;
 
@@ -106,4 +107,12 @@ public interface TransportDubboService {
      * @param param
      */
     void contractSignLogisticsCompleted(ContractSignLogisticsParam param);
+
+    /**
+     * @param params 参数
+     * @desc 查询车辆运单
+     * @author zk
+     * @date 2023/9/6
+     **/
+    List<RWaybillOrderVo> findWaybillOrder(RWaybillOrderDto params);
 }

+ 36 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/RWaybillOrderDto.java

@@ -0,0 +1,36 @@
+package com.sckw.transport.api.model.dto;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * desc 车辆运单
+ * author zk
+ * date 2023/9/6 0006
+ */
+@Data
+public class RWaybillOrderDto implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -2991208083876944003L;
+
+    /**
+     * 车牌号
+     */
+    private String truckNo;
+
+    /**
+     * busStatus 状态 2出车/3执行/4完结
+     */
+    private Integer busStatus;
+
+    public RWaybillOrderDto() {
+    }
+
+    public RWaybillOrderDto(String truckNo, Integer busStatus) {
+        this.truckNo = truckNo;
+        this.busStatus = busStatus;
+    }
+}

+ 128 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/vo/RWaybillOrderVo.java

@@ -0,0 +1,128 @@
+package com.sckw.transport.api.model.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * desc 车辆运单
+ * author zk
+ * date 2023/9/6 0006
+ */
+@Data
+public class RWaybillOrderVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -2991208083876944003L;
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 企业id
+     */
+    private Long entId;
+
+    /**
+     * 物流订单id(kwt_logistics_order)
+     */
+    private Long lOrderId;
+
+    /**
+     * 编号
+     */
+    private String wOrderNo;
+
+    /**
+     * 单据类型(1:趟次;2:循环)
+     */
+    private Integer type;
+
+    /**
+     * 车辆信息ID
+     */
+    private Long truckId;
+
+    /**
+     * 车牌号
+     */
+    private String truckNo;
+
+    /**
+     * 司机id
+     */
+    private Long driverId;
+
+    /**
+     * 司机姓名
+     */
+    private String driverName;
+
+    /**
+     * 司机手机号码
+     */
+    private String driverPhone;
+
+    /**
+     * 司机身份证号
+     */
+    private String driverIdcard;
+
+    /**
+     * 已委托量
+     */
+    private BigDecimal entrustAmount;
+
+    /**
+     * 卸货重量
+     */
+    private BigDecimal unloadAmount;
+
+    /**
+     * 装货重量
+     */
+    private BigDecimal loadAmount;
+
+    /**
+     * 亏吨重量
+     */
+    private BigDecimal deficitAmount;
+
+    /**
+     * 亏吨扣款
+     */
+    private BigDecimal deficitPrice;
+
+    /**
+     * 计划开始时间
+     */
+    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date startTime;
+
+    /**
+     * 计划结束时间
+     */
+    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date endTime;
+
+    /**
+     * 用户状态(待受理、待运输、运输中、已完成、已取消)
+     */
+    private Integer status;
+
+    /**
+     * 出车时间
+     */
+    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date departureTime;
+}

+ 1 - 1
sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TestController.java

@@ -25,7 +25,7 @@ public class TestController {
     private PaymentDubboService paymentDubboService;
 
     @GetMapping("/detail")
-    public R<MemberDetail> download(@RequestParam("uid") Long uid, String channel) {
+    public R<MemberDetail> download(/*@RequestParam("uid")*/ Long uid, String channel) {
         return payCenterDubboService.memberDetail(uid, ChannelEnum.HF);
     }
 

+ 5 - 0
sckw-modules/sckw-fleet/pom.xml

@@ -69,6 +69,11 @@
             <artifactId>sckw-fleet-api</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-transport-api</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>com.sckw</groupId>
             <artifactId>sckw-file-api</artifactId>

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

@@ -134,7 +134,7 @@ public class KwfFleetController {
      * @date 2023/8/4
      **/
     @PostMapping("/findTruckList")
-    public HttpResult findTruckList(@RequestBody Map params) throws SystemException {
+    public HttpResult findTruckList(@RequestBody Map<String, Object> params) throws SystemException {
         return HttpResult.ok(fleetService.findTruckList(params));
     }
 }

+ 11 - 35
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java

@@ -230,26 +230,13 @@ public class KwfTruckController {
 
     /**
      * @param params {truckNo 車牌號}
-     * @description 车辆查询(业务关联+归属车辆)
+     * @desc 车辆查询(业务关联+归属车辆)
      * @author zk
      * @date 2023/7/26
      **/
     @PostMapping("/findTruck")
     public HttpResult findTruck(@RequestBody Map<String, Object> params) {
-        params.put("entId", LoginUserHolder.getEntId());
-        List<KwfTruckVo> trucks = truckService.findPage(params);
-
-        List<Map<String, Object>> data = new ArrayList();
-        for (KwfTruckVo truck:trucks) {
-            int bbb = new Random().nextInt(10) / 4;
-            data.add(new HashMap<>(Global.NUMERICAL_SIXTEEN){{put("truckNo", truck.getTruckNo());
-                put("entId", truck.getEntId());
-                put("firmName", truck.getFirmName());
-                put("businessStatus", truck.getTruckNo().contains("1") ? 0 : 1);
-                put("runStatus", bbb == 0 ? 0 : bbb == 1 ? 1 : 2);}});
-        }
-
-        return HttpResult.ok(data);
+        return HttpResult.ok(truckService.findTruck(params));
     }
 
     /**
@@ -264,20 +251,7 @@ public class KwfTruckController {
             return HttpResult.ok();
         }
 
-        List<Map<String, Object>> data = new ArrayList();
-        for (String truckNo:truckNos) {
-            int aaa = new Random().nextInt(10) / 3;
-            int bbb = new Random().nextInt(10) / 4;
-            data.add(new HashMap<>(Global.NUMERICAL_SIXTEEN){{
-                put("truckNo", truckNo);
-                put("speed", new Random().nextInt(100));
-                put("lat", "29.48"+new Random().nextInt(10000));
-                put("lng", "103.53"+new Random().nextInt(10000));
-                put("businessStatus", aaa == 0 ? 0 : 1);
-                put("runStatus", bbb == 0 ? 0 : bbb == 1 ? 1 : 2);
-                put("gpsTime", DateUtils.getCurrentTime());}});
-        }
-        return HttpResult.ok(data);
+        return HttpResult.ok(truckService.findTruckGps(truckNos));
     }
 
     /**
@@ -355,13 +329,16 @@ public class KwfTruckController {
 
     /**
      * @param truckNo 车牌号
-     * @description 车牌号查询车辆关联数据
+     * @desc 车牌号查询车辆关联数据
      * @author zk
      * @date 2023/8/2
      **/
     @GetMapping("/findDetailByTruckNo")
-    public HttpResult findDetailByTruckNo(String truckNo) {
-        Map<String, Object> detail = new HashMap<>(Global.NUMERICAL_SIXTEEN);
+    public HttpResult findDetailByTruckNo(@RequestParam String truckNo) {
+        if (StringUtils.isBlank(truckNo)) {
+            return HttpResult.error("车牌号不能为空!");
+        }
+        /*Map<String, Object> detail = new HashMap<>(Global.NUMERICAL_SIXTEEN);
         detail.put("truckNo", truckNo);
         detail.put("driverName", "赵先生");
         detail.put("driverPhone", "17358629955");
@@ -370,9 +347,8 @@ public class KwfTruckController {
         detail.put("lat", "29.48"+new Random().nextInt(10000));
         detail.put("lng", "103.53"+new Random().nextInt(10000));
         detail.put("speed", new Random().nextInt(100));
-        detail.put("gpsTime", DateUtils.getCurrentTime());
-        return HttpResult.ok(detail);
+        detail.put("gpsTime", DateUtils.getCurrentTime());*/
+        return HttpResult.ok(truckService.findDetailByTruckNo(truckNo));
     }
 
-
 }

+ 16 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.fleet.model.KwfTruck;
 import com.sckw.fleet.model.vo.KwfDriverVo;
 import com.sckw.fleet.model.vo.KwfTableTopCount;
+import com.sckw.fleet.model.vo.KwfTruckMonitorVo;
 import com.sckw.fleet.model.vo.KwfTruckVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -49,8 +50,22 @@ public interface KwfTruckMapper extends BaseMapper<KwfTruck> {
 
     /**
      * 企业运力统计
-     * @param entIds
+     * @param entIds 企业id集
      * @return
      */
     List<Map<String, Object>> capacityStatistics(@Param("entIds") List entIds);
+
+    /**
+     * 查询企业车辆
+     * @param {entId 企业ID(必填), truckNo 车牌号}
+     * @return
+     */
+    List<KwfTruckMonitorVo> findTruckByEnt(Map<String, Object> params);
+
+    /**
+     * 查询全部车辆
+     * @param {truckNo 车牌号}
+     * @return
+     */
+    List<KwfTruckMonitorVo> findTruckByAll(Map<String, Object> params);
 }

+ 1 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/dto/KwfTruckDto.java

@@ -46,7 +46,7 @@ public class KwfTruckDto {
     /**
      * 外廓尺寸
      */
-    @Size(max=10, message = "外廓尺寸长度不能大于10个字符!")
+    @Size(max=20, message = "外廓尺寸长度不能大于20个字符!")
     private String spec;
 
     /**

+ 54 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckGpsVo.java

@@ -0,0 +1,54 @@
+package com.sckw.fleet.model.vo;
+
+import lombok.Data;
+
+/**
+ * desc 车辆定位
+ * author zk
+ * date 2023/9/5 0005
+ */
+@Data
+public class KwfTruckGpsVo {
+
+    /**
+     *车牌号
+     */
+    private String truckNo;
+
+    /**
+     *业务状态(0空闲、1任务中)
+     */
+    private Integer businessStatus;
+
+    /**
+     *运行状态(0行驶、1停止、2离线)
+     */
+    private Integer runStatus;
+
+    /**
+     *纬度
+     */
+    private String lat;
+
+    /**
+     *经度
+     */
+    private String lng;
+
+    /**
+     *详细地址
+     */
+    private String detailAddress;
+
+    /**
+     *速度
+     */
+    private Double speed;
+
+    /**
+     *gps时间
+     */
+    private String gpsTime;
+
+}
+

+ 38 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckMonitorVo.java

@@ -0,0 +1,38 @@
+package com.sckw.fleet.model.vo;
+
+import lombok.Data;
+
+/**
+ * desc 车辆监控
+ * author zk
+ * date 2023/9/5 0005
+ */
+@Data
+public class KwfTruckMonitorVo {
+
+    /**
+     *企业id
+     */
+    private Long entId;
+
+    /**
+     *企业名称
+     */
+    private String firmName;
+
+    /**
+     *车牌号
+     */
+    private String truckNo;
+
+    /**
+     *业务状态(0空闲、1任务中)
+     */
+    private Integer businessStatus;
+
+    /**
+     *运行状态(0行驶、1停止、2离线)
+     */
+    private Integer runStatus;
+
+}

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

@@ -184,5 +184,4 @@ public class KwfFleetService {
         result.put("truckCounts", truckCounts);
         return result;
     }
-
 }

+ 303 - 10
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -4,17 +4,19 @@ import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelReader;
 import com.alibaba.excel.read.metadata.ReadSheet;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.common.enums.enums.FileEnum;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.enums.SystemTypeEnum;
 import com.sckw.core.model.file.FileInfo;
-import com.sckw.core.utils.BeanUtils;
-import com.sckw.core.utils.CollectionUtils;
-import com.sckw.core.utils.FileUtils;
-import com.sckw.core.utils.StringUtils;
+import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
+import com.sckw.core.web.context.LoginEntHolder;
 import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.core.web.request.HttpClientUtil;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.easyexcel.ExcelImportListener;
 import com.sckw.excel.utils.ExcelUtil;
@@ -26,17 +28,18 @@ import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
+import com.sckw.transport.api.dubbo.TransportDubboService;
+import com.sckw.transport.api.model.dto.RWaybillOrderDto;
+import com.sckw.transport.api.model.vo.RWaybillOrderVo;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 import java.io.InputStream;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -63,6 +66,8 @@ public class KwfTruckService {
     KwfFleetTruckMapper fleetTruckDao;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private TransportDubboService transportDubboService;
 
     /**
      * @param key 主键id
@@ -139,7 +144,6 @@ public class KwfTruckService {
         /**数据处理**/
         Map<String, Integer> authStatusMap = new HashMap(){{put("正常", 1); put("临时", 2); put("异常", 3);}};
         for(Map.Entry<String, Integer> entry:authStatusMap.entrySet()){
-            System.out.println(entry.getKey()+"--->"+entry.getValue());
             KwfTableTopCount count = new KwfTableTopCount();
             for (KwfTableTopCount topCount:counts) {
                 if (Integer.parseInt(topCount.getValue()) == entry.getValue()) {
@@ -225,7 +229,7 @@ public class KwfTruckService {
 
     /**
      * @param {}
-     * @description 导出
+     * @desc 导出
      * @author zk
      * @date 2023/07/11
      **/
@@ -587,6 +591,135 @@ public class KwfTruckService {
         }
     }
 
+    /**
+     * @param params {truckNo 車牌號}
+     * @desc 车辆查询(业务关联+归属车辆)
+     * @author zk
+     * @date 2023/9/5
+     **/
+    public List<KwfTruckMonitorVo> findTruck(Map params){
+        /**车辆查询**/
+        Map queryParams = new HashMap<>(Global.NUMERICAL_SIXTEEN){{ put("truckNo", params.get("truckNo"));}};
+        List<KwfTruckMonitorVo> truckList = findTruckMonitor(queryParams);
+        if (truckList == null || truckList.size() == 0) {
+            return truckList;
+        }
+
+        /**数据配置**/
+        List<Long> entIds = new ArrayList<>();
+        List<String> truckNos = new ArrayList<>();
+        for (KwfTruckMonitorVo truck:truckList) {
+            entIds.add(truck.getEntId());
+            truckNos.add(truck.getTruckNo());
+        }
+
+        //企业数据集
+        entIds = entIds.stream().distinct().collect(Collectors.toList());
+        Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
+        //车辆定位数据集
+        Map<String, KwfTruckGpsVo> truckGpsMap = findTruckLocateHandle(truckNos);
+
+        /**数据组装**/
+        for (KwfTruckMonitorVo truck:truckList) {
+            EntCacheResDto ent = ents == null ? null : ents.get(truck.getEntId());
+            KwfTruckGpsVo truckGps = truckGpsMap != null ? truckGpsMap.get(truck.getTruckNo()) : null;
+            truck.setFirmName(ent != null ? ent.getFirmName() : null);
+            truck.setRunStatus(truckGps != null ? truckGps.getRunStatus() : null);
+        }
+
+        return truckList;
+    }
+
+    /**
+     * @param truckNos 車牌號集
+     * @description 车辆查询GPS(业务关联 + 归属车辆)
+     * @author zk
+     * @date 2023/9/6
+     **/
+    public List<KwfTruckGpsVo> findTruckGps(List<String> truckNos) {
+        /**车辆查询**/
+        List<KwfTruckGpsVo> truckGpsList = new ArrayList<>();
+        Map<String, Object> queryParams = new HashMap<>(Global.NUMERICAL_SIXTEEN){{ put("truckNos", truckNos);}};
+        List<KwfTruckMonitorVo> truckList = findTruckMonitor(queryParams);
+        if (truckList == null || truckList.size() == 0) {
+            return truckGpsList;
+        }
+
+        //车辆定位数据集
+        Map<String, KwfTruckGpsVo> truckGpsMap = findTruckLocateHandle(truckNos);
+
+        /**数据组装**/
+        for (KwfTruckMonitorVo truck:truckList) {
+            KwfTruckGpsVo truckGps = truckGpsMap != null ? truckGpsMap.get(truck.getTruckNo()) : null;
+            if (truckGps == null) {
+                continue;
+            }
+            truckGps.setTruckNo(truck.getTruckNo());
+            truckGps.setBusinessStatus(truck.getBusinessStatus());
+            truckGpsList.add(truckGps);
+        }
+
+        return truckGpsList;
+    }
+
+    /**
+     * @param params 参数
+     * @desc 车辆查询(业务关联 + 归属车辆)
+     * @author zk
+     * @date 2023/9/6
+     **/
+    public List<KwfTruckMonitorVo> findTruckMonitor(Map params) {
+        List<KwfTruckMonitorVo> trucks = new ArrayList<>();
+        if (LoginUserHolder.getSystemType() == SystemTypeEnum.COMPANY.getCode()) {
+            params.put("entId", LoginUserHolder.getEntId());
+            trucks = truckDao.findTruckByEnt(params);
+        }
+        if (LoginUserHolder.getSystemType() == SystemTypeEnum.MANAGE.getCode()) {
+            trucks = truckDao.findTruckByAll(params);
+        }
+        return trucks;
+    }
+
+    /**
+     * @param truckNo 车牌号
+     * @desc 车牌号查询车辆关联数据
+     * @author zk
+     * @date 2023/9/6
+     **/
+    public Map<String, Object> findDetailByTruckNo(String truckNo) {
+        //定位信息
+        KwfTruckGpsVo truckGps = findTruckLocate(truckNo);
+        //运单信息
+        RWaybillOrderVo waybillOrder = getWaybillOrder(truckNo, Global.NUMERICAL_THREE);
+        String firmName = LoginEntHolder.getFirmName();
+        if (LoginUserHolder.getSystemType() == SystemTypeEnum.MANAGE.getCode()) {
+            List<KwfTruck> trucks = truckDao.findTruck(new HashMap<>(Global.NUMERICAL_SIXTEEN){{put("truckNo", truckNo);}});
+            KwfTruck truck = CollectionUtils.isEmpty(trucks) ? null : trucks.get(Global.NUMERICAL_ZERO);
+            if (truck != null) {
+                //企业数据集
+                List<Long> entIds = new ArrayList<>() {{
+                    add(truck.getEntId());
+                }};
+                Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
+                EntCacheResDto ent = ents == null ? null : ents.get(truck.getEntId());
+                firmName = ent != null ? ent.getFirmName() : null;
+            }
+        }
+
+        Map<String, Object> detail = new HashMap<>(Global.NUMERICAL_SIXTEEN);
+        detail.put("truckNo", truckNo);
+        detail.put("firmName", firmName);
+        detail.put("detailAddress", truckGps != null ? truckGps.getDetailAddress() : null);
+        detail.put("speed", truckGps != null ? truckGps.getSpeed() : null);
+        detail.put("gpsTime", truckGps != null ? truckGps.getGpsTime() : null);
+        detail.put("driverName", waybillOrder != null ? waybillOrder.getDriverName() : null);
+        detail.put("driverPhone", waybillOrder != null ? waybillOrder.getDriverPhone() : null);
+        detail.put("startTime", waybillOrder != null ? DateUtils.formatV1(waybillOrder.getDepartureTime()) : null);
+        detail.put("endTime", waybillOrder != null && waybillOrder.getDepartureTime() != null ? DateUtils.getCurrentTime() : null);
+        detail.put("orderNo", waybillOrder != null ? waybillOrder.getWOrderNo() : null);
+        return detail;
+    }
+
     /**
      * @param params 参数
      * @desc 校验车辆是否有证书
@@ -690,4 +823,164 @@ public class KwfTruckService {
         }
         return false;
     }
+
+    /**
+     * @param truckNos 车牌号
+     * @desc 查询车辆定位数据
+     * @author zk
+     * @date 2023/9/5
+     **/
+    public Map<String, KwfTruckGpsVo> findTruckLocateHandle(List<String> truckNos){
+        /**车牌号超过100则分批次请求数据**/
+        int maxLimit = 100;
+        List<List<String>> truckNoList = new ArrayList<List<String>>();
+        List<String> findTruckSon = null;
+        for (int i = 0; i < truckNos.size(); i++) {
+            if (i % maxLimit == 0) {
+                findTruckSon = new ArrayList<String>();
+                truckNoList.add(findTruckSon);
+            }
+            findTruckSon.add(truckNos.get(i));
+        }
+
+        /**获取数据**/
+        Map<String, KwfTruckGpsVo> truckGpsMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
+        for (List<String> turckNo:truckNoList) {
+            Map<String, KwfTruckGpsVo> truckGps = findTruckLocate(turckNo);
+            truckGpsMap.putAll(truckGps);
+        }
+
+        return truckGpsMap;
+    }
+
+    /**
+     * @param truckNos 车牌号
+     * @desc 查询车辆定位数据
+     * @author zk
+     * @date 2023/9/5
+     **/
+    public RWaybillOrderVo getWaybillOrder(String truckNo, int busStatus) {
+        try {
+            List<RWaybillOrderVo> waybillOrders = transportDubboService.findWaybillOrder(new RWaybillOrderDto(truckNo, busStatus));
+            if (CollectionUtils.isEmpty(waybillOrders)) {
+                return null;
+            }
+            return waybillOrders.get(Global.NUMERICAL_ZERO);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    @Value("${external.openapi.queryLocate}")
+    private String queryLocate;
+
+    /**
+     * @param truckNos 车牌号
+     * @desc 查询车辆定位数据
+     * @author zk
+     * @date 2023/9/5
+     **/
+    public Map<String, KwfTruckGpsVo> findTruckLocate(List<String> truckNos){
+        Map<String, KwfTruckGpsVo> truckGpsMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
+        if (truckNos == null || truckNos.size() == 0) {
+            return truckGpsMap;
+        }
+
+        try {
+            Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
+                put("vehicleNoList", truckNos);
+            }};
+            String httpResult = HttpClientUtil.post(queryLocate, JSON.toJSONString(params));
+            if (StringUtils.isNotBlank(httpResult)) {
+                JSONObject result = JSONObject.parseObject(httpResult);
+                if (result.getInteger("code") != null && result.getInteger("code") != 200) {
+                    return truckGpsMap;
+                } else {
+
+                }
+                JSONArray trucks = result.getJSONArray("data");
+                System.out.println((trucks != null ? trucks.size() : 0) + "==="+ truckNos.size() + "===" + truckNos);
+                for (int i=0; trucks != null && i < trucks.size(); i++) {
+                    JSONObject truck = trucks.getJSONObject(i);
+                    JSONObject locateInfo = truck.getJSONObject("locateInfo");
+                    KwfTruckGpsVo truckGps = new KwfTruckGpsVo();
+                    truckGps.setTruckNo(truck.getString("vehicleNo"));
+                    truckGps.setLat(locateInfo.getString("lat"));
+                    truckGps.setLng(locateInfo.getString("lng"));
+                    truckGps.setSpeed(locateInfo.getDouble("speed"));
+                    truckGps.setGpsTime(locateInfo.getString("createTime"));
+                    truckGps.setRunStatus(runStatus(truckGps.getGpsTime(), truckGps.getSpeed()));
+                    truckGpsMap.put(truckGps.getTruckNo(), truckGps);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return truckGpsMap;
+    }
+
+    /**
+     * @param truckNos 车牌号
+     * @desc 查询车辆定位数据-单车牌号
+     * @author zk
+     * @date 2023/9/5
+     **/
+    public KwfTruckGpsVo findTruckLocate(String truckNo){
+        if (StringUtils.isBlank(truckNo)) {
+            return null;
+        }
+
+        try {
+            Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
+                put("vehicleNoList", new ArrayList<>(){{add(truckNo);}});
+            }};
+            String httpResult = HttpClientUtil.post(queryLocate, JSON.toJSONString(params));
+            if (StringUtils.isNotBlank(httpResult)) {
+                JSONObject result = JSONObject.parseObject(httpResult);
+                if (result.getInteger("code") != null && result.getInteger("code") != 200) {
+                    return null;
+                }
+                JSONArray trucks = result.getJSONArray("data");
+                if (trucks != null && trucks.size() > 0) {
+                    JSONObject truck = trucks.getJSONObject(Global.NUMERICAL_ZERO);
+                    JSONObject locateInfo = truck.getJSONObject("locateInfo");
+                    KwfTruckGpsVo truckGps = new KwfTruckGpsVo();
+                    truckGps.setTruckNo(truck.getString("vehicleNo"));
+                    truckGps.setLat(locateInfo.getString("lat"));
+                    truckGps.setLng(locateInfo.getString("lng"));
+                    truckGps.setSpeed(locateInfo.getDouble("speed"));
+                    truckGps.setGpsTime(locateInfo.getString("createTime"));
+                    truckGps.setRunStatus(runStatus(truckGps.getGpsTime(), truckGps.getSpeed()));
+                    return truckGps;
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * @param gpsTimeStr 地位时间
+     * @param speed 速度
+     * @desc 校验当前车辆运行状态
+     * @author zk
+     * @date 2023/9/5
+     **/
+    public int runStatus(String gpsTimeStr, Double speed){
+        if (StringUtils.isBlank(gpsTimeStr)) {
+            return Global.NUMERICAL_TWO;
+        }
+        Date gpsTime = DateUtils.formatDate(gpsTimeStr);
+        if (gpsTime == null) {
+            return Global.NUMERICAL_TWO;
+        }
+        Date newTime = DateUtils.addDateMinutes(gpsTime, 15);
+        int compareTo = DateUtils.compareTo(newTime, new Date());
+        //-1 date1小于date2、0 date1等于date2、1 date1大于date2
+        //运行状态(0行驶、1停止、2离线)
+        return compareTo < 0 ? 2 : (speed == null || speed == 0) ? 1 : 0;
+    }
+
 }

+ 22 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml

@@ -234,4 +234,26 @@
         GROUP BY ent_id
     </select>
 
+    <select id="findTruckByEnt" resultType="com.sckw.fleet.model.vo.KwfTruckMonitorVo" >
+        SELECT
+            kt.truck_no, kt.business_status businessStatus, kte.ent_id entId
+        from kwf_truck kt
+        left join kwf_truck_ent kte on kte.truck_id = kt.id
+        where kt.del_flag = 0 and kte.del_flag = 0
+        and kte.ent_id = #{entId, jdbcType=BIGINT}
+        <if test="truckNo != null and truckNo != ''">
+            and kt.truck_no = #{truckNo, jdbcType=VARCHAR}
+        </if>
+    </select>
+
+    <select id="findTruckByAll" resultType="com.sckw.fleet.model.vo.KwfTruckMonitorVo" >
+        SELECT
+        kt.truck_no, kt.business_status businessStatus, kt.ent_id entId
+        from kwf_truck kt
+        where kt.del_flag = 0
+        <if test="truckNo != null and truckNo != ''">
+            and kt.truck_no = #{truckNo, jdbcType=VARCHAR}
+        </if>
+    </select>
+
 </mapper>

+ 2 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/ManageApplication.java

@@ -2,6 +2,7 @@ package com.sckw.manage;
 
 import com.sckw.remote.annotation.SckwRemoteApplication;
 import com.sckw.startup.annotation.SckwCloudApplication;
+import io.seata.spring.annotation.datasource.EnableAutoDataSourceProxy;
 import org.springframework.boot.SpringApplication;
 
 /**
@@ -11,6 +12,7 @@ import org.springframework.boot.SpringApplication;
  */
 @SckwRemoteApplication
 @SckwCloudApplication
+@EnableAutoDataSourceProxy
 public class ManageApplication {
 
     public static void main(String[] args) {

+ 3 - 2
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/controller/KwmAddressController.java

@@ -125,8 +125,9 @@ public class KwmAddressController {
     }
 
     @PostMapping("test")
-    public HttpResult test(@RequestBody IdsReqVo reqVo) {
-        return HttpResult.ok(kwmAddressService.test(reqVo.getId()));
+    public HttpResult test() {
+        kwmAddressService.test();
+        return HttpResult.ok();
     }
 
 }

+ 27 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/CommonBusinessService.java

@@ -6,6 +6,7 @@ import com.sckw.core.model.enums.CooperateStatusEnum;
 import com.sckw.core.model.enums.CooperateTypeEnum;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.core.utils.UUIDUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.manage.dao.KwmCooperateMapper;
@@ -14,13 +15,20 @@ import com.sckw.manage.model.dto.res.CooperateManageQueryResDto;
 import com.sckw.manage.model.entity.KwmCooperate;
 import com.sckw.manage.model.vo.res.CooperateManageQueryResVo;
 import com.sckw.manage.model.vo.res.FindListGroupResVo;
+import com.sckw.stream.enums.MessageEnum;
+import com.sckw.stream.model.SckwMessage;
+import com.sckw.stream.model.UserInfo;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.RemoteUserService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
+import jakarta.annotation.Resource;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.stream.function.StreamBridge;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
@@ -32,6 +40,7 @@ import java.util.stream.Collectors;
  * @date 2023/7/12
  */
 @Service
+@Slf4j
 public class CommonBusinessService {
 
     @DubboReference(version = "1.0.0", group = "design", check = false)
@@ -43,6 +52,10 @@ public class CommonBusinessService {
     @Autowired
     private KwmCooperateMapper kwmCooperateMapper;
 
+    @Resource
+    private StreamBridge streamBridge;
+
+
     /**
      * @param keywords 关键字 resDto查询结果集
      * @desc: 是否匹配到关键字
@@ -328,4 +341,18 @@ public class CommonBusinessService {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
     }
+
+
+    public void sendSystemMessage(List<UserInfo> userInfos, MessageEnum messageEnum, Map<String, Object> map, String msgUrl) {
+        SckwMessage msg = new SckwMessage();
+        msg.setRequestId(UUIDUtils.get32UUID())
+                .setMessageEnum(messageEnum)
+                .setParams(map)
+                .setMsgUrl(msgUrl)
+                .setUserInfos(userInfos)
+                .setCreateBy(LoginUserHolder.getUserId());
+        log.info("合作申请:{}", com.alibaba.fastjson2.JSON.toJSONString(msg));
+        streamBridge.send("sckw-message", com.alibaba.fastjson2.JSON.toJSONString(msg));
+    }
+
 }

+ 18 - 2
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java

@@ -27,13 +27,17 @@ import com.sckw.manage.model.entity.KwmAddress;
 import com.sckw.manage.model.vo.req.*;
 import com.sckw.manage.model.vo.res.AddressDetailResVo;
 import com.sckw.manage.model.vo.res.AddressQueryResVo;
+import com.sckw.stream.enums.MessageEnum;
+import com.sckw.stream.model.UserInfo;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
+import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.stream.function.StreamBridge;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -58,6 +62,9 @@ public class KwmAddressService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
+    @Autowired
+    private StreamBridge streamBridge;
+
     /**
      * @param reqVo 分页入参
      * @return HttpResult
@@ -414,7 +421,16 @@ public class KwmAddressService {
         return addressDetailResVo;
     }
 
-    public Map<Long, List<EntAddressResDto>> test(Long id) {
-        return remoteManageService.queryEntAddressByEntIdList(Collections.singletonList(id));
+    public void test() {
+        Map<String, Object> map = new HashMap<>();
+        map.put("entName", "测试企业");
+        map.put("createByName", LoginUserHolder.getUserName());
+        commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId())),
+                MessageEnum.SUBMIT_COOPERATE,
+                map,
+                "testUrl");
+
+        String msg = "{\"createBy\":156382319433748480,\"messageEnum\":\"SUBMIT_COOPERATE\",\"msgUrl\":\"testUrl\",\"params\":{\"createByName\":\"楚镇豪-企业管理员\",\"entName\":\"徐长卿\"},\"requestId\":\"cefb6b5357ce48d9a11ffc94da83c879\",\"userInfos\":[{\"entId\":156382319450525696,\"userId\":156382319433748480}]}";
+        streamBridge.send("sckw-message", com.alibaba.fastjson2.JSON.toJSONString(msg));
     }
 }

+ 12 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java

@@ -31,6 +31,8 @@ import com.sckw.manage.model.vo.req.IdsReqVo;
 import com.sckw.manage.model.vo.req.InitiateReqVo;
 import com.sckw.manage.model.vo.res.CooperateManageQueryResVo;
 import com.sckw.manage.model.vo.res.FindListGroupResVo;
+import com.sckw.stream.enums.MessageEnum;
+import com.sckw.stream.model.UserInfo;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
@@ -264,6 +266,16 @@ public class KwmCooperateApplyService {
         }
         //保存发起申请
         saveInitiate(reqVo, currentEntId, chooseCooperateTypes);
+
+
+        EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(reqVo.getTargetEntId());
+        Map<String, Object> map = new HashMap<>();
+        map.put("entName", entCacheResDto.getFirmName());
+        map.put("createByName", LoginUserHolder.getUserName());
+        commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId())),
+                MessageEnum.SUBMIT_COOPERATE,
+                map,
+                "testUrl");
     }
 
 

+ 10 - 0
sckw-modules/sckw-message/src/main/java/com/sckw/message/dao/KwmMessageMapper.java

@@ -1,6 +1,7 @@
 package com.sckw.message.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sckw.core.model.vo.TableTop;
 import com.sckw.message.model.KwmMessage;
 import com.sckw.message.model.dto.MessageListDTO;
 import com.sckw.message.model.dto.SelectMessagesDTO;
@@ -24,4 +25,13 @@ public interface KwmMessageMapper extends BaseMapper<KwmMessage> {
      * @return java.util.List<com.sckw.message.model.dto.MessageListDTO>
      */
     List<MessageListDTO> findPage(@Param("item") SelectMessagesDTO item);
+
+    /**
+     * @desc: 统计查询
+     * @author: yzc
+     * @date: 2023-09-06 9:21
+     * @Param item:
+     * @return: java.util.List<com.sckw.core.model.vo.TableTop>
+     */
+    List<TableTop> statistics(@Param("item") SelectMessagesDTO item);
 }

+ 3 - 0
sckw-modules/sckw-message/src/main/java/com/sckw/message/model/vo/req/StatisticsMessagesReqVO.java

@@ -1,5 +1,6 @@
 package com.sckw.message.model.vo.req;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
@@ -24,11 +25,13 @@ public class StatisticsMessagesReqVO {
     /**
      * 创建时间开始(yyyy-MM-dd HH:mm:ss)
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date startCreateTime;
 
     /**
      * 创建时间结束(yyyy-MM-dd HH:mm:ss)
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date endCreateTime;
 
 

+ 12 - 0
sckw-modules/sckw-message/src/main/java/com/sckw/message/service/KwmMessageService.java

@@ -3,6 +3,7 @@ package com.sckw.message.service;
 import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.message.dao.KwmMessageMapper;
@@ -101,6 +102,17 @@ public class KwmMessageService {
         return kwmMessageMapper.findPage(dto);
     }
 
+    /**
+     * @desc: 统计查询
+     * @author: yzc
+     * @date: 2023-09-06 9:21
+     * @Param dto:
+     * @return: java.util.List<com.sckw.core.model.vo.TableTop>
+     */
+    public List<TableTop> statistics(SelectMessagesDTO dto) {
+        return kwmMessageMapper.statistics(dto);
+    }
+
     /**
      * @param id
      * @return com.sckw.message.model.KwmMessage

+ 20 - 10
sckw-modules/sckw-message/src/main/java/com/sckw/message/service/MessageService.java

@@ -215,22 +215,32 @@ public class MessageService {
      */
     public TableStatisticRes statistics(StatisticsMessagesReqVO params) {
         TableStatisticRes res = new TableStatisticRes();
-        List<KwmMessageListResVO> messages = this.select(BeanUtils.copyProperties(params, SelectMessagesReqVO.class));
-        Map<Integer, List<KwmMessageListResVO>> map = messages.stream().collect(Collectors.groupingBy(KwmMessageListResVO::getStatus));
+        SelectMessagesDTO dto = BeanUtils.copyProperties(params, SelectMessagesDTO.class);
+        //当前登录人是企业管理员则查看全部消息,否则只查看对应用户消息
+        if (Objects.equals(LoginUserHolder.getIsMain(), 1)) {
+            dto.setEntId(LoginUserHolder.getEntId());
+        } else {
+            dto.setUserId(LoginUserHolder.getUserId());
+        }
+        List<TableTop> statistics = kwmMessageService.statistics(dto);
+        Map<Integer, Integer> map = statistics.stream().
+                collect(Collectors.toMap(TableTop::getValue, TableTop::getTotal, (k1, k2) -> k1));
         List<TableTop> tableTops = new ArrayList<>();
-        TableTop all = new TableTop();
-        all.setName("全部").setTotal(CollectionUtils.isEmpty(messages) ? 0 : messages.size());
-        tableTops.add(all);
+        int totalCount = 0;
         List<MsgStatusEnum> enums = MsgStatusEnum.getSortList();
-        enums.forEach(e -> {
-            List<KwmMessageListResVO> list = map.get(e.getCode());
-            int total = CollectionUtils.isEmpty(list) ? 0 : list.size();
+        for (MsgStatusEnum e : enums) {
+            Integer count = map.get(e.getCode());
+            int total = Objects.isNull(count) ? 0 : count;
             TableTop tableTop = new TableTop();
             tableTop.setName(e.getMsg()).setValue(e.getCode()).setTotal(total);
             tableTops.add(tableTop);
-        });
+            totalCount = totalCount + total;
+        }
+        TableTop all = new TableTop();
+        all.setName("全部").setTotal(totalCount);
+        tableTops.add(0, all);
         TableBottom tableBottom = new TableBottom();
-        tableBottom.setTotal(CollectionUtils.isEmpty(messages) ? 0 : messages.size());
+        tableBottom.setTotal(totalCount);
         res.setTableTops(tableTops).setTableBottom(tableBottom);
         return res;
     }

+ 53 - 26
sckw-modules/sckw-message/src/main/resources/mapper/KwmMessageMapper.xml

@@ -3,35 +3,35 @@
 <mapper namespace="com.sckw.message.dao.KwmMessageMapper">
 
   <select id="findPage" resultType="com.sckw.message.model.dto.MessageListDTO" >
-    select
+      select
       mu.id, mu.ent_id entId, mu.user_id userId, mu.status, mu.remark, mu.create_by createBy, mu.create_time createTime,
       mu.update_by updateBy, mu.update_time updateTime, m.id as msgId, m.category, m.type, m.title, m.content, m.url,
       m.params, m.client_type clientType, m.remark as msgRemark
-    from kwm_message_user mu
-    left join kwm_message m
-    on mu.msg_id = m.id
-    <where>
-        m.del_flag = 0 and mu.del_flag = 0
-        <if test="item.entId != null">
-            and mu.ent_id = #{item.entId}
-        </if>
-        <if test="item.userId != null">
-            and mu.user_id = #{item.userId}
-        </if>
-        <if test="item.status != null">
-            and mu.status = #{item.status}
-        </if>
-        <if test="item.category != null and item.category != ''">
-          and m.category = #{item.category}
-        </if>
-        <if test="item.startCreateTime != null">
-            and mu.create_time &gt;= #{item.startCreateTime,jdbcType=TIMESTAMP}
-        </if>
-        <if test="item.endCreateTime != null">
-            and mu.create_time &lt;= #{item.endCreateTime,jdbcType=TIMESTAMP}
-        </if>
-    </where>
-    ORDER BY
+      from kwm_message_user mu
+      left join kwm_message m
+      on mu.msg_id = m.id
+      <where>
+          m.del_flag = 0 and mu.del_flag = 0
+          <if test="item.entId != null">
+              and mu.ent_id = #{item.entId}
+          </if>
+          <if test="item.userId != null">
+              and mu.user_id = #{item.userId}
+          </if>
+          <if test="item.status != null">
+              and mu.status = #{item.status}
+          </if>
+          <if test="item.category != null and item.category != ''">
+              and m.category = #{item.category}
+          </if>
+          <if test="item.startCreateTime != null">
+              and mu.create_time &gt;= #{item.startCreateTime,jdbcType=TIMESTAMP}
+          </if>
+          <if test="item.endCreateTime != null">
+              and mu.create_time &lt;= #{item.endCreateTime,jdbcType=TIMESTAMP}
+          </if>
+      </where>
+      ORDER BY
       <choose>
           <when test="item.sortType != null and item.sortType == 1">
               mu.status ASC, mu.create_time DESC
@@ -41,4 +41,31 @@
           </otherwise>
       </choose>
   </select>
+    <select id="statistics" resultType="com.sckw.core.model.vo.TableTop">
+        select
+        mu.status as value,count(*) as total
+        from kwm_message_user mu
+        left join kwm_message m
+        on mu.msg_id = m.id
+        <where>
+            m.del_flag = 0 and mu.del_flag = 0
+            <if test="item.entId != null">
+                and mu.ent_id = #{item.entId}
+            </if>
+            <if test="item.userId != null">
+                and mu.user_id = #{item.userId}
+            </if>
+            <if test="item.category != null and item.category != ''">
+                and m.category = #{item.category}
+            </if>
+            <if test="item.startCreateTime != null">
+                and mu.create_time &gt;= #{item.startCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="item.endCreateTime != null">
+                and mu.create_time &lt;= #{item.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+        </where>
+        group by mu.status
+
+    </select>
 </mapper>

+ 4 - 5
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/OrderCheckDTO.java

@@ -7,7 +7,6 @@ import lombok.ToString;
 import lombok.experimental.Accessors;
 
 import java.math.BigDecimal;
-import java.util.List;
 
 /**
  * @desc: 订单校验参数dto
@@ -61,9 +60,9 @@ public class OrderCheckDTO {
     private String procureFireName;
 
     /**
-     * 采购企业联系人集合
+     * 采购企业联系人
      */
-    private List<UserInfo> procureUsers;
+    private UserInfo procureUser;
 
     /**
      * 供应一级企业id
@@ -80,9 +79,9 @@ public class OrderCheckDTO {
     private String supplyFireName;
 
     /**
-     * 供应企业联系人集合
+     * 供应企业联系人
      */
-    private List<UserInfo> supplyUsers;
+    private UserInfo supplyUser;
 
     /**
      * 订单来源 1采购下单2代客下单

+ 60 - 77
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java

@@ -293,64 +293,63 @@ public class KwoTradeOrderService {
     private void submitOrderSendMsg(OrderCheckDTO orderCheck, String orderNo) {
         Map<String, Object> map = new HashMap<>();
         map.put("orderNo", orderNo);
-        //提交人信息
         List<UserInfo> userInfos = new ArrayList<>();
+        //提交人信息
         UserInfo createUser = new UserInfo();
         createUser.setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId());
         userInfos.add(createUser);
-
         boolean flag = Objects.equals(orderCheck.getOrderSource(), DictEnum.TORDER_SOURCE_1.getValue());
+        UserInfo procureUser = orderCheck.getProcureUser();
+        String procureFireName = orderCheck.getProcureFireName();
+        UserInfo supplyUser = orderCheck.getSupplyUser();
+        String supplyFireName = orderCheck.getSupplyFireName();
         //采购下单
         if (flag) {
-            //给创建人发消息
-            map.put("firmName", orderCheck.getSupplyFireName());
-            SckwMessage msg = new SckwMessage();
-            msg.setRequestId(UUIDUtils.get32UUID())
-                    .setMessageEnum(MessageEnum.ORDER_INITIATE_PURCHASE)
-                    .setParams(map)
-                    .setMsgUrl(purchaseOrderListUrl)
-                    .setUserInfos(userInfos)
-                    .setCreateBy(LoginUserHolder.getUserId());
-            log.info("发起采购下单消息:{}", JSON.toJSONString(msg));
-            streamBridge.send("sckw-message", JSON.toJSONString(msg));
+            //给创建人及采购联系人发消息
+            map.put("firmName", supplyFireName);
+            if (!Objects.equals(procureUser.getUserId(), LoginUserHolder.getUserId())) {
+                userInfos.add(procureUser);
+            }
+            sendMsg(MessageEnum.ORDER_INITIATE_PURCHASE, map, purchaseOrderListUrl, userInfos);
             //给供应企业联系人发消息
-            map.put("firmName", orderCheck.getProcureFireName());
-            SckwMessage contactsMsg = new SckwMessage();
-            contactsMsg.setRequestId(UUIDUtils.get32UUID())
-                    .setMessageEnum(MessageEnum.ORDER_NEW_PENDING)
-                    .setParams(map)
-                    .setMsgUrl(valetOrderListUrl)
-                    .setUserInfos(orderCheck.getSupplyUsers())
-                    .setCreateBy(LoginUserHolder.getUserId());
-            log.info("有新的待受理订单消息:{}", JSON.toJSONString(contactsMsg));
-            streamBridge.send("sckw-message", JSON.toJSONString(contactsMsg));
+            map.put("firmName", procureFireName);
+            sendMsg(MessageEnum.ORDER_NEW_PENDING, map, valetOrderListUrl, List.of(supplyUser));
         } else {
             //代客下单
-            //给创建人发消息
-            map.put("firmName", orderCheck.getProcureFireName());
-            SckwMessage msg = new SckwMessage();
-            msg.setRequestId(UUIDUtils.get32UUID())
-                    .setMessageEnum(MessageEnum.ORDER_INITIATE_SALE)
-                    .setParams(map)
-                    .setMsgUrl(valetOrderListUrl)
-                    .setUserInfos(userInfos)
-                    .setCreateBy(LoginUserHolder.getUserId());
-            log.info("发起代客下单消息:{}", JSON.toJSONString(msg));
-            streamBridge.send("sckw-message", JSON.toJSONString(msg));
+            //给创建人及供应企业联系人发消息
+            map.put("firmName", procureFireName);
+            if (!Objects.equals(supplyUser.getUserId(), LoginUserHolder.getUserId())) {
+                userInfos.add(supplyUser);
+            }
+            sendMsg(MessageEnum.ORDER_INITIATE_SALE, map, valetOrderListUrl, userInfos);
             //给采购企业联系人发消息
-            map.put("firmName", orderCheck.getSupplyFireName());
-            SckwMessage contactsMsg = new SckwMessage();
-            contactsMsg.setRequestId(UUIDUtils.get32UUID())
-                    .setMessageEnum(MessageEnum.ORDER_NEW_VALET_MSG)
-                    .setParams(map)
-                    .setMsgUrl(purchaseOrderListUrl)
-                    .setUserInfos(orderCheck.getSupplyUsers())
-                    .setCreateBy(LoginUserHolder.getUserId());
-            log.info("有新的代客下单消息:{}", JSON.toJSONString(contactsMsg));
-            streamBridge.send("sckw-message", JSON.toJSONString(contactsMsg));
+            map.put("firmName", supplyFireName);
+            sendMsg(MessageEnum.ORDER_NEW_VALET_MSG, map, purchaseOrderListUrl, List.of(procureUser));
         }
     }
 
+    /**
+     * @desc: 发送消息
+     * @author: yzc
+     * @date: 2023-09-06 15:57
+     * @Param msgEnum: 消息枚举
+     * @Param params: 消息变量
+     * @Param url: 消息调转url
+     * @Param userInfos:  发送消息用户集合
+     * @return: void
+     */
+    private void sendMsg(MessageEnum msgEnum, Map<String, Object> params, String url, List<UserInfo> userInfos) {
+        SckwMessage msg = new SckwMessage();
+        msg.setRequestId(UUIDUtils.get32UUID())
+                .setMessageEnum(msgEnum)
+                .setParams(params)
+                .setMsgUrl(url)
+                .setUserInfos(userInfos)
+                .setCreateBy(LoginUserHolder.getUserId());
+        log.info("有新的提醒消息:{}", JSON.toJSONString(msg));
+        streamBridge.send("sckw-message", JSON.toJSONString(msg));
+    }
+
     /**
      * @desc: 获取采购销售顶级企业id
      * @author: yzc
@@ -362,8 +361,6 @@ public class KwoTradeOrderService {
     private void getTopEnt(OrderCheckDTO orderCheck, List<UnitInfo> unitInfo) {
         List<Long> entIds = unitInfo.stream().map(UnitInfo::getEntId).toList();
         Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(entIds);
-        List<UserInfo> procureUsers = new ArrayList<>();
-        List<UserInfo> supplyUsers = new ArrayList<>();
         unitInfo.forEach(e -> {
             Long entId = e.getEntId();
             EntCacheResDto ent = entMap.get(entId);
@@ -377,17 +374,16 @@ public class KwoTradeOrderService {
                 orderCheck.setProcureEntId(entId);
                 orderCheck.setProcureFireName(e.getFirmName());
                 procureUser.setUserId(e.getContactsId()).setEntId(ent.getId());
-                procureUsers.add(procureUser);
+                orderCheck.setProcureUser(procureUser);
             } else {
                 UserInfo supplyUser = new UserInfo();
                 orderCheck.setSupplyTopEntId(ent.getId());
                 orderCheck.setSupplyEntId(entId);
                 orderCheck.setSupplyFireName(e.getFirmName());
                 supplyUser.setUserId(e.getContactsId()).setEntId(ent.getId());
-                supplyUsers.add(supplyUser);
+                orderCheck.setSupplyUser(supplyUser);
             }
         });
-        orderCheck.setProcureUsers(procureUsers).setSupplyUsers(supplyUsers);
     }
 
     /**
@@ -952,42 +948,29 @@ public class KwoTradeOrderService {
      * @return: void
      */
     private void rejectOrderSendMsg(List<KwoTradeOrderUnit> units, KwoTradeOrder order) {
-        Map<String, KwoTradeOrderUnit> unitMap = units.stream().collect
-                (Collectors.toMap(KwoTradeOrderUnit::getUnitType, Function.identity()));
         Map<String, Object> map = new HashMap<>();
         map.put("orderNo", order.getTOrderNo());
-
-        //给供应企业联系人发消息
-        List<UserInfo> purchaseUsers = new ArrayList<>();
-        UserInfo purchaseUser = new UserInfo();
+        Map<String, KwoTradeOrderUnit> unitMap = units.stream().collect
+                (Collectors.toMap(KwoTradeOrderUnit::getUnitType, Function.identity()));
         KwoTradeOrderUnit purchase = unitMap.get(DictEnum.TORDER_UNIT_TYPE_1.getValue());
-        purchaseUser.setUserId(purchase.getContactsId()).setEntId(purchase.getTopEntId());
-        purchaseUsers.add(purchaseUser);
-        SckwMessage contactsMsg = new SckwMessage();
+        KwoTradeOrderUnit supply = unitMap.get(DictEnum.TORDER_UNIT_TYPE_2.getValue());
+        //给供应企业联系人发消息
         map.put("firmName", purchase.getFirmName());
-        contactsMsg.setRequestId(UUIDUtils.get32UUID())
-                .setMessageEnum(MessageEnum.ORDER_REJECT_VALET)
-                .setParams(map)
-                .setMsgUrl(valetOrderListUrl)
-                .setUserInfos(purchaseUsers)
-                .setCreateBy(LoginUserHolder.getUserId());
-        log.info("驳回采购订单消息:{}", JSON.toJSONString(contactsMsg));
-        streamBridge.send("sckw-message", JSON.toJSONString(contactsMsg));
-        //给订单创建人发消息
+        UserInfo supplyUser = new UserInfo();
+        supplyUser.setUserId(supply.getContactsId()).setEntId(supply.getTopEntId());
+        sendMsg(MessageEnum.ORDER_REJECT_VALET, map, valetOrderListUrl, List.of(supplyUser));
+        //给订单创建人及采购企业联系人发消息
+        map.put("firmName", supply.getFirmName());
         List<UserInfo> userInfos = new ArrayList<>();
         UserInfo createUser = new UserInfo();
         createUser.setUserId(order.getCreateBy()).setEntId(order.getEntId());
         userInfos.add(createUser);
-        map.put("firmName", unitMap.get(DictEnum.TORDER_UNIT_TYPE_2.getValue()).getFirmName());
-        SckwMessage msg = new SckwMessage();
-        msg.setRequestId(UUIDUtils.get32UUID())
-                .setMessageEnum(MessageEnum.ORDER_REJECT_PURCHASE)
-                .setParams(map)
-                .setMsgUrl(purchaseOrderListUrl)
-                .setUserInfos(userInfos)
-                .setCreateBy(LoginUserHolder.getUserId());
-        log.info("采购订单被驳回消息:{}", JSON.toJSONString(msg));
-        streamBridge.send("sckw-message", JSON.toJSONString(msg));
+        if (!Objects.equals(createUser.getUserId(), purchase.getContactsId())) {
+            UserInfo purchaseUser = new UserInfo();
+            purchaseUser.setUserId(purchase.getContactsId()).setEntId(purchase.getTopEntId());
+            userInfos.add(purchaseUser);
+        }
+        sendMsg(MessageEnum.ORDER_REJECT_PURCHASE, map, purchaseOrderListUrl, userInfos);
     }
 
     /**

+ 155 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/WalletController.java

@@ -1,13 +1,12 @@
 package com.sckw.payment.controller;
 
 import com.sckw.core.web.response.HttpResult;
-import com.sckw.payment.model.vo.req.WalletDetailReq;
+import com.sckw.payment.model.vo.req.*;
 import com.sckw.payment.service.WalletService;
 import jakarta.annotation.Resource;
+import jakarta.validation.Valid;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * 钱包
@@ -42,4 +41,156 @@ public class WalletController {
         return HttpResult.ok(walletService.walletDetail(walletDetailReq));
     }
 
+    /**
+     * 新增账目
+     *
+     * @param addWalletReq
+     * @return
+     */
+    @PostMapping("add")
+    public HttpResult add(@RequestBody @Valid AddWalletReq addWalletReq) {
+        return HttpResult.ok(walletService.addWallet(addWalletReq));
+    }
+
+    /**
+     * 账目充值
+     *
+     * @param addWalletReq
+     * @return
+     */
+    @PostMapping("recharge")
+    public HttpResult recharge(@RequestBody @Valid AddWalletReq addWalletReq) {
+        return HttpResult.ok(walletService.addWalletMoney(addWalletReq));
+    }
+
+    /**
+     * 提现
+     *
+     * @param cashWalletReq
+     * @return
+     */
+    @PostMapping("cashOUt")
+    public HttpResult cashOUt(@RequestBody @Valid CashWalletReq cashWalletReq) {
+        return HttpResult.ok(walletService.cashOUt(cashWalletReq));
+    }
+
+    /**
+     * 重新提现
+     *
+     * @param cashWalletReq
+     * @return
+     */
+    @PostMapping("reCashOUt")
+    public HttpResult reCashOUt(@RequestBody @Valid CashWalletReq cashWalletReq) {
+        return HttpResult.ok(walletService.reCashOUt(cashWalletReq));
+    }
+
+    /**
+     * 转账
+     *
+     * @param transferReq
+     * @return
+     */
+    @PostMapping("transfer")
+    public HttpResult transfer(TransferReq transferReq) {
+        return HttpResult.ok(walletService.transfer(transferReq));
+    }
+
+    /**
+     * 提现记录
+     *
+     * @param cashPageReq
+     * @return
+     */
+    @GetMapping("cashList")
+    public HttpResult cashList(CashPageReq cashPageReq) {
+        return HttpResult.ok(walletService.cashList(cashPageReq));
+    }
+
+    /**
+     * 提现记录 分类统计
+     *
+     * @param cashPageReq
+     * @return
+     */
+    @GetMapping("cashCount")
+    public HttpResult cashCount(CashPageReq cashPageReq) {
+        return HttpResult.ok(walletService.cashCount(cashPageReq));
+    }
+
+    /**
+     * 预付列表
+     *
+     * @param prePayPage
+     * @return
+     */
+    @GetMapping("prePayList")
+    public HttpResult prePayList(PrePayPage prePayPage) {
+        return HttpResult.ok(walletService.prePayList(prePayPage));
+    }
+
+    /**
+     * 预收列表
+     *
+     * @param prePayPage
+     * @return
+     */
+    @GetMapping("preReceiveList")
+    public HttpResult preReceiveList(PrePayPage prePayPage) {
+        return HttpResult.ok(walletService.preReceiveList(prePayPage));
+    }
+
+    /**
+     * 预付校验
+     *
+     * @param prePayCheck
+     * @return
+     */
+    @PostMapping("prePayCheck")
+    public HttpResult prePayCheck(@RequestBody @Valid PrePayCheck prePayCheck) {
+        return HttpResult.ok(walletService.prePayCheck(prePayCheck));
+    }
+
+    /**
+     * 新增预付
+     *
+     * @param prePay
+     * @return
+     */
+    @PostMapping("addPrePay")
+    public HttpResult addPrePay(@RequestBody @Valid PrePay prePay) {
+        return HttpResult.ok(walletService.addPrePay(prePay));
+    }
+
+    /**
+     * 预付追加
+     *
+     * @param prePay
+     * @return
+     */
+    @PostMapping("prePayAppend")
+    public HttpResult prePayAppend(@RequestBody @Valid PrePay prePay) {
+        return HttpResult.ok(walletService.prePayAppend(prePay));
+    }
+
+    /**
+     * 申请退款
+     *
+     * @param refundReq
+     * @return
+     */
+    @PostMapping("applyRefund")
+    public HttpResult applyRefund(@RequestBody @Valid RefundReq refundReq) {
+        return HttpResult.ok(walletService.applyRefund(refundReq));
+    }
+    /**
+     * 退款
+     *
+     * @param refundReq
+     * @return
+     */
+    @PostMapping("refund")
+    public HttpResult refund(@RequestBody @Valid RefundReq refundReq) {
+        return HttpResult.ok(walletService.launchRefund(refundReq));
+    }
 }

+ 13 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpWalletRefundMapper.java

@@ -0,0 +1,13 @@
+package com.sckw.payment.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sckw.payment.model.KwpWalletRefund;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author xucaiqin
+ * @date 2023-09-05 17:53:14
+ */
+@Mapper
+public interface KwpWalletRefundMapper extends BaseMapper<KwpWalletRefund> {
+}

+ 33 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/job/AsyncPool.java

@@ -0,0 +1,33 @@
+package com.sckw.payment.job;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author xucaiqin
+ * @date 2023-09-05 20:13:57
+ */
+public class AsyncPool {
+
+    private AsyncPool() {
+    }
+
+    /**
+     * 提交任务
+     *
+     * @param runnable
+     */
+    public static void addTask(Runnable runnable) {
+        ThreadPool.threadPoolExecutor.execute(runnable);
+    }
+
+    private static class ThreadPool {
+        public static final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1,
+                1,
+                1,
+                TimeUnit.MINUTES,
+                new LinkedBlockingQueue<>(12));
+
+    }
+}

+ 117 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpWalletRefund.java

@@ -0,0 +1,117 @@
+package com.sckw.payment.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * @date 2023-09-05 17:53:14
+ * @author xucaiqin
+ */
+
+/**
+ * 退款记录表
+ */
+@Data
+@TableName(value = "kwp_wallet_refund")
+public class KwpWalletRefund {
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.INPUT)
+    private Long id;
+
+    /**
+     * 流水号
+     */
+    @TableField(value = "order_no")
+    private String orderNo;
+
+    /**
+     * uid
+     */
+    @TableField(value = "`uid`")
+    private String uid;
+
+    /**
+     * 退款企业id
+     */
+    @TableField(value = "from_ent")
+    private Long fromEnt;
+
+    /**
+     * filter
+     */
+    @TableField(value = "`filter`")
+    private String filter;
+
+    /**
+     * 收款企业id
+     */
+    @TableField(value = "to_ent")
+    private Long toEnt;
+
+    /**
+     * 电子钱包渠道
+     */
+    @TableField(value = "channel")
+    private String channel;
+    /**
+     * 备注
+     */
+    @TableField(value = "remark")
+    private String remark;
+
+    /**
+     * 退款金额
+     */
+    @TableField(value = "money")
+    private BigDecimal money;
+
+    /**
+     * 实际退款金额
+     */
+    @TableField(value = "actual_money")
+    private BigDecimal actualMoney;
+
+    /**
+     * 创建人
+     */
+    @TableField(value = "create_by")
+    private Long createBy;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private LocalDateTime createTime;
+
+    /**
+     * 更新人
+     */
+    @TableField(value = "update_by")
+    private Long updateBy;
+
+    /**
+     * 更新时间
+     */
+    @TableField(value = "update_time")
+    private LocalDateTime updateTime;
+
+    /**
+     * 0-正常 1-删除
+     */
+    @TableField(value = "del_flag")
+    private Integer delFlag;
+
+    /**
+     * 1-申请退款 2-退款中 3-退款失败 4-退款驳回
+     */
+    @TableField(value = "`status`")
+    private Integer status;
+}

+ 54 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/CashEnum.java

@@ -0,0 +1,54 @@
+package com.sckw.payment.model.constant;
+
+import java.util.Objects;
+
+/**
+ * 物流、贸易
+ * 对账单状态枚举
+ *
+ * @author xucaiqin
+ * @date 2023-07-11 12:00:52
+ */
+public enum CashEnum {
+    ALL(-1, "全部", "-1"),
+    FAIL(0, "提现失败", "0"),
+    SUCCESS(1, "提现成功", "1"),
+    LOAD(2, "提现中", "2"),
+    WAIT(3, "等待提现", "3");
+
+    private final int status;
+    private final String desc;
+    private final String label;
+
+    CashEnum(int status, String desc, String label) {
+        this.status = status;
+        this.label = label;
+        this.desc = desc;
+    }
+
+    public static String getDesc(Integer status) {
+        if (Objects.isNull(status)) {
+            return "";
+        }
+        for (CashEnum value : values()) {
+            if (status == value.getStatus()) {
+                return value.getDesc();
+            }
+        }
+        return "";
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+
+    public String getDesc() {
+        return desc;
+    }
+
+}

+ 9 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/PayCenterEnum.java

@@ -12,8 +12,13 @@ import lombok.Getter;
 public enum PayCenterEnum {
     MEMBER_DETAIL("/v1/member/detail", "会员详情"),
     MEMBER_WALLET("/v1/member/wallet", "钱包清单"),
+    MEMBER_WALLET_V2("/v2/member/wallet", "钱包清单"),
+    MEMBER_GENERAL("/v2/wallet/general", "总览信息"),
+
     WITHDRAW_DETAIL("/v1/wallet/withdraw/detail", "提现详情"),
-    WITHDRAW_INDEX("/v1/wallet/withdraw/index", "提现清单"),
+    //    WITHDRAW_INDEX("/v1/wallet/withdraw/index", "提现清单"), 原接口
+    WITHDRAW_INDEX("/v2/wallet/withdraw/index", "提现清单"),
+    WITHDRAW_CATEGORY("/v2/wallet/withdraw/categories", "提现清单分类"),
     WITHDRAW_STATUS("/v1/wallet/withdraw/status", "订单状态"),
     WITHDRAW_CANCEL("/v1/wallet/withdraw/cancel", "取消提现"),
     WITHDRAW_TAKE("/v1/wallet/withdraw/take", "申请提现"),
@@ -27,6 +32,8 @@ public enum PayCenterEnum {
     ADVANCE_PAY_DETAIL("/v1/wallet/advancepay/detail", "预付订单详情"),
     ADVANCE_PAY_APPLY("/v1/wallet/advancepay/apply", "发起预付"),
     ADVANCE_PAY_INDEX("/v1/wallet/advancepay/index", "预付订单清单"),
+    ADVANCE_PAY_WALLETS("/v2/advancepay/wallets", "钱包预付列表"),
+    ADVANCE_PAY_RECEIVE("/v2/advancepay/receives", "钱包预收列表"),
     ADVANCE_PAY_STATUS("/v1/wallet/advancepay/statusCategory", "预付订单状态"),
     INDEX("/v1/index/index", "获取通道清单"),
     MEMBER_PAY_INDEX("/v1/member/pay/index", "订单记录"),
@@ -35,6 +42,7 @@ public enum PayCenterEnum {
     WALLET_FREEZE("/v1/wallet/freeze", "冻结资金"),
     WALLET_UNFREEZE("/v1/wallet/unfreeze", "解冻金额"),
     PAY_AGENT_PAY("/v1/pay/agent_pay", "清分"),
+    PAY_AGENT_PAY_V2("/v2/pay/agent_pay", "清分"),
     WALLET_INDEX("/v1/wallet/index", "创建钱包");
     private final String addr;
     private final String desc;

+ 53 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/RefundEnum.java

@@ -0,0 +1,53 @@
+package com.sckw.payment.model.constant;
+
+import java.util.Objects;
+
+/**
+ * 钱包退款枚举类
+ * 1-申请退款 2-退款中 3-退款失败 4-退款驳回
+ * @author xucaiqin
+ * @date 2023-07-11 12:00:52
+ */
+public enum RefundEnum {
+    ALL(0, "全部", "0"),
+    APPLY(1, "申请退款", "1"),
+    REFUNDING(2, "退款中", "2"),
+    FAILED(3, "退款失败", "3"),
+    BACK(4, "退款驳回", "4");
+
+    private final int status;
+    private final String desc;
+    private final String label;
+
+    RefundEnum(int status, String desc, String label) {
+        this.status = status;
+        this.label = label;
+        this.desc = desc;
+    }
+
+    public static String getDesc(Integer status) {
+        if (Objects.isNull(status)) {
+            return "";
+        }
+        for (RefundEnum value : values()) {
+            if (status == value.getStatus()) {
+                return value.getDesc();
+            }
+        }
+        return "";
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+
+    public String getDesc() {
+        return desc;
+    }
+
+}

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/common/BusinessNo.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/common/BusinessNo.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto.common;
+package com.sckw.payment.model.dto.common;
 
 import com.alibaba.fastjson2.annotation.JSONField;
 import lombok.Getter;

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/common/Page.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/common/Page.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto.common;
+package com.sckw.payment.model.dto.common;
 
 import lombok.Getter;
 import lombok.Setter;

+ 6 - 5
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/page/CashPage.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/CashPage.java

@@ -1,7 +1,8 @@
-package com.sckw.payment.api.model.dto.page;
+package com.sckw.payment.model.dto.page;
 
-import com.sckw.payment.api.model.dto.CashItem;
-import com.sckw.payment.api.model.dto.common.Page;
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.sckw.payment.model.dto.common.Page;
+import com.sckw.payment.model.dto.wallet.CashItem;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -17,6 +18,6 @@ public class CashPage extends Page<CashItem> {
     @Serial
     private static final long serialVersionUID = 8737528173711734529L;
 
-    private long total_withdraw_money;
-    private long total_balance;
+    @JSONField(name = "total_withdraw_money")
+    private String totalWithdrawMoney;
 }

+ 3 - 3
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/page/PrePayIndexPage.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/PrePayIndexPage.java

@@ -1,7 +1,7 @@
-package com.sckw.payment.api.model.dto.page;
+package com.sckw.payment.model.dto.page;
 
-import com.sckw.payment.api.model.dto.PrePayIndex;
-import com.sckw.payment.api.model.dto.common.Page;
+import com.sckw.payment.model.dto.common.Page;
+import com.sckw.payment.model.dto.wallet.PrePayIndex;
 import lombok.Getter;
 import lombok.Setter;
 

+ 19 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/PrePayWalletPage.java

@@ -0,0 +1,19 @@
+package com.sckw.payment.model.dto.page;
+
+import com.sckw.payment.model.dto.common.Page;
+import com.sckw.payment.model.dto.wallet.PrePayWallet;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serial;
+
+/**
+ * @author xucaiqin
+ * @date 2023-07-25 16:23:34
+ */
+@Getter
+@Setter
+public class PrePayWalletPage extends Page<PrePayWallet> {
+    @Serial
+    private static final long serialVersionUID = 8374847700935135347L;
+}

+ 2 - 3
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/page/RecordPage.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/RecordPage.java

@@ -1,7 +1,6 @@
-package com.sckw.payment.api.model.dto.page;
+package com.sckw.payment.model.dto.page;
 
-import com.sckw.payment.api.model.dto.Record;
-import com.sckw.payment.api.model.dto.common.Page;
+import com.sckw.payment.model.dto.common.Page;
 import lombok.Getter;
 import lombok.Setter;
 

+ 22 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashCount.java

@@ -0,0 +1,22 @@
+package com.sckw.payment.model.dto.wallet;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author xucaiqin
+ * @date 2023-07-25 15:19:14
+ */
+@NoArgsConstructor
+@Data
+public class CashCount implements Serializable {
+    @Serial
+    private static final long serialVersionUID = -5090368604958419905L;
+
+    private String name;
+    private String value;
+    private Long total;
+}

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/CashDetail.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashDetail.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import lombok.Data;
 

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/CashDetailItem.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashDetailItem.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import lombok.Data;
 

+ 37 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashItem.java

@@ -0,0 +1,37 @@
+package com.sckw.payment.model.dto.wallet;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author xucaiqin
+ * @date 2023-07-25 15:19:14
+ */
+@NoArgsConstructor
+@Data
+public class CashItem implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 856945436214113979L;
+    @JSONField(name = "order_no")
+    private String orderNo;
+    private String uid;
+    private Integer status;
+    @JSONField(name = "status_label")
+    private String statusLabel;
+    private String channel;
+    @JSONField(name = "channel_label")
+    private String channelLabel;
+    @JSONField(name = "platform_no")
+    private String platformNo;
+    private Integer money;
+    private Integer balance;
+    private String remarks;
+    @JSONField(name = "create_time")
+    private String createTime;
+    @JSONField(name = "finish_time")
+    private String finishTime;
+}

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/Channel.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Channel.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import lombok.Getter;
 import lombok.Setter;

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/Detail.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Detail.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Getter;

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/Filter.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Filter.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import lombok.Data;
 

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/Freeze.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Freeze.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import lombok.Data;
 

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/LogItem.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/LogItem.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Getter;

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/MemberCreate.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/MemberCreate.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/MemberRes.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/MemberRes.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import lombok.Getter;
 import lombok.Setter;

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/Money.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Money.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import lombok.Data;
 

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/Operate.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Operate.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson2.annotation.JSONField;
 import lombok.Data;

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/OperateDown.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/OperateDown.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson2.annotation.JSONField;
 import lombok.Getter;

+ 4 - 2
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/Order.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Order.java

@@ -1,5 +1,6 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
+import com.alibaba.fastjson2.annotation.JSONField;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -15,5 +16,6 @@ import java.io.Serializable;
 public class Order implements Serializable {
     @Serial
     private static final long serialVersionUID = -3148504181066374194L;
-    private String order_no;
+    @JSONField(name = "order_no")
+    private String orderNo;
 }

+ 2 - 2
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/PatchPay.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PatchPay.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
@@ -18,7 +18,7 @@ public class PatchPay implements Serializable {
     @JSONField(name = "uid")
     private String uid;
     @JSONField(name = "money")
-    private Integer money;
+    private Long money;
     @JSONField(name = "remark")
     private String remark;
 }

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/PayIndex.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PayIndex.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Getter;

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/PayRecord.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PayRecord.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Getter;

+ 2 - 2
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/PayRecordPage.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PayRecordPage.java

@@ -1,6 +1,6 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
-import com.sckw.payment.api.model.dto.common.Page;
+import com.sckw.payment.model.dto.common.Page;
 import lombok.Getter;
 import lombok.Setter;
 

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/PrePayIndex.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PrePayIndex.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Getter;

+ 48 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PrePayWallet.java

@@ -0,0 +1,48 @@
+package com.sckw.payment.model.dto.wallet;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+@Getter
+@Setter
+public class PrePayWallet implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 7340075510663637767L;
+
+    @JSONField(name = "uid")
+    private String uid;
+    @JSONField(name = "filter")
+    private String filter;
+
+    @JSONField(name = "channel")
+    private String channel;
+
+    @JSONField(name = "channel_label")
+    private String channelLabel;
+    /**
+     * 预付金额
+     */
+    @JSONField(name = "ap_money")
+    private long apMoney;
+
+    /**
+     * 使用中
+     */
+    @JSONField(name = "using_ap_money")
+    private long usingApMoney;
+    /**
+     * 结算中
+     */
+    @JSONField(name = "settling_ap_money")
+    private long settlingApMoney;
+    /**
+     * 总预付金额
+     */
+    @JSONField(name = "total_ap_money")
+    private long totalApMoney;
+
+}

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/Record.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Record.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Getter;

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/RrePayDetail.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/RrePayDetail.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Getter;

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/Tips.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Tips.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import lombok.Data;
 

+ 21 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Wallet.java

@@ -0,0 +1,21 @@
+package com.sckw.payment.model.dto.wallet;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.sckw.payment.api.model.dto.WalletDto;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 钱包清单
+ */
+@Data
+public class Wallet implements Serializable {
+    /**
+     * 钱包清单
+     */
+    private List<WalletDto> rows;
+    @JSONField(name = "total_money")
+    private long totalMoney;
+}

+ 1 - 1
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/WalletInfo.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/WalletInfo.java

@@ -1,4 +1,4 @@
-package com.sckw.payment.api.model.dto;
+package com.sckw.payment.model.dto.wallet;
 
 import com.alibaba.fastjson2.annotation.JSONField;
 import lombok.Data;

+ 42 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/WalletOverview.java

@@ -0,0 +1,42 @@
+package com.sckw.payment.model.dto.wallet;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 钱包总览
+ */
+@Data
+public class WalletOverview implements Serializable {
+    @JSONField(name = "uid")
+    private String uid;
+    /**
+     * 提现中金额
+     */
+    @JSONField(name = "channel_total")
+    private Integer channelTotal;
+    /**
+     * 线上可用余额
+     */
+    private Long money;
+    @JSONField(name = "channels")
+    private List<String> channels;
+    /**
+     * 预付金额
+     */
+    @JSONField(name = "ap_money")
+    private Long apMoney;
+    /**
+     * 提现余额
+     */
+    @JSONField(name = "wd_money")
+    private Long wdMoney;
+    /**
+     * 总金额
+     */
+    @JSONField(name = "total_money")
+    private Long totalMoney;
+}

+ 7 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/CashPageReq.java

@@ -1,6 +1,7 @@
 package com.sckw.payment.model.vo.req;
 
 import com.sckw.core.model.vo.BasePara;
+import com.sckw.payment.model.constant.CashEnum;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -17,7 +18,11 @@ public class CashPageReq extends BasePara {
      * 支付通道 huifu
      */
     private String channel;
-
-    private String entName;
+    /**
+     * 提现状态
+     *
+     * @see CashEnum
+     */
+    private String status;
 
 }

+ 41 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePay.java

@@ -0,0 +1,41 @@
+package com.sckw.payment.model.vo.req;
+
+import com.sckw.payment.model.vo.res.MoneyChange;
+import jakarta.validation.constraints.Digits;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.Positive;
+import jakarta.validation.constraints.Size;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 新增预付参数
+ *
+ * @author xucaiqin
+ * @date 2023-08-29 09:14:04
+ */
+@Getter
+@Setter
+public class PrePay implements MoneyChange {
+    /**
+     * 支付通道 huifu
+     */
+    @NotBlank(message = "支付通道不能为空")
+    private String channel;
+
+    @NotBlank(message = "uid不能为空")
+    private String uid;
+
+    @NotBlank(message = "filter不能为空")
+    private String filter;
+
+    @Positive(message = "提现金额必须大于0")
+    @Digits(message = "小数位数过长或金额过大", integer = 10, fraction = 2)
+    private BigDecimal money;
+
+    @Size(message = "备注不能超过200字")
+    private String remark;
+
+}

+ 23 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayCheck.java

@@ -0,0 +1,23 @@
+package com.sckw.payment.model.vo.req;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 预付钱包可用余额校验
+ *
+ * @author xucaiqin
+ * @date 2023-08-29 09:14:04
+ */
+@Getter
+@Setter
+public class PrePayCheck {
+    /**
+     * 支付通道 huifu
+     */
+    @NotBlank(message = "支付通道不能为空")
+    private String channel;
+    @NotBlank(message = "filter不能为空")
+    private String filter;
+}

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayReq.java → sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayPage.java

@@ -12,7 +12,7 @@ import lombok.Setter;
  */
 @Getter
 @Setter
-public class PrePayReq extends BasePara {
+public class PrePayPage extends BasePara {
     /**
      * 支付通道 1
      */

+ 41 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/Refund.java

@@ -0,0 +1,41 @@
+package com.sckw.payment.model.vo.req;
+
+import com.sckw.payment.model.vo.res.MoneyChange;
+import jakarta.validation.constraints.Digits;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.Positive;
+import jakarta.validation.constraints.Size;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 退款
+ *
+ * @author xucaiqin
+ * @date 2023-08-29 09:14:04
+ */
+@Getter
+@Setter
+public class Refund implements MoneyChange {
+    /**
+     * 支付通道 huifu
+     */
+    @NotBlank(message = "支付通道不能为空")
+    private String channel;
+
+    @NotBlank(message = "uid不能为空")
+    private String uid;
+
+    @NotBlank(message = "filter不能为空")
+    private String filter;
+
+    @Positive(message = "提现金额必须大于0")
+    @Digits(message = "小数位数过长或金额过大", integer = 10, fraction = 2)
+    private BigDecimal money;
+
+    @Size(message = "备注不能超过200字")
+    private String remark;
+
+}

+ 4 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/RefundReq.java

@@ -18,7 +18,9 @@ import java.math.BigDecimal;
  */
 @Getter
 @Setter
-public class RefundReq  implements MoneyChange {
+public class RefundReq implements MoneyChange {
+    @NotBlank(message = "当前企业不能为空")
+    private String uid;
     /**
      * 支付通道字典值
      */
@@ -26,7 +28,7 @@ public class RefundReq  implements MoneyChange {
     private String channel;
 
     @NotBlank(message = "合作企业不能为空")
-    private String entId;
+    private String filter;
 
     @Positive(message = "提现金额必须大于0")
     @Digits(message = "小数位数过长或金额过大", integer = 10, fraction = 2)

+ 41 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/TransferReq.java

@@ -0,0 +1,41 @@
+package com.sckw.payment.model.vo.req;
+
+import com.sckw.payment.model.vo.res.MoneyChange;
+import jakarta.validation.constraints.Digits;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.Positive;
+import jakarta.validation.constraints.Size;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 转账
+ *
+ * @author xucaiqin
+ * @date 2023-08-29 09:14:04
+ */
+@Getter
+@Setter
+public class TransferReq implements MoneyChange {
+    /**
+     * 支付通道 huifu
+     */
+    @NotBlank(message = "支付通道不能为空")
+    private String channel;
+
+    @NotBlank(message = "uid不能为空")
+    private String uid;
+
+    @NotBlank(message = "filter不能为空")
+    private String filter;
+
+    @Positive(message = "提现金额必须大于0")
+    @Digits(message = "小数位数过长或金额过大", integer = 10, fraction = 2)
+    private BigDecimal money;
+
+    @Size(message = "备注不能超过200字")
+    private String remark;
+
+}

+ 27 - 6
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/FundVo.java

@@ -37,17 +37,38 @@ public class FundVo implements Serializable {
      * 往来单位名称
      */
     private String filterName;
-
-    private Long payMoney;
-    private Long cashMoney;
-    private Long refundMoney;
+    /**
+     * 充值中金额
+     */
+    private String chargingMoney;
+    /**
+     * 提现中金额
+     */
+    private String withdrawingMoney;
+    /**
+     * 退款中金额
+     */
+    private String refundMoney;
     /**
      * 可用余额
      */
-    private Long money;
+    private String money;
     /**
-     * 更新时间
+     * 总金额
+     */
+    private String totalMoney;
+    /**
+     * 操作
+     */
+    private String action;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间 todo-xcq 自我维护
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime updateTime;
+
 }

+ 34 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/MorePageRes.java

@@ -0,0 +1,34 @@
+package com.sckw.payment.model.vo.res;
+
+import com.sckw.core.model.page.PageRes;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 返回的分页数据中,有额外需要返回的参数
+ *
+ * @author Aick Spt
+ * @date 2023-07-25 17:31
+ */
+@Getter
+@Setter
+public class MorePageRes<T> extends PageRes<T> {
+    private String money;
+
+    public MorePageRes(int page, int pageSize, long size, int pages, List<T> list, String money) {
+        super(page, pageSize, size, pages, list);
+        this.money = money;
+    }
+
+    public MorePageRes(int page, int pageSize, List<T> list, String money) {
+        this.page = page;
+        this.pageSize = pageSize;
+        this.size = list.size();
+        this.pages = list.size() / pageSize + 1;
+        this.money = money;
+        this.list = list.stream().skip((long) (page - 1) * pageSize).limit(pageSize).toList();
+    }
+
+}

+ 3 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/WalletDetail.java

@@ -1,10 +1,12 @@
 package com.sckw.payment.model.vo.res;
 
+import java.util.List;
+
 /**
  * 钱包信息
  *
  * @author xucaiqin
  * @date 2023-08-28 15:43:49
  */
-public record WalletDetail(String entName, String money, String moneyYuan, int channel) {
+public record WalletDetail(String entName, String money, String moneyYuan, int channel, List<String> channels) {
 }

+ 136 - 12
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/PayCenterService.java

@@ -8,12 +8,14 @@ import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.OkHttpUtils;
 import com.sckw.payment.api.model.constant.ChannelEnum;
 import com.sckw.payment.api.model.dto.*;
-import com.sckw.payment.api.model.dto.common.BusinessNo;
+import com.sckw.payment.model.dto.common.BusinessNo;
 import com.sckw.payment.api.model.dto.common.R;
-import com.sckw.payment.api.model.dto.page.CashPage;
-import com.sckw.payment.api.model.dto.page.PrePayIndexPage;
-import com.sckw.payment.api.model.dto.page.RecordPage;
+import com.sckw.payment.model.dto.page.CashPage;
+import com.sckw.payment.model.dto.page.PrePayIndexPage;
+import com.sckw.payment.model.dto.page.PrePayWalletPage;
+import com.sckw.payment.model.dto.page.RecordPage;
 import com.sckw.payment.model.constant.PayCenterEnum;
+import com.sckw.payment.model.dto.wallet.*;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
 import lombok.extern.slf4j.Slf4j;
@@ -53,7 +55,7 @@ public class PayCenterService {
     }
 
     private String getHttp(PayCenterEnum payCenterEnum, Map<String, Object> para) {
-        log.info("{}入参->{}", payCenterEnum.getDesc(), JSONObject.toJSONString(para));
+        log.debug("{}入参->{}", payCenterEnum.getDesc(), JSONObject.toJSONString(para));
         OkHttpUtils okHttpUtils = OkHttpUtils.builder().url(payCenterAddr + payCenterEnum.getAddr());
         if (!CollectionUtils.isEmpty(para)) {
             for (Map.Entry<String, Object> p : para.entrySet()) {
@@ -88,12 +90,12 @@ public class PayCenterService {
             log.error("中台服务异常", e.getCause());
             throw new RuntimeException("支付服务异常!");
         }
-        log.info("{}返回值->{}", payCenterEnum.getDesc(), sync);
+        log.debug("{}返回值->{}", payCenterEnum.getDesc(), sync);
         return changeRes(sync);
     }
 
     private String postHttp(PayCenterEnum payCenterEnum, Map<String, Object> para) {
-        log.info("{}入参->{}", payCenterEnum.getDesc(), JSONObject.toJSONString(para));
+        log.debug("{}入参->{}", payCenterEnum.getDesc(), JSONObject.toJSONString(para));
         OkHttpUtils okHttpUtils = OkHttpUtils.builder().url(payCenterAddr + payCenterEnum.getAddr());
         if (!CollectionUtils.isEmpty(para)) {
             for (Map.Entry<String, Object> p : para.entrySet()) {
@@ -127,7 +129,7 @@ public class PayCenterService {
             log.error("中台服务异常", e.getCause());
             throw new RuntimeException("支付服务异常!");
         }
-        log.info("{}返回值->{}", payCenterEnum.getDesc(), sync);
+        log.debug("{}返回值->{}", payCenterEnum.getDesc(), sync);
         return changeRes(sync);
     }
 
@@ -159,6 +161,21 @@ public class PayCenterService {
         });
     }
 
+
+    /**
+     * 总览信息
+     *
+     * @param uid
+     * @return
+     */
+    public R<WalletOverview> general(String uid) {
+        String sync = getHttp(PayCenterEnum.MEMBER_GENERAL, new HashMap<>() {{
+            put("uid", uid);
+        }});
+        return JSONObject.parseObject(sync, new TypeReference<>() {
+        });
+    }
+
     /**
      * 钱包清单
      *
@@ -179,6 +196,27 @@ public class PayCenterService {
         return parseArray(sync, WalletDto.class);
     }
 
+    /**
+     * 钱包清单 v2
+     *
+     * @param uid
+     * @param channel
+     * @param filter
+     * @return
+     */
+    public R<Wallet> walletSum(@NotNull String uid, ChannelEnum channel, String filter) {
+        if (StringUtils.isBlank(uid)) {
+            throw new BusinessException("提现用户不能为空");
+        }
+        String sync = getHttp(PayCenterEnum.MEMBER_WALLET_V2, new HashMap<>() {{
+            put("uid", uid);
+            put("channel", Objects.isNull(channel) ? "" : channel);
+            put("filter", filter);
+        }});
+        return JSONObject.parseObject(sync, new TypeReference<>() {
+        });
+    }
+
     /**
      * 提现详情
      *
@@ -212,13 +250,10 @@ public class PayCenterService {
      * @param pageSize
      * @return
      */
-    public R<CashPage> withdrawIndex(String uid, ChannelEnum channel, Integer page, Integer pageSize) {
+    public R<CashPage> withdrawIndex(String uid, ChannelEnum channel, String status, Integer page, Integer pageSize) {
         if (StringUtils.isBlank(uid)) {
             throw new BusinessException("用户不能为空");
         }
-        if (Objects.isNull(channel)) {
-            throw new BusinessException("支付渠道不能为空");
-        }
         if (Objects.isNull(page)) {
             page = 1;
         }
@@ -232,11 +267,29 @@ public class PayCenterService {
             put("channel", channel);
             put("page", finalPage);
             put("pageSize", finalPageSize);
+            put("status", status);
         }});
         return JSONObject.parseObject(sync, new TypeReference<>() {
         });
     }
 
+    /**
+     * 提现类型分类统计
+     *
+     * @param uid
+     * @return
+     */
+    public R<List<CashCount>> withdrawCategory(String uid, ChannelEnum channel) {
+        if (StringUtils.isBlank(uid)) {
+            throw new BusinessException("用户不能为空");
+        }
+        String sync = getHttp(PayCenterEnum.WITHDRAW_CATEGORY, new HashMap<>() {{
+            put("uid", uid);
+            put("channel", channel);
+        }});
+        return parseArray(sync, CashCount.class);
+    }
+
     /**
      * 订单状态
      *
@@ -518,6 +571,50 @@ public class PayCenterService {
         });
     }
 
+    /**
+     * 钱包预付统计列表
+     *
+     * @param uid
+     * @param channel
+     * @param filter
+     * @param page
+     * @param pageSize
+     * @return
+     */
+    public R<PrePayWalletPage> advancePayWALLET(String uid, ChannelEnum channel, String filter, Integer page, Integer pageSize) {
+        String sync = getHttp(PayCenterEnum.ADVANCE_PAY_WALLETS, new HashMap<>() {{
+            put("uid", uid);
+            put("channel", channel);
+            put("filter", filter);
+            put("page", page);
+            put("pageSize", pageSize);
+        }});
+        return JSONObject.parseObject(sync, new TypeReference<>() {
+        });
+    }
+
+    /**
+     * 钱包预收列表
+     *
+     * @param uid
+     * @param channel
+     * @param filter
+     * @param page
+     * @param pageSize
+     * @return
+     */
+    public R<PrePayWalletPage> advancePayReceive(String uid, ChannelEnum channel, String filter, Integer page, Integer pageSize) {
+        String sync = getHttp(PayCenterEnum.ADVANCE_PAY_RECEIVE, new HashMap<>() {{
+            put("uid", uid);
+            put("channel", channel);
+            put("filter", filter);
+            put("page", page);
+            put("pageSize", pageSize);
+        }});
+        return JSONObject.parseObject(sync, new TypeReference<>() {
+        });
+    }
+
     /**
      * 预付订单状态
      *
@@ -639,6 +736,7 @@ public class PayCenterService {
      * 清分
      * 中台逻辑:
      * 先从预付金额中进行扣除,然后金额不够的情况下在调用三方接口进行清分,然后进行记账
+     * 因为预付业务实际就是真实的清分业务,所以先判断预付金额是否足够
      *
      * @param buyUid
      * @param sellUid
@@ -661,6 +759,32 @@ public class PayCenterService {
         });
     }
 
+    /**
+     * 清分
+     *
+     * @param buyUid 付款方uid
+     * @param sellUid 收款方
+     * @param channel
+     * @param money 总清分金额
+     * @param batchPayList 收款方集合
+     * @param businessNo 流水号
+     * @param payType 支付类型 0-默认 1-仅预付支付 2-仅余额支付
+     * @return
+     */
+    public R<BusinessNo> payAgentPayV2(String buyUid, String sellUid, ChannelEnum channel, Long money, List<PatchPay> batchPayList, String businessNo, String payType) {
+        String sync = postHttp(PayCenterEnum.PAY_AGENT_PAY_V2, new HashMap<>() {{
+            put("buy_uid", buyUid);
+            put("sell_uid", sellUid);
+            put("channel", channel);
+            put("money", money);
+            put("batch_pay_list", JSONObject.toJSONString(batchPayList));
+            put("business_no", businessNo);
+            put("pay_type", payType);
+        }});
+        return JSONObject.parseObject(sync, new TypeReference<>() {
+        });
+    }
+
     /**
      * 创建钱包
      *

+ 437 - 83
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/WalletService.java

@@ -1,17 +1,30 @@
 package com.sckw.payment.service;
 
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.sckw.core.common.enums.NumberConstant;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.IdWorker;
+import com.sckw.core.utils.OrderUtils;
 import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.manage.api.RemoteManageService;
+import com.sckw.manage.api.model.dto.res.FindEntCooperateResVo;
 import com.sckw.payment.api.model.constant.ChannelEnum;
-import com.sckw.payment.api.model.dto.Order;
-import com.sckw.payment.api.model.dto.WalletDto;
+import com.sckw.payment.api.model.dto.*;
+import com.sckw.payment.model.dto.common.BusinessNo;
 import com.sckw.payment.api.model.dto.common.R;
-import com.sckw.payment.api.model.dto.page.CashPage;
-import com.sckw.payment.api.model.dto.page.PrePayIndexPage;
+import com.sckw.payment.model.dto.page.CashPage;
+import com.sckw.payment.model.dto.page.PrePayWalletPage;
+import com.sckw.payment.dao.KwpWalletRefundMapper;
+import com.sckw.payment.job.AsyncPool;
+import com.sckw.payment.model.KwpWalletRefund;
+import com.sckw.payment.model.constant.RefundEnum;
+import com.sckw.payment.model.dto.wallet.*;
 import com.sckw.payment.model.vo.req.*;
 import com.sckw.payment.model.vo.res.FundVo;
+import com.sckw.payment.model.vo.res.MorePageRes;
 import com.sckw.payment.model.vo.res.WalletDetail;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
@@ -19,15 +32,17 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.dubbo.config.annotation.DubboReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
+import java.text.DecimalFormat;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 /**
  * 钱包
@@ -41,12 +56,84 @@ import java.util.concurrent.TimeUnit;
 public class WalletService {
     private final PayCenterService payCenterService;
     private final KwpWalletRelationService walletRelationService;
-    private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 2, TimeUnit.MINUTES, new LinkedBlockingQueue<>(12));
+    private final KwpWalletRefundMapper kwpWalletRefundMapper;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteManageService remoteManageService;
+
+    /**
+     * 通过中台用户id转为企业名称
+     *
+     * @param id 中台用户id
+     * @return
+     */
+    private String getFirmName(String id) {
+        if (StringUtils.isBlank(id)) {
+            return "";
+        }
+        Long ent = walletRelationService.getEnt(id);
+        if (Objects.nonNull(ent)) {
+            EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(ent);
+            if (Objects.nonNull(entCacheResDto)) {
+                return entCacheResDto.getFirmName();
+            }
+        }
+        return "";
+    }
+
+    /**
+     * 通过企业名称查询关联的中台用户id
+     *
+     * @param entName
+     * @return
+     */
+    private List<String> findFilter(String entName) {
+        if (StringUtils.isNotBlank(entName)) {
+            Long entId = LoginUserHolder.getEntId();
+            List<FindEntCooperateResVo> allCooperateEnt = remoteManageService.findAllCooperateEnt(entId);
+            if (!CollectionUtils.isEmpty(allCooperateEnt)) {
+                List<Long> collect = allCooperateEnt.stream().filter(a -> StringUtils.contains(a.getEntName(), entName)).map(FindEntCooperateResVo::getEntId).collect(Collectors.toList());
+                List<String> res = new ArrayList<>();
+                for (Long aLong : collect) {
+                    String relation = walletRelationService.getRelation(aLong);
+                    if (StringUtils.isNotBlank(relation) && !res.contains(relation)) {
+                        res.add(relation);
+                    }
+                }
+                return res;
+            }
+        }
+        return new ArrayList<>();
+    }
+
+    /**
+     * 通过企业名称查询关联的中台用户id
+     *
+     * @param entName
+     * @return "uid,uid,uid"
+     */
+    private String findFilterStr(String entName) {
+        List<String> filter = findFilter(entName);
+        return StringUtils.join(filter, ",");
+    }
+
+    /**
+     * 金额转元并转字符串
+     *
+     * @param money
+     * @return
+     */
+    private String dfMoney(Long money) {
+        if (Objects.isNull(money)) {
+            return "0.00";
+        }
+        DecimalFormat df = new DecimalFormat("0.00");
+        return df.format(money / 100.0D);
+    }
 
     /**
-     * 查询企业钱包总览信息
+     * 钱包总览信息
      *
      * @return
      */
@@ -56,15 +143,12 @@ public class WalletService {
         if (StringUtils.isBlank(relation)) {
             throw new BusinessException("暂未开通电子钱包");
         }
-        R<List<WalletDto>> wallet = payCenterService.wallet(relation, null, "");
-        long sum = 0;
+        R<WalletOverview> wallet = payCenterService.general(relation);
         if (wallet.getStatus()) {
-            List<WalletDto> data = CollectionUtils.isEmpty(wallet.getData()) ? new ArrayList<>() : wallet.getData();
-            for (WalletDto datum : data) {
-                sum += datum.getMoney();
-            }
+            WalletOverview data = wallet.getData();
+            return new WalletDetail(LoginUserHolder.getEntName(), String.valueOf(data.getTotalMoney()), String.valueOf(data.getTotalMoney() / 100D), data.getChannelTotal(), data.getChannels());
         }
-        return new WalletDetail(LoginUserHolder.getEntName(), String.valueOf(sum), String.valueOf(sum / 100.0D), 0);
+        return new WalletDetail(LoginUserHolder.getEntName(), "-", "-", 0, new ArrayList<>());
     }
 
     /**
@@ -73,9 +157,13 @@ public class WalletService {
      * @return
      */
     public Object walletDetail(WalletDetailReq walletDetailReq) {
+        log.info("查询资金明细:{}", JSONObject.toJSONString(walletDetailReq));
         Long entId = LoginUserHolder.getEntId();
-        String entName = walletDetailReq.getEntName();
-        //todo-xcq 确认下拉选规则参数
+        //查询我方企业开通的渠道
+        String relation = walletRelationService.getRelation(entId);
+        if (StringUtils.isBlank(relation)) {
+            return PageRes.handPage(walletDetailReq.getPage(), walletDetailReq.getPageSize(), new ArrayList<>());
+        }
         ChannelEnum channelEnum = null;
         if (StringUtils.isNotBlank(walletDetailReq.getChannel())) {
             channelEnum = ChannelEnum.getByValue(walletDetailReq.getChannel());
@@ -83,40 +171,40 @@ public class WalletService {
                 throw new BusinessException("支付通道不存在");
             }
         }
-        //查询我方企业开通的渠道
-        String relation = walletRelationService.getRelation(entId);
-        if (StringUtils.isBlank(relation)) {
-            throw new BusinessException("暂未开通电子钱包");
-        }
         List<WalletDto> res = new ArrayList<>();
-        List<Long> list = new ArrayList<>();
-        //筛选企业名称
+        long sum = 0L;
+        //筛选企业
+        String entName = walletDetailReq.getEntName();
         if (StringUtils.isNotBlank(entName)) {
-            List<EntCacheResDto> entCacheResDto = remoteSystemService.queryEntCacheByName(entName);
+            List<String> filterList = findFilter(entName);
             //未筛选出数据
-            if (CollectionUtils.isEmpty(entCacheResDto)) {
+            if (CollectionUtils.isEmpty(filterList)) {
                 return PageRes.handPage(walletDetailReq.getPage(), walletDetailReq.getPageSize(), new ArrayList<>());
             }
-            list = entCacheResDto.stream().map(EntCacheResDto::getId).toList();
-        }
-
-        //搜索指定往来单位
-        if (!CollectionUtils.isEmpty(list)) {
-            for (Long aLong : list) {
-                R<List<WalletDto>> wallet = payCenterService.wallet(relation, channelEnum, String.valueOf(aLong));
-                if (wallet.getStatus()) {
-                    List<WalletDto> data = wallet.getData();
-                    res.addAll(data);
+            for (String filter : filterList) {
+                R<Wallet> walletR = payCenterService.walletSum(relation, channelEnum, filter);
+                if (walletR.getStatus()) {
+                    Wallet data = walletR.getData();
+                    sum += data.getTotalMoney();
+                    List<WalletDto> rows = data.getRows();
+                    if (CollectionUtils.isEmpty(rows)) {
+                        continue;
+                    }
+                    res.addAll(rows);
                 }
             }
         } else {
             //不搜索往来单位
-            R<List<WalletDto>> wallet = payCenterService.wallet(relation, channelEnum, "");
+            R<Wallet> wallet = payCenterService.walletSum(relation, channelEnum, "");
             if (wallet.getStatus()) {
-                List<WalletDto> data = wallet.getData();
-                res.addAll(data);
+                Wallet data = wallet.getData();
+                sum += data.getTotalMoney();
+                if (!CollectionUtils.isEmpty(data.getRows())) {
+                    res.addAll(data.getRows());
+                }
             }
         }
+
         List<FundVo> vo = new ArrayList<>();
         FundVo fundVo;
 
@@ -125,9 +213,17 @@ public class WalletService {
             fundVo = new FundVo();
             BeanUtils.copyProperties(re, fundVo);
             fundVo.setChannelLabel(ChannelEnum.getDesc(re.getChannel()));
+            fundVo.setUidName(getFirmName(re.getUid()));
+            fundVo.setFilterName(getFirmName(re.getFilter()));
+            fundVo.setMoney(dfMoney(re.getMoney()));
+            fundVo.setWithdrawingMoney(dfMoney(re.getWithdrawingMoney()));
+            fundVo.setChargingMoney(dfMoney(re.getChargingMoney()));
+            fundVo.setTotalMoney(dfMoney(re.getTotalMoney()));
+//            fundVo.setRefundMoney(dfMoney(re.getMoney()));
             vo.add(fundVo);
         }
-        return PageRes.handPage(walletDetailReq.getPage(), walletDetailReq.getPageSize(), vo);
+        DecimalFormat df = new DecimalFormat("0.00");
+        return new MorePageRes<>(walletDetailReq.getPage(), walletDetailReq.getPageSize(), vo, df.format(sum / 100.0D));
     }
 
 
@@ -137,6 +233,7 @@ public class WalletService {
      * @return
      */
     public Object addWallet(AddWalletReq addWalletReq) {
+        log.info("新增账目:{}", JSONObject.toJSONString(addWalletReq));
         Long entId1 = LoginUserHolder.getEntId();
         String uid = walletRelationService.getRelation(entId1);
         if (StringUtils.isBlank(uid)) {
@@ -147,22 +244,23 @@ public class WalletService {
         if (StringUtils.isBlank(filter)) {
             throw new BusinessException("合作单位暂未开通电子钱包");
         }
-        ChannelEnum channelEnum = ChannelEnum.getByValue(addWalletReq.getChannel());
+        ChannelEnum channelEnum = ChannelEnum.getByChannel(addWalletReq.getChannel());
         if (Objects.isNull(channelEnum)) {
-            throw new BusinessException("支付通道不能为空");
+            throw new BusinessException("支付通道不存在");
         }
-
         //1.开通钱包
         R<Object> objectR = payCenterService.walletIndex(uid, channelEnum, filter, "");
+        log.info("新增账目-开通钱包:{}", JSONObject.toJSONString(objectR));
         if (!objectR.getStatus()) {
             throw new BusinessException(StringUtils.isBlank(objectR.getMsg()) ? "钱包开通失败" : objectR.getMsg());
         }
-        //2.发起预支付
-        R<Order> orderR = payCenterService.advancePayApply("", channelEnum, filter, addWalletReq.bigMoney(addWalletReq.getMoney()));
-        if (!orderR.getStatus()) {
-            throw new BusinessException(StringUtils.isBlank(orderR.getMsg()) ? "预支付失败" : orderR.getMsg());
+        //2.发起充值
+        R<PayIndex> payIndexR = payCenterService.payIndex(uid, filter, channelEnum, addWalletReq.bigMoney(addWalletReq.getMoney()));
+        log.info("新增账目-发起充值:{}", JSONObject.toJSONString(payIndexR));
+        if (!payIndexR.getStatus()) {
+            throw new BusinessException(StringUtils.isBlank(payIndexR.getMsg()) ? "充值失败" : payIndexR.getMsg());
         }
-        return orderR.getData();
+        return payIndexR.getData();
     }
 
     /**
@@ -171,6 +269,7 @@ public class WalletService {
      * @return
      */
     public Object addWalletMoney(AddWalletReq addWalletReq) {
+        log.info("账目充值:{}", JSONObject.toJSONString(addWalletReq));
         Long entId1 = LoginUserHolder.getEntId();
         String uid = walletRelationService.getRelation(entId1);
         if (StringUtils.isBlank(uid)) {
@@ -183,31 +282,63 @@ public class WalletService {
         }
         ChannelEnum channelEnum = ChannelEnum.getByValue(addWalletReq.getChannel());
         if (Objects.isNull(channelEnum)) {
-            throw new BusinessException("支付通道不能为空");
+            throw new BusinessException("支付通道不存在");
         }
-        //发起预支付
-        R<Order> orderR = payCenterService.advancePayApply(uid, channelEnum, filter, addWalletReq.bigMoney(addWalletReq.getMoney()));
-        if (!orderR.getStatus()) {
-            throw new BusinessException(StringUtils.isBlank(orderR.getMsg()) ? "预支付失败" : orderR.getMsg());
+        //发起充值
+        R<PayIndex> payIndexR = payCenterService.payIndex(uid, filter, channelEnum, addWalletReq.bigMoney(addWalletReq.getMoney()));
+        log.info("账目充值-发起充值:{}", JSONObject.toJSONString(payIndexR));
+        if (!payIndexR.getStatus()) {
+            throw new BusinessException(StringUtils.isBlank(payIndexR.getMsg()) ? "充值失败" : payIndexR.getMsg());
         }
-        return orderR.getData();
+        return payIndexR.getData();
     }
 
     /**
      * 提现
+     * 重新提现:只针对汇付
      * 1.余额转出
      * 2.申请提现
      *
      * @return
      */
     public Object cashOUt(CashWalletReq cashWalletReq) {
+        log.info("提现:{}", JSONObject.toJSONString(cashWalletReq));
         ChannelEnum byChannel = ChannelEnum.getByChannel(cashWalletReq.getChannel());
+        if (Objects.isNull(byChannel)) {
+            throw new BusinessException("支付通道不存在");
+        }
         //余额转出
         R<Object> transfer = payCenterService.transfer(cashWalletReq.getUid(), cashWalletReq.getFilter(), byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()));
+        log.info("提现-余额转出:{}", JSONObject.toJSONString(transfer));
         if (!transfer.getStatus()) {
             throw new BusinessException(StringUtils.isNotBlank(transfer.getMsg()) ? transfer.getMsg() : "提现异常");
         }
+        //申请提现
         R<Order> orderR = payCenterService.withdrawTake(cashWalletReq.getUid(), byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()), cashWalletReq.getRemark());
+        log.info("提现-申请提现:{}", JSONObject.toJSONString(orderR));
+        if (!orderR.getStatus()) {
+            throw new BusinessException(StringUtils.isNotBlank(orderR.getMsg()) ? orderR.getMsg() : "申请提现异常");
+        }
+        return orderR.getData();
+    }
+
+    /**
+     * 重新提现
+     * 重新提现:只针对汇付
+     * 1.余额转出
+     * 2.申请提现
+     *
+     * @return
+     */
+    public Object reCashOUt(CashWalletReq cashWalletReq) {
+        log.info("重新提现:{}", JSONObject.toJSONString(cashWalletReq));
+        ChannelEnum byChannel = ChannelEnum.getByChannel(cashWalletReq.getChannel());
+        if (Objects.isNull(byChannel)) {
+            throw new BusinessException("支付通道不存在");
+        }
+        //申请提现
+        R<Order> orderR = payCenterService.withdrawTake(cashWalletReq.getUid(), byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()), cashWalletReq.getRemark());
+        log.info("重新提现-申请提现:{}", JSONObject.toJSONString(orderR));
         if (!orderR.getStatus()) {
             throw new BusinessException(StringUtils.isNotBlank(orderR.getMsg()) ? orderR.getMsg() : "申请提现异常");
         }
@@ -219,8 +350,24 @@ public class WalletService {
      *
      * @return
      */
-    public Object transfer() {
-        return null;
+    public Object transfer(TransferReq transferReq) {
+        log.info("转账:{}", JSONObject.toJSONString(transferReq));
+        ChannelEnum channelEnum = ChannelEnum.getByChannel(transferReq.getChannel());
+        if (Objects.isNull(channelEnum)) {
+            throw new BusinessException("支付通道不存在");
+        }
+        List<PatchPay> list = new ArrayList<>();
+        PatchPay patchPay = new PatchPay();
+        patchPay.setUid(transferReq.getFilter());
+        patchPay.setMoney(transferReq.bigMoney(transferReq.getMoney()));
+        patchPay.setRemark(transferReq.getRemark());
+        list.add(patchPay);
+        R<BusinessNo> businessNoR1 = payCenterService.payAgentPayV2(transferReq.getUid(), transferReq.getFilter(),
+                channelEnum, transferReq.bigMoney(transferReq.getMoney()), list, OrderUtils.generateOrderNo("TF"), "2");
+        if (!businessNoR1.getStatus()) {
+            throw new BusinessException(StringUtils.isNotBlank(businessNoR1.getMsg()) ? businessNoR1.getMsg() : "转账失败");
+        }
+        return businessNoR1.getData();
     }
 
 
@@ -230,30 +377,54 @@ public class WalletService {
      * @return
      */
     public Object cashList(CashPageReq cashPageReq) {
+        log.info("提现记录:{}", JSONObject.toJSONString(cashPageReq));
         Long entId = LoginUserHolder.getEntId();
         String uid = walletRelationService.getRelation(entId);
         if (StringUtils.isBlank(uid)) {
-            return null;
+            return PageRes.handPage(cashPageReq.getPage(), cashPageReq.getPageSize(), new ArrayList<>());
         }
         ChannelEnum channelEnum = null;
         if (StringUtils.isNotBlank(cashPageReq.getChannel())) {
             channelEnum = ChannelEnum.getByValue(cashPageReq.getChannel());
             if (Objects.isNull(channelEnum)) {
-                throw new BusinessException("选择渠道异常");
+                throw new BusinessException("支付通道不存在");
             }
         }
-        String entName = cashPageReq.getEntName();
-        if (StringUtils.isNotBlank(entName)) {
-            //todo 转换企业名称为filter
-
-        }
         //查询中台接口
-        R<CashPage> cashPageR = payCenterService.withdrawIndex(uid, channelEnum, cashPageReq.getPage(), cashPageReq.getPageSize());
+        R<CashPage> cashPageR = payCenterService.withdrawIndex(uid, channelEnum, cashPageReq.getStatus(), cashPageReq.getPage(), cashPageReq.getPageSize());
         if (!cashPageR.getStatus()) {
-            return null;
+            return new MorePageRes<>(cashPageReq.getPage(), cashPageReq.getPageSize(), 0, 0, new ArrayList<>(), "0.00");
         }
+        CashPage data = cashPageR.getData();
         //组装数据
-        return cashPageR.getData();
+        return new MorePageRes<>(cashPageReq.getPage(), cashPageReq.getPageSize(), data.getTotal(), (int) (data.getTotal() / cashPageReq.getPageSize() + 1), data.getRows(), String.valueOf(Long.parseLong(data.getTotalWithdrawMoney()) / 100.0D));
+    }
+
+    /**
+     * 提现分类页签统计
+     *
+     * @param cashPageReq
+     * @return
+     */
+    public Object cashCount(CashPageReq cashPageReq) {
+        log.info("提现分类页签统计:{}", JSONObject.toJSONString(cashPageReq));
+        Long entId = LoginUserHolder.getEntId();
+        String uid = walletRelationService.getRelation(entId);
+        if (StringUtils.isBlank(uid)) {
+            return null;
+        }
+        ChannelEnum channelEnum = null;
+        if (StringUtils.isNotBlank(cashPageReq.getChannel())) {
+            channelEnum = ChannelEnum.getByValue(cashPageReq.getChannel());
+            if (Objects.isNull(channelEnum)) {
+                throw new BusinessException("支付通道不存在");
+            }
+        }
+        R<List<CashCount>> listR = payCenterService.withdrawCategory(uid, channelEnum);
+        if (listR.getStatus()) {
+            return listR.getData();
+        }
+        return new ArrayList<>();
     }
 
     /**
@@ -261,28 +432,93 @@ public class WalletService {
      *
      * @return
      */
-    public Object prePayList(PrePayReq prePayReq) {
+    public Object prePayList(PrePayPage prePayPage) {
         Long entId = LoginUserHolder.getEntId();
         String uid = walletRelationService.getRelation(entId);
         if (StringUtils.isBlank(uid)) {
             return null;
         }
         ChannelEnum channelEnum = null;
-        if (StringUtils.isNotBlank(prePayReq.getChannel())) {
-            channelEnum = ChannelEnum.getByValue(prePayReq.getChannel());
+        if (StringUtils.isNotBlank(prePayPage.getChannel())) {
+            channelEnum = ChannelEnum.getByValue(prePayPage.getChannel());
             if (Objects.isNull(channelEnum)) {
-                throw new BusinessException("选择渠道异常");
+                throw new BusinessException("支付通道异常");
             }
         }
-        String entName = prePayReq.getEntName();
+        String entName = prePayPage.getEntName();
+        String filter = "";
+        //筛选企业名称
         if (StringUtils.isNotBlank(entName)) {
-            //todo 转换企业名称为 filter
+            filter = findFilterStr(entName);
+        }
+        // 查询预付数据
+        R<PrePayWalletPage> prePayIndexPageR = payCenterService.advancePayWALLET(uid, channelEnum, filter, prePayPage.getPage(), prePayPage.getPageSize());
+        if (prePayIndexPageR.getStatus()) {
+            PrePayWalletPage data = prePayIndexPageR.getData();
+            return new PageRes<>(prePayPage.getPage(), prePayPage.getPageSize(), data.getTotal(), (int) (data.getTotal() / prePayPage.getPageSize() + 1), data.getRows());
+        }
+        return new PageRes<>(prePayPage.getPage(), prePayPage.getPageSize(), 0, 0, new ArrayList<>());
+
+    }
 
+    /**
+     * 预收列表
+     *
+     * @param prePayPage
+     * @return
+     */
+    public Object preReceiveList(PrePayPage prePayPage) {
+        Long entId = LoginUserHolder.getEntId();
+        String uid = walletRelationService.getRelation(entId);
+        if (StringUtils.isBlank(uid)) {
+            return null;
+        }
+        ChannelEnum channelEnum = null;
+        if (StringUtils.isNotBlank(prePayPage.getChannel())) {
+            channelEnum = ChannelEnum.getByValue(prePayPage.getChannel());
+            if (Objects.isNull(channelEnum)) {
+                throw new BusinessException("支付通道异常");
+            }
+        }
+        String entName = prePayPage.getEntName();
+        String filter = "";
+        //筛选企业名称
+        if (StringUtils.isNotBlank(entName)) {
+            filter = findFilterStr(entName);
         }
-        //
-        R<PrePayIndexPage> prePayIndexPageR = payCenterService.advancePayIndex(uid, channelEnum, "", prePayReq.getPage(), prePayReq.getPageSize());
+        // 预收列表
+        R<PrePayWalletPage> prePayIndexPageR = payCenterService.advancePayReceive(uid, channelEnum, filter, prePayPage.getPage(), prePayPage.getPageSize());
+        if (prePayIndexPageR.getStatus()) {
+            PrePayWalletPage data = prePayIndexPageR.getData();
+            return new PageRes<>(prePayPage.getPage(), prePayPage.getPageSize(), data.getTotal(), (int) (data.getTotal() / prePayPage.getPageSize() + 1), data.getRows());
+        }
+        return new PageRes<>(prePayPage.getPage(), prePayPage.getPageSize(), 0, 0, new ArrayList<>());
+    }
 
-        return null;
+    /**
+     * 预付校验
+     *
+     * @param prePayCheck
+     * @return
+     */
+    public Object prePayCheck(PrePayCheck prePayCheck) {
+        String uid = walletRelationService.getRelation(LoginUserHolder.getEntId());
+        if (StringUtils.isBlank(uid)) {
+            throw new BusinessException("您暂未开通电子钱包");
+        }
+        ChannelEnum channelEnum = ChannelEnum.getByValue(prePayCheck.getChannel());
+        if (Objects.isNull(channelEnum)) {
+            throw new BusinessException("支付通道不存在");
+        }
+        R<WalletInfo> walletInfoR = payCenterService.totalInfo(uid, channelEnum, prePayCheck.getFilter());
+        if (!walletInfoR.getStatus()) {
+            throw new BusinessException(StringUtils.isNotBlank(walletInfoR.getMsg()) ? walletInfoR.getMsg() : "未找到交易方");
+        }
+        WalletInfo data = walletInfoR.getData();
+        if (Objects.isNull(data)) {
+            throw new BusinessException("不存在交易");
+        }
+        return data;
     }
 
     /**
@@ -290,8 +526,21 @@ public class WalletService {
      *
      * @return
      */
-    public Object addPrePay() {
-        return null;
+    public Object addPrePay(PrePay prePay) {
+        String uid = walletRelationService.getRelation(LoginUserHolder.getEntId());
+        if (StringUtils.isBlank(uid)) {
+            throw new BusinessException("您暂未开通电子钱包");
+        }
+        ChannelEnum channelEnum = ChannelEnum.getByValue(prePay.getChannel());
+        if (Objects.isNull(channelEnum)) {
+            throw new BusinessException("支付通道不存在");
+        }
+
+        R<Order> orderR = payCenterService.advancePayApply(prePay.getUid(), channelEnum, prePay.getFilter(), prePay.bigMoney(prePay.getMoney()));
+        if (!orderR.getStatus()) {
+            throw new BusinessException(StringUtils.isNotBlank(orderR.getMsg()) ? orderR.getMsg() : "预付失败");
+        }
+        return orderR.getData();
     }
 
     /**
@@ -299,8 +548,21 @@ public class WalletService {
      *
      * @return
      */
-    public Object prePayAppend() {
-        return null;
+    public Object prePayAppend(PrePay prePay) {
+        String uid = walletRelationService.getRelation(LoginUserHolder.getEntId());
+        if (StringUtils.isBlank(uid)) {
+            throw new BusinessException("您暂未开通电子钱包");
+        }
+        ChannelEnum channelEnum = ChannelEnum.getByValue(prePay.getChannel());
+        if (Objects.isNull(channelEnum)) {
+            throw new BusinessException("支付通道不存在");
+        }
+
+        R<Order> orderR = payCenterService.advancePayApply(prePay.getUid(), channelEnum, prePay.getFilter(), prePay.bigMoney(prePay.getMoney()));
+        if (!orderR.getStatus()) {
+            throw new BusinessException(StringUtils.isNotBlank(orderR.getMsg()) ? orderR.getMsg() : "预付失败");
+        }
+        return orderR.getData();
     }
 
     /**
@@ -309,16 +571,108 @@ public class WalletService {
      * @return
      */
     public Object applyRefund(RefundReq refundReq) {
-        return null;
+        LambdaQueryWrapper<KwpWalletRefund> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwpWalletRefund::getChannel, refundReq.getChannel());
+        wrapper.eq(KwpWalletRefund::getUid, refundReq.getUid()).eq(KwpWalletRefund::getFilter, refundReq.getFilter()).eq(KwpWalletRefund::getStatus, RefundEnum.APPLY.getStatus()).last("limit 1");
+        KwpWalletRefund kwpWalletRefund = kwpWalletRefundMapper.selectOne(wrapper);
+        if (Objects.nonNull(kwpWalletRefund)) {
+            throw new BusinessException("存在未完成的退款订单");
+        }
+        ChannelEnum channelEnum = ChannelEnum.getByChannel(refundReq.getChannel());
+        if (Objects.isNull(channelEnum)) {
+            throw new BusinessException("支付通道不存在");
+        }
+        KwpWalletRefund kwpWalletRefundAdd = new KwpWalletRefund();
+        kwpWalletRefundAdd.setId(new IdWorker(NumberConstant.ONE).nextId());
+        kwpWalletRefundAdd.setOrderNo(OrderUtils.generateOrderNo("RF"));
+        kwpWalletRefundAdd.setUid(refundReq.getUid());
+        kwpWalletRefundAdd.setFromEnt(walletRelationService.getEnt(refundReq.getUid()));
+        kwpWalletRefundAdd.setFilter(refundReq.getFilter());
+        kwpWalletRefundAdd.setToEnt(walletRelationService.getEnt(refundReq.getFilter()));
+        kwpWalletRefundAdd.setChannel(refundReq.getChannel());
+        kwpWalletRefundAdd.setMoney(refundReq.getMoney());
+        kwpWalletRefundAdd.setRemark(refundReq.getRemark());
+        kwpWalletRefundAdd.setCreateBy(LoginUserHolder.getUserId());
+        kwpWalletRefundAdd.setCreateTime(LocalDateTime.now());
+        kwpWalletRefundAdd.setUpdateBy(LoginUserHolder.getUserId());
+        kwpWalletRefundAdd.setUpdateTime(LocalDateTime.now());
+        kwpWalletRefundAdd.setDelFlag(0);
+        kwpWalletRefundAdd.setStatus(RefundEnum.APPLY.getStatus());
+        kwpWalletRefundMapper.insert(kwpWalletRefundAdd);
+        return "提交成功";
     }
 
     /**
      * 发起退款
+     * 中台逻辑:
+     * 预付 A->B 100元
+     * 退款50元,调用2次清分。
+     * 1. 清分 A->B 50元
+     * 2. 清分 B->A 50元
      *
      * @return
      */
-    public Object launchRefund() {
-        return null;
+    public Object launchRefund(RefundReq refundReq) {
+        LambdaQueryWrapper<KwpWalletRefund> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwpWalletRefund::getChannel, refundReq.getChannel());
+        wrapper.eq(KwpWalletRefund::getUid, refundReq.getUid()).eq(KwpWalletRefund::getFilter, refundReq.getFilter()).eq(KwpWalletRefund::getStatus, RefundEnum.APPLY.getStatus()).last("limit 1");
+        KwpWalletRefund kwpWalletRefund = kwpWalletRefundMapper.selectOne(wrapper);
+        if (Objects.isNull(kwpWalletRefund)) {
+            throw new BusinessException("未找到待完成的退款订单");
+        }
+        ChannelEnum channelEnum = ChannelEnum.getByChannel(refundReq.getChannel());
+        if (Objects.isNull(channelEnum)) {
+            throw new BusinessException("支付通道不存在");
+        }
+        // 1.记账
+        List<PatchPay> list = new ArrayList<>();
+        PatchPay patchPay = new PatchPay();
+        patchPay.setUid(refundReq.getFilter());
+        patchPay.setMoney(refundReq.bigMoney(refundReq.getMoney()));
+        patchPay.setRemark(refundReq.getRemark());
+        list.add(patchPay);
+        R<BusinessNo> businessNoR = payCenterService.payAgentPayV2(refundReq.getUid(), refundReq.getFilter(), channelEnum, refundReq.bigMoney(refundReq.getMoney()), list, kwpWalletRefund.getOrderNo(), "1");
+        if (!businessNoR.getStatus()) {
+            throw new BusinessException(StringUtils.isNotBlank(businessNoR.getMsg()) ? businessNoR.getMsg() : "退款失败");
+        }
+        Long userId = LoginUserHolder.getUserId();
+        //异步提交清分退款任务
+        AsyncPool.addTask(new Refund(refundReq, kwpWalletRefund, payCenterService, kwpWalletRefundMapper, userId));
+        return businessNoR;
+    }
+
+    /**
+     * 退款处理
+     *
+     * @param refundReq
+     * @param kwpWalletRefund
+     * @param payCenterService
+     * @param kwpWalletRefundMapper
+     * @param userId
+     */
+    private record Refund(RefundReq refundReq, KwpWalletRefund kwpWalletRefund, PayCenterService payCenterService,
+                          KwpWalletRefundMapper kwpWalletRefundMapper, Long userId) implements Runnable {
+        private final static Logger log = LoggerFactory.getLogger(Refund.class);
+
+        @Override
+        public void run() {
+            ChannelEnum channelEnum = ChannelEnum.getByChannel(refundReq.getChannel());
+            List<PatchPay> list = new ArrayList<>();
+            PatchPay patchPay = new PatchPay();
+            patchPay.setUid(refundReq.getFilter());
+            patchPay.setMoney(refundReq.bigMoney(refundReq.getMoney()));
+            patchPay.setRemark(refundReq.getRemark());
+            list.add(patchPay);
+            log.info("异步提交清分退款任务");
+            R<BusinessNo> businessNoR1 = payCenterService.payAgentPayV2(refundReq.getFilter(), refundReq.getUid(), channelEnum, refundReq.bigMoney(refundReq.getMoney()), list, kwpWalletRefund.getOrderNo(), "2");
+            if (businessNoR1.getStatus()) {
+                kwpWalletRefund.setActualMoney(refundReq.getMoney());
+                kwpWalletRefund.setUpdateBy(userId);
+                kwpWalletRefund.setUpdateTime(LocalDateTime.now());
+                kwpWalletRefund.setStatus(RefundEnum.REFUNDING.getStatus());
+                kwpWalletRefundMapper.updateById(kwpWalletRefund);
+            }
+        }
     }
 
 }

+ 67 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/task/RefundTask.java

@@ -0,0 +1,67 @@
+package com.sckw.payment.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.sckw.payment.model.dto.wallet.PatchPay;
+import com.sckw.payment.dao.KwpWalletRefundMapper;
+import com.sckw.payment.model.KwpWalletRefund;
+import com.sckw.payment.model.constant.RefundEnum;
+import com.sckw.payment.service.PayCenterService;
+import jakarta.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author xucaiqin
+ * @date 2023-09-05 19:37:00
+ */
+@Slf4j
+@Component
+@EnableScheduling
+public class RefundTask {
+    @Resource
+    private PayCenterService payCenterService;
+    @Resource
+    private KwpWalletRefundMapper kwpWalletRefundMapper;
+
+
+    @Scheduled(cron = "0 0/1 * * * ? ")
+    public void task() {
+        LambdaQueryWrapper<KwpWalletRefund> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwpWalletRefund::getStatus, RefundEnum.REFUNDING.getStatus());
+        List<KwpWalletRefund> kwpWalletRefunds = kwpWalletRefundMapper.selectList(wrapper);
+        if (CollectionUtils.isEmpty(kwpWalletRefunds)) {
+            log.warn("无数据");
+            return;
+        }
+        List<PatchPay> list;
+        try {
+            for (KwpWalletRefund kwpWalletRefund : kwpWalletRefunds) {
+                list = new ArrayList<>();
+                PatchPay patchPay = new PatchPay();
+                patchPay.setUid(kwpWalletRefund.getFilter());
+                patchPay.setMoney(bigMoney(kwpWalletRefund.getActualMoney()));
+                patchPay.setRemark(kwpWalletRefund.getRemark());
+                list.add(patchPay);
+                //查询清分状态,修改退款单状态 todo-xcq
+            }
+        } catch (Exception ex) {
+            log.error("定时任务异常:{}", ex, ex);
+        }
+    }
+
+    private Long bigMoney(BigDecimal big) {
+        if (Objects.isNull(big)) {
+            return 0L;
+        }
+        BigDecimal divide = big.multiply(new BigDecimal("100"));
+        return divide.longValueExact();
+    }
+}

+ 29 - 0
sckw-modules/sckw-payment/src/main/resources/mapper/KwpWalletRefundMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sckw.payment.dao.KwpWalletRefundMapper">
+  <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpWalletRefund">
+    <!--@mbg.generated-->
+    <!--@Table kwp_wallet_refund-->
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
+    <result column="uid" jdbcType="VARCHAR" property="uid" />
+    <result column="from_ent" jdbcType="BIGINT" property="fromEnt" />
+    <result column="filter" jdbcType="VARCHAR" property="filter" />
+    <result column="to_ent" jdbcType="BIGINT" property="toEnt" />
+    <result column="channel" jdbcType="VARCHAR" property="channel" />
+    <result column="money" jdbcType="DECIMAL" property="money" />
+    <result column="actual_money" jdbcType="DECIMAL" property="actualMoney" />
+    <result column="remark" jdbcType="VARCHAR" property="remark" />
+    <result column="create_by" jdbcType="BIGINT" property="createBy" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_by" jdbcType="BIGINT" property="updateBy" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--@mbg.generated-->
+    id, order_no, `uid`, from_ent, `filter`, to_ent, channel, money,actual_money,remark, create_by, create_time,
+    update_by, update_time, del_flag, `status`
+  </sql>
+</mapper>

+ 25 - 9
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/CommonService.java

@@ -1,17 +1,18 @@
 package com.sckw.system.service;
-import java.util.Date;
+import java.util.*;
 
 import com.alibaba.fastjson.JSON;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
-import com.sckw.core.utils.CollectionUtils;
-import com.sckw.core.utils.IdWorker;
-import com.sckw.core.utils.RegularUtils;
-import com.sckw.core.utils.StringUtils;
+import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.model.EntCertificateInfo;
 import com.sckw.core.web.model.LoginEntInfo;
 import com.sckw.redis.utils.RedissonUtils;
+import com.sckw.stream.enums.MessageEnum;
+import com.sckw.stream.model.SckwMessage;
+import com.sckw.stream.model.UserInfo;
 import com.sckw.system.dao.KwsEnterpriseDao;
 import com.sckw.system.dao.KwsMenuDao;
 import com.sckw.system.dao.KwsMenuRightsDao;
@@ -19,19 +20,18 @@ import com.sckw.system.model.KwsEnterprise;
 import com.sckw.system.model.KwsMenu;
 import com.sckw.system.model.KwsMenuRights;
 import com.sckw.system.model.vo.res.FindEntListResVo;
+import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.stream.function.StreamBridge;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
 /**
  * @author czh
  * @desc 公共方法
  * @date 2023/6/30
  */
 @Service
+@RequiredArgsConstructor
 public class CommonService {
 
     @Autowired
@@ -43,6 +43,9 @@ public class CommonService {
     @Autowired
     private KwsMenuDao kwsMenuDao;
 
+    private final StreamBridge streamBridge;
+
+
     /**
      * @desc: 更新资质
      * @param: entId 企业id entCertificateInfoList 资质信息
@@ -130,4 +133,17 @@ public class CommonService {
             kwsMenuRightsDao.saveBatch(kwsMenuRightsList);
         }
     }
+
+
+    public void sendSystemMessage(List<UserInfo> userInfos, MessageEnum messageEnum, Map<String, Object> map, String msgUrl) {
+        SckwMessage msg = new SckwMessage();
+        msg.setRequestId(UUIDUtils.get32UUID())
+                .setMessageEnum(messageEnum)
+                .setParams(map)
+                .setMsgUrl(msgUrl)
+                .setUserInfos(userInfos)
+                .setCreateBy(LoginUserHolder.getUserId());
+        streamBridge.send("sckw-message", com.alibaba.fastjson2.JSON.toJSONString(msg));
+    }
+
 }

+ 10 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -1,6 +1,7 @@
 package com.sckw.system.service;
 
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.net.URLEncoder;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.SystemException;
@@ -12,6 +13,8 @@ import com.sckw.core.utils.*;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.model.EntCertificateInfo;
+import com.sckw.stream.enums.MessageEnum;
+import com.sckw.stream.model.UserInfo;
 import com.sckw.system.api.model.dto.req.RegisterReqDto;
 import com.sckw.system.api.model.dto.res.REnterpriseVo;
 import com.sckw.system.api.model.dto.res.*;
@@ -361,6 +364,13 @@ public class KwsEnterpriseService {
             }
         }
 
+        Map<String, Object> map = new HashMap<>();
+        map.put("entName", kwsEnterprise.getFirmName());
+        map.put("createByName", kwsEnterprise.getContacts());
+        commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(userId).setEntId(entId)),
+                                        MessageEnum.ENT_CERTIFICATE,
+                                        map,
+                                        "testUrl");
     }
 
     /**

+ 1 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java

@@ -431,7 +431,7 @@ public class KwsUserService {
         KwsUser kwsUser = checkUserBase(reqVo.getAccount(), reqVo.getSystemType());
 
         //从缓存中取出验证码,校验
-        String key = StringUtils.format(RedisConstant.MESSAGE_SMS_VERIFY_CODE_VALUE_KEY, DictEnum.SMS_REGISTER.getValue(), reqVo.getAccount());
+        String key = StringUtils.format(RedisConstant.MESSAGE_SMS_VERIFY_CODE_VALUE_KEY, DictEnum.SMS_UPDATE_PASSWORD.getValue(), reqVo.getAccount());
         String sms = RedissonUtils.getString(key);
         if (!reqVo.getCaptcha().equals(sms)) {
             throw new SystemException(HttpStatus.CODE_10301, HttpStatus.CAPTCHA_ERROR);

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

@@ -59,9 +59,9 @@ public class KwtWaybillOrderController {
      * @date 2023/8/1
      **/
     @PostMapping("/findSumByDriver")
-    public HttpResult findSumByDriver(@RequestBody Map params){
+    public HttpResult findSumByDriver(@RequestBody Map<String, Object> params){
         params.put("driverId", LoginUserHolder.getUserId());
-        Map count = waybillOrderService.findStatisticsSumByDriver(params);
+        Map<String, Object> count = waybillOrderService.findStatisticsSumByDriver(params);
         return HttpResult.ok(count);
     }
 
@@ -72,7 +72,7 @@ public class KwtWaybillOrderController {
      * @date 2023/8/1
      **/
     @PostMapping("/findWaybillOrderByDriver")
-    public HttpResult findWaybillOrderByDriver(@RequestBody Map params){
+    public HttpResult findWaybillOrderByDriver(@RequestBody Map<String, Object> params){
         params.put("driverId", LoginUserHolder.getUserId());
         /**校验**/
         if (StringUtils.isBlank(params.get("busStatus"))) {
@@ -288,6 +288,17 @@ public class KwtWaybillOrderController {
         return waybillOrderService.editTicket(params);
     }
 
+    /**
+     * @param params {}
+     * @desc 修改单证-装卸货一起修改
+     * @author zk
+     * @date 2023/7/26
+     **/
+    @PostMapping("/editTicketV1")
+    public HttpResult editTicketV1(@RequestBody @Valid WaybillOrderTicketV1Dto params){
+        return waybillOrderService.editTicket(params);
+    }
+
     /**
      * @param wOrderId
      * @desc 修改单证查询运单

+ 11 - 3
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtWaybillOrderMapper.java

@@ -99,7 +99,7 @@ public interface KwtWaybillOrderMapper extends BaseMapper<KwtWaybillOrder> {
      * @author zk
      * @date 2023/8/1
      **/
-    Map<String, Object> findStatisticsSumByDriver(Map params);
+    Map<String, Object> findStatisticsSumByDriver(Map<String, Object> params);
 
     /**
      * @param params {driverId 司机ID}
@@ -107,7 +107,7 @@ public interface KwtWaybillOrderMapper extends BaseMapper<KwtWaybillOrder> {
      * @author zk
      * @date 2023/8/1
      **/
-    List<WaybillOrderDriverVo> findWaitWaybillOrderByDriver(Map params);
+    List<WaybillOrderDriverVo> findWaitWaybillOrderByDriver(Map<String, Object> params);
 
     /**
      * @param params {driverId 司机ID, busStatus 状态 2出车/3执行/4完结, month月份}
@@ -115,7 +115,7 @@ public interface KwtWaybillOrderMapper extends BaseMapper<KwtWaybillOrder> {
      * @author zk
      * @date 2023/8/1
      **/
-    List<WaybillOrderDriverVo> findOtherWaybillOrderByDriver(Map params);
+    List<WaybillOrderDriverVo> findOtherWaybillOrderByDriver(Map<String, Object> params);
 
     /**
      *
@@ -149,4 +149,12 @@ public interface KwtWaybillOrderMapper extends BaseMapper<KwtWaybillOrder> {
     );
 
     String getMaxOrderNo(@Param("lOrderNo") String lOrderNo);
+
+    /**
+     * @param params {driverId 司机ID, truckNo车牌号, busStatus 状态 2出车/3执行/4完结}
+     * @desc 查询车辆运单
+     * @author zk
+     * @date 2023/9/6
+     **/
+    List<KwtWaybillOrder> findWaybillOrder(Map<String, Object> params);
 }

+ 83 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/WaybillOrderTicketV1Dto.java

@@ -0,0 +1,83 @@
+package com.sckw.transport.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.validation.constraints.DecimalMin;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+/**
+ * @author zk
+ * @desc 车辆运单审核
+ * @date 2023/7/27 0027
+ */
+@Data
+public class WaybillOrderTicketV1Dto {
+    /**
+     * 车辆运单id
+     */
+    @JsonProperty("wOrderId")
+    @NotNull(message = "车辆运单ID不能为空")
+    private Long wOrderId;
+
+    /**
+     * 装卸货数量
+     */
+    @JsonProperty("loadAmount")
+    @NotNull(message = "装货净重不能为空")
+    @DecimalMin(value= "0", inclusive=false, message = "装卸货净重必须等于或大于0")
+    private BigDecimal loadAmount;
+
+    /**
+     * 上传凭证地址,多个以英文逗号隔开
+     */
+    @JsonProperty("loadUrls")
+    @NotBlank(message = "装货凭证不能为空")
+    private String loadUrls;
+
+    /**
+     * 操作时间
+     */
+    @JsonProperty("loadOperateTime")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @NotNull(message = "装货时间不能为空")
+    private Date loadOperateTime;
+
+    /**
+     * 装卸货数量
+     */
+    @JsonProperty("unloadAmount")
+    @NotNull(message = "卸货净重不能为空")
+    @DecimalMin(value= "0", inclusive=false, message = "装卸货净重必须等于或大于0")
+    private BigDecimal unloadAmount;
+
+    /**
+     * 上传凭证地址,多个以英文逗号隔开
+     */
+    @JsonProperty("unloadUrls")
+    @NotBlank(message = "卸货凭证不能为空")
+    private String unloadUrls;
+
+    /**
+     * 操作时间
+     */
+    @JsonProperty("unloadOperateTime")
+    @JsonFormat(locale="zh", pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @NotNull(message = "卸货时间不能为空")
+    private Date unloadOperateTime;
+
+    /**
+     * 备注
+     */
+    @Size(max=100, message = "原因长度不能大于100个字符!")
+    private String remark;
+}

+ 80 - 9
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java

@@ -97,7 +97,7 @@ public class KwtWaybillOrderService {
      * @author zk
      * @date 2023/8/1
      **/
-    public Map findStatisticsCountByDriver(Long driverId) {
+    public Map<String, Object> findStatisticsCountByDriver(Long driverId) {
         return waybillOrderDao.findStatisticsCountByDriver(driverId);
     }
 
@@ -107,7 +107,7 @@ public class KwtWaybillOrderService {
      * @author zk
      * @date 2023/8/1
      **/
-    public Map findStatisticsSumByDriver(Map params) {
+    public Map<String, Object> findStatisticsSumByDriver(Map params) {
         return waybillOrderDao.findStatisticsSumByDriver(params);
     }
 
@@ -1524,7 +1524,7 @@ public class KwtWaybillOrderService {
         wOrder.set_id(waybillOrder.getId());
         wOrder.setLoadAmount(waybillOrder.getLoadAmount());
         wOrder.setLoadUrls(params.getUrls());
-        wOrder.setLoadTime(waybillOrder.getUpdateTime());
+        wOrder.setLoadTime(params.getOperateTime());
         editSckwWaybillOrder(wOrder, waybillOrder, 2);
 
         //2承运订单
@@ -1659,7 +1659,7 @@ public class KwtWaybillOrderService {
         wOrder.setDeficitAmount(waybillOrder.getDeficitAmount());
         wOrder.setDeficitPrice(waybillOrder.getDeficitPrice());
         wOrder.setUnloadUrls(params.getUrls());
-        wOrder.setUnloadTime(waybillOrder.getUpdateTime());
+        wOrder.setUnloadTime(params.getOperateTime());
         editSckwWaybillOrder(wOrder, waybillOrder, 2);
 
         //2承运订单
@@ -1740,7 +1740,7 @@ public class KwtWaybillOrderService {
                 && subcontractBool) {
             //---------------------------------------------zk 2023-08-01 全量可运
             /**1-3下级分包承运订单运输完成**/
-            logisticsOrder.setStatus(LogisticsOrderEnum.HAVE_FINISHED.getCode());
+            //logisticsOrder.setStatus(LogisticsOrderEnum.HAVE_FINISHED.getCode());//取消自动完结
             logisticsOrderDao.updateById(logisticsOrder);
 
             /**1-4承运订单状态记录**/
@@ -1907,6 +1907,69 @@ public class KwtWaybillOrderService {
         return HttpResult.ok("修改单证成功!");
     }
 
+    /**
+     * @param params {}
+     * @desc 单证审核(编辑单证)
+     * @author zk
+     * @date 2023/7/26
+     **/
+    public HttpResult editTicket(WaybillOrderTicketV1Dto params) {
+        /**1数据校验**/
+        KwtWaybillOrder waybillOrder = waybillOrderDao.selectById(params.getWOrderId());
+        if (waybillOrder == null) {
+            return HttpResult.error("车辆运单不存在!");
+        }
+        //已卸货/审批不通过车辆运单才能审核
+        if (waybillOrder.getStatus() != CarWaybillEnum.COMPLETION_UNLOADING.getCode()
+                && waybillOrder.getStatus() != CarWaybillEnum.APPROVAL_NO_PASS.getCode()) {
+            return HttpResult.error("车辆运单当前状态不能编辑!");
+        }
+
+        /**2更新车辆运单**/
+        KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(waybillOrder.getLOrderId());
+        waybillOrder.setLoadAmount(params.getLoadAmount());
+        waybillOrder.setUnloadAmount(params.getUnloadAmount());
+        waybillOrder.setDeficitAmount(waybillOrder.getLoadAmount().subtract(waybillOrder.getUnloadAmount()));
+        BigDecimal deficitPrice = deficitPrice(waybillOrder.getLoadAmount(), waybillOrder.getDeficitAmount(),
+                logisticsOrder.getLoss(), logisticsOrder.getLossUnit(), logisticsOrder.getGoodsPrice());
+        waybillOrder.setDeficitPrice(deficitPrice);
+        waybillOrder.setStatus(CarWaybillEnum.APPROVAL_IN.getCode());
+        waybillOrderDao.updateById(waybillOrder);
+
+        /**3更新榜单信息**/
+        KwtWaybillOrderTicket loadTicket = waybillOrderTicketDao.findWaybillOrderTicket(params.getWOrderId(), Global.NUMERICAL_ONE);
+        loadTicket.setAmount(params.getLoadAmount());
+        loadTicket.setUrls(params.getLoadUrls());
+        loadTicket.setOperateTime(params.getLoadOperateTime());
+        waybillOrderTicketDao.updateById(loadTicket);
+        KwtWaybillOrderTicket unloadTicket = waybillOrderTicketDao.findWaybillOrderTicket(params.getWOrderId(), Global.NUMERICAL_TWO);
+        unloadTicket.setAmount(params.getUnloadAmount());
+        unloadTicket.setUrls(params.getUnloadUrls());
+        unloadTicket.setOperateTime(params.getUnloadOperateTime());
+        waybillOrderTicketDao.updateById(unloadTicket);
+
+        /**4新增运单状态记录**/
+        setWaybillOrderTrack(waybillOrder.getId(), waybillOrder.getUpdateTime(), waybillOrder.getStatus(), params.getRemark());
+
+        /**5Mongodb数据更新**/
+        //1车辆运单
+        SckwWaybillOrder wOrder = new SckwWaybillOrder();
+        wOrder.set_id(waybillOrder.getId());
+        wOrder.setLoadAmount(waybillOrder.getLoadAmount());
+        wOrder.setLoadTime(params.getLoadOperateTime());
+        wOrder.setLoadUrls(params.getLoadUrls());
+        wOrder.setUnloadAmount(waybillOrder.getUnloadAmount());
+        wOrder.setUnloadTime(params.getUnloadOperateTime());
+        wOrder.setUnloadUrls(params.getUnloadUrls());
+        wOrder.setDeficitAmount(waybillOrder.getDeficitAmount());
+        wOrder.setDeficitPrice(waybillOrder.getDeficitPrice());
+        editSckwWaybillOrder(wOrder, waybillOrder, Global.NUMERICAL_TWO);
+
+        /**5发送消息**/
+
+        return HttpResult.ok("车辆运单单证更新完成!");
+    }
+
     /**
      * @param wOrderId
      * @desc 修改单证查询运单
@@ -1929,15 +1992,20 @@ public class KwtWaybillOrderService {
         KwtWaybillOrderAddress unloadAddress = this.getAddress(waybillOrder.getId(), Global.NUMERICAL_TWO, Global.NUMERICAL_TWO);
         //商品信息
         KwtLogisticsOrderGoods goods = logisticsOrderGoodsDao.findByGoods(waybillOrder.getLOrderId());
+        //审批意见
+        KwtWaybillOrderTrack track = waybillOrderTrackDao.findWaybillOrderTrack(waybillOrder.getLOrderId(), CarWaybillEnum.APPROVAL_NO_PASS.getCode());
+
         //用户数据集
         List<Long> createBys = new ArrayList() {{
-            add(loadTicket.getUpdateBy());
-            add(unloadTicket.getUpdateBy());
+            add(loadTicket != null ? loadTicket.getUpdateBy() : null);
+            add(unloadTicket != null ? unloadTicket.getUpdateBy() : null);
+            add(track != null ? track.getCreateBy() : null);
         }};
         createBys = createBys.stream().distinct().collect(Collectors.toList());
         Map<Long, UserCacheResDto> users = remoteSystemService.queryUserCacheMapByIds(createBys);
-        UserCacheResDto loadUser = users == null ? null : users.get(loadTicket.getUpdateBy());
-        UserCacheResDto unloadUser = users == null ? null : users.get(unloadTicket.getUpdateBy());
+        UserCacheResDto loadUser = users == null ? null : users.get(loadTicket != null ? loadTicket.getUpdateBy() : null);
+        UserCacheResDto unloadUser = users == null ? null : users.get(unloadTicket != null ? unloadTicket.getUpdateBy() : null);
+        UserCacheResDto approver = users == null ? null : users.get(track != null ? track.getCreateBy() : null);
 
         Map result = new HashMap();
         result.put("wOrderId", wOrderId);
@@ -1964,6 +2032,9 @@ public class KwtWaybillOrderService {
         result.put("unloadCreateByName", unloadUser != null ? unloadUser.getName() : null);
         result.put("unloadCityName", unloadAddress != null ? unloadAddress.getCityName() : null);
         result.put("unloadDetailAddress", unloadAddress != null ? unloadAddress.getDetailAddress() : null);
+        result.put("approvalTime", track != null ? track.getCreateTime() : null);
+        result.put("approvalOpinions", track != null ? track.getRemark() : null);
+        result.put("approver", approver != null ? approver.getName() : null);
 
         return HttpResult.ok(result);
     }

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

@@ -9,6 +9,8 @@ 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.exception.BusinessException;
+import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.enums.CarWaybillEnum;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.IdWorker;
@@ -30,9 +32,11 @@ import com.sckw.transport.api.dubbo.TransportDubboService;
 import com.sckw.transport.api.model.dto.AccountCheckingBindDTO;
 import com.sckw.transport.api.model.dto.AddressResDTO;
 import com.sckw.transport.api.model.dto.LogisticsOrderDTO;
+import com.sckw.transport.api.model.dto.RWaybillOrderDto;
 import com.sckw.transport.api.model.param.ContractSignLogisticsParam;
 import com.sckw.transport.api.model.param.LogisticsOrderParam;
 import com.sckw.transport.api.model.vo.KwtLogisticsOrderVO;
+import com.sckw.transport.api.model.vo.RWaybillOrderVo;
 import com.sckw.transport.dao.*;
 import com.sckw.transport.model.*;
 import jakarta.annotation.Resource;
@@ -86,6 +90,12 @@ public class TransportDubboServiceImpl implements TransportDubboService {
     @Autowired
     private KwtLogisticsOrderGoodsMapper logisticsOrderGoodsMapper;
 
+    @Autowired
+    private KwtWaybillOrderMapper waybillOrderDao;
+
+    @Autowired
+    private KwtWaybillOrderTrackMapper waybillOrderTrackDao;
+
     /**
      * 对账管理-ids查询
      *
@@ -534,4 +544,33 @@ public class TransportDubboServiceImpl implements TransportDubboService {
             RedissonUtils.unlock(lockKey);
         }
     }
+
+    /**
+     * @param params 参数
+     * @desc 查询车辆运单
+     * @author zk
+     * @date 2023/9/6
+     **/
+    @Override
+    public List<RWaybillOrderVo> findWaybillOrder(RWaybillOrderDto params) {
+        List<RWaybillOrderVo> waybillOrderVos = new ArrayList<>();
+        Map<String, Object> queryParams = new HashMap<>(Global.NUMERICAL_SIXTEEN){{
+            put("truckNo", params.getTruckNo());
+            put("busStatus", params.getBusStatus());
+        }};
+        List<KwtWaybillOrder> waybillOrders = waybillOrderDao.findWaybillOrder(queryParams);
+        if (CollectionUtils.isEmpty(waybillOrders)) {
+            return waybillOrderVos;
+        }
+
+        for (KwtWaybillOrder waybillOrder:waybillOrders) {
+            RWaybillOrderVo order = new RWaybillOrderVo();
+            BeanUtils.copyProperties(waybillOrder, order);
+            KwtWaybillOrderTrack track = waybillOrderTrackDao.findWaybillOrderTrack(waybillOrder.getId(), CarWaybillEnum.EXIT_COMPLETED.getCode());
+            order.setDepartureTime(track != null ? track.getOperateTime(): null);
+            waybillOrderVos.add(order);
+        }
+
+        return waybillOrderVos;
+    }
 }

+ 49 - 5
sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderMapper.xml

@@ -32,6 +32,7 @@
     load_amount, deficit_amount, remark, `status`, create_by, create_time, update_by,
     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,
@@ -51,6 +52,7 @@
           and b.t_order_id = #{id,jdbcType=VARCHAR} limit #{page}
             , #{pageSize}
     </select>
+
     <select id="selectWaybillOrderCarCount" resultType="java.lang.Long">
         SELECT count(a.id)
         FROM kwt_waybill_order a
@@ -80,6 +82,7 @@
         </where>
         group by lOrderId
     </select>
+
     <select id="getWaybillData" resultType="com.sckw.transport.model.vo.WaybillDetailVO">
     </select>
 
@@ -178,10 +181,10 @@
             and wo.status = 8
         </if>
         <if test="loadCountStatus != null and loadCountStatus != ''">
-            and wo.status in (5, 6, 7, 8, 12)
+            and wo.status in (5, 6, 7, 8, 12, 13)
         </if>
         <if test="unloadCountStatus != null and unloadCountStatus != ''">
-            and wo.status in (7, 8, 12)
+            and wo.status in (7, 8, 12, 13)
         </if>
         <if test="upperlOrderId != null and upperlOrderId != ''">
             and FIND_IN_SET(#{upperlOrderId, jdbcType=BIGINT}, pids)
@@ -271,7 +274,7 @@
                        LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
               where wo.del_flag = 0
                 and lo.del_flag = 0
-                and wo.status in (7, 8, 9, 10, 11, 12)
+                and wo.status in (7, 8, 9, 10, 12, 13)
                 and wo.driver_id = #{driverId, jdbcType=BIGINT}) tabE on tabE.indexNum = tabA.indexNum
     </select>
 
@@ -284,7 +287,7 @@
         LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
         where wo.del_flag = 0 and lo.del_flag = 0
         <if test="busStatus != null and busStatus == 4">
-            and wo.status in (7, 8, 9, 10, 11, 12)
+            and wo.status in (7, 8, 9, 10, 12, 13)
         </if>
         <if test="driverId != null and driverId != ''">
             and wo.driver_id = #{driverId, jdbcType=BIGINT}
@@ -292,6 +295,12 @@
         <if test="month != null and month != ''">
             and LEFT(wo.create_time, 7) = #{month, jdbcType=TIMESTAMP}
         </if>
+        <if test="startTime != null and startTime != ''">
+            and DATE(wo.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and DATE(wo.create_time) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        </if>
     </select>
 
     <select id="findWaitWaybillOrderByDriver" resultType="com.sckw.transport.model.vo.WaybillOrderDriverVo"
@@ -403,12 +412,19 @@
             and wo.status in (3, 4, 5, 6)
         </if>
         <if test="busStatus != null and busStatus == 4">
-            and wo.status in (7, 8, 9, 10, 11, 12)
+            and wo.status in (7, 8, 9, 10, 12, 13)
         </if>
         <if test="month != null and month != ''">
             and LEFT(wo.create_time, 7) = #{month, jdbcType=TIMESTAMP}
         </if>
+        <if test="startTime != null and startTime != ''">
+            and DATE(wo.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and DATE(wo.create_time) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
+        </if>
     </select>
+
     <select id="selectWaybillOrderCarListNotPage" resultType="com.sckw.transport.model.dto.OrderCarDTO">
         SELECT a.id            as wOrderId,
                a.w_order_no    as wOrderNo,
@@ -427,6 +443,7 @@
           and b.del_flag = '0'
           and b.t_order_id = #{id,jdbcType=VARCHAR}
     </select>
+
     <select id="selectWaybillOrderCountByStatus">
         SELECT COUNT(id)
         FROM kwt_waybill_order
@@ -462,6 +479,7 @@
             </foreach>
         </if>
     </select>
+
     <select id="selectWaybillOrderAmountByStatus" resultType="java.util.Map">
         SELECT
         COUNT(id) total,
@@ -491,7 +509,33 @@
             </foreach>
         </if>
     </select>
+
     <select id="getMaxOrderNo" resultType="java.lang.String">
         SELECT w_order_no FROM `kwt_waybill_order`  WHERE w_order_no LIKE concat(#{lOrderNo},'%') ORDER BY w_order_no DESC LIMIT 1
     </select>
+
+    <select id="findWaybillOrder" resultType="com.sckw.transport.model.KwtWaybillOrder" parameterType="java.util.Map">
+        SELECT
+        kwo.id worderId, kwo.w_order_no worderNo, kwo.l_order_id lOrderId, kwo.type, kwo.ent_id carrierEntId, kwo.start_time startTime,
+        kwo.end_time endTime, kwo.entrust_amount entrustAmount, kwo.load_amount loadAmount, kwo.unload_amount unloadAmount,
+        kwo.deficit_amount deficitAmount, kwo.deficit_price deficitPrice, kwo.truck_id truckId, kwo.truck_no truckNo, kwo.status,
+        kwo.create_time createTime, kwo.driver_id driverId, kwo.driver_name driverName, kwo.driver_phone driverPhone
+        FROM kwt_waybill_order kwo
+        where kwo.del_flag = 0
+        <if test="driverId != null and driverId != ''">
+            and kwo.driver_id = #{driverId, jdbcType=BIGINT}
+        </if>
+        <if test="truckNo != null and truckNo != ''">
+            and kwo.truck_no = #{truckNo, jdbcType=VARCHAR}
+        </if>
+        <if test="busStatus != null and busStatus == 2">
+            and kwo.status = 2
+        </if>
+        <if test="busStatus != null and busStatus == 3">
+            and kwo.status in (3, 4, 5, 6)
+        </if>
+        <if test="busStatus != null and busStatus == 4">
+            and kwo.status in (7, 8, 9, 10, 12, 13)
+        </if>
+    </select>
 </mapper>