From f18a802137a7642473891f6886d44cf0c229efed Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 11 一月 2025 18:09:10 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java           |    3 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java          |   99 ++++++++++++++++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java               |    4 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java                      |    1 
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java                         |    3 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java                       |   22 +++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java                      |   18 ++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java                   |    2 
 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              |   10 +
 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml                      |    1 
 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml                                     |    1 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopPoint.java                            |   40 +++---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java |   25 +++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java              |    6 +
 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml                   |    6 +
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopBalanceStatementServiceImpl.java    |    4 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java                     |    7 +
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java              |   47 +++++++
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java                        |    2 
 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml                                |   30 ++++
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java                |    3 
 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml                              |    2 
 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml                  |    2 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java                      |   11 +
 25 files changed, 317 insertions(+), 34 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 a1c7158..e37d35e 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
@@ -73,6 +73,9 @@
     @ApiModelProperty(value = "用户名称")
     @TableField(exist = false)
     private String userName;
+    @ApiModelProperty(value = "变动类型 0未变化1增加2减少")
+    @TableField(exist = false)
+    private Integer variableType;
 
     @ApiModelProperty(value = "联系电话")
     @TableField(exist = false)
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java
index 893f3b2..261499c 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -66,6 +67,7 @@
 
     @ApiModelProperty(value = "添加时间")
     @TableField("create_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     private LocalDateTime createTime;
 
 
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 50d50cc..e0328e6 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=核销门店服务费,4=提现)")
     @TableField("type")
-    @Excel(name = "变更类型",readConverterExp = "1=绑定门店分佣,2=下级门店分佣,3=核销门店服务费,4=提现")
+    @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 9fbcae4..34e632c 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
@@ -39,11 +39,28 @@
     @ApiModelProperty(value = "门店id")
     @TableField("shop_id")
     private Integer shopId;
+    @ApiModelProperty(value = "门店名称")
+    @TableField(exist = false)
+    @Excel(name = "门店名称")
+    private String shopName;
 
+    @ApiModelProperty(value = "店长姓名")
+    @TableField(exist = false)
+    @Excel(name = "店长姓名")
+    private String shopLeaderName;
+    @ApiModelProperty(value = "联系电话")
+    @TableField(exist = false)
+    @Excel(name = "联系电话")
+    private String phone;
     @ApiModelProperty(value = "变动类型(1=门店业绩,2=门店返佣,3=下级门店返佣)")
     @TableField("type")
-    @Excel(name = "变动类型", readConverterExp = "1=门店服务返佣,2=门店返佣,3=下级门店返佣")
+    @Excel(name = "变动类型", readConverterExp = "1=门店服务返佣,2=门店返佣,3=下级门店返佣")
     private Integer type;
+    @ApiModelProperty(value = "变动时间")
+    @TableField("create_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "变动时间")
+    private LocalDateTime createTime;
 
     @ApiModelProperty(value = "历史余额")
     @TableField("historical_point")
@@ -58,11 +75,7 @@
     @TableField("balance")
     private Integer balance;
 
-    @ApiModelProperty(value = "变动时间")
-    @TableField("create_time")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @Excel(name = "变动时间")
-    private LocalDateTime createTime;
+
 
     @ApiModelProperty(value = "变动用户id")
     @TableField("create_user_id")
@@ -76,20 +89,11 @@
     @TableField("order_num")
     private String orderNum;
 
-    @ApiModelProperty(value = "门店名称")
-    @TableField(exist = false)
-    @Excel(name = "门店名称")
-    private String shopName;
 
-    @ApiModelProperty(value = "店长姓名")
-    @TableField(exist = false)
-    @Excel(name = "店长姓名")
-    private String shopLeaderName;
 
-    @ApiModelProperty(value = "联系电话")
-    @TableField(exist = false)
-    @Excel(name = "联系电话")
-    private String phone;
+
+
+
 
     @TableField(exist = false)
     private List<Integer> shopIds;
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
index 81e91a9..b11596b 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -649,11 +649,14 @@
         SysUser data = sysUserClient.getSysUser(userid).getData();
         Integer shopId = null;
         Set<Long> userId = null;
+        Set<Long> userIdT = null;
         if(data.getRoleType() == 2){
             shopId = data.getObjectId();
             userId = orderClient.getAppUserByShoppingShop(shopId).getData();
         }
         UserStatistics userStatistics = appUserMapper.getUserStatistics(shopId, userId);
+        UserStatistics userStatistics1 = appUserMapper.getUserStatistics(shopId, userIdT);
+        userStatistics.setShopUser(userStatistics1.getShopUser());
         return R.ok(userStatistics);
     }
 
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 80938f5..3839d5e 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
@@ -135,6 +135,16 @@
     @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()));
