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

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

czh преди 2 години
родител
ревизия
22dcb5d6c7
променени са 85 файла, в които са добавени 2744 реда и са изтрити 290 реда
  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. 124 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. 0 24
      sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/CashItem.java
  7. 10 0
      sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/WalletDto.java
  8. 1 1
      sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TestController.java
  9. 2 15
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java
  10. 15 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java
  11. 49 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckGpsVo.java
  12. 38 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfTruckMonitorVo.java
  13. 0 1
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfFleetService.java
  14. 160 8
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  15. 16 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml
  16. 10 0
      sckw-modules/sckw-message/src/main/java/com/sckw/message/dao/KwmMessageMapper.java
  17. 5 0
      sckw-modules/sckw-message/src/main/java/com/sckw/message/model/dto/SelectMessagesDTO.java
  18. 6 0
      sckw-modules/sckw-message/src/main/java/com/sckw/message/model/vo/req/SelectMessagesReqVO.java
  19. 3 0
      sckw-modules/sckw-message/src/main/java/com/sckw/message/model/vo/req/StatisticsMessagesReqVO.java
  20. 12 0
      sckw-modules/sckw-message/src/main/java/com/sckw/message/service/KwmMessageService.java
  21. 21 11
      sckw-modules/sckw-message/src/main/java/com/sckw/message/service/MessageService.java
  22. 62 27
      sckw-modules/sckw-message/src/main/resources/mapper/KwmMessageMapper.xml
  23. 155 4
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/WalletController.java
  24. 13 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpWalletRefundMapper.java
  25. 33 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/job/AsyncPool.java
  26. 117 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpWalletRefund.java
  27. 54 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/CashEnum.java
  28. 9 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/PayCenterEnum.java
  29. 53 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/RefundEnum.java
  30. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/common/BusinessNo.java
  31. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/common/Page.java
  32. 6 5
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/CashPage.java
  33. 3 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/PrePayIndexPage.java
  34. 19 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/PrePayWalletPage.java
  35. 2 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/RecordPage.java
  36. 22 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashCount.java
  37. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashDetail.java
  38. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashDetailItem.java
  39. 37 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/CashItem.java
  40. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Channel.java
  41. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Detail.java
  42. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Filter.java
  43. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Freeze.java
  44. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/LogItem.java
  45. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/MemberCreate.java
  46. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/MemberRes.java
  47. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Money.java
  48. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Operate.java
  49. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/OperateDown.java
  50. 4 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Order.java
  51. 2 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PatchPay.java
  52. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PayIndex.java
  53. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PayRecord.java
  54. 2 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PayRecordPage.java
  55. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PrePayIndex.java
  56. 48 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/PrePayWallet.java
  57. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Record.java
  58. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/RrePayDetail.java
  59. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Tips.java
  60. 21 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Wallet.java
  61. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/WalletInfo.java
  62. 42 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/WalletOverview.java
  63. 7 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/CashPageReq.java
  64. 41 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePay.java
  65. 23 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayCheck.java
  66. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/PrePayPage.java
  67. 41 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/Refund.java
  68. 4 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/RefundReq.java
  69. 41 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/TransferReq.java
  70. 27 6
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/FundVo.java
  71. 34 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/MorePageRes.java
  72. 3 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/WalletDetail.java
  73. 136 12
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/PayCenterService.java
  74. 437 83
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/WalletService.java
  75. 67 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/task/RefundTask.java
  76. 29 0
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpWalletRefundMapper.xml
  77. 7 7
      sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwOrderService.java
  78. 14 3
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtWaybillOrderController.java
  79. 16 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/LogisticsOrderDTO.java
  80. 83 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/WaybillOrderTicketV1Dto.java
  81. 80 9
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java
  82. 21 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java
  83. 24 15
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/WaybillManagementService.java
  84. 14 10
      sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml
  85. 17 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;
     }

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

