From bf2a3c2e40859b16a58d34d52c09a4ade96777af Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期四, 19 十二月 2024 10:02:29 +0800
Subject: [PATCH] 12.18

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/ShopBalanceDto.java                        |   21 +++++++
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopBalanceStatement.java           |    2 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java        |    8 ++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java |   64 ++++++++++++++++++++-
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java            |   14 ++++
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java                   |    4 +
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java                      |    5 +
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java         |   43 ++++++++++++++
 8 files changed, 156 insertions(+), 5 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java
index adf20b6..047d64f 100644
--- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java
@@ -66,6 +66,10 @@
     @TableField("object_id")
     private Long objectId;
 
+    @ApiModelProperty(value = "拓展字段")
+    @TableField("extention")
+    private String extention;
+
     @ApiModelProperty(value = "用户名称")
     @TableField(exist = false)
     private String userName;
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopBalanceStatement.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopBalanceStatement.java
index 377b1c6..9a97e0a 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopBalanceStatement.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopBalanceStatement.java
@@ -41,7 +41,7 @@
 
     @ApiModelProperty(value = "变动类型(1=门店分佣,2=下级门店分佣,3=门店服务费)")
     @TableField("type")
-    @Excel(name = "变更类型",readConverterExp = "1=门店分佣,2=下级门店分佣,3=门店服务费")
+    @Excel(name = "变更类型",readConverterExp = "1=门店分佣,2=下级门店分佣,3=门店服务费,4=关联用户分佣")
     private Integer type;
 
     @ApiModelProperty(value = "历史余额")
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java
index 49eda6f..3dbe43c 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java
@@ -53,6 +53,7 @@
 
     @ApiModelProperty(value = "变动时间")
     @TableField("create_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime createTime;
 
     @ApiModelProperty(value = "变动用户id")
@@ -63,6 +64,10 @@
     @TableField("object_id")
     private Long objectId;
 
+    @ApiModelProperty(value = "订单号")
+    @TableField("order_num")
+    private String orderNum;
+
     @ApiModelProperty(value = "门店名称")
     @TableField(exist = false)
     private String shopName;
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
index adff1d8..9afbe26 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
@@ -130,6 +130,14 @@
         return R.ok(userPointPage);
     }
 