+        for (UserPoint record : page.getRecords()) {
+            int i = record.getHistoricalPoint() - record.getBalance();
+            if (i>0){
+                record.setVariableType(2);
+            }else if (i<0){
+                record.setVariableType(1);
+            }else{
+                record.setVariableType(0);
+            }
+        }
         return R.ok(page);
     }
 
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
index 15d1a49..33f6baf 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
@@ -12,6 +12,7 @@
 import com.ruoyi.account.vo.WalletStatisticsDetail;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.bean.BeanUtils;
 import com.ruoyi.other.api.domain.ShopBalanceStatement;
 import com.ruoyi.other.api.feignClient.ShopClient;
@@ -42,6 +43,7 @@
     @Override
     public CommissionStatistics commissionStatistics(Page<BalanceChangeRecord> page, BalanceChangeRecord balanceChangeRecord) {
         List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord);
+
         BigDecimal totalCommission = balanceChangeRecordList.stream()
                 .filter(item -> !(item.getChangeType().equals(2) && item.getChangeType().equals(5)))
                 .map(BalanceChangeRecord::getChangeAmount)
@@ -49,6 +51,9 @@
                 .setScale(2, RoundingMode.HALF_UP);
 
         IPage<BalanceChangeRecord> balanceChangeRecordIPage = this.baseMapper.queryCommissionStatistics(page, balanceChangeRecord);
+        // 过滤商城购物
+        List<BalanceChangeRecord> collect = balanceChangeRecordIPage.getRecords().stream().filter(e -> e.getChangeType() != 5).collect(Collectors.toList());
+        balanceChangeRecordIPage.setRecords(collect);
         return new CommissionStatistics(totalCommission, balanceChangeRecordIPage);
     }
 
@@ -70,7 +75,6 @@
         }
 
         List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord);
-
         List<WalletStatisticsDetail> walletStatisticsDetailList = new ArrayList<>();
         for (BalanceChangeRecord changeRecord : balanceChangeRecordList) {
             WalletStatisticsDetail walletStatisticsDetail = new WalletStatisticsDetail();
@@ -78,7 +82,24 @@
             walletStatisticsDetailList.add(walletStatisticsDetail);
         }
 
-        walletStatisticsDetailList.addAll(r.getData().stream().map(this::createWalletStatisticsDetail).collect(Collectors.toList()));
+        List<WalletStatisticsDetail> collect = r.getData().stream().map(this::createWalletStatisticsDetail).collect(Collectors.toList());
+        // 根据门店名称、用户姓名、联系电话进行模糊过滤
+        collect = collect.stream()
+                .filter(e -> {
+                    if (StringUtils.isNotEmpty(balanceChangeRecord.getShopName())) {
+                        return e.getShopName().contains(balanceChangeRecord.getShopName());
+                    } else if (StringUtils.isNotEmpty(balanceChangeRecord.getUserName())) {
+                        return e.getUserName().contains(balanceChangeRecord.getUserName());
+                    } else if (StringUtils.isNotEmpty(balanceChangeRecord.getUserPhone())) {
+                        return e.getUserPhone().contains(balanceChangeRecord.getUserPhone());
+                    }
+                    // 根据时间进行范围过滤
+                    if (balanceChangeRecord.getStartTime() != null && balanceChangeRecord.getEndTime() != null) {
+                        return e.getCreateTime().isAfter(balanceChangeRecord.getStartTime()) && e.getCreateTime().isBefore(balanceChangeRecord.getEndTime());
+                    }
+                    return false;
+                }).collect(Collectors.toList());
+        walletStatisticsDetailList.addAll(collect);
 
         // 按时间排序(倒序)
         walletStatisticsDetailList.sort(Comparator.comparing(WalletStatisticsDetail::getCreateTime).reversed());
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
index ccd0c75..063597c 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -71,7 +71,8 @@
         VipSetting vipSetting = vipSettingService.getVipSettingByUserId(userId);
 
         UserPointVO userPointVO = new UserPointVO();
