From 2baa90c11d0ee7284d127f3a96c0f8452292d150 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 02 一月 2025 16:41:27 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java                      |    4 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java           |    2 
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java              |   44 --------
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java             |   95 +++++++++++++++++--
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java       |    2 
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/DeliverGoodsRefundPass.java                       |   14 ++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java                    |   17 ++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java                               |    2 
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java                  |   16 +-
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java           |   23 +++-
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java                       |    8 +
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java            |    2 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopBalanceStatement.java                 |    2 
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java                 |    6 
 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml                                     |    3 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java                |   17 +-
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java              |    2 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java |    2 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java                   |   32 ++++--
 19 files changed, 186 insertions(+), 107 deletions(-)

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 177e0f3..23c24ac 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=门店服务费,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/feignClient/ShopClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
index eef39bd..e86f791 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
@@ -42,10 +42,10 @@
 	@PostMapping("/shop/getShopByPhone")
 	R<Shop> getShopByPhone(@RequestParam("phone") String phone);
 
-	@PostMapping("/getShopByUserIds")
+	@PostMapping("/shop/getShopByUserIds")
 	R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds);
 
-	@GetMapping("/getShopIdByName")
+	@GetMapping("/shop/getShopIdByName")
     R<Set<Integer>> getShopIdByName(String shopName);
 
 	@PostMapping("/shop-balance-statement/getList")
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java
index 0fd46e6..669ec92 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java
@@ -85,14 +85,14 @@
         if (!deptService.checkDeptNameUnique(dept)) {
             return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
         }
-        else if (dept.getParentId().equals(deptId))
-        {
-            return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
-        }
-        else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
-        {
-            return error("该部门包含未停用的子部门!");
-        }
+//        else if (dept.getParentId().equals(deptId))
+//        {
+//            return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
+//        }
+//        else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
+//        {
+//            return error("该部门包含未停用的子部门!");
+//        }
         dept.setUpdateBy(SecurityUtils.getUsername());
         return toAjax(deptService.updateDept(dept));
     }
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 35c5952..daa2396 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
@@ -232,15 +232,15 @@
             user.setTopUser(byId);
         }
         //获取绑定下级列表
-        List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, user.getInviteUserId()).list();
+        List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, user.getId()).list();
         for (AppUser appUser : list) {
-            Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getTopInviteId, 1).count();
-            Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getTopInviteId, userId).count();
-            Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getTopInviteId, userId).count();
-            Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getTopInviteId, userId).count();
-            Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getTopInviteId, userId).count();
-            Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getTopInviteId, userId).count();
-            Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getTopInviteId, userId).count();
+            Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, appUser.getId()).count();
+            Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getInviteUserId, appUser.getId()).count();
+            Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getInviteUserId, appUser.getId()).count();
+            Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getInviteUserId, appUser.getId()).count();
+            Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getInviteUserId, appUser.getId()).count();
+            Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getInviteUserId, appUser.getId()).count();
+            Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getInviteUserId, appUser.getId()).count();
             appUser.setCount1(count1);
             appUser.setCount2(count2);
             appUser.setCount3(count3);
@@ -274,7 +274,6 @@
     @GetMapping("/index")
     @ApiOperation(value = "个人中心首页", tags = {"小程序-个人中心首页"})
     public R<AppUser> index() {
-        System.err.println("=-====");
         Long userId = tokenService.getLoginUserApplet().getUserid();
         //当前用户信息
         AppUser user = appUserService.getById(userId);
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
index 7920fbb..2094c25 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -365,9 +365,10 @@
 				userPoint.setCreateTime(LocalDateTime.now());
 				userPoint.setAppUserId(appUser.getId());
 				userPointService.save(userPoint);
-				//变更等级
-				vipUpgrade(appUser.getId());
 			}