+    @GetMapping("/user/list")
+    @ApiOperation(value = "积分管理-用户积分明细(必传用户id)", tags = "后台")
+    public R<Page<UserPoint>> userlist(UserPoint userPoint) {
+        Page<UserPoint> page = userPointService.lambdaQuery().eq(UserPoint::getAppUserId, userPoint.getAppUserId()).orderByDesc(UserPoint::getCreateTime).page(Page.of(userPoint.getPageNum(), userPoint.getPageSize()));
+        return R.ok(page);
+    }
+
+
 
     /**
      * 导出
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
index f9b7729..ca0d70a 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
@@ -5,8 +5,12 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.poi.ExcelUtil;
+import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.other.api.domain.Shop;
 import com.ruoyi.other.api.domain.ShopBalanceStatement;
+import com.ruoyi.other.dto.ShopBalanceDto;
 import com.ruoyi.other.service.ShopBalanceStatementService;
+import com.ruoyi.other.service.ShopService;
 import com.ruoyi.other.vo.ShopCommissionStatisticsVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -18,6 +22,8 @@
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * <p>
@@ -33,6 +39,8 @@
 public class ShopBalanceStatementController {
     @Resource
     private ShopBalanceStatementService shopBalanceStatementService;
+    @Resource
+    private TokenService tokenService;
 
     /**
      * 门店分佣统计
@@ -47,13 +55,63 @@
     }
     @GetMapping("/commissionStatistics/list")
     @ApiOperation(value = "门店余额明细", notes = "门店余额明细", tags = {"门店后台"})
-    public R<ShopCommissionStatisticsVO> shopCommissionStatisticslist(@ApiParam("页码") @RequestParam Integer pageNum,
+    public R<Page<ShopBalanceStatement>> shopCommissionStatisticslist(@ApiParam("页码") @RequestParam Integer pageNum,
                                                                   @ApiParam("每一页数据大小") Integer pageSize,
                                                                   ShopBalanceStatement shopBalanceStatement){
-        ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(pageNum, pageSize), shopBalanceStatement);
-        return R.ok(shopCommissionStatisticsVO);
+        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
+        Page<ShopBalanceStatement> page = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId, objectId).eq(shopBalanceStatement.getType() != null, ShopBalanceStatement::getType, shopBalanceStatement.getType())
+                .orderByDesc(ShopBalanceStatement::getCreateTime)
+                .page(Page.of(pageNum, pageSize));
+
+        return R.ok(page);
+
+
     }
 
+   @Resource
+   private ShopService shopService;
+    @GetMapping("/commissionStatistics/info")
+    @ApiOperation(value = "门店余额明细上方数据", notes = "门店余额明细", tags = {"门店后台"})
+    public R<ShopBalanceDto> shopCommissionStatisticsinfo(){
+        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
+        ShopBalanceDto dto = new ShopBalanceDto();
+        List<ShopBalanceStatement> list = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 3).list();
+        List<ShopBalanceStatement> list1 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 4).list();
+        BigDecimal bigDecimal1 = new BigDecimal(0);
+        for (ShopBalanceStatement shopBalanceStatement : list) {
+            bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount());
+        }
+        for (ShopBalanceStatement shopBalanceStatement : list1) {
+            bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount());
+        }
+        dto.setBigDecimal1(bigDecimal1);
+
+        BigDecimal bigDecimal2= new BigDecimal(0);
+        for (ShopBalanceStatement shopBalanceStatement : list) {
+            bigDecimal2 = bigDecimal2.add(shopBalanceStatement.getVariableAmount());
+        }
+        dto.setBigDecimal2(bigDecimal2);
+
+        BigDecimal bigDecimal3= new BigDecimal(0);
+        for (ShopBalanceStatement shopBalanceStatement : list1) {
+            bigDecimal3 = bigDecimal3.add(shopBalanceStatement.getVariableAmount());
+        }
+        dto.setBigDecimal3(bigDecimal3);
+
+        List<ShopBalanceStatement> list2 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 2).list();
+        BigDecimal bigDecimal4= new BigDecimal(0);
+        for (ShopBalanceStatement shopBalanceStatement : list2) {
+            bigDecimal4 = bigDecimal4.add(shopBalanceStatement.getVariableAmount());
+        }
+        dto.setBigDecimal4(bigDecimal4);
+
+        Shop byId = shopService.getById(objectId);
+        dto.setBigDecimal5(byId.getCanWithdrawMoney());
+        dto.setBigDecimal6(byId.getWithdrawMoney());
+        return R.ok(dto);
+    }
+
+
     /**
      * 导出门店分佣统计
      */
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java
index 1b6daee..e04c2bc 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopPointController.java
@@ -62,10 +62,22 @@
     @ApiOperation(value = "门店积分统计列表", notes = "门店积分统计", tags = {"门店后台"})
     public R<Page<ShopPoint>> shopstatisticslist(ShopPoint shopPoint,Integer pageNum,Integer pageSize) {
         Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
-        Page<ShopPoint> page = shopPointService.lambdaQuery().eq(ShopPoint::getShopId, objectId).eq(ShopPoint::getType, shopPoint.getType())
+        Page<ShopPoint> page = shopPointService.lambdaQuery().eq(ShopPoint::getShopId, objectId).eq(shopPoint.getType()!=null,ShopPoint::getType, shopPoint.getType())
+                .like(shopPoint.getOrderNum()!=null,ShopPoint::getOrderNum, shopPoint.getOrderNum())
+                .orderByDesc(ShopPoint::getCreateTime)
                 .page(Page.of(pageNum, pageSize));
         return R.ok(page);
     }