@@ -106,6 +106,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 +384,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();
+    }
+
+    /**
+     * 对日期的【分钟】进行加/减
+     * @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();
+    }
 
-    public static void main(String[] ager) throws InterruptedException {
+    /**
+     * 对日期的【小时】进行加/减
+     * @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);
+    }
+
+
+}

+ 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;
 }

+ 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);
     }
 

+ 2 - 15
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));
     }
 
     /**

+ 15 - 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,21 @@ public interface KwfTruckMapper extends BaseMapper<KwfTruck> {
 
     /**
      * 企业运力统计
-     * @param entIds
+     * @param entIds 企业id集
      * @return
      */
     List<Map<String, Object>> capacityStatistics(@Param("entIds") List entIds);
+
+    /**
+     * 查询企业车辆
+     * @param entId 企业id
+     * @return
+     */
+    List<KwfTruckMonitorVo> findTruckByEnt(@Param("entId") Long entId);
+
+    /**
+     * 查询全部车辆
+     * @return
+     */
+    List<KwfTruckMonitorVo> findTruckByAll();
 }

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

@@ -0,0 +1,49 @@
+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 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;
     }
-
 }

+ 160 - 8
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -4,17 +4,18 @@ 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.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;
@@ -28,15 +29,13 @@ import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 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;
 
 /**
@@ -587,6 +586,50 @@ public class KwfTruckService {
         }
     }
 
+    /**
+     * @param params {truckNo 車牌號}
+     * @desc 车辆查询(业务关联+归属车辆)
+     * @author zk
+     * @date 2023/9/5
+     **/
+    public List<KwfTruckMonitorVo> findTruck(Map<String, Object> params){
+        /**车辆查询**/
+        List<KwfTruckMonitorVo> trucks = new ArrayList<>();
+        if (LoginUserHolder.getSystemType() == SystemTypeEnum.COMPANY.getCode()) {
+            trucks = truckDao.findTruckByEnt(LoginUserHolder.getEntId());
+        }
+        if (LoginUserHolder.getSystemType() == SystemTypeEnum.MANAGE.getCode()) {
+            trucks = truckDao.findTruckByAll();
+        }
+        if (trucks == null || trucks.size() == 0) {
+            return trucks;
+        }
+
+        /**数据配置**/
+        List<Long> entIds = new ArrayList<>();
+        List<String> truckNos = new ArrayList<>();
+        for (KwfTruckMonitorVo truck:trucks) {
+            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:trucks) {
+            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 trucks;
+    }
+
     /**
      * @param params 参数
      * @desc 校验车辆是否有证书
@@ -690,4 +733,113 @@ 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;
+    }
+
+    @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 {
+                    System.out.println(result);
+                }
+                JSONArray trucks = result.getJSONArray("data");
+                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("lng"));
+                    truckGps.setLng(locateInfo.getString("vehicleNo"));
+                    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 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;
+    }
+
+    public static void main(String[] args) {
+        String url = "http://10.10.10.224:27802/openapi/vehicleLocate/queryLocateByDesignatedTime";
+        Map<String, Object> params = new HashMap<>(Global.NUMERICAL_SIXTEEN){{put("vehicleNo", "川L01819D");}};
+        String result = HttpClientUtil.post(url, JSON.toJSONString(params));
+        System.out.println(result);
+
+
+
+    }
+
 }

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

@@ -234,4 +234,20 @@
         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}
+    </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
+    </select>
+
 </mapper>

+ 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);
 }

+ 5 - 0
sckw-modules/sckw-message/src/main/java/com/sckw/message/model/dto/SelectMessagesDTO.java

@@ -50,4 +50,9 @@ public class SelectMessagesDTO {
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date endCreateTime;
+
+    /**
+     * 消息列表排序类型 1状态升序,创建时间降序   2创建时间降序
+     */
+    private Integer sortType;
 }

+ 6 - 0
sckw-modules/sckw-message/src/main/java/com/sckw/message/model/vo/req/SelectMessagesReqVO.java

@@ -2,9 +2,11 @@ package com.sckw.message.model.vo.req;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.sckw.core.model.page.PageRequest;
+import jakarta.validation.constraints.NotNull;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
+import org.hibernate.validator.constraints.Range;
 
 import java.util.Date;
 
@@ -40,5 +42,9 @@ public class SelectMessagesReqVO extends PageRequest {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date endCreateTime;
 
+    @NotNull(message = "消息列表排序类型不能为空")
+    @Range(min = 1, max = 2, message = "非法消息列表排序类型")
+    private Integer sortType;
+
 
 }