+			//变更等级
+			vipUpgrade(appUser.getId());
+
 			//拉新分佣
 			if(0 == old && null != appUser2){
 				pointSetting = pointSettingClient.getPointSetting(appUser2.getVipId()).getData();
@@ -393,9 +394,9 @@
 					userPoint.setCreateTime(LocalDateTime.now());
 					userPoint.setAppUserId(appUser2.getId());
 					userPointService.save(userPoint);
-					//变更等级
-					vipUpgrade(appUser2.getId());
 				}
+				//变更等级
+				vipUpgrade(appUser2.getId());
 				
 				if(null != appUser2.getInviteUserId()){
 					AppUser appUser3 = this.getById(appUser2.getInviteUserId());
@@ -416,9 +417,9 @@
 						userPoint.setCreateTime(LocalDateTime.now());
 						userPoint.setAppUserId(appUser3.getId());
 						userPointService.save(userPoint);
-						//变更等级
-						vipUpgrade(appUser3.getId());
 					}
+					//变更等级
+					vipUpgrade(appUser3.getId());
 				}
 			}
 			
@@ -478,6 +479,37 @@
 		Integer vipId = appUser.getVipId();
 		//钻石会员
 		VipSetting vipSetting3 = vipSettingClient.getVipSetting(3).getData();
+		//消费积分满足升级
+		if(1 == vipSetting3.getVipLevelUpShopRole() && appUser.getShopPoint() >= vipSetting3.getVipLevelUpShop() && appUser.getVipId() < 3){
+			appUser.setVipId(3);
+			this.updateById(appUser);
+			//添加等级变化记录
+			UserChangeLog userChangeLog = new UserChangeLog();
+			userChangeLog.setDelFlag(0);
+			userChangeLog.setCreateTime(LocalDateTime.now());
+			userChangeLog.setAppUserId(appUser.getId());
+			userChangeLog.setBeforeVipId(vipId);
+			userChangeLog.setAfterVipId(appUser.getVipId());
+			userChangeLog.setChangeType(1);
+			userChangeLogService.save(userChangeLog);
+			return;
+		}
+		//返佣积分满足升级
+		if(1 == vipSetting3.getVipLevelUpShareRole() && appUser.getSharePoint() >= vipSetting3.getVipLevelUpShare() && appUser.getVipId() < 3){
+			appUser.setVipId(3);
+			this.updateById(appUser);
+			//添加等级变化记录
+			UserChangeLog userChangeLog = new UserChangeLog();
+			userChangeLog.setDelFlag(0);
+			userChangeLog.setCreateTime(LocalDateTime.now());
+			userChangeLog.setAppUserId(appUser.getId());
+			userChangeLog.setBeforeVipId(vipId);
+			userChangeLog.setAfterVipId(appUser.getVipId());
+			userChangeLog.setChangeType(1);
+			userChangeLogService.save(userChangeLog);
+			return;
+		}
+		//下级人数满足升级
 		Integer vipLevelUpNumRole = vipSetting3.getVipLevelUpNumRole();
 		Integer vipDirectNum = vipSetting3.getVipDirectNum();
 		Integer vipTeamNum = vipSetting3.getVipTeamNum();
@@ -502,8 +534,40 @@
 				return;
 			}
 		}
+
 		//黄金会员
 		VipSetting vipSetting2 = vipSettingClient.getVipSetting(2).getData();
