Jelajahi Sumber

查询各类对账分页数据

wanxl 1 tahun lalu
induk
melakukan
3414e6a3e0

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

@@ -1,7 +1,9 @@
 package com.sqx.modules.reconciliation.controller;
 
 
+import com.sqx.common.utils.PageUtils;
 import com.sqx.common.utils.Result;
+import com.sqx.modules.reconciliation.model.PlatformBillDto;
 import com.sqx.modules.reconciliation.service.PlatformBillService;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
@@ -19,17 +21,31 @@ import org.springframework.web.bind.annotation.RestController;
  * @since 2025-02-27
  */
 @RestController
-@RequestMapping("/reconciliation/platform-bill")
+@RequestMapping("/reconciliation")
 @RequiredArgsConstructor
 public class PlatformBillController {
 
     private final PlatformBillService platformBillService;
 
     @ApiOperation("查询骑手对账")
-    @PostMapping(value = "addAdminIntegral")
-    public Result addAdminIntegral(Long userId, Integer sum, Integer type){
-            return null;
-//        return platformBillService.addAdminIntegral(userId, sum, type);
+    @PostMapping(value = "riderBill")
+    public Result riderBill(PlatformBillDto platformBillDto){
+        PageUtils pageUtils = platformBillService.riderBill(platformBillDto);
+        return Result.success().put("data",pageUtils);
+    }
+
+    @ApiOperation("查询商家对账")
+    @PostMapping(value = "shopBill")
+    public Result shopBill(PlatformBillDto platformBillDto){
+        PageUtils pageUtils = platformBillService.shopBill(platformBillDto);
+        return Result.success().put("data",pageUtils);
+    }
+
+    @ApiOperation("查询平台对账")
+    @PostMapping(value = "platformBill")
+    public Result platformBill(PlatformBillDto platformBillDto){
+        PageUtils pageUtils = platformBillService.platformBill(platformBillDto);
+        return Result.success().put("data",pageUtils);
     }
 
 }

+ 15 - 6
src/main/java/com/sqx/modules/reconciliation/mapper/PlatformBillMapper.java

@@ -1,10 +1,13 @@
 package com.sqx.modules.reconciliation.mapper;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.sqx.modules.reconciliation.model.PlatformBill;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
+import com.sqx.modules.reconciliation.model.PlatformBillDto;
+import com.sqx.modules.reconciliation.model.RiderBillVo;
+import com.sqx.modules.reconciliation.model.ShopBillVo;
+import org.apache.ibatis.annotations.*;
 
 /**
  * <p>
@@ -17,7 +20,7 @@ import org.apache.ibatis.annotations.Select;
 @Mapper
 public interface PlatformBillMapper extends BaseMapper<PlatformBill> {
 
-    @Select("INSERT INTO `tcwm2.5`.platform_bill \n" +
+    @Insert("INSERT INTO `tcwm2.5`.platform_bill \n" +
             "(day_id, user_id, shop_name, `type`, start_money, revenue, revenue_count, \n" +
             "shop_payouts, shop_payouts_rates, shop_payouts_count, rider_payouts, rider_payouts_rates,\n" +
             "rider_payouts_count, refund_money, refund_count, end_money,sys_gift_amount, platform_rates,total_income,pay_money,create_time,update_time)\n" +
@@ -66,11 +69,11 @@ public interface PlatformBillMapper extends BaseMapper<PlatformBill> {
             "group by tu.user_id ")
     Integer insertPlatformBill(@Param("dayId") String dayId,@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("now") String now);
 
-    @Select("update platform_bill a join platform_bill b on a.user_id =b.user_id and a.type =b.type and  TO_DAYS(a.day_id)-TO_DAYS(b.day_id)= 1 set a.start_money=b.end_money\n" +
+    @Update("update platform_bill a join platform_bill b on a.user_id =b.user_id and a.type =b.type and  TO_DAYS(a.day_id)-TO_DAYS(b.day_id)= 1 set a.start_money=b.end_money\n" +
             "where a.day_id =#{dayId} ")
     Integer updateStartMoney(@Param("dayId") String dayId);
 
-    @Select("INSERT INTO `tcwm2.5`.platform_bill \n" +
+    @Insert("INSERT INTO `tcwm2.5`.platform_bill \n" +
             "(day_id, user_id, shop_name, `type`, start_money, revenue, revenue_count, \n" +
             "shop_payouts, shop_payouts_rates, shop_payouts_count, rider_payouts, rider_payouts_rates,\n" +
             "rider_payouts_count, refund_money, refund_count, end_money,sys_gift_amount, platform_rates,total_income,pay_money,create_time,update_time)\n" +
@@ -82,4 +85,10 @@ public interface PlatformBillMapper extends BaseMapper<PlatformBill> {
             "sum(if(type=1, platform_rates ,0)),null,null,max(create_time) ,max(update_time) \n" +
             "from platform_bill pb where day_id =#{dayId}\n")
     Integer insertTotalPlatformBill(@Param("dayId") String dayId);
+
+    IPage<PlatformBill> platformBill(@Param("page")Page<PlatformBill> pages, @Param("params")PlatformBillDto platformBillDto);
+
+    IPage<ShopBillVo> shopBill(@Param("page")Page<ShopBillVo> pages, @Param("params")PlatformBillDto platformBillDto);
+
+    IPage<RiderBillVo> riderBill(@Param("page")Page<RiderBillVo> pages, @Param("params")PlatformBillDto platformBillDto);
 }

+ 16 - 0
src/main/java/com/sqx/modules/reconciliation/model/PlatformBillDto.java

@@ -0,0 +1,16 @@
+package com.sqx.modules.reconciliation.model;
+
+import com.sqx.common.query.PageQuery;
+import lombok.Data;
+
+@Data
+public class PlatformBillDto extends PageQuery {
+
+    private String startDate;
+    private String endDate;
+    private String riderStation;
+    private String riderName;
+    private String riderPhone;
+    private String shopName;
+    private String shopPhone;
+}

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

@@ -0,0 +1,5 @@
+package com.sqx.modules.reconciliation.model;
+
+public class RiderBillVo extends PlatformBill{
+
+}

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

@@ -0,0 +1,5 @@
+package com.sqx.modules.reconciliation.model;
+
+public class ShopBillVo extends PlatformBill{
+
+}

+ 8 - 0
src/main/java/com/sqx/modules/reconciliation/service/PlatformBillService.java

@@ -1,7 +1,9 @@
 package com.sqx.modules.reconciliation.service;
 
+import com.sqx.common.utils.PageUtils;
 import com.sqx.modules.reconciliation.model.PlatformBill;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.sqx.modules.reconciliation.model.PlatformBillDto;
 
 /**
  * <p>
@@ -14,4 +16,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface PlatformBillService extends IService<PlatformBill> {
 
     int insertPlatformBill();
+
+    PageUtils riderBill(PlatformBillDto platformBillDto);
+
+    PageUtils shopBill(PlatformBillDto platformBillDto);
+
+    PageUtils platformBill(PlatformBillDto platformBillDto);
 }

+ 42 - 1
src/main/java/com/sqx/modules/reconciliation/service/impl/PlatformBillServiceImpl.java

@@ -1,9 +1,16 @@
 package com.sqx.modules.reconciliation.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.sqx.common.utils.DateUtils;
+import com.sqx.common.utils.PageUtils;
+import com.sqx.modules.pay.entity.CashOut;
 import com.sqx.modules.reconciliation.model.PlatformBill;
 import com.sqx.modules.reconciliation.mapper.PlatformBillMapper;
+import com.sqx.modules.reconciliation.model.PlatformBillDto;
+import com.sqx.modules.reconciliation.model.RiderBillVo;
+import com.sqx.modules.reconciliation.model.ShopBillVo;
 import com.sqx.modules.reconciliation.service.PlatformBillService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
@@ -23,7 +30,6 @@ import java.util.Date;
 @Service
 public class PlatformBillServiceImpl extends ServiceImpl<PlatformBillMapper, PlatformBill> implements PlatformBillService {
 
-
     /**
      * @return
      */
@@ -53,4 +59,39 @@ public class PlatformBillServiceImpl extends ServiceImpl<PlatformBillMapper, Pla
         }
         return count3;
     }
