Bläddra i källkod

增加对账查询接口;数据库增加返回修改行数

wanxl 1 år sedan
förälder
incheckning
661e762527

+ 1 - 1
src/main/java/com/sqx/modules/reconciliation/controller/PlatformBillController.java

@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
  * @since 2025-02-27
  */
 @RestController
-@RequestMapping("/reconciliation")
+@RequestMapping("/reconciliation/")
 @RequiredArgsConstructor
 public class PlatformBillController {
 

+ 7 - 0
src/main/java/com/sqx/modules/reconciliation/model/RiderBillVo.java

@@ -1,5 +1,12 @@
 package com.sqx.modules.reconciliation.model;
 
+import lombok.Data;
+
+@Data
 public class RiderBillVo extends PlatformBill{
 
+    private  String userName;
+    private  String phone;
+    private  String stationName;
+
 }

+ 5 - 0
src/main/java/com/sqx/modules/reconciliation/model/ShopBillVo.java

@@ -1,5 +1,10 @@
 package com.sqx.modules.reconciliation.model;
 
+import lombok.Data;
+
+@Data
 public class ShopBillVo extends PlatformBill{
 
+    private String phone;
+
 }

+ 1 - 2
src/main/java/com/sqx/scheduler/reconciliation/BillsScheduler.java

@@ -29,8 +29,7 @@ public class BillsScheduler {
      * 每填0点2分30秒执行一次
      */
     @Async
-//    @Scheduled(cron = "30 2 0 * * ?", zone = "Asia/Shanghai")
-    @Scheduled(cron = "30 * * * * ?", zone = "Asia/Shanghai")
+    @Scheduled(cron = "30 2 0 * * ?", zone = "Asia/Shanghai")
     public void insertPlatformBill(){
         int errorCount = 0 ;
         log.info("开始统计对账数据");

+ 1 - 1
src/main/resources/application-dev.yml

@@ -3,7 +3,7 @@ spring:
         type: com.alibaba.druid.pool.DruidDataSource
         druid:
             driver-class-name: com.mysql.cj.jdbc.Driver
-            url: jdbc:mysql://172.16.20.108:3306/tcwm2.5?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&serverTimezone=CTT
+            url: jdbc:mysql://172.16.20.108:3306/tcwm2.5?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&serverTimezone=CTT&useAffectedRows=true
             username: root
             password: chuanghai@2024
             initial-size: 15

+ 1 - 1
src/main/resources/application-prod.yml

@@ -119,7 +119,7 @@ sftp:
 #查询备用数据库
 dynamic:
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://172.16.20.104:3306/tcwm2.5?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&serverTimezone=CTT
+    url: jdbc:mysql://172.16.20.111:3306/tcwm2.5?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&serverTimezone=CTT&useAffectedRows=true
     #    url: jdbc:mysql://172.16.20.108:3306/tcwm2.5?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&serverTimezone=CTT
     username: root
     password: ch@2025.wm

+ 45 - 49
src/main/resources/mapper/reconciliation/PlatformBillMapper.xml

@@ -2,68 +2,64 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sqx.modules.reconciliation.mapper.PlatformBillMapper">
 
-    <select id="selectCashOutList" resultType="com.sqx.modules.pay.vo.CashOutVO">
-        select gh.shop_name, co.*,rs.station_name as stationName,tu.user_name as userName, gh.mch_id as mchId, tu.phone as phoneNumber
-        from cash_out co
-        left join goods_shop gh on gh.shop_id = co.shop_id
-        left join tb_user tu on tu.user_id=co.user_id
-        left join rider_station rs on tu.rider_station_id=rs.id
+    <select id="riderBill" resultType="com.sqx.modules.reconciliation.model.RiderBillVo">
+        select pb.*,tu.user_name as userName,tu.phone ,rs.station_name as stationName
+        from platform_bill pb left join tb_user tu on pb.user_id =tu.user_id
+        left join rider_station rs on rs.id =tu.rider_station_id
         <where>
-            <if test="params.zhifubaoName != null and params.zhifubaoName != '' and params.zhifubaoName != 'null'">
-                and co.zhifubao_name = #{params.zhifubaoName}
+            pb.`type` =2
+            <if test="params.startDate != null and params.startDate != '' and params.startDate != 'null'">
+                and pb.day_id >= #{params.startDate}
             </if>
-            <if test="params.zhifubao != null and params.zhifubao != '' and params.zhifubao != 'null'">
-                and co.zhifubao = #{params.zhifubao}
+            <if test="params.endDate != null and params.endDate != '' and params.endDate != 'null'">
+                and pb.day_id <![CDATA[ <= ]]> #{params.endDate}
             </if>
-            <if test="params.userId != null">
-                and co.user_id = #{params.userId}
+            <if test="params.riderStation != null and params.riderStation != ''">
+                and rs.id = #{params.riderStation}
             </if>
-            <if test="params.type != null and params.type != '' and params.type != 'null'">
-                and co.type = #{params.type}
+            <if test="params.riderPhone != null and params.riderPhone != '' and params.riderPhone != 'null'">
+                and tu.phone like concat('%',#{params.riderPhone},'%')
             </if>
-            <if test="params.state != null">
-                and co.state = #{params.state}
+            <if test="params.riderName != null and params.riderName != '' and params.riderName != 'null'">
+                and tu.user_name like concat('%',#{params.riderName},'%')
             </if>
-            <if test="params.phone != null and params.phone != '' and params.phone != 'null'">
-                and tu.phone like concat('%',#{params.phone},'%')
-            </if>
-            <if test="params.userName != null and params.userName != '' and params.userName != 'null'">
-                and tu.user_name like concat('%',#{params.userName},'%')
-            </if>
-            <if test="params.classify == 1 || params.classify == 5 || params.classify == 6">
-                and co.classify = #{params.classify}
-            </if>
-            <if test="params.classify == 2">
-                and co.classify in (2, 3, 4)
-            </if>
-            <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">
-                and co.create_at <![CDATA[ >= ]]> #{params.startTime}
-            </if>
-            <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">
-                and co.create_at <![CDATA[ <= ]]> #{params.endTime}
+        </where>
+        order by pb.bill_id desc
+    </select>
+
+    <select id="shopBill" resultType="com.sqx.modules.reconciliation.model.ShopBillVo">
+        select pb.*,gs.shop_name as shopName,gs.phone
+        from platform_bill pb left join tb_user tu on pb.user_id =tu.user_id
+        left join goods_shop gs on gs.user_id =tu.user_id
+        <where>
+            pb.`type` = 1
+            <if test="params.startDate != null and params.startDate != '' and params.startDate != 'null'">
+                and pb.day_id >= #{params.startDate}
             </if>
-            <if test="params.outStartTime != null and params.outStartTime != '' and params.outStartTime != 'null'">
-                and co.out_at <![CDATA[ >= ]]> #{params.outStartTime}
+            <if test="params.endDate != null and params.endDate != '' and params.endDate != 'null'">
+                and pb.day_id <![CDATA[ <= ]]> #{params.endDate}
             </if>
-            <if test="params.outEndTime != null and params.outEndTime != '' and params.outEndTime != 'null'">
-                and co.out_at <![CDATA[ <= ]]> #{params.outEndTime}
+            <if test="params.shopPhone != null and params.shopPhone != '' and params.shopPhone != 'null'">
+                and gs.phone like concat('%',#{params.shopPhone},'%')
             </if>
             <if test="params.shopName != null and params.shopName != '' and params.shopName != 'null'">
-                and gh.shop_name like concat('%',#{params.shopName},'%')
-            </if>
-            <if test="params.bankCardNo != null and params.bankCardNo != '' and params.bankCardNo != 'null'">
-                and co.bank_card_no = #{params.bankCardNo}
-            </if>
-            <if test="params.bankRealName != null and params.bankRealName != '' and params.bankRealName != 'null'">
-                and co.bank_real_name = #{params.bankRealName}
+                and gs.shop_name like concat('%',#{params.shopName},'%')
             </if>
-            <if test="params.openBank != null and params.openBank != '' and params.openBank != 'null'">
-                and co.open_bank = #{params.openBank}
+        </where>
+        order by pb.bill_id desc
+    </select>
+    <select id="platformBill" resultType="com.sqx.modules.reconciliation.model.PlatformBill">
+        select pb.*
+        from platform_bill pb
+        <where>
+            pb.`type` = 0
+            <if test="params.startDate != null and params.startDate != '' and params.startDate != 'null'">
+                and pb.day_id >= #{params.startDate}
             </if>
-            <if test="params.riderStationId != null and params.riderStationId != '' ">
-                and tu.rider_station_id = #{params.riderStationId}
+            <if test="params.endDate != null and params.endDate != '' and params.endDate != 'null'">
+                and pb.day_id <![CDATA[ <= ]]> #{params.endDate}
             </if>
         </where>
-        order by id desc
+        order by pb.bill_id desc
     </select>
 </mapper>