+ 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

+ 21 - 11
sckw-modules/sckw-message/src/main/java/com/sckw/message/service/MessageService.java

@@ -58,7 +58,7 @@ public class MessageService {
      */
     @Transactional(rollbackFor = Exception.class)
     public void read(ReadMessagesReqVO reqVO) {
-        List<Long> ids = StringUtils.splitStrToList(reqVO.toString(), Long.class);
+        List<Long> ids = StringUtils.splitStrToList(reqVO.getIds(), Long.class);
         List<KwmMessageUser> msgList = kwmMessageUserService.getByMsgIds(ids);
         if (!Objects.equals(ids.size(), msgList.size())) {
             throw new BusinessException("无权限读取消息!");
@@ -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;
     }

+ 62 - 27
sckw-modules/sckw-message/src/main/resources/mapper/KwmMessageMapper.xml

@@ -3,34 +3,69 @@
 <mapper namespace="com.sckw.message.dao.KwmMessageMapper">
 
   <select id="findPage" resultType="com.sckw.message.model.dto.MessageListDTO" >
-    select
-      mu.id, mu.ent_id entId, mu.user_id userId, mu.status, mu.reamrk, mu.create_by createBy, mu.create_time createTime,
+      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 m.create_time &gt;= #{item.startCreateTime,jdbcType=TIMESTAMP}
-        </if>
-        <if test="item.endCreateTime != null">
-            and m.create_time &lt;= #{item.endCreateTime,jdbcType=TIMESTAMP}
-        </if>
-    </where>
-    ORDER BY m.create_time desc
+      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
+          </when>
+          <otherwise>
+              mu.create_time DESC
+          </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>

+ 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>

+ 7 - 7
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwOrderService.java

@@ -97,13 +97,16 @@ public class KwOrderService {
             String loadDetailAddress = Objects.isNull(e.getLoadDetailAddress()) ? "" : e.getLoadDetailAddress();
             String unloadDetailAddress = Objects.isNull(e.getUnloadDetailAddress()) ? "" : e.getUnloadDetailAddress();
             order.setStatusLabel(DictEnum.getLabel(DictTypeEnum.TORDER_STATUS.getType(), String.valueOf(e.getStatus())))
+                    .setTradingLabel(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
                     .setTrading(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
+                    .setDeliveryTypeLabel(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
                     .setDeliveryType(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
                     .setPickupTypeLabel(DictEnum.getLabel(DictTypeEnum.PICKUP_TYPE.getType(), e.getPickupType()))
+                    .setSourceLabel(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()))
+                    .setSource(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()))
                     .setLoadDetailAddressInfo(loadCityName + loadDetailAddress)
                     .setUnloadDetailAddressInfo(unloadCityName + unloadDetailAddress)
-                    .setWaitEntrustAmount(getWaitEntrustAmount(e.getAmount(), e.getEntrustAmount()))
-                    .setSource(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()));
+                    .setWaitEntrustAmount(getWaitEntrustAmount(e.getAmount(), e.getEntrustAmount()));
             result.add(order);
         });
         return PageResult.build(page, pageSize, count, result);
@@ -137,7 +140,7 @@ public class KwOrderService {
         Long userId = LoginUserHolder.getUserId();
         Criteria criteria = new Criteria();
         String topEnt = Objects.equals(params.getOrderType(), 1) ? "procureTopEntId" : "supplyTopEntId";
-        criteria.and("delFlag").is(0);
+        criteria.and(topEnt).is(entId).and("delFlag").is(0);
         //日期范围
         if (Objects.nonNull(params.getStartCreateTime()) && Objects.nonNull(params.getEndCreateTime())) {
             criteria.and("createTime").gte(params.getStartCreateTime()).lte(params.getEndCreateTime());
@@ -190,14 +193,11 @@ public class KwOrderService {
             if (Objects.equals(params.getStatus(), 0)) {
                 //草稿状态只能创建订单的人能看
                 criteria.and("createBy").is(userId);
-            }else {
-                criteria.and(topEnt).is(entId);
             }
         } else {
             //非草稿状态且一级企业匹配or草稿状态且是当前人
             Criteria orOperator = new Criteria().orOperator(
-                    new Criteria().andOperator(Criteria.where("status").ne(0),
-                            Criteria.where(topEnt).is(entId)),
+                    Criteria.where("status").ne(0),
                     new Criteria().andOperator(Criteria.where("status").is(0),
                             Criteria.where("createBy").is(userId)));
             orOperators.add(orOperator);

+ 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 修改单证查询运单

+ 16 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/LogisticsOrderDTO.java

@@ -52,18 +52,34 @@ public class LogisticsOrderDTO {
      * 计划量
      */
     private BigDecimal amount;
+    private String unit;
+    private String unitLabel;
     /**
      * 运价
      */
     private String price;
+
+    /**
+     * 运价
+     */
+    private String priceType;
+
+    /**
+     * 运价
+     */
+    private String priceLabel;
     /**
      * 合理损耗
      */
     private String loss;
+    private String lossUnit;
+    private String lossUnitLabel;
     /**
      * 扣亏货值
      */
     private String goodsPrice;
+    private String goodsPriceUnit;
+    private String goodsPriceUnitLabel;
     /**
      * 联系人
      */

+ 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

@@ -99,7 +99,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);
     }
 
@@ -109,7 +109,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);
     }
 
@@ -1526,7 +1526,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承运订单
@@ -1661,7 +1661,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承运订单
@@ -1742,7 +1742,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承运订单状态记录**/
@@ -1909,6 +1909,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 修改单证查询运单
@@ -1931,15 +1994,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);
@@ -1966,6 +2034,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);
     }

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