+    @GetMapping("/statistics/list")
+    @ApiOperation(value = "门店积分明细必传门店id", tags = {"后台"})
+    public R<Page<ShopPoint>> statisticslist(ShopPoint shopPoint,Integer pageNum,Integer pageSize) {
+        Page<ShopPoint> page = shopPointService.lambdaQuery().eq(ShopPoint::getShopId, shopPoint.getShopId()).eq(shopPoint.getType()!=null,ShopPoint::getType, shopPoint.getType())
+                .like(shopPoint.getOrderNum()!=null,ShopPoint::getOrderNum, shopPoint.getOrderNum())
+                .orderByDesc(ShopPoint::getCreateTime)
+                .page(Page.of(pageNum, pageSize));
+        return R.ok(page);
+    }
+
 
     /**
      * 导出门店积分统计
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
index 0b9afb2..c804805 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
@@ -7,7 +7,9 @@
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.other.api.domain.Shop;
 import com.ruoyi.other.api.domain.ShopWithdraw;
+import com.ruoyi.other.dto.ShopBalanceDto;
 import com.ruoyi.other.service.ShopService;
 import com.ruoyi.other.service.ShopWithdrawService;
 import com.ruoyi.system.api.model.LoginUser;
@@ -17,6 +19,7 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
 
 /**
@@ -54,6 +57,46 @@
         return R.ok(page);
     }
 
+    @GetMapping("/shop/list")
+    @ApiOperation(value = "提现申请列表", notes = "提现申请列表", tags = {"门店后台"})
+    public R<IPage<ShopWithdraw>> shoplist(@ApiParam("页码") @RequestParam Integer pageNum,
+                                       @ApiParam("每一页数据大小") Integer pageSize,
+                                       ShopWithdraw shopWithdraw) {
+        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
+        Page<ShopWithdraw> page = shopWithdrawService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<ShopWithdraw>()
+                        .eq(ShopWithdraw::getShopId,objectId)
+                        .eq(shopWithdraw.getAuditStatus()!=null,ShopWithdraw::getAuditStatus,shopWithdraw.getAuditStatus())
+                        .orderByDesc(ShopWithdraw::getCreateTime)
+                );
+        return R.ok(page);
+    }
+
+    @GetMapping("/shop/info")
+    @ApiOperation(value = "提现申请列表上方数据", notes = "提现申请列表", tags = {"门店后台"})
+    public R<Shop> shopCommissionStatisticsinfo(){
+        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
+        Shop byId = shopService.getById(objectId);
+        return R.ok(byId);
+    }
+    @GetMapping("/shop/with")
+    @ApiOperation(value = "提现申请", notes = "提现申请列表", tags = {"门店后台"})
+    public R<Shop> shopwith(@RequestParam BigDecimal money){
+        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
+        Shop byId = shopService.getById(objectId);
+        if (money.compareTo(byId.getCanWithdrawMoney())>0){
+            return R.fail("提现金额不能大于可提现金额");
+        }
+        ShopWithdraw shopWithdraw = new ShopWithdraw();
+        shopWithdraw.setShopId(objectId);
+        shopWithdraw.setMoney(money);
+        shopWithdraw.setAuditStatus(0);
+        shopWithdraw.setStatus(1);
+        shopWithdrawService.save(shopWithdraw);
+
+        return R.ok(byId);
+    }
+
+
     /**
      * 审核
      */
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/ShopBalanceDto.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/ShopBalanceDto.java
new file mode 100644
index 0000000..f5600b8
--- /dev/null
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/dto/ShopBalanceDto.java
@@ -0,0 +1,21 @@
+package com.ruoyi.other.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+@Data
+public class ShopBalanceDto {
+    @ApiModelProperty("分佣总金额")
+    private BigDecimal bigDecimal1;
+    @ApiModelProperty("服务费分佣")
+    private BigDecimal bigDecimal2;
+    @ApiModelProperty("关联用户分佣")
+    private BigDecimal bigDecimal3;
+    @ApiModelProperty("下级门店分佣")
+    private BigDecimal bigDecimal4;
+    @ApiModelProperty("可提现金额")
+    private BigDecimal bigDecimal5;
+    @ApiModelProperty("已提现金额")
+    private BigDecimal bigDecimal6;
+}

--
Gitblit v1.7.1