소스 검색

查询提现记录列表新增根据店铺名称查询参数;
新增查询提现记录总金额接口;

codingliang 2 년 전
부모
커밋
ef6d58620b

+ 10 - 0
src/main/java/com/sqx/modules/pay/controller/CashController.java

@@ -197,6 +197,7 @@ public class CashController {
                                    @ApiParam("用户id") String userId,
                                    @ApiParam("提现状态") Integer state,
                                    @ApiParam("用户手机号") String phone,
+                                   @ApiParam("店铺名称") String shopName,
                                    @ApiParam("分类  1用户提现  2退保障金") String type,
                                    Integer classify,
                                    String startTime, String endTime){
@@ -209,6 +210,7 @@ public class CashController {
         map.put("type",type);
         map.put("state",state);
         map.put("phone",phone);
+        map.put("shopName", shopName);
         map.put("classify",classify);
         map.put("startTime",startTime);
         map.put("endTime",endTime);
@@ -216,6 +218,14 @@ public class CashController {
         return Result.success().put("data",pageUtils);
     }
 
+    @RequestMapping(value = "/selectPayTotal", method = RequestMethod.GET)
+    @ApiOperation("查询提现记录总金额")
+    @ResponseBody
+    public Result selectPayTotal(Map<String, Object> map){
+        Double total = cashOutService.selectCashOutTotal(map);
+        return Result.success().put("data", total);
+    }
+
     @RequestMapping(value = "/excelPayDetails", method = RequestMethod.GET)
     @ApiOperation("查询提现记录列表")
     @ResponseBody

+ 5 - 0
src/main/java/com/sqx/modules/pay/dao/CashOutDao.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.sqx.common.utils.Result;
 import com.sqx.modules.pay.entity.CashOut;
+import com.sqx.modules.pay.vo.CashOutVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -12,6 +13,7 @@ import java.math.BigDecimal;
 import java.sql.Timestamp;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author fang
@@ -68,4 +70,7 @@ public interface CashOutDao extends BaseMapper<CashOut> {
 
     BigDecimal cashDepositMoney(String date, String dateType);
 
+    IPage<CashOutVO> selectCashOutList(@Param("page") IPage<CashOut> pageParam, @Param("params") Map<String, Object> params);
+
+    Double selectCashOutTotal(@Param("page") IPage<CashOut> page, @Param("params") Map<String, Object> params);
 }

+ 6 - 0
src/main/java/com/sqx/modules/pay/service/CashOutService.java

@@ -50,6 +50,12 @@ public interface CashOutService extends IService<CashOut> {
 
     Result cashDepositMoney(Long userId);
 
+    /**
+     * 查询提现总金额
+     * @param map 参数同查询提现记录列表接口
+     */
+    Double selectCashOutTotal(Map<String, Object> map);
+
 
     //   Result cashDepositMoney(Long userId);
 

+ 35 - 24
src/main/java/com/sqx/modules/pay/service/impl/CashOutServiceImpl.java

@@ -27,6 +27,7 @@ import com.sqx.modules.message.entity.MessageInfo;
 import com.sqx.modules.pay.dao.CashOutDao;
 import com.sqx.modules.pay.entity.CashOut;
 import com.sqx.modules.pay.service.CashOutService;
+import com.sqx.modules.pay.vo.CashOutVO;
 import com.sqx.modules.sys.dao.SysUserDao;
 import com.sqx.modules.utils.AmountCalUtils;
 import com.sqx.modules.utils.excel.ExcelData;
@@ -94,30 +95,34 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
 
     @Override
     public PageUtils selectCashOutList(Map<String, Object> params) {
-        String zhifubaoName = (String) params.get("zhifubaoName");
-        String zhifubao = (String) params.get("zhifubao");
-        String userId = String.valueOf(params.get("userId"));
-        String type = String.valueOf(params.get("type"));
-        String state = String.valueOf(params.get("state"));
-        String phone = String.valueOf(params.get("phone"));
-        String classify = String.valueOf(params.get("classify"));
-        String startTime = String.valueOf(params.get("startTime"));
-        String endTime = String.valueOf(params.get("endTime"));
-        IPage<CashOut> page = this.page(
-                new Query<CashOut>().getPage(params),
-                new QueryWrapper<CashOut>()
-                        .eq(StringUtils.isNotBlank(zhifubaoName) && !"null".equals(zhifubaoName), "zhifubao_name", zhifubaoName)
-                        .eq(StringUtils.isNotBlank(zhifubao) && !"null".equals(zhifubao), "zhifubao", zhifubao)
-                        .eq(StringUtils.isNotBlank(userId) && !"null".equals(userId), "user_id", userId)
-                        .eq(StringUtils.isNotBlank(type) && !"null".equals(type), "type", type)
-                        .eq(StringUtils.isNotBlank(state) && !"null".equals(state), "state", state)
-                        .like(StringUtils.isNotBlank(phone) && !"null".equals(phone), "phone", phone)
-                        .eq(StringUtils.isNotBlank(classify) && !"null".equals(classify) && "1".equals(classify), "classify", classify)
-                        .in(StringUtils.isNotBlank(classify) && !"null".equals(classify) && "2".equals(classify), "classify", "2","3","4")
-                        .ge(StringUtils.isNotBlank(startTime) && !"null".equals(startTime),"create_at",startTime)
-                        .le(StringUtils.isNotBlank(endTime) && !"null".equals(endTime),"create_at",endTime)
-                        .orderByDesc("id")
-        );
+        // String zhifubaoName = (String) params.get("zhifubaoName");
+        // String zhifubao = (String) params.get("zhifubao");
+        // String userId = String.valueOf(params.get("userId"));
+        // String type = String.valueOf(params.get("type"));
+        // String state = String.valueOf(params.get("state"));
+        // String phone = String.valueOf(params.get("phone"));
+        // String classify = String.valueOf(params.get("classify"));
+        // String startTime = String.valueOf(params.get("startTime"));
+        // String endTime = String.valueOf(params.get("endTime"));
+
+        IPage<CashOut> pageParam = new Query<CashOut>().getPage(params);
+        IPage<CashOutVO> page = this.baseMapper.selectCashOutList(pageParam, params);
+
+        // IPage<CashOut> page = this.page(
+        //         new Query<CashOut>().getPage(params),
+        //         new QueryWrapper<CashOut>()
+        //                 .eq(StringUtils.isNotBlank(zhifubaoName) && !"null".equals(zhifubaoName), "zhifubao_name", zhifubaoName)
+        //                 .eq(StringUtils.isNotBlank(zhifubao) && !"null".equals(zhifubao), "zhifubao", zhifubao)
+        //                 .eq(StringUtils.isNotBlank(userId) && !"null".equals(userId), "user_id", userId)
+        //                 .eq(StringUtils.isNotBlank(type) && !"null".equals(type), "type", type)
+        //                 .eq(StringUtils.isNotBlank(state) && !"null".equals(state), "state", state)
+        //                 .like(StringUtils.isNotBlank(phone) && !"null".equals(phone), "phone", phone)
+        //                 .eq(StringUtils.isNotBlank(classify) && !"null".equals(classify) && "1".equals(classify), "classify", classify)
+        //                 .in(StringUtils.isNotBlank(classify) && !"null".equals(classify) && "2".equals(classify), "classify", "2","3","4")
+        //                 .ge(StringUtils.isNotBlank(startTime) && !"null".equals(startTime),"create_at",startTime)
+        //                 .le(StringUtils.isNotBlank(endTime) && !"null".equals(endTime),"create_at",endTime)
+        //                 .orderByDesc("id")
+        // );
         return new PageUtils(page);
     }
 
@@ -597,4 +602,10 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
         return Result.success("保证金已退回到您的钱包");
     }
 
+    @Override
+    public Double selectCashOutTotal(Map<String, Object> params) {
+        IPage<CashOut> page = new Query<CashOut>().getPage(params);
+        return this.baseMapper.selectCashOutTotal(page, params);
+    }
+
 }

+ 17 - 0
src/main/java/com/sqx/modules/pay/vo/CashOutVO.java

@@ -0,0 +1,17 @@
+package com.sqx.modules.pay.vo;
+
+import com.sqx.modules.pay.entity.CashOut;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 提现vo
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CashOutVO extends CashOut {
+    /**
+     * 店铺名称
+     */
+    private String shopName;
+}

+ 52 - 0
src/main/resources/mapper/pay/CashDao.xml

@@ -229,5 +229,57 @@
         and type = 3 and state = 1
     </select>
 
+    <sql id="cashOutQueryCondition">
+        <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 params.userId != '' and 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 params.state != '' and params.state != 'null'">
+                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},'%')
+            </if>
+            <if test="params.classify == '1'">
+                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.shopName != null and params.shopName != '' and params.shopName != 'null'">
+                and gh.shop_name like concat('%',#{params.shopName},'%')
+            </if>
+        </where>
+    </sql>
+
+    <select id="selectCashOutList" resultType="com.sqx.modules.pay.vo.CashOutVO">
+        select gh.shop_name, co.*
+        from cash_out co
+        left join goods_shop gh on gh.shop_id = co.shop_id
+        <include refid="cashOutQueryCondition"></include>
+        order by id desc
+    </select>
+
+    <select id="selectCashOutTotal" resultType="java.lang.Double">
+        select sum(co.money)
+        from cash_out co
+        left join goods_shop gh on gh.shop_id = co.shop_id
+        <include refid="cashOutQueryCondition"></include>
+    </select>
 
 </mapper>