-        userPointVO.setTotalPoint(appUser.getTotalPoint());
+        // todo bug说取剩余积分
+        userPointVO.setTotalPoint(appUser.getLavePoint());
         userPointVO.setConsumePoint(appUser.getAvailablePoint());
         userPointVO.setShopPoint(appUser.getShopPoint());
         userPointVO.setSharePoint(appUser.getSharePoint());
diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml
index 4a891f6..2bb301d 100644
--- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml
+++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml
@@ -138,6 +138,7 @@
                     #{item}
                 </foreach>
             </if>
+        and  tau.del_flag = 0
         </where>
     </select>
     <select id="getUserStatisticsDetail" resultType="com.ruoyi.account.vo.UserStatisticsDetail">
@@ -164,6 +165,7 @@
                     #{item}
                 </foreach>
             </if>
+        and tau.del_flag = 0
         </where>
     </select>
 </mapper>
diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml
index b5da79d..f26c0ff 100644
--- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml
+++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml
@@ -40,7 +40,7 @@
                 and tau.phone like concat('%',#{changeRecord.userPhone},'%')
             </if>
             <if test="changeRecord.startTime != null and changeRecord.endTime != null">
-                and DATE(tbcr.create_time) between  #{changeRecord.startTime} and #{changeRecord.endTime}
+                and (tbcr.create_time between  #{changeRecord.startTime} and #{changeRecord.endTime})
             </if>
         </where>
     </sql>
diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml
index d5943b6..7f913d7 100644
--- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml
+++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml
@@ -23,6 +23,12 @@
         select t1.*,t2.name as userName,t2.phone as userPhone
         from t_withdrawal_requests t1
         left join t_app_user t2 on t1.app_user_id = t2.id
+        <if test="withQuery.phone != null and withQuery.phone != ''">
+            AND t2.phone LIKE concat('%',#{withQuery.phone},'%')
+        </if>
+        <if test="withQuery.name != null and withQuery.name != ''">
+            AND t2.phone LIKE concat('%',#{withQuery.name},'%')
+        </if>
         order by t1.create_time desc
     </select>
 
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
index 132a453..bc929ba 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -33,6 +33,8 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -312,6 +314,10 @@
             orderStatisticsDetail.setServiceTotal(serviceTotal);
             orderStatisticsDetail.setSingleTotal(singleTotal);
             orderStatisticsDetail.setTotal(total);
+
+            orderStatisticsDetail.setServiceTotalMoney(serviceTotalMoney);
+            orderStatisticsDetail.setSingleTotalMoney(singleTotalMoney);
+            orderStatisticsDetail.setTotalMoney(totalMoney);
             orderStatisticsDetails.add(orderStatisticsDetail);
         });
         Integer shopId = null;
@@ -320,7 +326,17 @@
         }
         OrderStatistics orderStatistics = orderMapper.getOrderStatistics(startTime, endTime, shopId);
         if(null != orderStatistics){
-            orderStatistics.setOrderStatisticsDetailList(orderStatisticsDetails);
+            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            List<OrderStatisticsDetail> sortedDetails = orderStatisticsDetails.stream()
+                    .sorted(Comparator.comparing((OrderStatisticsDetail detail) -> {
+                        try {
+                            return dateFormat.parse(detail.getDate());
+                        } catch (ParseException e) {
+                            throw new RuntimeException(e);
+                        }
+                    }).reversed())
+                    .collect(Collectors.toList());
+            orderStatistics.setOrderStatisticsDetailList(sortedDetails);
         }
         return R.ok(orderStatistics);
     }
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
index 8a7a62c..51132ee 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -718,7 +718,7 @@
             orderInfo.setUserName(appUser.getName());
             orderInfo.setPhone(appUser.getPhone());
         }