+		//消费积分满足升级
+		if(1 == vipSetting2.getVipLevelUpShopRole() && appUser.getShopPoint() >= vipSetting2.getVipLevelUpShop() && appUser.getVipId() < 2){
+			appUser.setVipId(2);
+			this.updateById(appUser);
+			//添加等级变化记录
+			UserChangeLog userChangeLog = new UserChangeLog();
+			userChangeLog.setDelFlag(0);
+			userChangeLog.setCreateTime(LocalDateTime.now());
+			userChangeLog.setAppUserId(appUser.getId());
+			userChangeLog.setBeforeVipId(vipId);
+			userChangeLog.setAfterVipId(appUser.getVipId());
+			userChangeLog.setChangeType(1);
+			userChangeLogService.save(userChangeLog);
+			return;
+		}
+		//返佣积分满足升级
+		if(1 == vipSetting2.getVipLevelUpShareRole() && appUser.getSharePoint() >= vipSetting2.getVipLevelUpShare() && appUser.getVipId() < 2){
+			appUser.setVipId(2);
+			this.updateById(appUser);
+			//添加等级变化记录
+			UserChangeLog userChangeLog = new UserChangeLog();
+			userChangeLog.setDelFlag(0);
+			userChangeLog.setCreateTime(LocalDateTime.now());
+			userChangeLog.setAppUserId(appUser.getId());
+			userChangeLog.setBeforeVipId(vipId);
+			userChangeLog.setAfterVipId(appUser.getVipId());
+			userChangeLog.setChangeType(1);
+			userChangeLogService.save(userChangeLog);
+			return;
+		}
+		//下级人数满足升级
 		vipLevelUpNumRole = vipSetting2.getVipLevelUpNumRole();
 		vipDirectNum = vipSetting2.getVipDirectNum();
 		vipTeamNum = vipSetting2.getVipTeamNum();
@@ -525,6 +589,7 @@
 				userChangeLog.setAfterVipId(appUser.getVipId());
 				userChangeLog.setChangeType(1);
 				userChangeLogService.save(userChangeLog);
+				return;
 			}
 		}
 	}
@@ -575,8 +640,18 @@
 			if(collect.size() == 0){
 				return result;
 			}else{
-				result.addAll(collect);
-				List<Long> collect1 = collect.stream().map(AppUser::getId).collect(Collectors.toList());
+				List<Long> collect2 = result.stream().map(AppUser::getId).collect(Collectors.toList());
+				List<AppUser> list1 = new ArrayList<>();
+				for (AppUser appUser : collect) {
+					if(!collect2.contains(appUser.getId())){
+						list1.add(appUser);
+					}
+				}
+				if(list1.size() == 0){
+					return result;
+				}
+				result.addAll(list1);
+				List<Long> collect1 = list1.stream().map(AppUser::getId).collect(Collectors.toList());
 				idss.addAll(collect1);
 			}
 		}
@@ -662,7 +737,7 @@
 		Integer vipCancelDay = vipSetting.getVipCancelDay();
 		Integer vipChangeDay = vipSetting.getVipChangeDay();
 		List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, 1).eq(AppUser::getDelFlag, 0).isNotNull(AppUser::getInviteUserId)
-				.eq(AppUser::getStatus, 1).last(" and (UNIX_TIMESTAMP(create_time) + " + vipCancelDay + ") <= UNIX_TIMESTAMP()"));
+				.eq(AppUser::getStatus, 1).last(" and ADDDATE(create_time,INTERVAL " + vipCancelDay + " DAY) <= now()"));
 		for (AppUser appUser : list) {
 			appUser.setInviteUserId(null);
 			appUser.setShopId(null);
@@ -671,7 +746,7 @@
 		
 		//可更换推广人
 		list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, 1).eq(AppUser::getDelFlag, 0).eq(AppUser::getChangePromoter, 0)
