Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng
| | |
| | | } |
| | | |
| | | @Override |
| | | public void vipDemotion(Long appUserId) { |
| | | R.fail("检查会员等级降级失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void demotionDetection() { |
| | | R.fail("用户降级检测失败:" + cause.getMessage()); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 检查会员降级 |
| | | * @param appUserId |
| | | */ |
| | | @PostMapping("/app-user/vipDemotion") |
| | | void vipDemotion(@RequestParam("appUserId") Long appUserId); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 用户降级检测 |
| | | */ |
| | | @PostMapping("/app-user/demotionDetection") |
| | |
| | | @TableField(exist = false) |
| | | private String shopName; |
| | | |
| | | @ApiModelProperty(value = "增或减标识: 1-增 2-减") |
| | | @TableField(exist = false) |
| | | private Integer flag; |
| | | |
| | | } |
| | |
| | | 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-赠与他人,15-兑换券)") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Order>> byUserId(Long appUserId) { |
| | | public R<List<Order>> byUserId(Long appUserId,Integer shopId) { |
| | | return R.fail(); |
| | | } |
| | | |
| | |
| | | public R<List<Order>> byShopId(Integer shopId) { |
| | | return R.fail(); |
| | | } |
| | | @Override |
| | | public R<List<Order>> byShopIdAndUserId(Long userId,Integer shopId) { |
| | | return R.fail("通过门店和用户id查询订单失败"); |
| | | } |
| | | }; |
| | | |
| | | } |
| | |
| | | R<List<Order>> getOrderListByIds(@RequestBody List<Long> orderIds); |
| | | |
| | | @PostMapping("/order/byUserId") |
| | | R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId); |
| | | R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId); |
| | | @PostMapping("/order/byShopId") |
| | | R<List<Order>> byShopId(@RequestParam("shopId") Integer shopId); |
| | | @PostMapping("/order/byShopIdAndUserId") |
| | | R<List<Order>> byShopIdAndUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId); |
| | | |
| | | |
| | | /** |
| | |
| | | private String expressResult; |
| | | |
| | | @ApiModelProperty("最新快递信息") |
| | | @TableField(exist = false) |
| | | private String express; |
| | | } |
| | |
| | | */ |
| | | @TableField(exist = false) |
| | | private String isAsc; |
| | | @TableField(exist = false) |
| | | private Integer pageNum; |
| | | @TableField(exist = false) |
| | | private Integer pageSize; |
| | | |
| | | |
| | | public String getIdStr() { |
| | |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.factory.StoreFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | |
| | | */ |
| | | @FeignClient(contextId = "StoreClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = StoreFallbackFactory.class) |
| | | public interface StoreClient { |
| | | @PostMapping(value = "/shop/getDetailById") |
| | | @GetMapping(value = "/shop/getDetailById") |
| | | R<Shop> getStoreById(@RequestParam("id") Integer id); |
| | | |
| | | |
| | |
| | | if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户已停用,请联系管理员"); |
| | | // throw new ServiceException("对不起,您的账号:" + username + " 已停用"); |
| | | throw new ServiceException("您所属门店已被冻结,请联系平台"); |
| | | throw new ServiceException("您的账号已被禁用,请联系平台"); |
| | | } |
| | | passwordService.validate(user, password, request); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "登录成功"); |
| | |
| | | this.pageNum = pageNum; |
| | | } |
| | | |
| | | public void setPageCurr(Integer pageCurr){ |
| | | this.pageNum = pageCurr; |
| | | } |
| | | |
| | | public Integer getPageSize() |
| | | { |
| | | return pageSize; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 个人信息 业务处理 |
| | |
| | | System.err.println(newPassword); |
| | | // String username = SecurityUtils.getUsername(); |
| | | SysUser user = userService.selectUserByUserName(username); |
| | | if (Objects.isNull(user)) |
| | | { |
| | | return error("未查询到该账号"); |
| | | } |
| | | String password = user.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) |
| | | { |
| | |
| | | if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { |
| | | return error("当前用户不能删除"); |
| | | } |
| | | return toAjax(userService.deleteUserByIds(userIds)); |
| | | userService.deleteUserByIds(userIds); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | |
| | | * @param userIds 需要删除的用户ID |
| | | * @return 结果 |
| | | */ |
| | | int deleteUserByIds(Long[] userIds); |
| | | void deleteUserByIds(Long[] userIds); |
| | | |
| | | /** |
| | | * 导入用户数据 |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteUserByIds(Long[] userIds) { |
| | | public void deleteUserByIds(Long[] userIds) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = this.getById(userid); |
| | | for (Long userId : userIds) { |
| | |
| | | userMapper.deleteUserById(user.getUserId()); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | update sys_user set password = #{password} where user_name = #{userName} |
| | | </update> |
| | | |
| | | <delete id="deleteUserById" parameterType="Long"> |
| | | <update id="deleteUserById" parameterType="Long"> |
| | | update sys_user set del_flag = '2' where user_id = #{userId} |
| | | </delete> |
| | | </update> |
| | | |
| | | <delete id="deleteUserByIds" parameterType="Long"> |
| | | <update id="deleteUserByIds" parameterType="Long"> |
| | | update sys_user set del_flag = '2' where user_id in |
| | | <foreach collection="array" item="userId" open="(" separator="," close=")"> |
| | | #{userId} |
| | | </foreach> |
| | | </delete> |
| | | </update> |
| | | <delete id="deleteSysUser"> |
| | | delete from sys_user where user_id in |
| | | <foreach collection="userIds" separator="," open="(" item="id" close=")" > |
| | |
| | | package com.ruoyi.account.controller; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.account.api.model.AgentApplication; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | |
| | | import com.ruoyi.account.service.AgentApplicationService; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserChangeLogService; |
| | | import com.ruoyi.account.service.VipCenterService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private BaseSettingClient baseSettingClient; |
| | | @Resource |
| | | private VipCenterService vipCenterService; |
| | | |
| | | @PostMapping("/apply") |
| | | @ApiOperation(value = "会员申请", tags = {"会员中心-小程序"}) |
| | |
| | | userChangeLogService.save(userChangeLog); |
| | | //变更会员等级 |
| | | byId1.setVipId(byId.getApplicationVipId()); |
| | | appUserService.updateById(byId1); |
| | | |
| | | // 当用户为合伙人时,计算合伙人积分和培育积分 |
| | | Integer vipId = byId1.getVipId(); |
| | | if (vipId == 7){ |
| | | R<BaseSetting> baseSetting = baseSettingClient.getBaseSetting(1); |
| | | BaseSetting data = baseSetting.getData(); |
| | | int basePoint = Integer.parseInt(data.getContent()); |
| | | // 当前用户计算合伙人积分 |
| | | R<VipSetting> vipSetting = vipSettingClient.getVipSetting(vipId); |
| | | setPoint(vipSetting, byId1, byId1.getShopPoint(), byId1.getSharePoint()); |
| | | Integer point = getPoint(vipSetting, byId1, basePoint); |
| | | byId1.setPartPoint(point); |
| | | // 上级计算培育积分 |
| | | R<BaseSetting> baseSetting2 = baseSettingClient.getBaseSetting(1); |
| | | BaseSetting data2 = baseSetting2.getData(); |
| | | int basePoint2 = Integer.parseInt(data2.getContent()); |
| | | Long inviteUserId = byId1.getInviteUserId(); |
| | | AppUser byId2 = appUserService.getById(inviteUserId); |
| | | if (byId2 != null){ |
| | | setPoint(vipSetting, byId2, byId1.getShopPoint(), byId1.getSharePoint()); |
| | | Integer point1 = getPoint(vipSetting, byId2, basePoint2); |
| | | byId2.setPartGrowPoint(point1); |
| | | } |
| | | } |
| | | |
| | | appUserService.updateById(byId1); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | private void setPoint(R<VipSetting> vipSetting, AppUser appUser, Integer shopPoint, Integer sharePoint) { |
| | | private Integer getPoint(R<VipSetting> vipSetting, AppUser appUser, Integer basePoint) { |
| | | VipSetting vipSettingData = vipSetting.getData(); |
| | | Integer vipLevelUpShopRole = vipSettingData.getVipLevelUpShopRole(); |
| | | int i = 1; |
| | | if (vipLevelUpShopRole == 1){ |
| | | Integer vipLevelUpShop = vipSettingData.getVipLevelUpShop(); |
| | | Integer vipLevelUpShare = vipSettingData.getVipLevelUpShare(); |
| | | if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare) { |
| | | R<BaseSetting> baseSetting = baseSettingClient.getBaseSetting(1); |
| | | BaseSetting data = baseSetting.getData(); |
| | | if (data != null){ |
| | | appUser.setPartPoint(Integer.parseInt(data.getContent())); |
| | | appUserService.updateById(appUser); |
| | | } |
| | | } |
| | | i += 1; |
| | | } |
| | | Integer vipLevelUpNumRole = vipSettingData.getVipLevelUpNumRole(); |
| | | if (vipLevelUpNumRole == 1){ |
| | | i += 1; |
| | | } |
| | | |
| | | |
| | | if (vipCenterService.checkReadyToBePartner(appUser.getId())){ |
| | | return basePoint * i; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | |
| | |
| | | .eq(AppUser::getDelFlag, 0)); |
| | | ArrayList<Long> userIds = new ArrayList<>(); |
| | | userIds.add(userId); |
| | | getUserAncestorList(userIds, appUserList); |
| | | getUserAncestorList(user,userIds,new ArrayList<>(),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 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); |
| | | // 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(); |
| | |
| | | } |
| | | return R.ok(user); |
| | | } |
| | | private Long count1 = 0L; |
| | | private Long count2 = 0L; |
| | | private Long count3 = 0L; |
| | | private Long count4 = 0L; |
| | | private Long count5 = 0L; |
| | | private Long count6 = 0L; |
| | | private Long count7 = 0L; |
| | | public void getUserAncestorList(List<Long> userIds, List<AppUser> list) { |
| | | List<AppUser> children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList()); |
| | | public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> children,List<AppUser> list) { |
| | | children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(children)){ |
| | | count1 = count1 + children.stream().filter(e->e.getVipId() == 1).count(); |
| | | count2 = count2 + children.stream().filter(e->e.getVipId() == 2).count(); |
| | | count3 = count3 + children.stream().filter(e->e.getVipId() == 3).count(); |
| | | count4 = count4 + children.stream().filter(e->e.getVipId() == 4).count(); |
| | | count5 = count5 + children.stream().filter(e->e.getVipId() == 5).count(); |
| | | count6 = count6 + children.stream().filter(e->e.getVipId() == 6).count(); |
| | | count7 = count7 + children.stream().filter(e->e.getVipId() == 7).count(); |
| | | 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(userIdList, children); |
| | | getUserAncestorList(user,userIdList, children,list); |
| | | } |
| | | } |
| | | |
| | |
| | | DangerInfoDto dangerInfoDto = new DangerInfoDto(); |
| | | BeanUtils.copyProperties(data, dangerInfoDto); |
| | | List<UserPoint> list1 = userPointService.lambdaQuery().eq(UserPoint::getType, 1).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list2 = userPointService.lambdaQuery().eq(UserPoint::getType, 2).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list3 = userPointService.lambdaQuery().eq(UserPoint::getType, 5).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list2 = userPointService.lambdaQuery().eq(UserPoint::getType, 9).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | List<UserPoint> list3 = userPointService.lambdaQuery().eq(UserPoint::getType, 8).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); |
| | | Integer userKeepBuyPoint = 0; |
| | | for (UserPoint userPoint : list1) { |
| | | userKeepBuyPoint = userPoint.getVariablePoint() + userKeepBuyPoint; |
| | |
| | | List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).list(); |
| | | byId.setBottomUsers(list); |
| | | //消费总金额 |
| | | R<List<Order>> orderR = remoteOrderGoodsClient.byShopId(sysUser.getObjectId()); |
| | | R<List<Order>> orderR = remoteOrderGoodsClient.byShopIdAndUserId(id,sysUser.getObjectId()); |
| | | List<Order> orderList = orderR.getData(); |
| | | if (!CollectionUtils.isEmpty(orderList)){ |
| | | BigDecimal paymentAmount = orderList.stream().map(Order::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | |
| | | @GetMapping("/orders") |
| | | @ApiOperation(value = "用户列表-订单列表", tags = {"管理后台"}) |
| | | public R<List<Order>> orders(Long id) { |
| | | R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id); |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userid).getData(); |
| | | Integer shopId = sysUser.getObjectId(); |
| | | R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id,shopId); |
| | | return R.ok(listR.getData()); |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 检查会员降级 |
| | | * @param appUserId |
| | | */ |
| | | @PostMapping("/app-user/vipDemotion") |
| | | public void vipDemotion(@RequestParam("appUserId") Long appUserId){ |
| | | appUserService.vipDemotion(appUserId); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 用户降级检测 |
| | | */ |
| | | @PostMapping("/demotionDetection") |
| | |
| | | appUserService.updateById(byId); |
| | | |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(11); |
| | | userPoint.setType(15); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(point); |
| | | userPoint.setBalance(byId.getLavePoint()); |
| | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import com.ruoyi.account.api.model.BalancePayment; |
| | |
| | | */ |
| | | @ApiOperation(value = "变更明细", notes = "变更明细") |
| | | @GetMapping("change") |
| | | public R<List<BalanceChangeRecord>> change(@ApiParam(value = "变更类型") |
| | | public R<IPage<BalanceChangeRecord>> change(@ApiParam(value = "变更类型") |
| | | @RequestParam(required = false) Integer changeType, |
| | | @ApiParam(value = "创建时间") |
| | | Integer pageCurr, |
| | | Integer pageSize, |
| | | @ApiParam(value = "创建时间") |
| | | @RequestParam(required = false) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | LocalDate createTime) { |
| | |
| | | endTime = lastDayOfMonth.atTime(LocalTime.MAX); |
| | | } |
| | | |
| | | List<BalanceChangeRecord> list = balanceChangeRecordService.list(new LambdaQueryWrapper<BalanceChangeRecord>() |
| | | Page<BalanceChangeRecord> page = balanceChangeRecordService.page(Page.of(pageCurr, pageSize), new LambdaQueryWrapper<BalanceChangeRecord>() |
| | | .eq(changeType != null, BalanceChangeRecord::getChangeType, changeType) |
| | | .between(startTime != null, BalanceChangeRecord::getCreateTime, startTime, endTime) |
| | | .eq(BalanceChangeRecord::getAppUserId, userId).orderByDesc(BalanceChangeRecord::getCreateTime)); |
| | | |
| | | List<BalanceChangeRecord> list = page.getRecords(); |
| | | |
| | | List<Long> orderIds = list.stream().map(BalanceChangeRecord::getOrderId).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(orderIds)){ |
| | |
| | | orderList.stream().filter(o -> o.getId().equals(bc.getOrderId())).findFirst().ifPresent(o -> { |
| | | Long appUserId = o.getAppUserId(); |
| | | AppUser appUser = appUserService.getById(appUserId); |
| | | bc.setUserName(appUser.getName()); |
| | | bc.setAmount(o.getPaymentAmount()); |
| | | if(null != appUser){ |
| | | bc.setUserName(appUser.getName()); |
| | | bc.setAmount(o.getPaymentAmount()); |
| | | } |
| | | }); |
| | | |
| | | BigDecimal beforeAmount = bc.getBeforeAmount(); |
| | | BigDecimal afterAmount = bc.getAfterAmount(); |
| | | if (beforeAmount.compareTo(afterAmount) > 0){ |
| | | bc.setFlag(2); |
| | | }else { |
| | | bc.setFlag(1); |
| | | } |
| | | }); |
| | | } |
| | | return R.ok(list); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | /** |
| | |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | */ |
| | | void vipUpgrade(Long appUserId); |
| | | |
| | | /** |
| | | * 处理用户会员降级 |
| | | * @param appUserId |
| | | */ |
| | | void vipDemotion(Long appUserId); |
| | | |
| | | |
| | | /** |
| | | * 降级检测 |
| | |
| | | } |
| | | |
| | | //查询用户是否注册,没有注册则跳转到注册页面 |
| | | AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, mobileLogin.getPhone()).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, mobileLogin.getPhone()) |
| | | .ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | if(null == appUser){ |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(2); |
| | |
| | | loginUser.setUsername(appUser.getName()); |
| | | Map<String, Object> tokenApplet = tokenService.createTokenApplet(loginUser); |
| | | loginVo.setToken(tokenApplet.get("access_token").toString()); |
| | | loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString())); |
| | | |
| | | loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString())); |
| | | appUser.setLastLoginTime(LocalDateTime.now()); |
| | | this.updateById(appUser); |
| | | return R.ok(loginVo); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理会员降级 |
| | | * @param appUserId |
| | | */ |
| | | @Override |
| | | public void vipDemotion(Long appUserId) { |
| | | AppUser appUser = this.getById(appUserId); |
| | | Integer vipId = appUser.getVipId(); |
| | | //黄金会员 |
| | | 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(0); |
| | | 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(0); |
| | | userChangeLogService.save(userChangeLog); |
| | | return; |
| | | } |
| | | //下级人数满足升级 |
| | | Integer vipLevelUpNumRole = vipSetting2.getVipLevelUpNumRole(); |
| | | Integer vipDirectNum = vipSetting2.getVipDirectNum(); |
| | | Integer vipTeamNum = vipSetting2.getVipTeamNum(); |
| | | if(1 == vipLevelUpNumRole && appUser.getVipId() > 2){ |
| | | //查询直推用户达到X人或者团队人数达到X人后,可升级 |
| | | //直推用户数 |
| | | long count = this.count(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1).eq(AppUser::getInviteUserId, appUserId)); |
| | | //团队用户数 |
| | | List<AppUser> subordinate = getSubordinate(appUserId); |
| | | if(vipDirectNum <= count || vipTeamNum <= subordinate.size()){ |
| | | 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(0); |
| | | userChangeLogService.save(userChangeLog); |
| | | return; |
| | | } |
| | | } |
| | | if(appUser.getVipId() > 2){ |
| | | appUser.setVipId(1); |
| | | 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(0); |
| | | userChangeLogService.save(userChangeLog); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 递归查询顶级推广人 |
| | |
| | | // 获取用户直推代理用户数量 |
| | | List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .in(AppUser::getId, userShopList) |
| | | .eq(AppUser::getVipId, 5)); |
| | | .gt(AppUser::getVipId, 4)); |
| | | |
| | | // 代理下的准代理数量 |
| | | List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | |
| | | |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserService.getById(loginUserApplet.getUserid()); |
| | | Integer vipId = appUser.getVipId(); |
| | | VipSetting vipSetting = vipSettingService.getVipSettingById(vipId); |
| | | BigDecimal withdrawableAmount = appUser.getWithdrawableAmount(); |
| | | |
| | | BigDecimal vipWithdrawalMinAmount = vipSetting.getVipWithdrawalMinAmount(); |
| | | if (vipWithdrawalMinAmount.compareTo(withdrawableAmount) > 0) { |
| | | throw new ServiceException("提现失败,提现门槛为:"+vipWithdrawalMinAmount+"元!"); |
| | | } |
| | | |
| | | if (appUser.getWithdrawableAmount().compareTo(withdrawalAmount) < 0) { |
| | | throw new ServiceException("提现失败,可提现金额不足!"); |
| | | } |
| | | |
| | | Integer vipId = appUser.getVipId(); |
| | | VipSetting vipSetting = vipSettingService.getVipSettingById(vipId); |
| | | |
| | | if (vipSetting.getVipWithdrawalRole() == 0) { |
| | | throw new ServiceException("提现失败,当前会员等级不允许提现!"); |
| | | } |
| | | BigDecimal vipWithdrawalMinAmount = vipSetting.getVipWithdrawalMinAmount(); |
| | | if (withdrawalAmount.compareTo(vipWithdrawalMinAmount) < 0) { |
| | | throw new ServiceException("提现失败,提现金额不能小于" + vipWithdrawalMinAmount + "元!"); |
| | | } |
| | | |
| | | |
| | | // 提现手续费 |
| | | BigDecimal vipWithdrawalFee = vipSetting.getVipWithdrawalFee() |
| | | .divide(VIP_WITHDRAWAL_FEE_DENOMINATOR, 2, RoundingMode.HALF_UP); |
| | |
| | | withdrawalRequests.setAuditStatus(1); |
| | | save(withdrawalRequests); |
| | | //修改用户的可提现金额 |
| | | BigDecimal withdrawableAmount = appUser.getWithdrawableAmount(); |
| | | BigDecimal withdrawnAmount = appUser.getWithdrawnAmount(); |
| | | BigDecimal balance = appUser.getBalance(); |
| | | appUser.setWithdrawableAmount(withdrawableAmount.subtract(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN)); |
| | |
| | | @Test |
| | | public void contextLoads() { |
| | | List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .ne(AppUser::getStatus, 3)); |
| | | .ne(AppUser::getStatus, 3) |
| | | .eq(AppUser::getDelFlag, 0)); |
| | | AppUser user = appUserService.getById(1879047378761244673L); |
| | | ArrayList<Long> userIds = new ArrayList<>(); |
| | | userIds.add(1879046499735789569L); |
| | | getUserAncestorList(userIds, appUserList); |
| | | System.err.println(count1); |
| | | System.err.println(count2); |
| | | System.err.println(count3); |
| | | System.err.println(count4); |
| | | System.err.println(count5); |
| | | System.err.println(count6); |
| | | System.err.println(count7); |
| | | userIds.add(1879047378761244673L); |
| | | getUserAncestorList(user,userIds, new ArrayList<>(),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()); |
| | | } |
| | | |
| | | private Long count1 = 0L; |
| | | private Long count2 = 0L; |
| | | private Long count3 = 0L; |
| | | private Long count4 = 0L; |
| | | private Long count5 = 0L; |
| | | private Long count6 = 0L; |
| | | private Long count7 = 0L; |
| | | public void getUserAncestorList(List<Long> userIds, List<AppUser> list) { |
| | | List<AppUser> children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList()); |
| | | public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> children,List<AppUser> list) { |
| | | children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(children)){ |
| | | count1 = count1 + children.stream().filter(e->e.getVipId() == 1).count(); |
| | | count2 = count2 + children.stream().filter(e->e.getVipId() == 2).count(); |
| | | count3 = count3 + children.stream().filter(e->e.getVipId() == 3).count(); |
| | | count4 = count4 + children.stream().filter(e->e.getVipId() == 4).count(); |
| | | count5 = count5 + children.stream().filter(e->e.getVipId() == 5).count(); |
| | | count6 = count6 + children.stream().filter(e->e.getVipId() == 6).count(); |
| | | count7 = count7 + children.stream().filter(e->e.getVipId() == 7).count(); |
| | | 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(userIdList, children); |
| | | getUserAncestorList(user,userIdList, children,list); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @PostMapping("/byUserId") |
| | | public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId){ |
| | | return R.ok(orderService.lambdaQuery().eq(Order::getAppUserId, appUserId).list()); |
| | | public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId){ |
| | | return R.ok(orderService.lambdaQuery().eq(Order::getAppUserId, appUserId).eq(Order::getShopId, shopId).list()); |
| | | } |
| | | @PostMapping("/byShopId") |
| | | public R<List<Order>> byShopId(@RequestParam("shopId") Integer shopId){ |
| | | return R.ok(orderService.lambdaQuery().isNotNull(Order::getEndTime).eq(Order::getShopId, shopId).list()); |
| | | } |
| | | @PostMapping("/byShopIdAndUserId") |
| | | public R<List<Order>> byShopIdAndUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId){ |
| | | List<Order> list = orderService.lambdaQuery().isNotNull(Order::getEndTime).eq(Order::getShopId, shopId).eq(Order::getAppUserId, appUserId).in(Order::getOrderStatus, 4, 7, 8).list(); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @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); |
| | | } |
| | | |
| | |
| | | if(StringUtils.isNotEmpty(one.getExpressResult())){ |
| | | MapTrackKD100Vo mapTrackKD100Vo = JSON.parseObject(one.getExpressResult(), MapTrackKD100Vo.class); |
| | | List<QueryKD100ListVo> data = mapTrackKD100Vo.getData(); |
| | | one.setExpress(data.size() > 0 ? data.get(0).getContext() : ""); |
| | | one.setExpress(null != data && data.size() > 0 ? data.get(0).getContext() : ""); |
| | | } |
| | | return R.ok(one); |
| | | } |
| | |
| | | * @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); |
| | | |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.feignClient.BalanceChangeRecordClient; |
| | | import com.ruoyi.account.api.feignClient.UserCouponClient; |
| | | import com.ruoyi.account.api.feignClient.UserPointClient; |
| | | import com.ruoyi.account.api.feignClient.*; |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | private UserPointClient userPointClient; |
| | | |
| | | @Resource |
| | | private PointSettingClient pointSettingClient; |
| | | |
| | | @Resource |
| | | private OrderBalancePaymentService orderBalancePaymentService; |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private UserCouponClient userCouponClient; |
| | | |
| | | @Resource |
| | | private UserChangeLogClient userChangeLogClient; |
| | | |
| | | |
| | | |
| | |
| | | if(StringUtils.isNotEmpty(order.getExpressResult())){ |
| | | MapTrackKD100Vo mapTrackKD100Vo = JSON.parseObject(order.getExpressResult(), MapTrackKD100Vo.class); |
| | | List<QueryKD100ListVo> data = mapTrackKD100Vo.getData(); |
| | | orderDetailVO.setExpress(data.size() > 0 ? data.get(0).getContext() : ""); |
| | | orderDetailVO.setExpress(null != data && data.size() > 0 ? data.get(0).getContext() : ""); |
| | | } |
| | | |
| | | if(order.getOrderType() == 1){ |
| | |
| | | if(StringUtils.isNotEmpty(technicianId) && !"null".equals(technicianId)){ |
| | | order.setTechnicianId(Integer.valueOf(technicianId)); |
| | | } |
| | | // TODO |
| | | orderMapper.updateById(order); |
| | | } |
| | | |
| | |
| | | } |
| | | appUser.setTotalPoint(appUser.getTotalPoint() - shopPoint); |
| | | |
| | | boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId()); |
| | | if(vipDemotion){ |
| | | appUser.setVipId(appUser.getVipId() - 1); |
| | | } |
| | | |
| | | //构建积分流水明细 |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(1); |
| | |
| | | userPoint.setObjectId(order.getId()); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | appUserClient.editAppUserById(appUser); |
| | | |
| | | //降级检测 |
| | | boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId()); |
| | | if(vipDemotion){ |
| | | appUserClient.vipDemotion(appUser.getId()); |
| | | } |
| | | //回退优惠券状态 |
| | | if(null != order.getUserCouponId()){ |
| | | UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData(); |
| | |
| | | } |
| | | appUser.setTotalPoint(appUser.getTotalPoint() - shopPoint); |
| | | |
| | | boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId()); |
| | | if(vipDemotion){ |
| | | appUser.setVipId(appUser.getVipId() - 1); |
| | | } |
| | | |
| | | //构建积分流水明细 |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(1); |
| | |
| | | userPoint.setObjectId(order.getId()); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | appUserClient.editAppUserById(appUser); |
| | | |
| | | //降级检测 |
| | | boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId()); |
| | | if(vipDemotion){ |
| | | appUserClient.vipDemotion(appUser.getId()); |
| | | } |
| | | |
| | | //回退优惠券状态 |
| | | if(null != order.getUserCouponId()){ |
| | |
| | | * @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); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.account.api.vo.PaymentUserCoupon; |
| | | import com.ruoyi.account.api.vo.PaymentUserCouponVo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.mapper.ShoppingCartMapper; |
| | |
| | | info.setVip(appUser.getVipId()); |
| | | GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData(); |
| | | //没有秒杀活动或者添加的普通商品则不使用秒杀活动价格 |
| | | if((null == goodsSeckill || (null != goodsSeckill.getCashPayment() && null != goodsSeckill.getPointPayment())) || type == 1){ |
| | | if((null == goodsSeckill || (null == goodsSeckill.getCashPayment() && null == goodsSeckill.getPointPayment())) || type == 1){ |
| | | //没有秒杀价,则判断门店特价 |
| | | GetGoodsBargainPrice goodsBargainPrice = new GetGoodsBargainPrice(); |
| | | goodsBargainPrice.setGoodsId(goodsId); |
| | |
| | | @Override |
| | | public Long addGoods(ShoppingCart shoppingCart) { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | long goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), null, userid); |
| | | long count = count(new LambdaQueryWrapper<ShoppingCart>() |
| | | .eq(ShoppingCart::getGoodsId, shoppingCart.getGoodsId()) |
| | | .eq(ShoppingCart::getAppUserId, userid)); |
| | | goodsSaleNum += count; |
| | | Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && (goodsSaleNum + shoppingCart.getNumber()) > goods.getPurchaseLimit()){ |
| | | throw new ServiceException("超出购买数量限制"); |
| | | } |
| | | ShoppingCart one = this.getOne(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid) |
| | | .eq(ShoppingCart::getGoodsId, shoppingCart.getGoodsId()).eq(ShoppingCart::getType, shoppingCart.getType()).eq(ShoppingCart::getStatus, 1)); |
| | | if(null != one){ |
| | |
| | | */ |
| | | @Override |
| | | public R setGoodsNumber(SetGoodsNumber setGoodsNumber) { |
| | | |
| | | ShoppingCart shoppingCart = this.getById(setGoodsNumber.getId()); |
| | | if(0 >= setGoodsNumber.getNumber()){ |
| | | return R.fail("修改数量不能小于等于0"); |
| | | } |
| | | ShoppingCart shoppingCart = this.getById(setGoodsNumber.getId()); |
| | | |
| | | if(null != shoppingCart){ |
| | | |
| | | Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && goods.getPurchaseLimit() < setGoodsNumber.getNumber()){ |
| | | Goods goods1 = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); |
| | | if(null != goods1.getPurchaseLimit() && -1 != goods1.getPurchaseLimit() && goods1.getPurchaseLimit() < setGoodsNumber.getNumber()){ |
| | | return R.fail("修改数量不能大于限购数量"); |
| | | } |
| | | |
| | |
| | | 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> |
| | | |
| | | |
| | |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页","后台管理-活动管理-秒杀活动"}) |
| | | public R<TableDataInfo> list(Goods goods) |
| | | { |
| | | startPage(); |
| | | return R.ok(getDataTable(seckillActivityInfoService.listSeckillActivity(goods))); |
| | | } |
| | | |
| | |
| | | shop.setStatus(status); |
| | | shopService.updateById(shop); |
| | | //处理员工等数据 |
| | | UserShop userSh = new UserShop(); |
| | | userSh.setShopId(id); |
| | | List<UserShop> data = userShopClient.getUserShop(userSh).getData(); |
| | | for (UserShop datum : data) { |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setUserId(datum.getUserId()); |
| | | List<UserShop> data1 = userShopClient.getUserShop(userShop).getData(); |
| | | long count = data1.stream().filter(s -> !s.getShopId().equals(id)).count(); |
| | | if(0 == count){ |
| | | if(status == 1){ |
| | | UserShop userSh = new UserShop(); |
| | | userSh.setShopId(id); |
| | | List<UserShop> data = userShopClient.getUserShop(userSh).getData(); |
| | | for (UserShop datum : data) { |
| | | SysUser sysUser = sysUserClient.getSysUser(datum.getUserId()).getData(); |
| | | sysUser.setStatus(status == 1 ? "0" : "1"); |
| | | sysUser.setStatus("0"); |
| | | sysUserClient.updateUser(sysUser); |
| | | } |
| | | }else{ |
| | | //查询门店所有关联数据 |
| | | UserShop userSh = new UserShop(); |
| | | userSh.setShopId(id); |
| | | List<UserShop> data = userShopClient.getUserShop(userSh).getData(); |
| | | for (UserShop datum : data) { |
| | | //查询用户关联的其他店铺 |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setUserId(datum.getUserId()); |
| | | List<UserShop> data1 = userShopClient.getUserShop(userShop).getData(); |
| | | List<UserShop> collect = data1.stream().filter(s -> !s.getShopId().equals(id)).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | //如果没有其他店铺,则将用户禁用 |
| | | SysUser sysUser = sysUserClient.getSysUser(datum.getUserId()).getData(); |
| | | sysUser.setStatus("1"); |
| | | sysUserClient.updateUser(sysUser); |
| | | }else{ |
| | | List<Integer> shopIds = collect.stream().map(UserShop::getShopId).collect(Collectors.toList()); |
| | | List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1) |
| | | .in(Shop::getId, shopIds)); |
| | | //如果用户关联的其他门店都禁用了,将用户禁用 |
| | | if(list.size() == 0){ |
| | | SysUser sysUser = sysUserClient.getSysUser(datum.getUserId()).getData(); |
| | | sysUser.setStatus("1"); |
| | | sysUserClient.updateUser(sysUser); |
| | | }else{ |
| | | //修改默认门店 |
| | | SysUser sysUser = sysUserClient.getSysUser(datum.getUserId()).getData(); |
| | | if(sysUser.getObjectId().equals(id)){ |
| | | sysUser.setObjectId(list.get(0).getId()); |
| | | sysUserClient.updateUser(sysUser); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @Getter |
| | | public enum TechnicianStatus { |
| | | UNSUBSCRIBE(0, "待服务"), |
| | | SERVE(1, "已服务"), |
| | | CANCEL(2, "已取消"), |
| | | EXPIRED(3, "已到期"); |
| | | private final Integer code; |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.sql.SqlUtil; |
| | | import com.ruoyi.common.core.web.page.PageDomain; |
| | | import com.ruoyi.common.core.web.page.TableSupport; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.common.core.utils.PageUtils.startPage; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid()); |
| | | goods.setVipId(appUser.getVipId()); |
| | | |
| | | |
| | | PageDomain pageDomain = TableSupport.buildPageRequest(); |
| | | Boolean reasonable = pageDomain.getReasonable(); |
| | | PageHelper.startPage(goods.getPageCurr(), goods.getPageSize(), goods.getOrderByColumn()).setReasonable(reasonable); |
| | | |
| | | List<SeckillActivityVO> seckillActivityVOS = seckillActivityInfoMapper.listSeckillActivity(goods); |
| | | for (SeckillActivityVO seckillActivityVO : seckillActivityVOS) { |
| | | Integer data = orderClient.getGoodsSaleNum(seckillActivityVO.getGoodsId(), 2).getData(); |
| | |
| | | Integer sPoint = 0; |
| | | Integer shopCommissionPoint = 0; |
| | | Integer subShopCommissionPoint = 0; |
| | | Shop shop = shopService.getById(sysUser.getObjectId()); |
| | | sPoint += shop.getServerPoint(); |
| | | shopCommissionPoint += shop.getSharePoint(); |
| | | subShopCommissionPoint += shop.getLowerLevelSharePoint(); |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | | shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint); |
| | | shopPointStatistics.setShopPoint(sPoint); |
| | | shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); |
| | | shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); |
| | | |
| | | IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); |
| | | shopPointStatistics.setShopPointIPage(shopPointIPage); |
| | | |
| | | LocalDateTime startTime = shopPoint.getStartTime(); |
| | | LocalDateTime endTime = shopPoint.getEndTime(); |
| | | if(null != startTime){ |
| | | List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>() |
| | | .eq(ShopPoint::getShopId, sysUser.getObjectId()) |
| | | .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); |
| | | List<String> date = new ArrayList<>(); |
| | | List<Map<String, Integer>> data = new ArrayList<>(); |
| | | String format = "MM.dd"; |
| | | while (true){ |
| | | if(startTime.isAfter(endTime)){ |
| | | break; |
| | | } |
| | | date.add(startTime.format(DateTimeFormatter.ofPattern(format))); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | //返佣积分 |
| | | LocalDateTime finalStartTime = startTime; |
| | | List<ShopPoint> collect = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 2).collect(Collectors.toList()); |
| | | map.put("fyjf", collect.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | |
| | | //服务积分 |
| | | List<ShopPoint> collect1 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 4).collect(Collectors.toList()); |
| | | map.put("fwjf", collect1.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | //绑定下级门店返佣积分 |
| | | List<ShopPoint> collect2 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 3).collect(Collectors.toList()); |
| | | map.put("xjmdfyjf", collect2.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | data.add(map); |
| | | startTime = startTime.plusDays(1); |
| | | if (sysUser.getRoleType()==1){ |
| | | List<Shop> shopIds = shopService.lambdaQuery().eq(Shop::getDelFlag, 0).list(); |
| | | for (Shop shop : shopIds) { |
| | | sPoint += shop.getServerPoint(); |
| | | shopCommissionPoint += shop.getSharePoint(); |
| | | subShopCommissionPoint += shop.getLowerLevelSharePoint(); |
| | | } |
| | | Map<String, Object> brokenLine = new HashMap<>(); |
| | | brokenLine.put("date", date); |
| | | brokenLine.put("data", data); |
| | | shopPointStatistics.setBrokenLine(brokenLine); |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | | shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint); |
| | | shopPointStatistics.setShopPoint(sPoint); |
| | | shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); |
| | | shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); |
| | | IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); |
| | | shopPointStatistics.setShopPointIPage(shopPointIPage); |
| | | |
| | | LocalDateTime startTime = shopPoint.getStartTime(); |
| | | LocalDateTime endTime = shopPoint.getEndTime(); |
| | | if(null != startTime){ |
| | | List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>() |
| | | .eq(ShopPoint::getShopId, sysUser.getObjectId()) |
| | | .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); |
| | | List<String> date = new ArrayList<>(); |
| | | List<Map<String, Integer>> data = new ArrayList<>(); |
| | | String format = "MM.dd"; |
| | | while (true){ |
| | | if(startTime.isAfter(endTime)){ |
| | | break; |
| | | } |
| | | date.add(startTime.format(DateTimeFormatter.ofPattern(format))); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | //返佣积分 |
| | | LocalDateTime finalStartTime = startTime; |
| | | List<ShopPoint> collect = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 2).collect(Collectors.toList()); |
| | | map.put("fyjf", collect.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | |
| | | //服务积分 |
| | | List<ShopPoint> collect1 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 4).collect(Collectors.toList()); |
| | | map.put("fwjf", collect1.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | //绑定下级门店返佣积分 |
| | | List<ShopPoint> collect2 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 3).collect(Collectors.toList()); |
| | | map.put("xjmdfyjf", collect2.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | data.add(map); |
| | | startTime = startTime.plusDays(1); |
| | | } |
| | | Map<String, Object> brokenLine = new HashMap<>(); |
| | | brokenLine.put("date", date); |
| | | brokenLine.put("data", data); |
| | | shopPointStatistics.setBrokenLine(brokenLine); |
| | | } |
| | | return shopPointStatistics; |
| | | }else{ |
| | | Shop shop = shopService.getById(sysUser.getObjectId()); |
| | | sPoint += shop.getServerPoint(); |
| | | shopCommissionPoint += shop.getSharePoint(); |
| | | subShopCommissionPoint += shop.getLowerLevelSharePoint(); |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | | shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint); |
| | | shopPointStatistics.setShopPoint(sPoint); |
| | | shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); |
| | | shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); |
| | | |
| | | IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); |
| | | shopPointStatistics.setShopPointIPage(shopPointIPage); |
| | | |
| | | LocalDateTime startTime = shopPoint.getStartTime(); |
| | | LocalDateTime endTime = shopPoint.getEndTime(); |
| | | if(null != startTime){ |
| | | List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>() |
| | | .eq(ShopPoint::getShopId, sysUser.getObjectId()) |
| | | .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); |
| | | List<String> date = new ArrayList<>(); |
| | | List<Map<String, Integer>> data = new ArrayList<>(); |
| | | String format = "MM.dd"; |
| | | while (true){ |
| | | if(startTime.isAfter(endTime)){ |
| | | break; |
| | | } |
| | | date.add(startTime.format(DateTimeFormatter.ofPattern(format))); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | //返佣积分 |
| | | LocalDateTime finalStartTime = startTime; |
| | | List<ShopPoint> collect = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 2).collect(Collectors.toList()); |
| | | map.put("fyjf", collect.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | |
| | | //服务积分 |
| | | List<ShopPoint> collect1 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 4).collect(Collectors.toList()); |
| | | map.put("fwjf", collect1.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | //绑定下级门店返佣积分 |
| | | List<ShopPoint> collect2 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 3).collect(Collectors.toList()); |
| | | map.put("xjmdfyjf", collect2.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | data.add(map); |
| | | startTime = startTime.plusDays(1); |
| | | } |
| | | Map<String, Object> brokenLine = new HashMap<>(); |
| | | brokenLine.put("date", date); |
| | | brokenLine.put("data", data); |
| | | shopPointStatistics.setBrokenLine(brokenLine); |
| | | } |
| | | return shopPointStatistics; |
| | | } |
| | | return shopPointStatistics; |
| | | } |
| | | } |
| | |
| | | String id = technicianSubscribeVO.getId(); |
| | | TechnicianSubscribe technicianSubscribe = this.getById(id); |
| | | AppUser appUser = appUserClient.getAppUserById(technicianSubscribe.getAppUserId()); |
| | | technicianSubscribeVO.setUserName(appUser.getName()); |
| | | technicianSubscribeVO.setPhone(appUser.getPhone()); |
| | | if(null != appUser){ |
| | | technicianSubscribeVO.setUserName(appUser.getName()); |
| | | technicianSubscribeVO.setPhone(appUser.getPhone()); |
| | | } |
| | | Integer serviceMode = technicianSubscribeVO.getServiceMode(); |
| | | if(1 == serviceMode){ |
| | | UserAddress userAddress = JSON.parseObject(technicianSubscribeVO.getUserAddress(), UserAddress.class); |
| | |
| | | } |
| | | @Override |
| | | public IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status) { |
| | | return technicianSubscribeMapper.getTechnicianSubscribeByUser(page, userId, status); |
| | | IPage<TechnicianSubscribeVO> technicianSubscribeByUser = technicianSubscribeMapper.getTechnicianSubscribeByUser(page, userId, status); |
| | | technicianSubscribeByUser.getRecords().forEach(technicianSubscribeVO -> { |
| | | UserAddress userAddress = JSON.parseObject(technicianSubscribeVO.getUserAddress(), UserAddress.class); |
| | | if (userAddress != null){ |
| | | technicianSubscribeVO.setUserAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress()); |
| | | } |
| | | }); |
| | | return technicianSubscribeByUser; |
| | | } |
| | | |
| | | @Override |
| | |
| | | <if test="vipId == null"> |
| | | AND tgs.vip in (0, -1) |
| | | </if> |
| | | order by tsai.create_time desc |
| | | </select> |
| | | <select id="selectDetail" resultType="com.ruoyi.other.vo.SeckillActivityDetailVO"> |
| | | SELECT |
| | |
| | | AVG( IFNULL(ttsc.score,0) ) AS score |
| | | FROM |
| | | t_technician tt |
| | | LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id and tts.`status` != 0 |
| | | LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id |
| | | LEFT JOIN t_technician_score ttsc ON ttsc.technician_id = tt.id |
| | | WHERE |
| | | tt.`status` = 2 |