| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | |
| | | @RestController |
| | | @RequestMapping("/app-user") |
| | | public class AppUserController extends BaseController { |
| | | |
| | | |
| | | |
| | | @Resource |
| | |
| | | public R<LoginVo> mobileLogin(@RequestBody MobileLogin mobileLogin){ |
| | | return appUserService.mobileLogin(mobileLogin); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getSMSCode") |
| | | @ApiOperation(value = "获取短信验证码") |
| | | public R getSMSCode(@RequestBody SMSCode smsCode){ |
| | | return appUserService.getSMSCode(smsCode); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getNearbyReferrer") |
| | | @ApiOperation(value = "获取附近推荐人列表") |
| | |
| | | AppUser user = appUserService.getById(userId); |
| | | return R.ok(user); |
| | | } |
| | | |
| | | @Resource |
| | | private UserCancellationLogService userCancellationLogService; |
| | | |
| | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/index") |
| | | @ApiOperation(value = "个人中心首页", tags = {"小程序-个人中心首页"}) |
| | | public R<AppUser> index(){ |
| | |
| | | appUserService.updateById(user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户的祖籍列表 |
| | | */ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/onlineRecord") |
| | | @ApiOperation(value = "10分钟定时任务调用,记录用户在线时长", tags = {"小程序-个人中心首页"}) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据用户名称模糊搜索用户列表 |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据用户电话模糊搜索用户列表 |
| | | * |
| | | * @param phone |
| | | * @return |
| | | */ |
| | |
| | | @ApiOperation(value = "用户列表", tags = {"管理后台"}) |
| | | public R<IPage<AppUser>> getAppuserPage(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | AppUser appUser) |
| | | { |
| | | AppUser appUser) { |
| | | IPage<AppUser> appuserPage = appUserService.getAppuserPage(pageNum, pageSize, appUser); |
| | | return R.ok(appuserPage); |
| | | } |
| | |
| | | @ApiOperation(value = "用户列表", tags = {"门店后台"}) |
| | | public R<IPage<AppUser>> shopGetAppuserPage(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | AppUser appUser) |
| | | { |
| | | AppUser appUser) { |
| | | Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); |
| | | |
| | | List<Long> userIds = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/danger/info") |
| | | @ApiOperation(value = "用户列表-保级条件详情", tags = {"管理后台"}) |
| | | public R<DangerInfoDto> dangerinfo(Long id) |
| | | { |
| | | public R<DangerInfoDto> dangerinfo(Long id) { |
| | | AppUser byId = appUserService.getById(id); |
| | | LocalDate now = LocalDate.now(); |
| | | R<VipSetting> vipSetting = vipSettingClient.getVipSetting(byId.getVipId()); |
| | |
| | | |
| | | @GetMapping("/danger/down") |
| | | @ApiOperation(value = "用户列表-保级条件降级", tags = {"管理后台"}) |
| | | public R down(Long id) |
| | | { |
| | | public R down(Long id) { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setVipId(byId.getVipId()-1); |
| | | appUserService.updateById(byId); |
| | |
| | | ).start(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/frozen") |
| | | @ApiOperation(value = "用户列表-冻结解冻", tags = {"管理后台"}) |
| | | public R frozen(Long id,@ApiParam("1=正常,2=冻结")Integer status) |
| | | { |
| | | public R frozen(Long id, @ApiParam("1=正常,2=冻结") Integer status) { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setStatus(status); |
| | | appUserService.updateById(byId); |
| | |
| | | |
| | | @GetMapping("/select") |
| | | @ApiOperation(value = "用户列表-查询绑定人", tags = {"管理后台"}) |
| | | public R<AppUser> select(String phone) |
| | | { |
| | | public R<AppUser> select(String phone) { |
| | | AppUser byId = appUserService.lambdaQuery().eq(AppUser::getPhone,phone).one(); |
| | | if (byId==null){ |
| | | return R.fail("搜索失败,手机号错误。"); |
| | |
| | | |
| | | @GetMapping("/change/bind") |
| | | @ApiOperation(value = "用户列表-更换绑定人", tags = {"管理后台"}) |
| | | public R<AppUser> select(Long id,Long inviteId) |
| | | { |
| | | public R<AppUser> select(Long id, Long inviteId) { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setInviteUserId(inviteId); |
| | | byId.setTopInviteId(getTop(inviteId)); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/change/shop") |
| | | @ApiOperation(value = "用户列表-更换门店", tags = {"管理后台"}) |
| | | public R<AppUser> shop(Long id,Long shopId) |
| | | { |
| | | public R<AppUser> shop(Long id, Long shopId) { |
| | | AppUser byId = appUserService.getById(id); |
| | | byId.setShopId(shopId); |
| | | appUserService.updateById(byId); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private ShopClient shopClient; |
| | | @Resource |
| | |
| | | |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "用户列表-详情", tags = {"管理后台"}) |
| | | public R<AppUser> detail(Long id) |
| | | { |
| | | 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()))); |
| | |
| | | |
| | | @Resource |
| | | private UserChangeLogService userChangeLogService; |
| | | |
| | | @GetMapping("/change/vip") |
| | | @ApiOperation(value = "用户列表-修改会员等级", tags = {"管理后台"}) |
| | | public R<Page<AppUser>> changevip(Long id,Integer vipId) |
| | | { |
| | | public R<Page<AppUser>> changevip(Long id, Integer vipId) { |
| | | AppUser byId = appUserService.getById(id); |
| | | |
| | | UserChangeLog userChangeLog = new UserChangeLog(); |
| | |
| | | |
| | | @GetMapping("/bottom") |
| | | @ApiOperation(value = "用户列表-绑定下级列表", tags = {"管理后台"}) |
| | | public R<Page<AppUser>> bottom(Long id,Integer pageNum,Integer pageSize) |
| | | { |
| | | 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("/orders") |
| | | @ApiOperation(value = "用户列表-订单列表", tags = {"管理后台"}) |
| | | public R<List<Order>> orders(Long id) |
| | | { |
| | | public R<List<Order>> orders(Long id) { |
| | | R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id); |
| | | return R.ok(listR.getData()); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/listByIds") |
| | |
| | | List<AppUser> appUsers = appUserService.listByIds(ids); |
| | | return appUsers; |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/getAppUserByPhone1") |
| | |
| | | return R.ok(userStatisticsDetail); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分佣统计明细 |
| | | */ |
| | | @GetMapping("/commissionDetail") |
| | | @ApiOperation(value = "分佣统计", tags = "管理后台-首页统计") |
| | | public R<CommissionDetail> commissionDetail(BalanceChangeRecord balanceChangeRecord) { |
| | | List<AppUser> appUserList = Optional.ofNullable(appUserService.list()).orElse(Collections.emptyList()); |
| | | |
| | | if (appUserList.isEmpty()) { |
| | | return R.ok(new CommissionDetail()); |
| | | } |
| | | |
| | | BigDecimal totalCommission = BigDecimal.ZERO; |
| | | BigDecimal totalServiceFee = BigDecimal.ZERO; |
| | | BigDecimal totalUserCommission = BigDecimal.ZERO; |
| | | Map<Integer, BigDecimal> vipCommissions = new HashMap<>(); |
| | | |
| | | for (AppUser appUser : appUserList) { |
| | | totalCommission = totalCommission.add(Optional.ofNullable(appUser.getTotalDistributionAmount()).orElse(BigDecimal.ZERO)); |
| | | totalServiceFee = totalServiceFee.add(Optional.ofNullable(appUser.getShopServiceFee()).orElse(BigDecimal.ZERO)); |
| | | totalUserCommission = totalUserCommission.add(Optional.ofNullable(appUser.getShopCommission()).orElse(BigDecimal.ZERO)); |
| | | |
| | | Integer vipId = appUser.getVipId(); |
| | | if (vipId != null && vipId >= 1 && vipId <= 7) { |
| | | vipCommissions.merge(vipId, Optional.ofNullable(appUser.getTotalDistributionAmount()).orElse(BigDecimal.ZERO), BigDecimal::add); |
| | | } |
| | | } |
| | | |
| | | CommissionDetail commissionDetail = new CommissionDetail(); |
| | | commissionDetail.setTotalCommission(totalCommission); |
| | | commissionDetail.setTotalServiceFee(totalServiceFee); |
| | | commissionDetail.setTotalUserCommission(totalUserCommission); |
| | | |
| | | commissionDetail.setTotalNormalCommission(vipCommissions.getOrDefault(1, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalGoldCommission(vipCommissions.getOrDefault(2, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalDiamondCommission(vipCommissions.getOrDefault(3, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalAgentCommission(vipCommissions.getOrDefault(4, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalSuperAgentCommission(vipCommissions.getOrDefault(5, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalTopAgentCommission(vipCommissions.getOrDefault(6, BigDecimal.ZERO)); |
| | | commissionDetail.setTotalPartnerCommission(vipCommissions.getOrDefault(7, BigDecimal.ZERO)); |
| | | |
| | | return R.ok(commissionDetail); |
| | | } |
| | | |
| | | |
| | | } |
| | | |