-        orderInfo.setOrderType(order.getOrderType() == 1 ? "服务" : (StringUtils.isNotEmpty(order.getExpressJson()) ? "单品-快递配送" : "单品-自提"));
+        orderInfo.setOrderType(order.getOrderType() == 1 ? "服务" : (StringUtils.isNotEmpty(order.getAddressJson()) ? "单品-快递配送" : "单品-上门自提"));
         Shop shop = shopClient.getShopById(order.getShopId()).getData();
         if(null != shop){
             orderInfo.setShopName(shop.getName());
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java
index adfa1cf..bd3ec88 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java
@@ -1,6 +1,7 @@
 package com.ruoyi.other.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.account.api.feignClient.AppUserClient;
 import com.ruoyi.account.api.model.AppUser;
@@ -108,6 +109,12 @@
 	@ApiOperation(value = "广告管理-banner管理-修改", tags = {"管理后台"})
 	public R edit(@RequestBody Banner banner){
             bannerService.updateById(banner);
+            if (banner.getContentType()==2){
+                LambdaUpdateWrapper<Banner> bannerLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+                bannerLambdaUpdateWrapper.set(Banner::getJumpType,null);
+                bannerLambdaUpdateWrapper.eq(Banner::getId,banner.getId());
+                bannerService.update(bannerLambdaUpdateWrapper);
+            }
             return R.ok();
       }
       @GetMapping("/detail")
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
index 3007670..e175199 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
@@ -10,8 +10,10 @@
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.page.TableDataInfo;
+import com.ruoyi.other.api.domain.Goods;
 import com.ruoyi.other.api.domain.GoodsCategory;
 import com.ruoyi.other.service.GoodsCategoryService;
+import com.ruoyi.other.service.GoodsService;
 import io.swagger.annotations.*;
 import org.springframework.web.bind.annotation.*;
 
@@ -32,6 +34,8 @@
 public class GoodsCategoryController extends BaseController {
     @Resource
     private GoodsCategoryService goodsCategoryService;
+    @Resource
+    private GoodsService goodsService;
 
 
     @PostMapping("/addGoodsCategory")
@@ -67,6 +71,8 @@
     @DeleteMapping("/delete")
     @ApiOperation(value = "商品管理-商品分类-删除", tags = {"管理后台"})
     public R<Void> delete(@RequestParam("id") Integer id){
+        List<Goods> list = goodsService.lambdaQuery().eq(Goods::getGoodsCategoryId, id).list();
+        if (!list.isEmpty())return R.fail("当前分类已关联商品,不可删除");
         goodsCategoryService.update(new LambdaUpdateWrapper<GoodsCategory>().eq(GoodsCategory::getId, id).set(GoodsCategory::getDelFlag, 1));
         return R.ok();
     }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
index 9cb55d0..1a20f52 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -2,6 +2,7 @@
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
@@ -77,6 +78,16 @@
     @ApiOperation(value = "商品修改", tags = {"管理后台-商品管理"})
     public R<Void> manageGoodsUpdate(@RequestBody Goods goods){
         goodsService.updateManageGoods(goods);
+        if (goods.getType()==2){
+            goods.setAppointStore(2);
+            goodsService.updateById(goods);
+        }
+        if (goods.getType()==1){
+            LambdaUpdateWrapper<Goods> goodsLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+            goodsLambdaUpdateWrapper.set(Goods::getDistributionMode,null);
+            goodsLambdaUpdateWrapper.eq(Goods::getId, goods.getId());
+            goodsService.update(goodsLambdaUpdateWrapper);
+        }
         return R.ok();
     }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
index 8ff1004..078c824 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -18,10 +18,13 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import io.swagger.models.auth.In;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -99,6 +102,19 @@
         return R.ok();
     }
 
+    public static void main(String[] args) {
+        List<Integer> integers = new ArrayList<>();
+        integers.add(1);
+        integers.add(2);
+        integers.add(3);
+        integers.add(4);
+        List<Integer> integers1 = new ArrayList<>();
+        integers.retainAll(integers1);
+        System.err.println(integers);
+        System.err.println(integers1);
+
+    }
+
     /**
      * 评论列表
      */
@@ -107,10 +123,35 @@
     public R<Page<GoodsEvaluate>> list(@ApiParam("页码") @RequestParam Integer pageNum,
                                        @ApiParam("每一页数据大小") Integer pageSize,
                                        GoodsEvaluate goodsEvaluate){
+        List<Integer> goodsIds = new ArrayList<>();
+        List<Long> usersNameList = new ArrayList<>();
+        List<Long> usersPhoneList = new ArrayList<>();
+
+        if (StringUtils.isNotEmpty(goodsEvaluate.getUserName())) {
+            goodsIds = goodsService.lambdaQuery()
+                    .like(Goods::getName, goodsEvaluate.getGoodsName())
+                    .list().stream().map(Goods::getId).collect(Collectors.toList());
+            if (goodsIds.isEmpty()) {
+                return R.ok(new Page<>());
+            }
+        }
+        if (StringUtils.isNotEmpty(goodsEvaluate.getUserName())) {
+            usersNameList = appUserClient.getAppUserByName(goodsEvaluate.getUserName()).getData().stream().map(AppUser::getId).collect(Collectors.toList());
+            if (usersNameList.isEmpty()) {
+                return R.ok(new Page<>());
+            }
+
+        }
+        if (StringUtils.isNotEmpty(goodsEvaluate.getPhone())) {
+            usersPhoneList = appUserClient.getAppUserByPhone(goodsEvaluate.getPhone()).getData().stream().map(AppUser::getId).collect(Collectors.toList());
+            if (usersPhoneList.isEmpty()) {
+                return R.ok(new Page<>());
+            }
+        }
+        usersNameList.retainAll(usersPhoneList);
         Page<GoodsEvaluate> page = goodsEvaluateService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<GoodsEvaluate>()
-                .like(StringUtils.isNotEmpty(goodsEvaluate.getGoodsName()), GoodsEvaluate::getGoodsName, goodsEvaluate.getComment())
-                .like(StringUtils.isNotEmpty(goodsEvaluate.getUserName()), GoodsEvaluate::getUserName, goodsEvaluate.getUserName())
-                .like(StringUtils.isNotEmpty(goodsEvaluate.getPhone()), GoodsEvaluate::getPhone, goodsEvaluate.getPhone())
+                .in(!goodsIds.isEmpty(), GoodsEvaluate::getGoodsId, goodsIds)
+                .in(!usersNameList.isEmpty(), GoodsEvaluate::getAppUserId, usersNameList)
                 .eq(goodsEvaluate.getStatus() != null, GoodsEvaluate::getStatus, goodsEvaluate.getStatus())
                 .orderByDesc(GoodsEvaluate::getCreateTime));
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java
index 3779fe3..16009ad 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java
@@ -52,6 +52,8 @@
 		return R.ok(one);
 	}
 
+
+
 	/**
 	 * 添加活动
 	 */
@@ -59,7 +61,52 @@
 	@ApiOperation(value = "订单优惠活动-添加活动", tags = {"管理后台-活动管理"})
 	public R<Void> saveActivityConfig(@RequestBody OrderActivityInfo orderActivityInfo){
 		orderActivityInfo.setIsShelf(0);
+		if (org.springframework.util.StringUtils.hasLength(orderActivityInfo.getVipIds())){
+			List<String> vipIds = Arrays.asList(orderActivityInfo.getVipIds().split(","));
+			List<OrderActivityInfo> list = orderActivityInfoService.lambdaQuery()
+					.le(OrderActivityInfo::getStartTime, orderActivityInfo.getStartTime())
+					.or()
+					.ge(OrderActivityInfo::getEndTime, orderActivityInfo.getEndTime()).list();
+			if (!list.isEmpty()){
+				for (OrderActivityInfo activityInfo : list) {
+					List<String> vips = Arrays.asList(activityInfo.getVipIds().split(","));
+					vipIds.retainAll(vips);
+					if (!vipIds.isEmpty()){
+						StringBuilder message = new StringBuilder();
+						List<String> collect = vips.stream().sorted().collect(Collectors.toList());
+						for (String s : collect) {
+							switch (s){
+								case "1":
+									message.append("普通会员,");
+									break;
+								case "2":
+									message.append("黄金会员,");
+									break;
+								case "3":
+									message.append("钻石会员,");
+									break;
+								case "4":
+									message.append("准代理,");
+									break;
+								case "5":
+									message.append("代理,");
+									break;
+								case "6":
+									message.append("总代,");
+									break;
+								case "7":
+									message.append("合伙人,");
+									break;
+							}
+						}
+						StringBuilder res = message.deleteCharAt(message.length() - 1);
+						return R.fail(res+"在当前活动时间已有订单优惠");
+					}
+				}
+			}
+		}
 		orderActivityInfoService.save(orderActivityInfo);
+
 		return R.ok();
 	}
 