@@ -656,6 +656,12 @@ public class LogisticsConsignmentService {
             if (flag) {
                 /**数据展示*/
                 list = kwtLogisticsOrderMapper.selectOrderListNotPage(id, type);
+                /**计量单位*/
+                Map<String, String> unitTypeDictData = commonService.getDictData(DictTypeEnum.UNIT_TYPE.getType());
+                /**运价方式*/
+                Map<String, String> priceDictData = commonService.getDictData(DictTypeEnum.PRICE_TYPE.getType());
+                /**合理损耗*/
+                Map<String, String> taxRateTypeDictData = commonService.getDictData(DictTypeEnum.TAX_RATE_TYPE.getType());
                 if (CollectionUtils.isNotEmpty(list)) {
                     for (LogisticsOrderDTO logisticsOrderDTO : list) {
                         logisticsOrderDTO.setStatusLabel(LogisticsOrderEnum.getDestination(logisticsOrderDTO.getStatus()));
@@ -663,6 +669,10 @@ public class LogisticsConsignmentService {
                                 (remoteSystemService.queryUserCacheById(Long.parseLong(logisticsOrderDTO.getCreateBy())) == null ? null :
                                         remoteSystemService.queryUserCacheById(Long.parseLong(logisticsOrderDTO.getCreateBy())).getName());
                         logisticsOrderDTO.setCreateName(createName);
+                        logisticsOrderDTO.setPriceLabel(priceDictData.get(logisticsOrderDTO.getPriceType()));
+                        logisticsOrderDTO.setLossUnitLabel(taxRateTypeDictData.get(logisticsOrderDTO.getLossUnit()));
+                        logisticsOrderDTO.setGoodsPriceUnitLabel(priceDictData.get(logisticsOrderDTO.getGoodsPriceUnit()));
+                        logisticsOrderDTO.setUnitLabel(unitTypeDictData.get(logisticsOrderDTO.getUnit()));
                     }
                     returnList.addAll(list);
                 }
@@ -756,6 +766,12 @@ public class LogisticsConsignmentService {
             if (flag) {
                 /**数据展示*/
                 list = kwtLogisticsOrderMapper.selectOrderListNotPage(id, type);
+                /**计量单位*/
+                Map<String, String> unitTypeDictData = commonService.getDictData(DictTypeEnum.UNIT_TYPE.getType());
+                /**运价方式*/
+                Map<String, String> priceDictData = commonService.getDictData(DictTypeEnum.PRICE_TYPE.getType());
+                /**合理损耗*/
+                Map<String, String> taxRateTypeDictData = commonService.getDictData(DictTypeEnum.TAX_RATE_TYPE.getType());
                 if (CollectionUtils.isNotEmpty(list)) {
                     for (LogisticsOrderDTO logisticsOrderDTO : list) {
                         logisticsOrderDTO.setStatusLabel(LogisticsOrderEnum.getDestination(logisticsOrderDTO.getStatus()));
@@ -763,6 +779,10 @@ public class LogisticsConsignmentService {
                                 (remoteSystemService.queryUserCacheById(Long.parseLong(logisticsOrderDTO.getCreateBy())) == null ? null :
                                         remoteSystemService.queryUserCacheById(Long.parseLong(logisticsOrderDTO.getCreateBy())).getName());
                         logisticsOrderDTO.setCreateName(createName);
+                        logisticsOrderDTO.setPriceLabel(priceDictData.get(logisticsOrderDTO.getPriceType()));
+                        logisticsOrderDTO.setLossUnitLabel(taxRateTypeDictData.get(logisticsOrderDTO.getLossUnit()));
+                        logisticsOrderDTO.setGoodsPriceUnitLabel(priceDictData.get(logisticsOrderDTO.getGoodsPriceUnit()));
+                        logisticsOrderDTO.setUnitLabel(unitTypeDictData.get(logisticsOrderDTO.getUnit()));
                     }
                     returnList.addAll(list);
                 }
@@ -1236,7 +1256,7 @@ public class LogisticsConsignmentService {
         tradeOrder.setActualUnloadAmount(map.get("totalUnloadAmount"));
         tradeOrder.setUpdateBy(LoginUserHolder.getUserId());
         tradeOrder.setUpdateByName(LoginUserHolder.getUserName());
-        log.info("采购订单手动完结订单请求参数:{}",JSONObject.toJSONString(tradeOrder));
+        log.info("采购订单手动完结订单请求参数:{}", JSONObject.toJSONString(tradeOrder));
         HttpResult httpResult = tradeOrderInfoService.completeLogisticsOrder(tradeOrder);
         if (httpResult.getCode() != HttpStatus.SUCCESS_CODE) {
             log.info("贸易订单-采购订单/销售订单-手动完结订单异常,传递信息:{},返回信息:{}", JSONObject.toJSONString(tradeOrder), JSONObject.toJSONString(httpResult));

+ 24 - 15
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/WaybillManagementService.java

@@ -20,10 +20,7 @@ import com.sckw.system.api.model.dto.res.AreaTreeFrontResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import com.sckw.transport.dao.*;
-import com.sckw.transport.model.KwtLogisticsOrder;
-import com.sckw.transport.model.KwtLogisticsOrderCirculate;
-import com.sckw.transport.model.KwtWaybillOrder;
-import com.sckw.transport.model.KwtWaybillOrderTrack;
+import com.sckw.transport.model.*;
 import com.sckw.transport.model.dto.AddressDropListDTO;
 import com.sckw.transport.model.dto.WayBillDetailDTO;
 import com.sckw.transport.model.dto.WaybillListAppDTO;
@@ -154,16 +151,28 @@ public class WaybillManagementService {
             waybillCarVO.setDriverId(String.valueOf(info.getTruckId()));
             waybillCarVO.setTrailerNo(info.getTruckTrailerNo());
             // 票据
-            if (info.getLoadTime() != null) {
-                waybillTicketVO.setLoadTime(DateUtil.getDateTime(info.getLoadTime()));
-            }
-            waybillTicketVO.setLoadWeight(String.valueOf(info.getLoadAmount()));
-            waybillTicketVO.setLoadUrl(String.valueOf(info.getLoadUrls()));
-            if (info.getUnloadTime() != null) {
-                waybillTicketVO.setUnloadTime(DateUtil.getDateTime(info.getUnloadTime()));
+            List<KwtWaybillOrderTicket> waybillOrderTickets = kwtWaybillOrderTicketMapper.selectList(new LambdaQueryWrapper<KwtWaybillOrderTicket>()
+                    .eq(KwtWaybillOrderTicket::getWOrderId, id)
+            );
+            if (!org.springframework.util.CollectionUtils.isEmpty(waybillOrderTickets)) {
+                for (KwtWaybillOrderTicket waybillOrderTicket : waybillOrderTickets) {
+                    //1装货单/2卸货单
+                    if (waybillOrderTicket.getType() == 1) {
+                        if (info.getLoadTime() != null) {
+                            waybillTicketVO.setLoadTime(waybillOrderTicket.getOperateTime() == null ? null : DateUtil.getDateTime(waybillOrderTicket.getOperateTime()));
+                        }
+                        waybillTicketVO.setLoadWeight(String.valueOf(info.getLoadAmount()));
+                        waybillTicketVO.setLoadUrl(String.valueOf(info.getLoadUrls()));
+                    }
+                    if (waybillOrderTicket.getType() == 2) {
+                        if (info.getUnloadTime() != null) {
+                            waybillTicketVO.setUnloadTime(waybillOrderTicket.getOperateTime() == null ? null : DateUtil.getDateTime(waybillOrderTicket.getOperateTime()));
+                        }
+                        waybillTicketVO.setUnloadWeight(String.valueOf(info.getUnloadAmount()));
+                        waybillTicketVO.setUnloadUrl(String.valueOf(info.getUnloadUrls()));
+                    }
+                }
             }
-            waybillTicketVO.setUnloadWeight(String.valueOf(info.getUnloadAmount()));
-            waybillTicketVO.setUnloadUrl(String.valueOf(info.getUnloadUrls()));
             waybillTicketVO.setDeficitAmount(String.valueOf(info.getDeficitAmount()));
             BigDecimal deficitLoss = info.getLoss() == null ? BigDecimal.valueOf(0) : info.getLoss();
             BigDecimal deficitAmount = info.getDeficitAmount() == null ? BigDecimal.valueOf(0) : info.getDeficitAmount();
@@ -602,7 +611,7 @@ public class WaybillManagementService {
                 allTotal += result.getTotal();
             }
         }
-       // allTotal= Math.toIntExact(results.stream().filter(item -> ObjectUtil.isNotEmpty(item.getTotal())).collect(Collectors.summarizingInt(item -> item.getTotal())).getSum());
+        // allTotal= Math.toIntExact(results.stream().filter(item -> ObjectUtil.isNotEmpty(item.getTotal())).collect(Collectors.summarizingInt(item -> item.getTotal())).getSum());
         listMap.get("all").setTotal(allTotal);
 
         /**数据状态整合做计算
@@ -619,7 +628,7 @@ public class WaybillManagementService {
             for (TableTops result : results) {
                 if (CarWaybillEnum.COMPLETION_UNLOADING.getStatus().equals(result.getValue())) {
                     result.setTotal(result.getTotal() + number);
-                    listMap.put(result.getValue(),result);
+                    listMap.put(result.getValue(), result);
                 }
             }
         }

+ 14 - 10
sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

@@ -77,21 +77,25 @@
     </select>
 
     <select id="selectOrderListNotPage" resultType="com.sckw.transport.model.dto.LogisticsOrderDTO">
-        SELECT a.id          as lOrderId,
-               a.l_order_no  as lOrderNo,
-               b.`status`    as `status`,
-               a.t_order_id  as tOrderId,
-               a.t_order_no  as tOrderNo,
-               a.payment     as payment,
+        SELECT a.id               as lOrderId,
+               a.l_order_no       as lOrderNo,
+               b.`status`         as `status`,
+               a.t_order_id       as tOrderId,
+               a.t_order_no       as tOrderNo,
+               a.payment          as payment,
                a.amount,
+               a.unit             as unit,
                a.price,
+               a.price_type       as priceType,
                a.loss,
-               a.goods_price as goodsPrice,
-               c.firm_name   as companyName,
+               a.loss_unit        AS lossUnit,
+               a.goods_price      as goodsPrice,
+               a.goods_price_unit as goodsPriceUnit,
+               c.firm_name        as companyName,
                c.contacts,
                c.phone,
-               a.create_by   as createBy,
-               a.create_time as createTime
+               a.create_by        as createBy,
+               a.create_time      as createTime
         FROM kwt_logistics_order a
                  LEFT JOIN kwt_logistics_order_track b ON a.id = b.l_order_id and a.`status` = b.`status`
                  LEFT JOIN kwt_logistics_order_unit c ON a.id = c.l_order_id AND c.unit_type = #{type}

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

@@ -178,10 +178,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 +271,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 +284,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 +292,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,11 +409,17 @@
             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,