-				.isNull(AppUser::getLastShopTime).eq(AppUser::getStatus, 1).last(" and (UNIX_TIMESTAMP(create_time) + " + vipCancelDay + ") <= UNIX_TIMESTAMP()"));
+				.isNull(AppUser::getLastShopTime).eq(AppUser::getStatus, 1).last(" and ADDDATE(create_time,INTERVAL " + vipChangeDay + " DAY) <= now()"));
 		for (AppUser appUser : list) {
 			appUser.setChangePromoter(1);
 			this.updateById(appUser);
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 e317ae3..15d1a49 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
@@ -55,7 +55,7 @@
     @Override
     public WalletStatistics walletStatistics(Page<BalanceChangeRecord> page, BalanceChangeRecord balanceChangeRecord) {
         ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
-        shopBalanceStatement.setType(4);
+        shopBalanceStatement.setType(1);
 
         R<List<ShopBalanceStatement>> r;
         try {
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 1230f20..15e3ad8 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
@@ -62,7 +62,7 @@
 
         UserPointVO userPointVO = new UserPointVO();
         userPointVO.setTotalPoint(appUser.getTotalPoint());
-        userPointVO.setConsumePoint(appUser.getLavePoint());
+        userPointVO.setConsumePoint(appUser.getAvailablePoint());
         userPointVO.setShopPoint(appUser.getShopPoint());
         userPointVO.setSharePoint(appUser.getSharePoint());
         userPointVO.setPullNewPoint(appUser.getTotalInvitePoint());
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java
index 49a6415..402bd5d 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java
@@ -204,9 +204,12 @@
 
             // 代理下的准代理数量
             List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList());
-            long userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
-                    .in(AppUser::getInviteUserId, userQuasiAgent)
-                    .eq(AppUser::getVipId, 4));
+            long userQuasiAgentCount = 0;
+            if(userQuasiAgent.size() > 0){
+                userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
+                        .in(AppUser::getInviteUserId, userQuasiAgent)
+                        .eq(AppUser::getVipId, 4));
+            }
 
             // 判断是否满足直推代理用户数量和准代理数量
             return userAgentList.size() >= vipDirectNum && userQuasiAgentCount >= vipDirectVipNum.longValue();
@@ -279,19 +282,23 @@
 
                     // 获取用户直推总代理数量
                     List<AppUser> userTotalAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>()
-                            .in(AppUser::getInviteUserId, shopUserIdSet)
+                            .in(AppUser::getId, shopUserIdSet)
                             .eq(AppUser::getVipId, 6));
+
 
                     // 获取用户直推代理用户数量
                     List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>()
-                            .in(AppUser::getInviteUserId, shopUserIdSet)
+                            .in(AppUser::getId, userShopList)
                             .eq(AppUser::getVipId, 5));
 
                     // 代理下的准代理数量
                     List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList());
-                    long userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
-                            .in(AppUser::getInviteUserId, userQuasiAgent)
-                            .eq(AppUser::getVipId, 4));
+                    long userQuasiAgentCount = 0;
+                    if(userQuasiAgent.size() > 0){
+                        userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
+                                .in(AppUser::getInviteUserId, userQuasiAgent)
+                                .eq(AppUser::getVipId, 4));
+                    }
 
                     // 判断是否满足直推代理用户数量和准代理数量
                     return userTotalAgentList.size() >= vipTeamVipNum && userAgentList.size() >= vipDirectNum &&
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
index 2bb8ac1..3c86592 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
@@ -104,8 +104,8 @@
 			@ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"),
 			@ApiImplicitParam(name = "code", value = "快递单号", required = true, dataType = "string"),
 	})
-	public R deliverGoodsRefundPass(@RequestParam("id") String id, @RequestParam("code") String code){
-		RefundPass refundPass = refundPassService.getById(id);
+	public R deliverGoodsRefundPass(@RequestBody DeliverGoodsRefundPass pass){
+		RefundPass refundPass = refundPassService.getById(pass.getId());
 		if(null == refundPass){
 			return R.fail();
 		}
@@ -118,7 +118,7 @@
 			return R.fail("操作失败");
 		}
 		refundPass.setStatus(5);
-		refundPass.setCode(code);
+		refundPass.setCode(pass.getCode());
 		refundPassService.updateById(refundPass);
 		return R.ok();
 	}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java
