From d3e9a09cb54017a8063e5bfe3ace5012f66f3130 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 25 三月 2025 18:34:34 +0800 Subject: [PATCH] 修改统计bug --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShareServiceImpl.java | 13 ++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShareMapper.java | 18 +++ ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/SecurityConstants.java | 5 + ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java | 35 +++--- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java | 38 +++---- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java | 3 ruoyi-auth/src/main/resources/bootstrap.yml | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShareService.java | 15 +++ ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 52 +++++++++- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserStatisticsDetail.java | 6 + ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java | 7 + ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShareMapper.xml | 43 ++++++++ ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml | 35 +++---- 16 files changed, 210 insertions(+), 70 deletions(-) diff --git a/ruoyi-auth/src/main/resources/bootstrap.yml b/ruoyi-auth/src/main/resources/bootstrap.yml index 82bd9e7..42e0257 100644 --- a/ruoyi-auth/src/main/resources/bootstrap.yml +++ b/ruoyi-auth/src/main/resources/bootstrap.yml @@ -55,13 +55,13 @@ server-addr: 127.0.0.1:8848 service: ${spring.application.name} group: DEFAULT_GROUP - namespace: cdf47c5f-2bf9-4dec-a616-a8dc653aceb9 + namespace: 20c168da-8cf1-4fff-bc38-bc62df656b6a username: nacos password: nacos config: # 配置中心地址 server-addr: 127.0.0.1:8848 - namespace: cdf47c5f-2bf9-4dec-a616-a8dc653aceb9 + namespace: 20c168da-8cf1-4fff-bc38-bc62df656b6a username: nacos password: nacos group: DEFAULT_GROUP diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/SecurityConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/SecurityConstants.java index be3a1e7..e7fed09 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/SecurityConstants.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/SecurityConstants.java @@ -55,4 +55,9 @@ * 角色权限 */ public static final String ROLE_PERMISSION = "role_permission"; + + /** + * 过期时间 + */ + public static final String EXPIRATION_TIME = "expiration_time"; } diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java index d8e5eba..2511ad1 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java @@ -57,6 +57,7 @@ claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId); claimsMap.put(SecurityConstants.USER_TYPE, "system"); claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName); + claimsMap.put(SecurityConstants.EXPIRATION_TIME, System.currentTimeMillis() + expireTime * MILLIS_MINUTE); // 接口返回信息 Map<String, Object> rspMap = new HashMap<String, Object>(); @@ -81,6 +82,7 @@ claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId); claimsMap.put(SecurityConstants.USER_TYPE, "applet"); claimsMap.put(SecurityConstants.DETAILS_USERNAME, name); + claimsMap.put(SecurityConstants.EXPIRATION_TIME, System.currentTimeMillis() + expireAppletTime * MILLIS_MINUTE); // 接口返回信息 Map<String, Object> rspMap = new HashMap<String, Object>(); rspMap.put("access_token", JwtUtils.createToken(claimsMap)); diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java index 12d0cdc..2ab3ca5 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java @@ -25,6 +25,7 @@ import io.jsonwebtoken.Claims; import reactor.core.publisher.Mono; +import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; @@ -184,6 +185,12 @@ Claims claims = JwtUtils.parseToken(token); if (claims == null) { throw new NotPermissionException("令牌已过期或验证不正确!"); + }else{ + Object o = claims.get(SecurityConstants.EXPIRATION_TIME); + Long time = Long.valueOf(o.toString()); + if(null == time || time <= System.currentTimeMillis()){ + throw new NotPermissionException("令牌已过期!"); + } } String userid = JwtUtils.getUserId(claims); if (StringUtils.isEmpty(userid)) { 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 5d9b385..5dae7c5 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 @@ -574,10 +574,42 @@ } return allSubordinates; } - - - - + + + /** + * 获取门店作为服务商的所有用户 + * @param shopId + * @return + */ + public Set<Long> getShopServerUser(Integer shopId){ + Shop shop = shopClient.getShopById(shopId).getData(); + List<Shop> shopList = shopClient.getAllShop().getData(); + List<Long> appUserIds = shopList.stream().map(Shop::getAppUserId).collect(Collectors.toList()); + Long appUserId = shop.getAppUserId(); + //所有未开店的用户 + List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0) + .ne(AppUser::getStatus, 3).notIn(AppUser::getId, appUserIds)); + Set<Long> ids = new HashSet<>(); + getShopServerUser(appUserId, list, ids); + return ids; + } + + + + public void getShopServerUser(Long appUserId, List<AppUser> appUserList, Set<Long> ids){ + List<AppUser> collect = appUserList.stream().filter(s->s.getInviteUserId().equals(appUserId)).collect(Collectors.toList()); + if(collect.size() == 0){ + return; + } + Set<Long> appUserSet = collect.stream().map(AppUser::getId).collect(Collectors.toSet()); + if(ids.containsAll(appUserSet)){ + return; + } + ids.addAll(appUserSet); + for (AppUser appUser : collect) { + getShopServerUser(appUser.getId(), appUserList, ids); + } + } @@ -683,6 +715,9 @@ Integer shopId = data.getObjectId(); List<Order> orders = orderClient.getRedeemedOrdersByShop(shopId).getData(); List<Long> userIds = orders.stream().map(Order::getAppUserId).collect(Collectors.toList()); + //门店作为服务商的用户 + Set<Long> shopServerUser = getShopServerUser(shopId); + userIds.addAll(shopServerUser); queryWrapper.in(!CollectionUtils.isEmpty(userIds), "id", userIds) .like(StringUtils.isNotEmpty( appUser.getName()),"name", appUser.getName()); } @@ -785,8 +820,10 @@ for (Order datum : listR.getData()) { userIds.add(datum.getAppUserId()); } + Set<Long> shopServerUser = getShopServerUser(objectId); + userIds.addAll(shopServerUser); } - IPage<AppUser> appuserPage = appUserService.getAppuserPage1(pageCurr, pageSize, appUser, objectId, userIds); + IPage<AppUser> appuserPage = appUserService.getAppuserPage1(pageCurr, pageSize, appUser, userIds); return R.ok(appuserPage); } @@ -1179,12 +1216,15 @@ shopId = data.getObjectId(); if(null == userId){ userIds = orderClient.getAppUserByShoppingShop(shopId).getData(); + Set<Long> shopServerUser = getShopServerUser(shopId); + userIds.addAll(shopServerUser); }else{ userIds = new HashSet<>(); userIds.add(userId); } + } - UserStatisticsDetail userStatisticsDetail = appUserMapper.getUserStatisticsDetail(shopId, userIds); + UserStatisticsDetail userStatisticsDetail = appUserMapper.getUserStatisticsDetail(null, userIds); return R.ok(userStatisticsDetail); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java index 99a146f..e8698f6 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java @@ -35,7 +35,7 @@ - IPage<AppUser> getAppuserPage1(@Param("page") IPage<AppUser> page, @Param("appUser") AppUser appUser,@Param("objectId")Integer objectId,@Param("userIds")List<Long> userIds); + IPage<AppUser> getAppuserPage1(@Param("page") IPage<AppUser> page, @Param("appUser") AppUser appUser,@Param("userIds")List<Long> userIds); UserStatistics getUserStatistics(@Param("shopId") Integer shopId, @Param("userId") Set<Long> userId); diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java index e99826b..962e5ed 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java @@ -86,7 +86,7 @@ IPage<AppUser> getAppuserPage(Integer pageNum, Integer pageSize, AppUser appUser, Integer shopId, Set<Long> userId); - IPage<AppUser> getAppuserPage1(Integer pageNum, Integer pageSize, AppUser appUser,Integer objectId,List<Long> userIds); + IPage<AppUser> getAppuserPage1(Integer pageNum, Integer pageSize, AppUser appUser,List<Long> userIds); /** * 处理用户会员等级 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 26825a6..7ce7769 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 @@ -1041,9 +1041,9 @@ JSONObject jsonObject = (JSONObject) cacheObject; long time = System.currentTimeMillis() - jsonObject.getInteger("time"); Integer online = jsonObject.getInteger("online"); - online += 10; - //满足一个小时,开始发放积分,计时归0 - if(time >= 60000 && 1 <= online){ + online++; + //时间满足1小时,并且次数记录满足6次(10分钟记录一次) + if(time >= 3600000 && 6 <= online){ jsonObject.put("time", System.currentTimeMillis()); jsonObject.put("online", 0); redisService.setCacheObject("ONLINE_" + userid, jsonObject, 1L, TimeUnit.HOURS); @@ -1055,18 +1055,19 @@ if(1 == pointSetting.getWorkPointOpen()){ hourPoint1 = new BigDecimal(hourPoint).multiply(pointSetting.getWorkPoint().divide(new BigDecimal(100))).intValue(); } - Integer lavePoint = appUser.getLavePoint(); - appUser.setTotalPoint(appUser.getTotalPoint() + hourPoint); - appUser.setLavePoint(appUser.getLavePoint() + hourPoint); - appUser.setAvailablePoint(appUser.getAvailablePoint() + hourPoint1); - appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + hourPoint1); - if(null != pointSetting && 1 == pointSetting.getWorkPointGift()){ - appUser.setTransferablePoint(appUser.getTransferablePoint() + hourPoint1); - } - appUser.setTotalHourPoint(appUser.getTotalHourPoint() + hourPoint); - this.updateById(appUser); //添加积分变动记录 if(hourPoint > 0){ + Integer lavePoint = appUser.getLavePoint(); + appUser.setTotalPoint(appUser.getTotalPoint() + hourPoint); + appUser.setLavePoint(appUser.getLavePoint() + hourPoint); + appUser.setAvailablePoint(appUser.getAvailablePoint() + hourPoint1); + appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + hourPoint1); + if(null != pointSetting && 1 == pointSetting.getWorkPointGift()){ + appUser.setTransferablePoint(appUser.getTransferablePoint() + hourPoint1); + } + appUser.setTotalHourPoint(appUser.getTotalHourPoint() + hourPoint); + this.updateById(appUser); + UserPoint userPoint = new UserPoint(); userPoint.setType(6); userPoint.setHistoricalPoint(lavePoint); @@ -1075,9 +1076,9 @@ userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(appUser.getId()); userPointService.save(userPoint); + //变更等级 + vipUpgrade(appUser.getId()); } - //变更等级 - vipUpgrade(appUser.getId()); } }else{ jsonObject.put("online", online); @@ -1102,8 +1103,8 @@ return appUserMapper.getAppuserPage(new Page<>(pageNum, pageSize), appUser, shopId, userId); } @Override - public IPage<AppUser> getAppuserPage1(Integer pageNum, Integer pageSize, AppUser appUser,Integer objectId,List<Long> userIds) { - return appUserMapper.getAppuserPage1(new Page<>(pageNum, pageSize), appUser,objectId,userIds); + public IPage<AppUser> getAppuserPage1(Integer pageNum, Integer pageSize, AppUser appUser,List<Long> userIds) { + return appUserMapper.getAppuserPage1(new Page<>(pageNum, pageSize), appUser,userIds); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserStatisticsDetail.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserStatisticsDetail.java index 18da92a..359ade8 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserStatisticsDetail.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserStatisticsDetail.java @@ -69,4 +69,10 @@ */ @ApiModelProperty("已提现金额") private BigDecimal totalWithdraw; + + /** + * 消费总金额 + */ + @ApiModelProperty("消费总金额") + private BigDecimal shopAmount; } 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 23fad57..423f894 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 @@ -103,18 +103,12 @@ <if test="null != appUser.vipId"> and ta.vip_id = #{appUser.vipId} </if> - <if test="null != appUser.shopIds and appUser.shopIds.size() > 0"> - and ta.shop_id in - <foreach collection="appUser.shopIds" item="shopId" open="(" separator="," close=")"> - #{shopId} + <if test="null != userIds and userIds.size() > 0"> + and ta.id in + <foreach collection="userIds" item="userId" open="(" separator="," close=")"> + #{userId} </foreach> </if> - and ( ta.id - in - <foreach collection="userIds" item="userId" open="(" separator="," close=")"> - #{userId} - </foreach> - or ta.shop_id = #{objectId} ) </where> </select> <select id="getUserStatistics" resultType="com.ruoyi.account.vo.UserStatistics"> @@ -146,16 +140,17 @@ </select> <select id="getUserStatisticsDetail" resultType="com.ruoyi.account.vo.UserStatisticsDetail"> SELECT - SUM(tau.shop_point+tau.share_point+tau.total_invite_point+tau.total_register_point+tau.total_share_point+tau.total_sign_point+tau.total_hour_point+total_performance_point) totalScore, - SUM(tau.shop_point) consumeScore, - SUM(tau.share_point) rebateScore, - SUM(tau.total_invite_point) inviteScore, - SUM(tau.total_register_point) registerScore, - SUM(tau.total_share_point+tau.total_sign_point+tau.total_hour_point) workScore, - SUM(tau.total_performance_point) achievementScore, - SUM(tau.total_distribution_amount) totalRebate, - SUM(tau.total_recharge_amount) totalRecharge, - SUM(tau.withdrawn_amount) totalWithdraw + ifnull(SUM(tau.shop_point+tau.share_point+tau.total_invite_point+tau.total_register_point+tau.total_share_point+tau.total_sign_point+tau.total_hour_point+total_performance_point), 0) totalScore, + ifnull(SUM(tau.shop_point), 0) consumeScore, + ifnull(SUM(tau.share_point), 0) rebateScore, + ifnull(SUM(tau.total_invite_point), 0) inviteScore, + ifnull(SUM(tau.total_register_point), 0) registerScore, + ifnull(SUM(tau.total_share_point+tau.total_sign_point+tau.total_hour_point), 0) workScore, + ifnull(SUM(tau.total_performance_point), 0) achievementScore, + ifnull(SUM(tau.total_distribution_amount), 0) totalRebate, + ifnull(SUM(tau.total_recharge_amount), 0) totalRecharge, + ifnull(SUM(tau.withdrawn_amount), 0) totalWithdraw, + ifnull(SUM(tau.shop_amount), 0) shopAmount FROM t_app_user tau <where> 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 57ba325..efd454d 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 @@ -32,6 +32,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; /** @@ -236,6 +237,7 @@ @RequestParam Integer pageNum, Integer pageSize) { + List<Integer> shopIds = new ArrayList<>(); List<Long> userIds = new ArrayList<>(); if (StringUtils.isNotEmpty(authName)){ R<List<AppUser>> uR = appUserClient.getAppUserByName(authName); @@ -244,7 +246,11 @@ return R.ok(Page.of(pageNum, pageSize)); } userIds.addAll(userList.stream().map(AppUser::getId).collect(Collectors.toList())); - + //门店名称 + Set<Integer> integers = shopClient.getShopIdByName(authName).getData(); + if(null != integers){ + shopIds.addAll(integers); + } } if (StringUtils.isNotEmpty(authPhone)){ R<List<AppUser>> uR = appUserClient.getAppUserByPhone(authPhone); @@ -253,29 +259,15 @@ return R.ok(Page.of(pageNum, pageSize)); } userIds.addAll(userList.stream().map(AppUser::getId).collect(Collectors.toList())); + //获取门店 + for (AppUser appUser : userList) { + List<Shop> data = shopClient.getShopByUserId(appUser.getId()).getData(); + if(null != data && data.size() > 0){ + shopIds.addAll(data.stream().map(Shop::getId).collect(Collectors.toList())); + } + } } - - List<Share> list = shareService.list(); - if (CollectionUtils.isEmpty(list)){ - return R.ok(Page.of(pageNum, pageSize)); - } - List<Long> objectIds = list.stream().map(Share::getObjectId).distinct().collect(Collectors.toList()); - List<AppUser> appUsers = appUserClient.listByIds(objectIds); - List<Long> appUserIds = appUsers.stream().filter(item -> !item.getDelFlag()).map(AppUser::getId).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(userIds)){ - userIds = appUserIds; - } - - - Page<Share> page = shareService.lambdaQuery() - .ne(Share::getAuditStatus, 1) - .like(name != null, Share::getName, name) - .eq(addType != null, Share::getAddType, addType) - .eq(auditStatus != null, Share::getAuditStatus, auditStatus) - .in(!CollectionUtils.isEmpty(userIds),Share::getObjectId, userIds) - .eq(Share::getDelFlag, 0) - .orderByDesc(Share::getCreateTime) - .page(Page.of(pageNum, pageSize)); + Page<Share> page = shareService.authmanagelist(name, addType, auditStatus, userIds, shopIds, pageNum, pageSize); for (Share record : page.getRecords()) { if (record.getAddType() == 2) { AppUser appUserById = appUserClient.getAppUserById(Long.valueOf(record.getObjectId())); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java index a92abbc..95c0509 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java @@ -56,6 +56,9 @@ @ApiParam("服务方式:1=上门服务,2=到店服务")Integer serviceMode, Integer pageCurr, Integer pageSize) { Long userid = tokenService.getLoginUser().getUserid(); SysUser sysUser = sysUserClient.getSysUser(userid).getData(); + if(null != status && 1 == status){ + status = 3; + } PageInfo<TechnicianSubscribeVO> pageInfo = technicianSubscribeService.getTechnicianSubscribeByUserAndShop1(Long.valueOf(sysUser.getObjectId()), status, phone, userName, serviceMode, pageCurr, pageSize); return R.ok(pageInfo); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShareMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShareMapper.java index a116b92..5b164f2 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShareMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShareMapper.java @@ -1,7 +1,11 @@ package com.ruoyi.other.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.other.api.domain.Share; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * <p> @@ -12,5 +16,19 @@ * @since 2024-11-20 */ public interface ShareMapper extends BaseMapper<Share> { + + /** + * 获取分享审核列表 + * @param page + * @param name + * @param addType + * @param auditStatus + * @param userIds + * @param shopIds + * @return + */ + PageInfo<Share> authmanagelist(PageInfo<Share> page, @Param("name") String name, @Param("addType") Integer addType, + @Param("auditStatus") Integer auditStatus, @Param("userIds") List<Long> userIds, + @Param("shopIds") List<Integer> shopIds); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShareService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShareService.java index a77005b..d9a51a5 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShareService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShareService.java @@ -1,7 +1,10 @@ package com.ruoyi.other.service; +import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.other.api.domain.Share; import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; /** * <p> @@ -12,4 +15,16 @@ * @since 2024-11-20 */ public interface ShareService extends IService<Share> { + + + /** + * 获取分享审核列表 + * @param name + * @param addType + * @param auditStatus + * @param userIds + * @param shopIds + * @return + */ + PageInfo<Share> authmanagelist(String name, Integer addType, Integer auditStatus, List<Long> userIds, List<Integer> shopIds, Integer pageNum, Integer pageSize); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShareServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShareServiceImpl.java index 44dcb61..6d2261c 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShareServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShareServiceImpl.java @@ -1,10 +1,13 @@ package com.ruoyi.other.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.other.mapper.ShareMapper; import com.ruoyi.other.api.domain.Share; import com.ruoyi.other.service.ShareService; import org.springframework.stereotype.Service; + +import java.util.List; /** * <p> @@ -16,4 +19,14 @@ */ @Service public class ShareServiceImpl extends ServiceImpl<ShareMapper, Share> implements ShareService { + + + @Override + public PageInfo<Share> authmanagelist(String name, Integer addType, Integer auditStatus, List<Long> userIds, List<Integer> shopIds, Integer pageNum, Integer pageSize) { + PageInfo<Share> pageInfo = new PageInfo<>(pageNum, pageSize); + return this.baseMapper.authmanagelist(pageInfo, name, addType, auditStatus, userIds, shopIds); + } + + + } diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShareMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShareMapper.xml new file mode 100644 index 0000000..8f66357 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShareMapper.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ruoyi.other.mapper.ShareMapper"> + + <select id="authmanagelist" resultType="com.ruoyi.other.api.domain.Share"> + select * from t_share where del_flag = 0 and audit_status != 1 + <if test="null != name and '' != name"> + and name like CONCAT('%', #{name}, '%') + </if> + <if test="null != addType"> + and add_type = #{addType} + </if> + <if test="null != auditStatus"> + and audit_status = #{auditStatus} + </if> + <if test="null != userIds and userIds.size() > 0 and null != shopIds and shopIds.size() > 0"> + and ( + (add_type = 2 and object_id in + <foreach collection="userIds" item="item" index="index" open="(" separator="," close=")"> + #{item} + </foreach> + ) or (add_type = 3 and object_id in + <foreach collection="shopIds" item="item" index="index" open="(" separator="," close=")"> + #{item} + </foreach> + ) + ) + </if> + <if test="null != userIds and userIds.size() > 0 and (null == shopIds or shopIds.size() == 0)"> + and add_type = 2 and object_id in + <foreach collection="userIds" item="item" index="index" open="(" separator="," close=")"> + #{item} + </foreach> + </if> + <if test="(null == userIds or userIds.size() == 0) and null != shopIds and shopIds.size() > 0"> + and add_type = 3 and object_id in + <foreach collection="shopIds" item="item" index="index" open="(" separator="," close=")"> + #{item} + </foreach> + </if> + order by create_time desc + </select> +</mapper> \ No newline at end of file -- Gitblit v1.7.1