Selaa lähdekoodia

骑手提现增加增加手机号和姓名筛选;骑手排行增加姓名和余额展示

wanxl 1 vuosi sitten
vanhempi
commit
be4edbbd13

+ 4 - 0
src/main/java/com/sqx/modules/errand/entity/TbIndent.java

@@ -267,5 +267,9 @@ public class TbIndent implements Serializable {
     @TableField(exist = false)
     private String stationName;
 
+    //骑手余额
+    @TableField(exist = false)
+    private String riderBalance;
+
     public TbIndent() {}
 }

+ 6 - 2
src/main/java/com/sqx/modules/pay/controller/query/CashOutQueryDTO.java

@@ -45,6 +45,8 @@ public class CashOutQueryDTO extends PageQuery {
     private String outStartTime;
     @ApiModelProperty("操作结束时间")
     private String outEndTime;
+    @ApiModelProperty("用户名称")
+    private String userName;
 
     public String toStrCode() {
         return
@@ -63,7 +65,8 @@ public class CashOutQueryDTO extends PageQuery {
                 ","+(endTime==null?"":endTime)+
                 ","+(riderStationId==null?"":riderStationId)+
                 ","+(outStartTime==null?"":outStartTime)+
-                ","+(outEndTime==null?"":outEndTime)+",";
+                ","+(outEndTime==null?"":outEndTime)+
+                ","+(userName==null?"":userName)+",";
     }
     public String toStrMessage() {
         StringBuffer stringBuffer=new StringBuffer();
@@ -80,7 +83,8 @@ public class CashOutQueryDTO extends PageQuery {
                 .append(startTime==null||startTime==""?"":"开始时间:"+startTime+";")
                 .append(endTime==null||endTime==""?"":"结束时间:"+endTime+";")
                 .append(outStartTime==null||outStartTime==""?"":"操作开始时间:"+outStartTime+";")
-                .append(outEndTime==null||outEndTime==""?"":"操作结束时间:"+outEndTime+";");
+                .append(outEndTime==null||outEndTime==""?"":"操作结束时间:"+outEndTime+";")
+                .append(userName==null||userName==""?"":"姓名:"+userName+";");
         if(state!=null){
             switch (state){
                 case 0: stringBuffer.append("状态:待转账;");break;

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

@@ -1,6 +1,11 @@
 package com.sqx.modules.reconciliation.controller;
 
 
+import com.sqx.common.utils.Result;
+import com.sqx.modules.reconciliation.service.PlatformBillService;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -15,7 +20,17 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 @RequestMapping("/reconciliation/platform-bill")
+@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);
+    }
+
 }
 

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

@@ -24,51 +24,51 @@ public interface PlatformBillMapper extends BaseMapper<PlatformBill> {
             "select #{dayId}, tu.user_id, null,2,null,sum(ti.rider_money),count(ti.rider_money),null,null,null,\n" +
             "sum(co.money),sum(co.rate), count(co.money),null,null,max(tu.balance),\n" +
             "(select sum(money) b from  user_money_details ud1 where ud1.user_id =tu.user_id and ud1.title like '系统赠送%' \n" +
-            "and ud1.create_time>#{startTime} and ud1.create_time &lt;=#{endTime})\n" +
+            "and ud1.create_time>#{startTime} and ud1.create_time <=#{endTime})\n" +
             "-(select sum(money) a from  user_money_details ud2 where ud2.user_id =tu.user_id and ud2.title like '系统扣除%' \n" +
-            "and ud2.create_time>#{startTime} and ud2.create_time &lt;= #{endTime}) as gift_amount,null,\n" +
+            "and ud2.create_time>#{startTime} and ud2.create_time <= #{endTime}) as gift_amount,null,\n" +
             "sum(ti.rider_money),null,#{now},#{now}\n" +
             "from tb_user tu USE INDEX(tb_user_rider_open_id_IDX)\n" +
             "left join tb_indent ti USE INDEX(tb_indent_finish_time_IDX) on  \n" +
             " ti.finish_time >#{startTime} \n" +
-            "and ti.finish_time &lt;= #{endTime}\n" +
+            "and ti.finish_time <= #{endTime}\n" +
             "and ti.rider_user_id =tu.user_id\n" +
             "and ti.indent_state ='6'\n" +
             "left join cash_out co on co.user_id =tu.user_id and co.type =1 and co.state=1\n" +
             "and co.out_at >#{startTime} \n" +
-            "and co.out_at &lt;=#{endTime}\n" +
+            "and co.out_at <=#{endTime}\n" +
             "where tu.rider_open_id is not null \n" +
             "group by tu.user_id \n" +
             "union all \n" +
             "select #{dayId}, tu.user_id, null,1,null,sum(tor.shop_income_money),count(tor.shop_income_money),\n" +
             "sum(co.money),sum(co.rate),count(co.money),null,null,null,sum(to1.pay_money),count(to1.pay_money),max(um.money),\n" +
             "(select sum(money) b from  user_money_details ud1 where ud1.user_id =tu.user_id and ud1.title like '系统赠送%' \n" +
-            "and ud1.create_time>#{startTime} and ud1.create_time &lt;=#{endTime})\n" +
+            "and ud1.create_time>#{startTime} and ud1.create_time <=#{endTime})\n" +
             "-(select sum(money) a from  user_money_details ud2 where ud2.user_id =tu.user_id and ud2.title like '系统扣除%' \n" +
-            "and ud2.create_time>#{startTime} and ud2.create_time &lt;=#{endTime}) as gift_amount\n" +
+            "and ud2.create_time>#{startTime} and ud2.create_time <=#{endTime}) as gift_amount\n" +
             ",sum(tor.shop_income_money*(1-gs.shop_rate)/gs.shop_rate) platform_rates,sum(tor.shop_income_money),\n" +
             "sum(tor.pay_money),#{now},#{now} \n" +
             "from tb_user tu \n" +
             "left join goods_shop gs on tu.user_id =gs.user_id\n" +
             "left join tb_order  tor USE INDEX(tb_order_update_time_IDX) on gs.shop_id =tor.shop_id \n" +
             "and tor.update_time >#{startTime}\n" +
-            "and tor.update_time &lt;=#{endTime}\n" +
+            "and tor.update_time <=#{endTime}\n" +
             "and tor.status=4\n" +
             "left join tb_order  to1 USE INDEX(tb_order_update_time_IDX) on gs.shop_id =to1.shop_id \n" +
             "and to1.update_time >#{startTime}\n" +
-            "and to1.update_time &lt;=#{endTime}\n" +
+            "and to1.update_time <=#{endTime}\n" +
             "and to1.status in(5,8)\n" +
             "left join cash_out co on co.user_id =tu.user_id and co.type =2 and co.state=1\n" +
             "and co.out_at >#{startTime} \n" +
-            "and co.out_at &lt;=#{endTime}\n" +
+            "and co.out_at <=#{endTime}\n" +
             "left join user_money um on um.user_id =tu.user_id\n" +
             "where  tu.admin_user_id is not null\n" +
             "group by tu.user_id ")
-    int insertPlatformBill(@Param("dayId") String dayId,@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("now") String now);
+    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" +
             "where a.day_id =#{dayId} ")
-    int updateStartMoney(@Param("dayId") String dayId);
+    Integer updateStartMoney(@Param("dayId") String dayId);
 
     @Select("INSERT INTO `tcwm2.5`.platform_bill \n" +
             "(day_id, user_id, shop_name, `type`, start_money, revenue, revenue_count, \n" +
@@ -81,5 +81,5 @@ public interface PlatformBillMapper extends BaseMapper<PlatformBill> {
             "sum(if(type=1, refund_money ,0)),sum(if(type=1, refund_count ,0)),sum(if(type=1, end_money ,0)),null,\n" +
             "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")
-    int insertTotalPlatformBill(@Param("dayId") String dayId);
+    Integer insertTotalPlatformBill(@Param("dayId") String dayId);
 }

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

@@ -40,13 +40,13 @@ public class PlatformBillServiceImpl extends ServiceImpl<PlatformBillMapper, Pla
         //先删除防止重复生成
         baseMapper.delete(new QueryWrapper<PlatformBill>().eq("day_id",dayId));
         //导入商家和骑手对账
-        int count1 =baseMapper.insertPlatformBill(dayId,startTime,endTime,now);
+        Integer count1 =baseMapper.insertPlatformBill(dayId,startTime,endTime,now);
         log.info("导入商家和骑手对账:{}条",count1);
         //导入账期开始金额
-        int count2=baseMapper.updateStartMoney(dayId);
+        Integer count2=baseMapper.updateStartMoney(dayId);
         log.info("导入账期开始金额:{}条",count2);
         //导入平台对账
-        int count3 =baseMapper.insertTotalPlatformBill(dayId);
+        Integer count3 =baseMapper.insertTotalPlatformBill(dayId);
         log.info("导入平台对账:{}条",count3);
         if(count1<1||count2<1||count3<1){
             return 0;

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

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

+ 1 - 1
src/main/resources/mapper/dataCentre/dataCenterMapper.xml

@@ -286,7 +286,7 @@
         FROM
         ( SELECT @rank_num := 0 ) r,
         ( SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney,ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney, tor.shop_id , u.shop_name,gp.id as
-        shopType,gp.shop_type_name as shopTypeName
+        shopType,gp.shop_type_name as shopTypeName,u.user_name as riderNickName,u.balance as riderBalance
         FROM tb_order tor left join goods_shop u on tor.shop_id = u.shop_id
         left join shop_type gp on gp.id=u.shop_type_id
         WHERE tor.shop_id IS NOT NULL and tor.status = 4

+ 6 - 1
src/main/resources/mapper/pay/CashDao.xml

@@ -238,7 +238,10 @@
                 and co.state = #{params.state}
             </if>
             <if test="params.phone != null and params.phone != '' and params.phone != 'null'">
-                and co.phone like concat('%',#{params.phone},'%')
+                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}
@@ -299,6 +302,7 @@
     <select id="selectCashOutTotal" resultType="java.lang.Double">
         select ifnull(sum(co.money), 0.0) as totalMoney
         from cash_out co
+        left join tb_user tu on tu.user_id = co.user_id
         left join goods_shop gh on gh.shop_id = co.shop_id
         <include refid="cashOutQueryCondition"></include>
     </select>
@@ -306,6 +310,7 @@
     <select id="selectCommissionTotal" resultType="java.lang.Double">
         select ifnull(sum(co.rate), 0.0) as totalMoney
         from cash_out co
+        left join tb_user tu on tu.user_id=co.user_id
         left join goods_shop gh on gh.shop_id = co.shop_id
         <include refid="cashOutQueryCondition"></include>
     </select>