index ef55d38..e4014b3 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java
@@ -257,7 +257,6 @@
             Shop shop = shopClient.getShopById(order.getShopId()).getData();
             AppUser shopAppUser = appUserClient.getAppUserById(shop.getAppUserId());
             if(null != shopAppUser){
-                BigDecimal balance = shopAppUser.getBalance();
                 BigDecimal shopBalance = shop.getBalance();
                 Integer lavePoint = shopAppUser.getLavePoint();
                 Integer shopLavePoint = shop.getLavePoint();
@@ -290,19 +289,6 @@
                 appUserClient.editAppUserById(shopAppUser);
                 shopClient.updateShop(shop);
                 //添加明细记录
-                if(!shopAppUser.getBalance().equals(balance)){
-                    BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
-                    balanceChangeRecord.setAppUserId(shopAppUser.getId());
-                    balanceChangeRecord.setOrderId(order.getId());
-                    balanceChangeRecord.setChangeType(4);
-                    balanceChangeRecord.setBeforeAmount(balance);
-                    balanceChangeRecord.setChangeAmount(hxmd_price);
-                    balanceChangeRecord.setAfterAmount(shopAppUser.getBalance());
-                    balanceChangeRecord.setDelFlag(0);
-                    balanceChangeRecord.setCreateTime(LocalDateTime.now());
-                    balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord);
-                }
-                
                 if(!shop.getBalance().equals(shopBalance)){
                     ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
                     shopBalanceStatement.setShopId(shop.getId());
@@ -392,7 +378,6 @@
             if(null != shop1){
                 AppUser bdShopAppUser = appUserClient.getAppUserById(shop1.getAppUserId());
                 if(null != bdShopAppUser){
-                    BigDecimal balance = bdShopAppUser.getBalance();
                     BigDecimal shopBalance = shop1.getBalance();
                     Integer lavePoint = bdShopAppUser.getLavePoint();
                     Integer shopLavePoint = shop1.getLavePoint();
@@ -425,23 +410,10 @@
                     appUserClient.editAppUserById(bdShopAppUser);
                     shopClient.updateShop(shop1);
                     //添加明细记录
-                    if(!bdShopAppUser.getBalance().equals(balance)){
-                        BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
-                        balanceChangeRecord.setAppUserId(bdShopAppUser.getId());
-                        balanceChangeRecord.setOrderId(order.getId());
-                        balanceChangeRecord.setChangeType(4);
-                        balanceChangeRecord.setBeforeAmount(balance);
-                        balanceChangeRecord.setChangeAmount(bdmd_price);
-                        balanceChangeRecord.setAfterAmount(bdShopAppUser.getBalance());
-                        balanceChangeRecord.setDelFlag(0);
-                        balanceChangeRecord.setCreateTime(LocalDateTime.now());
-                        balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord);
-                    }
-        
                     if(!shop1.getBalance().equals(shopBalance)){
                         ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
                         shopBalanceStatement.setShopId(shop1.getId());
-                        shopBalanceStatement.setType(4);
+                        shopBalanceStatement.setType(1);
                         shopBalanceStatement.setHistoricalBalance(shopBalance);
                         shopBalanceStatement.setVariableAmount(bdmd_price);
                         shopBalanceStatement.setBalance(shop1.getBalance());
@@ -489,7 +461,6 @@
             if(null != shop2){
                 AppUser sjShopAppUser = appUserClient.getAppUserById(shop2.getAppUserId());
                 if(null != sjShopAppUser){
-                    BigDecimal balance = sjShopAppUser.getBalance();
                     BigDecimal shopBalance = shop2.getBalance();
                     Integer lavePoint = sjShopAppUser.getLavePoint();
                     Integer shopLavePoint = shop2.getLavePoint();
@@ -522,19 +493,6 @@
                     appUserClient.editAppUserById(sjShopAppUser);
                     shopClient.updateShop(shop2);
                     //添加明细记录
-                    if(!sjShopAppUser.getBalance().equals(balance)){
-                        BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
-                        balanceChangeRecord.setAppUserId(sjShopAppUser.getId());
-                        balanceChangeRecord.setOrderId(order.getId());
-                        balanceChangeRecord.setChangeType(4);
-                        balanceChangeRecord.setBeforeAmount(balance);
-                        balanceChangeRecord.setChangeAmount(bdmdsj_price);
-                        balanceChangeRecord.setAfterAmount(sjShopAppUser.getBalance());
-                        balanceChangeRecord.setDelFlag(0);
-                        balanceChangeRecord.setCreateTime(LocalDateTime.now());
-                        balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord);
-                    }
-        
                     if(!shop2.getBalance().equals(shopBalance)){
                         ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
                         shopBalanceStatement.setShopId(shop2.getId());
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
index 2335be4..199eaf5 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
@@ -76,7 +76,7 @@
 		Order order = orderService.getById(applyRefundPass.getId());
 		//判断是都已经超过售后时间
 		LocalDateTime afterSaleTime = order.getAfterSaleTime();
-		if(null != afterSaleTime && afterSaleTime.toEpochSecond(ZoneOffset.UTC) < LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)){
+		if(null != afterSaleTime && LocalDateTime.now().isAfter(afterSaleTime)){
 			return R.fail("已超过售后期间");
 		}
 		
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
index 49c7347..67a1939 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -596,7 +596,7 @@
 			String goodsName = "";
 			for (Integer goodsId : goodsIds) {
 				Goods goods = goodsClient.getGoodsById(goodsId).getData();
-				if(1 == goods.getAppointStore() && !collect.contains(goodsId)){
+				if(goods.getType() == 1 && 1 == goods.getAppointStore() && !collect.contains(goodsId)){
 					goodsName = goods.getName();
 					break;
 				}
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/DeliverGoodsRefundPass.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/DeliverGoodsRefundPass.java
new file mode 100644
index 0000000..4ad61ea
--- /dev/null
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/DeliverGoodsRefundPass.java
@@ -0,0 +1,14 @@
+package com.ruoyi.order.vo;
+
+import lombok.Data;
+
+/**
+ * @author zhibing.pu
+ * @date 2025/1/2 14:27
+ */
+@Data
+public class DeliverGoodsRefundPass {
+    private String id;
+
+    private String code;
+}
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 f703879..c0d33fb 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
@@ -83,7 +83,7 @@
         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();
+        List<ShopBalanceStatement> list1 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 1).list();
         BigDecimal bigDecimal1 = new BigDecimal(0);
         for (ShopBalanceStatement shopBalanceStatement : list) {
             bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount());
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 617ff88..3cf5908 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
@@ -116,7 +116,9 @@
     @DeleteMapping("/deleteShop")
     @ApiOperation(value = "删除门店", tags = {"管理后台-门店管理"})
     public R<Void> deleteShop(@ApiParam("门店id") @RequestParam("id") Integer id){
-        shopService.removeById(id);
+        Shop shop = shopService.getById(id);
+        shop.setDelFlag(1);
+        shopService.updateById(shop);
         return R.ok();
     }
 
@@ -298,8 +300,8 @@
      */
     @GetMapping("/shopStatistics")
     @ApiOperation(value = "门店统计", tags = {"管理后台-首页统计"})
-    public R<ShopStatistics> shopStatistics(@ApiParam("门店名称") String shopName) {
-        ShopStatistics shopStatistics = shopMapper.getShopStatistics(shopName);
+    public R<ShopStatistics> shopStatistics(@ApiParam("门店id") Integer shopId) {
+        ShopStatistics shopStatistics = shopMapper.getShopStatistics(shopId);
         return R.ok(shopStatistics);
     }
     
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java
index c8d43d8..df25f9d 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java
@@ -28,6 +28,6 @@
 
     ShopDetailVO selectShopDetail(Integer shopId);
 
-    ShopStatistics getShopStatistics(String shopName);
+    ShopStatistics getShopStatistics(@Param("shopId") Integer shopId);
 
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
index 90916e8..d647b1d 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -7,11 +7,14 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.account.api.feignClient.AppUserClient;
 import com.ruoyi.account.api.model.AppUser;
+import com.ruoyi.common.core.constant.TokenConstants;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.utils.ServletUtils;
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.bean.BeanUtils;
 import com.ruoyi.common.core.web.page.PageInfo;
 import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
 import com.ruoyi.order.vo.Price;
 import com.ruoyi.other.api.domain.*;
@@ -73,13 +76,20 @@
     public PageInfo<GoodsVO> goodsList(Goods search) {
         PageInfo<GoodsVO> pageInfo = new PageInfo(search.getPageCurr(), search.getPageSize());
         List<GoodsVO> list = this.baseMapper.goodsList(pageInfo, search.getGoodsCategoryId(), search.getName());
-        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
+        Long userId = null;
+        String token = SecurityUtils.getToken(ServletUtils.getRequest());
+        if(StringUtils.isNotEmpty(token)){
+            userId = tokenService.getLoginUserApplet().getUserid();
+        }
         for (GoodsVO goods : list) {
-            R<Price> r = remoteOrderGoodsClient.getGoodsPrice(loginUserApplet.getUserid(), goods.getGoodsId(), null);
-            if (null != r.getData()){
-                Price price = r.getData();
-                goods.setSellingPrice(price.getCash());
-                goods.setIntegral(price.getPoint());
+            //游客展示基础售价
+            if(null != userId){
+                R<Price> r = remoteOrderGoodsClient.getGoodsPrice(userId, goods.getGoodsId(), null);
+                if (null != r.getData()){
+                    Price price = r.getData();
+                    goods.setSellingPrice(price.getCash());
+                    goods.setIntegral(price.getPoint());
+                }
             }
         }
         return pageInfo.setRecords(list);
@@ -283,10 +293,12 @@
 
         for (GoodsShop goodsShop : goodsShops) {
             Shop shop = shopMapper.selectById(goodsShop.getShopId());
-            goodsShop.setShopName(shop.getName());
-            goodsShop.setOwnerName(shop.getShopManager());
-            goodsShop.setPhone(shop.getPhone());
-            goodsShop.setAddress(shop.getAddress());
+            if(null != shop){
+                goodsShop.setShopName(shop.getName());
+                goodsShop.setOwnerName(shop.getShopManager());
+                goodsShop.setPhone(shop.getPhone());
+                goodsShop.setAddress(shop.getAddress());
+            }
         }
         goods.setGoodsShopList(goodsShops);
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
index 1ada38b..16b42b6 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
@@ -9,7 +9,10 @@
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.GeodesyUtil;
+import com.ruoyi.common.core.utils.ServletUtils;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.other.api.domain.Shop;
 import com.ruoyi.other.api.domain.ShopScore;
 import com.ruoyi.other.mapper.ShopMapper;
@@ -58,11 +61,17 @@
 
     @Override
     public List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude) {
-        Long userid = tokenService.getLoginUserApplet().getUserid();
-        AppUser appUser = appUserClient.getAppUserById(userid);
+        String token = SecurityUtils.getToken(ServletUtils.getRequest());
+        AppUser appUser = null;
+        if(StringUtils.isNotEmpty(token)){
+            Long userid = tokenService.getLoginUserApplet().getUserid();
+            appUser = appUserClient.getAppUserById(userid);
+        }
+
         List<NearbyShopVO> nearbyShopVOS = shopMapper.selectNearbyShopList(longitude, longitude);
-        if(null != appUser.getShopId()){
-            NearbyShopVO nearbyShopVO = nearbyShopVOS.stream().filter(s -> s.getId().equals(appUser.getShopId().longValue())).findFirst().get();
+        if(null != appUser && null != appUser.getShopId()){
+            AppUser finalAppUser = appUser;
+            NearbyShopVO nearbyShopVO = nearbyShopVOS.stream().filter(s -> s.getId().equals(finalAppUser.getShopId().longValue())).findFirst().get();
             if(null != nearbyShopVO){
                 nearbyShopVOS.remove(nearbyShopVO);
             }
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 93820f1..80526d4 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
@@ -91,5 +91,8 @@
             SUM(ts.withdraw_money) alreadyWithdrawMoney
         FROM
             t_shop ts
+            <if test="null != shopId">
+                where ts.id = #{shopId}
+            </if>
     </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.7.1