@@ -80,6 +127,50 @@
 	@ApiOperation(value = "修改活动", tags = {"管理后台-活动管理"})
 	public R<Void> updateActivityConfig(@RequestBody OrderActivityInfo orderActivityInfo){
 		orderActivityInfo.setId(Long.valueOf(orderActivityInfo.getIdStr()));
+		if (org.springframework.util.StringUtils.hasLength(orderActivityInfo.getVipIds())){
+			List<String> vipIds = Arrays.asList(orderActivityInfo.getVipIds().split(","));
+			List<OrderActivityInfo> list = orderActivityInfoService.lambdaQuery()
+					.le(OrderActivityInfo::getStartTime, orderActivityInfo.getStartTime())
+					.or()
+					.ge(OrderActivityInfo::getEndTime, orderActivityInfo.getEndTime()).list();
+			if (!list.isEmpty()){
+				for (OrderActivityInfo activityInfo : list) {
+					List<String> vips = Arrays.asList(activityInfo.getVipIds().split(","));
+					vipIds.retainAll(vips);
+					if (!vipIds.isEmpty()){
+						StringBuilder message = new StringBuilder();
+						List<String> collect = vips.stream().sorted().collect(Collectors.toList());
+						for (String s : collect) {
+							switch (s){
+								case "1":
+									message.append("普通会员,");
+									break;
+								case "2":
+									message.append("黄金会员,");
+									break;
+								case "3":
+									message.append("钻石会员,");
+									break;
+								case "4":
+									message.append("准代理,");
+									break;
+								case "5":
+									message.append("代理,");
+									break;
+								case "6":
+									message.append("总代,");
+									break;
+								case "7":
+									message.append("合伙人,");
+									break;
+							}
+						}
+						StringBuilder res = message.deleteCharAt(message.length() - 1);
+						return R.fail(res+"在当前活动时间已有订单优惠");
+					}
+				}
+			}
+		}
 		orderActivityInfoService.updateById(orderActivityInfo);
 		return R.ok();
 	}