+
+    /**
+     * @param platformBillDto
+     * @return
+     */
+    @Override
+    public PageUtils riderBill(PlatformBillDto platformBillDto) {
+        Page<RiderBillVo> pages = new Page<>(platformBillDto.getPage(), platformBillDto.getLimit());
+        IPage<RiderBillVo> page = baseMapper.riderBill(pages, platformBillDto);
+        return new PageUtils(page);
+    }
+
+    /**
+     * @param platformBillDto
+     * @return
+     */
+    @Override
+    public PageUtils shopBill(PlatformBillDto platformBillDto) {
+        Page<ShopBillVo> pages = new Page<>(platformBillDto.getPage(), platformBillDto.getLimit());
+        IPage<ShopBillVo> page = baseMapper.shopBill(pages, platformBillDto);
+        return new PageUtils(page);
+    }
+
+    /**
+     * @param platformBillDto
+     * @return
+     */
+    @Override
+    public PageUtils platformBill(PlatformBillDto platformBillDto) {
+        Page<PlatformBill> pages = new Page<>(platformBillDto.getPage(), platformBillDto.getLimit());
+        IPage<PlatformBill> page = baseMapper.platformBill(pages, platformBillDto);
+        return new PageUtils(page);
+    }
+
+
 }

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

@@ -60,7 +60,7 @@ mybatis-plus:
     cache-enabled: false
     call-setters-on-nulls: true
     jdbc-type-for-null: 'null'
-#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
 sqx:
   redis:

+ 69 - 0
src/main/resources/mapper/reconciliation/PlatformBillMapper.xml

@@ -0,0 +1,69 @@
+<?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.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
+        <where>
+            <if test="params.zhifubaoName != null and params.zhifubaoName != '' and params.zhifubaoName != 'null'">
+                and co.zhifubao_name = #{params.zhifubaoName}
+            </if>
+            <if test="params.zhifubao != null and params.zhifubao != '' and params.zhifubao != 'null'">
+                and co.zhifubao = #{params.zhifubao}
+            </if>
+            <if test="params.userId != null">
+                and co.user_id = #{params.userId}
+            </if>
+            <if test="params.type != null and params.type != '' and params.type != 'null'">
+                and co.type = #{params.type}
+            </if>
+            <if test="params.state != null">
+                and co.state = #{params.state}
+            </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}
+            </if>
+            <if test="params.outStartTime != null and params.outStartTime != '' and params.outStartTime != 'null'">
+                and co.out_at <![CDATA[ >= ]]> #{params.outStartTime}
+            </if>
+            <if test="params.outEndTime != null and params.outEndTime != '' and params.outEndTime != 'null'">
+                and co.out_at <![CDATA[ <= ]]> #{params.outEndTime}
+            </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}
+            </if>
+            <if test="params.openBank != null and params.openBank != '' and params.openBank != 'null'">
+                and co.open_bank = #{params.openBank}
+            </if>
+            <if test="params.riderStationId != null and params.riderStationId != '' ">
+                and tu.rider_station_id = #{params.riderStationId}
+            </if>
+        </where>
+        order by id desc
+    </select>
+</mapper>