Merge remote-tracking branch 'origin/master'
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "变动类型(1-消费,2-返佣,3-拉新,4-每日分享,5-每日签到,6-使用时长, 7-注册积分, 8-门店业绩," + |
| | | "9-门店返佣,14-下级门店返佣,10-技师业绩,11-兑换商品,12-他人赠送,13-赠与他人)") |
| | | "9-门店返佣,14-下级门店返佣,10-技师业绩,11-兑换商品,12-他人赠送,13-赠与他人,14-兑换券)") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | |
| | | user.setShopName(shop.getName()); |
| | | } |
| | | } |
| | | Long count1 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count2 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 2).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count3 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 3).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count4 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 4).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count5 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 5).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count6 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 6).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | Long count7 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 7).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | user.setCount1(count1); |
| | | user.setCount2(count2); |
| | | user.setCount3(count3); |
| | | user.setCount4(count4); |
| | | user.setCount5(count5); |
| | | user.setCount6(count6); |
| | | user.setCount7(count7); |
| | | List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .ne(AppUser::getStatus, 3) |
| | | .eq(AppUser::getDelFlag, 0)); |
| | | ArrayList<Long> userIds = new ArrayList<>(); |
| | | userIds.add(userId); |
| | | getUserAncestorList(user,userIds, appUserList); |
| | | // Long count1 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | // Long count2 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 2).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | // Long count3 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 3).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | // Long count4 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 4).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | // Long count5 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 5).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | // Long count6 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 6).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | // Long count7 = appUserService.lambdaQuery().ne(AppUser::getStatus,3).eq(AppUser::getVipId, 7).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count(); |
| | | // user.setCount1(count1); |
| | | // user.setCount2(count2); |
| | | // user.setCount3(count3); |
| | | // user.setCount4(count4); |
| | | // user.setCount5(count5); |
| | | // user.setCount6(count6); |
| | | // user.setCount7(count7); |
| | | |
| | | List<UserSignRecord> list = userSignRecordService.lambdaQuery().eq(UserSignRecord::getSignDay, LocalDate.now()) |
| | | .eq(UserSignRecord::getAppUserId,userId).list(); |
| | |
| | | user.setIsSign(0); |
| | | } |
| | | return R.ok(user); |
| | | |
| | | |
| | | } |
| | | public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> list) { |
| | | List<AppUser> children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(children)){ |
| | | user.setCount1((user.getCount1() == null ? 0L : user.getCount1()) + children.stream().filter(e->e.getVipId() == 1).count()); |
| | | user.setCount2((user.getCount2() == null ? 0L : user.getCount2()) + children.stream().filter(e->e.getVipId() == 2).count()); |
| | | user.setCount3((user.getCount3() == null ? 0L : user.getCount3()) + children.stream().filter(e->e.getVipId() == 3).count()); |
| | | user.setCount4((user.getCount4() == null ? 0L : user.getCount4()) + children.stream().filter(e->e.getVipId() == 4).count()); |
| | | user.setCount5((user.getCount5() == null ? 0L : user.getCount5()) + children.stream().filter(e->e.getVipId() == 5).count()); |
| | | user.setCount6((user.getCount6() == null ? 0L : user.getCount6()) + children.stream().filter(e->e.getVipId() == 6).count()); |
| | | user.setCount7((user.getCount7() == null ? 0L : user.getCount7()) + children.stream().filter(e->e.getVipId() == 7).count()); |
| | | List<Long> userIdList = children.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | getUserAncestorList(user,userIdList, children); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("/index/change") |
| | |
| | | appUserService.updateById(byId); |
| | | |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(11); |
| | | userPoint.setType(14); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(point); |
| | | userPoint.setBalance(byId.getLavePoint()); |
| | |
| | | and t2.phone like concat('%',#{agentQuery.phone},'%') |
| | | </if> |
| | | <if test="agentQuery.vipId !=null"> |
| | | and t1.application_vip_id = #{agentQuery.vipId} |
| | | and t2.vip_id = #{agentQuery.vipId} |
| | | </if> |
| | | <if test="agentQuery.status !=null"> |
| | | and t1.status = #{agentQuery.status} |
| | |
| | | package com.ruoyi.account; |
| | | package com.ruoyi.order.account; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.RuoYiAccountApplication; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiAccountApplication.class) |
| | | public class RuoYiAccountApplicationTests { |
| | | |
| | | @Autowired |
| | | private AppUserService appUserService; |
| | | |
| | | @Test |
| | | public void contextLoads() { |
| | | List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .ne(AppUser::getStatus, 3) |
| | | .eq(AppUser::getDelFlag, 0)); |
| | | AppUser user = appUserService.getById(1879046499735789569L); |
| | | ArrayList<Long> userIds = new ArrayList<>(); |
| | | userIds.add(1879046499735789569L); |
| | | getUserAncestorList(user,userIds, appUserList); |
| | | System.err.println(user.getCount1()); |
| | | System.err.println(user.getCount2()); |
| | | System.err.println(user.getCount3()); |
| | | System.err.println(user.getCount4()); |
| | | System.err.println(user.getCount5()); |
| | | System.err.println(user.getCount6()); |
| | | System.err.println(user.getCount7()); |
| | | } |
| | | public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> list) { |
| | | List<AppUser> children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(children)){ |
| | | user.setCount1((user.getCount1() == null ? 0L : user.getCount1()) + children.stream().filter(e->e.getVipId() == 1).count()); |
| | | user.setCount2((user.getCount2() == null ? 0L : user.getCount2()) + children.stream().filter(e->e.getVipId() == 2).count()); |
| | | user.setCount3((user.getCount3() == null ? 0L : user.getCount3()) + children.stream().filter(e->e.getVipId() == 3).count()); |
| | | user.setCount4((user.getCount4() == null ? 0L : user.getCount4()) + children.stream().filter(e->e.getVipId() == 4).count()); |
| | | user.setCount5((user.getCount5() == null ? 0L : user.getCount5()) + children.stream().filter(e->e.getVipId() == 5).count()); |
| | | user.setCount6((user.getCount6() == null ? 0L : user.getCount6()) + children.stream().filter(e->e.getVipId() == 6).count()); |
| | | user.setCount7((user.getCount7() == null ? 0L : user.getCount7()) + children.stream().filter(e->e.getVipId() == 7).count()); |
| | | List<Long> userIdList = children.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | getUserAncestorList(user,userIdList, children); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/getGoodsSaleNum") |
| | | public R<Integer> getGoodsSaleNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("type") Integer type){ |
| | | Integer goodsSaleNum = orderService.getGoodsSaleNum(goodsId, type); |
| | | Integer goodsSaleNum = orderService.getGoodsSaleNum(goodsId, type, null); |
| | | return R.ok(goodsSaleNum); |
| | | } |
| | | |
| | |
| | | * @param goodsId |
| | | * @return |
| | | */ |
| | | Integer getGoodsSaleNum(@Param("goodsId") Integer goodsId, @Param("type") Integer type); |
| | | Integer getGoodsSaleNum(@Param("goodsId") Integer goodsId, |
| | | @Param("type") Integer type, |
| | | @Param("userId") Long userId); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param goodsId |
| | | * @return |
| | | */ |
| | | Integer getGoodsSaleNum(Integer goodsId, Integer type); |
| | | Integer getGoodsSaleNum(Integer goodsId, Integer type, Long userId); |
| | | |
| | | |
| | | /** |
| | |
| | | if(Arrays.asList(5, 6, 7).contains(order.getOrderStatus())){ |
| | | return R.fail("无效的操作"); |
| | | } |
| | | if(LocalDateTime.now().isAfter(order.getAfterSaleTime())){ |
| | | if(null != order.getAfterSaleTime() && LocalDateTime.now().isAfter(order.getAfterSaleTime())){ |
| | | return R.fail("订单取消失败"); |
| | | } |
| | | order.setOrderStatus(5); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getGoodsSaleNum(Integer goodsId, Integer type) { |
| | | return this.baseMapper.getGoodsSaleNum(goodsId, type); |
| | | public Integer getGoodsSaleNum(Integer goodsId, Integer type, Long userId) { |
| | | return this.baseMapper.getGoodsSaleNum(goodsId, type, userId); |
| | | } |
| | | |
| | | |
| | |
| | | num += num1; |
| | | ShoppingCart shoppingCart = this.getById(id); |
| | | //判断当前数量是否已经超出限购数量(需要计算已经购买的数量) |
| | | Integer goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), type); |
| | | Integer goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), type, userid); |
| | | Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | if(1 == type){ |
| | | if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && (goodsSaleNum + num1) > goods.getPurchaseLimit()){ |
| | |
| | | <if test="null != type"> |
| | | and a.type = #{type} |
| | | </if> |
| | | <if test="userId != null"> |
| | | and b.app_user_id = #{userId} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | |
| | | share.setObjectId(userid); |
| | | } |
| | | share.setDelFlag(0); |
| | | share.setAppletShare(1); |
| | | share.setCreateTime(LocalDateTime.now()); |
| | | shareService.save(share); |
| | | return R.ok(); |
| | |
| | | @Override |
| | | public int compare(GoodsVO o1, GoodsVO o2) { |
| | | if(null != o1.getIntegral() && null != o2.getIntegral()){ |
| | | return o1.getIntegral().compareTo(o2.getIntegral()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1); |
| | | return o1.getIntegral().compareTo(o2.getIntegral()) * ("desc".equals(search.getIsAsc()) ? -1 : 1); |
| | | } |
| | | if(null == o1.getIntegral() && null != o2.getIntegral()){ |
| | | return Integer.valueOf(0).compareTo(o2.getIntegral()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1); |
| | | return Integer.valueOf(0).compareTo(o2.getIntegral()) * ("desc".equals(search.getIsAsc()) ? -1 : 1); |
| | | } |
| | | if(null != o1.getIntegral() && null == o2.getIntegral()){ |
| | | return o1.getIntegral().compareTo(Integer.valueOf(0)) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1); |
| | | return o1.getIntegral().compareTo(Integer.valueOf(0)) * ("desc".equals(search.getIsAsc()) ? -1 : 1); |
| | | } |
| | | return 0; |
| | | } |
| | |
| | | list.sort(new Comparator<GoodsVO>() { |
| | | @Override |
| | | public int compare(GoodsVO o1, GoodsVO o2) { |
| | | return o1.getSaleNum().compareTo(o2.getSaleNum()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1); |
| | | return o1.getSaleNum().compareTo(o2.getSaleNum()) * ("desc".equals(search.getIsAsc()) ? -1 : 1); |
| | | } |
| | | }); |
| | | } |