@@ -94,12 +185,14 @@
 									 OrderActivityInfo orderActivityInfo){
 
 		Page<OrderActivityInfo> page = orderActivityInfoService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<OrderActivityInfo>()
-				.eq(orderActivityInfo.getId() != null, OrderActivityInfo::getId, orderActivityInfo.getId())
-				.eq(StringUtils.isNotEmpty(orderActivityInfo.getActivityName()), OrderActivityInfo::getActivityName, orderActivityInfo.getActivityName())
+				.like(orderActivityInfo.getId() != null, OrderActivityInfo::getId, orderActivityInfo.getId())
+				.like(StringUtils.isNotEmpty(orderActivityInfo.getActivityName()), OrderActivityInfo::getActivityName, orderActivityInfo.getActivityName())
 				.gt(orderActivityInfo.getStatus() != null && orderActivityInfo.getStatus() == 0, OrderActivityInfo::getStartTime, LocalDateTime.now())
 				.ge(orderActivityInfo.getStatus() != null && orderActivityInfo.getStatus() == 1, OrderActivityInfo::getEndTime, LocalDateTime.now())
 				.lt(orderActivityInfo.getStatus() != null && orderActivityInfo.getStatus() == 1, OrderActivityInfo::getStartTime, LocalDateTime.now())
-				.eq(orderActivityInfo.getIsShelf() != null, OrderActivityInfo::getIsShelf, orderActivityInfo.getIsShelf()).orderByDesc(OrderActivityInfo::getCreateTime));
+				.eq(orderActivityInfo.getIsShelf() != null, OrderActivityInfo::getIsShelf, orderActivityInfo.getIsShelf()).orderByDesc(OrderActivityInfo::getCreateTime)
+				.orderByDesc(OrderActivityInfo::getCreateTime))
+				;
 		page.getRecords().forEach(item -> {
 			LocalDateTime startTime = item.getStartTime();
 			LocalDateTime now = LocalDateTime.now();
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
index e93350d..7498f9c 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -146,6 +146,7 @@
         if(sysUser.getRoleType() == 2){
             share.setObjectId(sysUser.getObjectId().longValue());
         }
+        share.setAuditStatus(0);
         share.setDelFlag(0);
         shareService.save(share);
         return R.ok();
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
index 43ceb6d..bb34e23 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -138,6 +138,7 @@
             userShop.setUserId(sysUser.getUserId());
             userShop.setShopId(shop.getId());
             userShop.setRoleType(1);
+            userShop.setNickName(sysUser.getNickName());
             List<UserShop> data = userShopClient.getUserShop(userShop).getData();
             if(null == data || data.size() == 0){
                 userShop = new UserShop();
@@ -145,6 +146,7 @@
                 userShop.setShopId(shop.getId());
                 userShop.setRoleType(1);
                 userShop.setRoleId(2L);
+                userShop.setCreateTime(LocalDateTime.now());
                 userShopClient.saveUserShop(userShop);
             }
         }else{
@@ -234,6 +236,12 @@
         String phone = shop.getPhone();
         if (!shopService.cheUserByPhone(phone)) {
             return R.fail("该手机号未注册");
+        }
+        if (shop.getPid()!=null){
+            Shop shopP = shopService.getById(shop.getPid());
+            if (shopP.getPid()!=null&&shopP.getPid()!=0&& shopP.getPid().equals(shop.getId())){
+                return R.fail("门店之间不能互相作为上级门店");
+            }
         }
         String city = TencentMapUtil.inverseGeographicalAnalysis(shop.getLongitude(), shop.getLatitude(), false);
         shop.setProvinceCode(city.substring(0, 2) + "0000");
@@ -363,6 +371,20 @@
         return R.ok();
     }
 
+    /**
+     * 获取手机号的后六位。
+     *
+     * @param phoneNumber 以字符串形式提供的手机号
+     * @return 手机号的后六位
+     * @throws IllegalArgumentException 如果手机号长度不足六位
+     */
+    public String getLastSixDigits(String phoneNumber) {
+        if (phoneNumber == null || phoneNumber.length() < 6) {
+            throw new IllegalArgumentException("手机号长度不足六位");
+        }
+        // 取字符串的最后六位
+        return phoneNumber.substring(phoneNumber.length() - 6);
+    }
 
 
     /**
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopBalanceStatementServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopBalanceStatementServiceImpl.java
index 2276d32..6a6d49b 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopBalanceStatementServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopBalanceStatementServiceImpl.java
@@ -44,7 +44,9 @@
         BigDecimal totalCommission = shopCommissionMap.getOrDefault(1,BigDecimal.ZERO);
         BigDecimal totalSubordinateCommission = shopCommissionMap.getOrDefault(2,BigDecimal.ZERO);
         BigDecimal totalServiceCharge = shopCommissionMap.getOrDefault(3,BigDecimal.ZERO);
-
+        shopCommissionStatisticsVO.setTotalCommission(totalCommission);
+        shopCommissionStatisticsVO.setTotalSubordinateCommission(totalSubordinateCommission);
+        shopCommissionStatisticsVO.setTotalServiceCharge(totalServiceCharge);
         BigDecimal totalAmount = totalCommission.add(totalSubordinateCommission).add(totalServiceCharge);
         shopCommissionStatisticsVO.setTotalAmount(totalAmount);
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
index 230aa4a..cce5829 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
@@ -53,7 +53,9 @@
         LocalDateTime startTime = shopPoint.getStartTime();
         LocalDateTime endTime = shopPoint.getEndTime();
         if(null != startTime){
-            List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>().eq(ShopPoint::getShopId, shopPoint.getShopId())
+            List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>()
+                    // todo bug说应展示所有门店积分数据
+//                    .eq(ShopPoint::getShopId, shopPoint.getShopId())
                     .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'"));
             List<String> date = new ArrayList<>();
             List<Map<String, Integer>> data = new ArrayList<>();
diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml
index 73ff077..287a6be 100644
--- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml
+++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml
@@ -32,6 +32,7 @@
         <if test="vipId == null">
             AND tgs.vip in (0, -1)
         </if>
+        order by tsai.create_time desc
     </select>
     <select id="selectDetail" resultType="com.ruoyi.other.vo.SeckillActivityDetailVO">
         SELECT
diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
index d61a246..2b1d9bb 100644
--- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
+++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
@@ -50,6 +50,7 @@
                 and ts.status = #{shop.status}
             </if>
         </where>
+        order by ts.create_time desc
     </select>
     <select id="getShopStatistics" resultType="com.ruoyi.other.vo.ShopStatistics">
         SELECT
diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
index f95ef42..80ee631 100644
--- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
+++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
@@ -41,6 +41,34 @@
         <include refid="ShopPointList"/>
     </select>
     <select id="queryShpointPage" resultType="com.ruoyi.other.api.domain.ShopPoint">
-        <include refid="ShopPointList"/>
+        SELECT
+        ts.`name` shopName,
+        ts.shop_manager shopLeaderName,
+        ts.phone,
+        tsp.type,
+        tsp.create_time,
+        tsp.variable_point,
+        tsp.order_num
+        FROM
+        t_shop_point tsp
+        LEFT JOIN t_shop ts ON tsp.shop_id = ts.id
+        <where>
+            <if test="shopPoint.shopName != null and shopPoint.shopName != ''">
+                AND ts.`name` LIKE concat('%',#{shopPoint.shopName},'%')
+            </if>
+            <if test="shopPoint.shopLeaderName != null and shopPoint.shopLeaderName != ''">
+                AND ts.shop_manager LIKE concat('%',#{shopPoint.shopLeaderName},'%')
+            </if>
+            <if test="shopPoint.phone != null and shopPoint.phone != ''">
+                AND ts.phone LIKE concat('%',#{shopPoint.phone},'%')
+            </if>
+            <if test="shopPoint.type != null">
+                AND tsp.type = #{shopPoint.type}
+            </if>
+            <if test="shopPoint.startTime !=null and shopPoint.endTime !=null">
+                AND tsp.create_time BETWEEN #{shopPoint.startTime} AND #{shopPoint.endTime}
+            </if>
+        </where>
+        order by tsp.create_time desc
     </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.7.1