| | |
| | | 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 |
| | |
| | | * 角色权限 |
| | | */ |
| | | public static final String ROLE_PERMISSION = "role_permission"; |
| | | |
| | | /** |
| | | * 过期时间 |
| | | */ |
| | | public static final String EXPIRATION_TIME = "expiration_time"; |
| | | } |
| | |
| | | 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>(); |
| | |
| | | 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)); |
| | |
| | | import io.jsonwebtoken.Claims; |
| | | import reactor.core.publisher.Mono; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | 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)) { |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | 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()); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | |
| | | 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); |
| | | |
| | |
| | | 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); |
| | | |
| | | /** |
| | | * 处理用户会员等级 |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPointService.save(userPoint); |
| | | //变更等级 |
| | | vipUpgrade(appUser.getId()); |
| | | } |
| | | //变更等级 |
| | | vipUpgrade(appUser.getId()); |
| | | } |
| | | }else{ |
| | | jsonObject.put("online", online); |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @ApiModelProperty("已提现金额") |
| | | private BigDecimal totalWithdraw; |
| | | |
| | | /** |
| | | * 消费总金额 |
| | | */ |
| | | @ApiModelProperty("消费总金额") |
| | | private BigDecimal shopAmount; |
| | | } |
| | |
| | | <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"> |
| | |
| | | </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> |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @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); |
| | |
| | | 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); |
| | |
| | | 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())); |
| | |
| | | @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); |
| | | } |
| | |
| | | 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> |
| | |
| | | * @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); |
| | | |
| | | } |
| | |
| | | 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> |
| | |
| | | * @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); |
| | | } |
| | |
| | | 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> |
| | |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | <?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> |