| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserCancellationLog; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | import com.ruoyi.account.api.model.UserSignRecord; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserCancellationLogService; |
| | | import com.ruoyi.account.service.UserCouponService; |
| | | import com.ruoyi.account.service.UserSignRecordService; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.account.dto.DangerInfoDto; |
| | | import com.ruoyi.account.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import com.ruoyi.other.api.feignClient.StoreClient; |
| | | import com.ruoyi.other.api.feignClient.VipSettingClient; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | |
| | | @Resource |
| | | private UserSignRecordService userSignRecordService; |
| | | @Resource |
| | | private VipSettingClient vipSettingClient; |
| | | @Resource |
| | | private UserPointService userPointService; |
| | | @Resource |
| | | private VipSettingService vipSettingService; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | return R.ok(appuserPage); |
| | | } |
| | | |
| | | @GetMapping("/danger/info") |
| | | @ApiOperation(value = "用户列表-保级条件详情", tags = {"管理后台"}) |
| | | public R<DangerInfoDto> dangerinfo(Long id) |
| | | { |
| | | AppUser byId = appUserService.getById(id); |
| | | LocalDate now = LocalDate.now(); |
| | | R<VipSetting> vipSetting = vipSettingClient.getVipSetting(byId.getVipId()); |
| | | VipSetting data = vipSetting.getData(); |
| | | 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(); |
| | | Integer userKeepBuyPoint = 0; |
| | | for (UserPoint userPoint : list1) { |
| | | userKeepBuyPoint = userPoint.getVariablePoint()+userKeepBuyPoint; |
| | | } |
| | | Integer userKeepSharePoint = 0; |
| | | for (UserPoint userPoint : list2) { |
| | | userKeepSharePoint = userPoint.getVariablePoint()+userKeepSharePoint; |
| | | } |
| | | Integer userKeepShopPoint = 0; |
| | | for (UserPoint userPoint : list3) { |
| | | userKeepShopPoint = userPoint.getVariablePoint()+userKeepShopPoint; |
| | | } |
| | | dangerInfoDto.setUserKeepBuyPoint(userKeepBuyPoint); |
| | | dangerInfoDto.setUserKeepSharePoint(userKeepSharePoint); |
| | | dangerInfoDto.setUserKeepShopPoint(userKeepShopPoint); |
| | | return R.ok(dangerInfoDto); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/danger/down") |
| | | @ApiOperation(value = "用户列表-保级条件降级", tags = {"管理后台"}) |
| | | public R down(Long id) |
| | | { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setVipId(byId.getVipId()-1); |
| | | appUserService.updateById(byId); |
| | | //执行降级标记代码 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | { |
| | | vipSettingService.downUsers(); |
| | | } |
| | | } |
| | | } |
| | | ).start(); |
| | | return R.ok(); |
| | | } |
| | | @GetMapping("/frozen") |
| | | @ApiOperation(value = "用户列表-冻结解冻", tags = {"管理后台"}) |
| | | public R frozen(Long id,@ApiParam("1=正常,2=冻结")Integer status) |
| | | { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setStatus(status); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | @Resource |
| | | private RemoteOrderGoodsClient remoteOrderGoodsClient; |
| | | |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "用户列表-详情", tags = {"管理后台"}) |
| | | public R<AppUser> detail(Long id) |
| | | { |
| | | AppUser byId = appUserService.getById(id); |
| | | if (byId.getShopId()!=null) { |
| | | R<Shop> shopById = shopClient.getShopById(Integer.parseInt(String.valueOf(byId.getShopId()))); |
| | | if (shopById.getData()!=null) { |
| | | byId.setShopName(shopById.getData().getName()); |
| | | } |
| | | } |
| | | R<List<Shop>> shopByUserId = shopClient.getShopByUserId(id); |
| | | if (shopByUserId.getData()!=null) { |
| | | List<String> shopName = new ArrayList<>(); |
| | | for (Shop datum : shopByUserId.getData()) { |
| | | shopName.add(datum.getName()); |
| | | } |
| | | byId.setShopNames(shopName); |
| | | } |
| | | //推广人 |
| | | if (byId.getInviteUserId()!=null) { |
| | | AppUser byId1 = appUserService.getById(byId.getInviteUserId()); |
| | | byId1.setInviteUserName(byId1.getInviteUserName()); |
| | | } |
| | | //最后下单时间 |
| | | R<Order> lastOrder = remoteOrderGoodsClient.getLastOrder(id); |
| | | if (lastOrder.getData()!=null){ |
| | | byId.setLastOrderTime(lastOrder.getData().getCreateTime()); |
| | | } |
| | | return R.ok(byId); |
| | | } |
| | | @GetMapping("/bottom") |
| | | @ApiOperation(value = "用户列表-绑定下级列表", tags = {"管理后台"}) |
| | | public R<Page<AppUser>> bottom(Long id,Integer pageNum,Integer pageSize) |
| | | { |
| | | //绑定下级 |
| | | Page<AppUser> page = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/getAppUserByPhone") |
| | | public R<AppUser> getAppUserByPhone(String phone){ |
| | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |