init
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应信息主体
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class PageModel<T> implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "分页数据")
|
||||||
|
private List<T> rows;
|
||||||
|
@Schema(description = "总数量")
|
||||||
|
private long total;
|
||||||
|
|
||||||
|
public PageModel(List<T> list, long total) {
|
||||||
|
this.rows = list;
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> PageModel<T> build(IPage<T> page) {
|
||||||
|
PageModel<T> rspData = new PageModel<>();
|
||||||
|
rspData.setRows(page.getRecords());
|
||||||
|
rspData.setTotal(page.getTotal());
|
||||||
|
return rspData;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.ruoyi.xq.controller.app;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.domain.PageModel;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
@@ -38,8 +39,8 @@ public class DynamicAppController {
|
|||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "动态列表-分页")
|
@Operation(summary = "动态列表-分页")
|
||||||
@Log(title = "动态列表-分页", businessType = BusinessType.OTHER, isSaveDb = false)
|
@Log(title = "动态列表-分页", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
public R<List<DynamicListVo>> page(PageQuery pageQuery, DynamicQuery dynamicQuery){
|
public R<PageModel<DynamicListVo>> page(PageQuery pageQuery, DynamicQuery dynamicQuery){
|
||||||
Page<DynamicListVo> page = dynamicService.pageApp(pageQuery, dynamicQuery);
|
Page<DynamicListVo> page = dynamicService.pageApp(pageQuery, dynamicQuery);
|
||||||
return R.ok(page.getRecords());
|
return R.ok(PageModel.build(page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,21 @@ package com.ruoyi.xq.controller.app;
|
|||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.domain.PageModel;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.xq.domain.Banner;
|
import com.ruoyi.xq.domain.Banner;
|
||||||
|
import com.ruoyi.xq.dto.app.user.HomePageReq;
|
||||||
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserListVo;
|
||||||
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
|
||||||
import com.ruoyi.xq.service.BannerService;
|
import com.ruoyi.xq.service.BannerService;
|
||||||
import com.ruoyi.xq.service.UserService;
|
import com.ruoyi.xq.service.UserService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -25,17 +27,28 @@ import java.util.List;
|
|||||||
public class HomeAppController {
|
public class HomeAppController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
@Autowired
|
||||||
|
private BannerService bannerService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/user/page")
|
||||||
|
@Operation(summary = "首页查询用户-分页")
|
||||||
|
@Log(title = "首页查询用户-分页", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
|
public R<PageModel<HomeUserListVo>> userPage(@RequestBody HomePageReq homePageReq){
|
||||||
|
Page<HomeUserListVo> vo = userService.homePage(homePageReq);
|
||||||
|
return R.ok(PageModel.build(vo));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/user/info")
|
@GetMapping("/user/info")
|
||||||
@Operation(summary = "查询用户主页信息")
|
@Operation(summary = "查询用户主页信息")
|
||||||
@Log(title = "查询用户主页信息", businessType = BusinessType.OTHER, isSaveDb = false)
|
@Log(title = "查询用户主页信息", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
public R<HomeUserVo> homeUser(Long userId){
|
public R<HomeUserVo> userInfo(Long userId){
|
||||||
HomeUserVo vo = userService.homeUser(userId);
|
HomeUserVo vo = userService.homeUser(userId);
|
||||||
return R.ok(vo);
|
return R.ok(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BannerService bannerService;
|
|
||||||
|
|
||||||
@GetMapping("/banner")
|
@GetMapping("/banner")
|
||||||
@Operation(summary = "轮播图")
|
@Operation(summary = "轮播图")
|
||||||
@Log(title = "轮播图", businessType = BusinessType.OTHER, isSaveDb = false)
|
@Log(title = "轮播图", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.ruoyi.xq.controller.app;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.domain.PageModel;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.helper.LoginHelper;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.UserStarQuery;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.UserStarReq;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.vo.UserStarListVo;
|
||||||
|
import com.ruoyi.xq.service.UserStarService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/star")
|
||||||
|
@Tag(name = "用户关注接口")
|
||||||
|
public class UserStarAppController {
|
||||||
|
@Autowired
|
||||||
|
private UserStarService userStarService;
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
@Operation(summary = "用户关注和取消关注")
|
||||||
|
@Log(title = "用户关注和取消关注", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
|
public R<Void> starUpdate(@RequestBody UserStarReq req){
|
||||||
|
req.setUserId(LoginHelper.getUserId());
|
||||||
|
userStarService.starUpdate(req);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "关注查询-分页")
|
||||||
|
@Log(title = "关注查询-分页", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
|
public R<PageModel<UserStarListVo>> page(PageQuery pageQuery, UserStarQuery query){
|
||||||
|
query.setUserId(LoginHelper.getUserId());
|
||||||
|
Page<UserStarListVo> app = userStarService.pageApp(pageQuery, query);
|
||||||
|
return R.ok(PageModel.build(app));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ package com.ruoyi.xq.controller.app;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.domain.PageModel;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
@@ -56,10 +57,10 @@ public class WithdrawAppController {
|
|||||||
@GetMapping("/logs/page")
|
@GetMapping("/logs/page")
|
||||||
@Operation(summary = "提现记录")
|
@Operation(summary = "提现记录")
|
||||||
@Log(title = "申请记录", businessType = BusinessType.OTHER, isSaveDb = false)
|
@Log(title = "申请记录", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
public R<List<WithdrawListAppVo>> logsPage(PageQuery pageQuery, WithdrawListPageQuery query){
|
public R<PageModel<WithdrawListAppVo>> logsPage(PageQuery pageQuery, WithdrawListPageQuery query){
|
||||||
query.setUserId(LoginHelper.getUserId());
|
query.setUserId(LoginHelper.getUserId());
|
||||||
Page<WithdrawListAppVo> result = userWithdrawService.pageApp(pageQuery,query);
|
Page<WithdrawListAppVo> result = userWithdrawService.pageApp(pageQuery,query);
|
||||||
return R.ok(result.getRecords());
|
return R.ok(PageModel.build(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class User implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String nickname;
|
private String nickname;
|
||||||
/**
|
/**
|
||||||
* 用户类型: 0普通用户 1 内部用户 2 审核人员账号
|
* 用户类型: 0普通用户 1 内部用户
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
/**
|
/**
|
||||||
|
|||||||
47
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/UserStar.java
Normal file
47
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/UserStar.java
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package com.ruoyi.xq.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户关注对象 xq_user_star
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("xq_user_star")
|
||||||
|
public class UserStar implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 用户号
|
||||||
|
*/
|
||||||
|
private String usercode;
|
||||||
|
/**
|
||||||
|
* 我关注的用户ID
|
||||||
|
*/
|
||||||
|
private Long starUserId;
|
||||||
|
/**
|
||||||
|
* 我关注的用户编号
|
||||||
|
*/
|
||||||
|
private String starUserCode;
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.user;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HomePageReq extends PageQuery {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.user.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HomeUserListVo {
|
||||||
|
@Schema(description = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
@Schema(description = "用户头像")
|
||||||
|
private String avatar;
|
||||||
|
@Schema(description = "性别 0-未知 1-女 2-男")
|
||||||
|
private Integer gender;
|
||||||
|
@Schema(description = "昵称")
|
||||||
|
private String nickname;
|
||||||
|
@Schema(description = "生日")
|
||||||
|
private LocalDate birthday;
|
||||||
|
@Schema(description = "生日-缩减显示")
|
||||||
|
private String birthdayStr;
|
||||||
|
@Schema(description = "居住城市")
|
||||||
|
private String residenceCity;
|
||||||
|
@Schema(description = "学历")
|
||||||
|
private Integer education;
|
||||||
|
@Schema(description = "职业")
|
||||||
|
private String profession;
|
||||||
|
@Schema(description = "是否已经实名")
|
||||||
|
private Boolean cardNumAuthBool = false;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ public class HomeUserVo {
|
|||||||
@Schema(description = "用户ID")
|
@Schema(description = "用户ID")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
@Schema(description = "用户编号")
|
@Schema(description = "用户编号")
|
||||||
private Long usercode;
|
private String usercode;
|
||||||
@Schema(description = "用户头像")
|
@Schema(description = "用户头像")
|
||||||
private String avatar;
|
private String avatar;
|
||||||
@Schema(description = "相册")
|
@Schema(description = "相册")
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.userstar;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserStarQuery{
|
||||||
|
@Schema(hidden = true)
|
||||||
|
private Long userId;
|
||||||
|
@Schema(description = "1-我关注的 2-关注我的")
|
||||||
|
private Integer queryType;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.userstar;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserStarReq {
|
||||||
|
@Schema(hidden = true)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "1-关注 2-取消关注")
|
||||||
|
private Integer star;
|
||||||
|
|
||||||
|
@Schema(description = "关注或者取消关注的目标用户ID")
|
||||||
|
private Long starUserId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.userstar.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserStarListVo {
|
||||||
|
@Schema(description = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
@Schema(description = "用户头像")
|
||||||
|
private String avatar;
|
||||||
|
@Schema(description = "性别 0-未知 1-女 2-男")
|
||||||
|
private Integer gender;
|
||||||
|
@Schema(description = "昵称")
|
||||||
|
private String nickname;
|
||||||
|
@Schema(description = "生日")
|
||||||
|
private LocalDate birthday;
|
||||||
|
@Schema(description = "生日-缩减显示")
|
||||||
|
private String birthdayStr;
|
||||||
|
@Schema(description = "居住城市")
|
||||||
|
private String residenceCity;
|
||||||
|
@Schema(description = "学历")
|
||||||
|
private Integer education;
|
||||||
|
@Schema(description = "职业")
|
||||||
|
private String profession;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.ruoyi.xq.manager;
|
package com.ruoyi.xq.manager;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.ruoyi.common.annotation.Translation;
|
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.helper.LoginHelper;
|
import com.ruoyi.common.helper.LoginHelper;
|
||||||
import com.ruoyi.common.utils.BeanConvertUtil;
|
import com.ruoyi.common.utils.BeanConvertUtil;
|
||||||
@@ -29,7 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.swing.plaf.basic.BasicBorders;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -79,7 +77,7 @@ public class CurrentUserManager {
|
|||||||
}
|
}
|
||||||
result.setRemarkAudit(remarkAuditInfo);
|
result.setRemarkAudit(remarkAuditInfo);
|
||||||
|
|
||||||
List<UserPictures> userPictures = userPicturesService.listByUserId(user.getId());
|
List<UserPictures> userPictures = userPicturesService.listByUserIdAuditingAndSuccess(user.getId());
|
||||||
result.setUserPicturesList(BeanConvertUtil.convertListTo(userPictures, UserPicturesDTO::new));
|
result.setUserPicturesList(BeanConvertUtil.convertListTo(userPictures, UserPicturesDTO::new));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -100,7 +98,7 @@ public class CurrentUserManager {
|
|||||||
vo.setStatus(user.getStatus());
|
vo.setStatus(user.getStatus());
|
||||||
vo.setFinishBaseStatus(user.getFinishBaseStatus());
|
vo.setFinishBaseStatus(user.getFinishBaseStatus());
|
||||||
vo.setImToken(user.getImToken());
|
vo.setImToken(user.getImToken());
|
||||||
List<UserPictures> userPictures = userPicturesService.listByUserId(user.getId());
|
List<UserPictures> userPictures = userPicturesService.listByUserIdAuditingAndSuccess(user.getId());
|
||||||
vo.setUserPicturesList(BeanConvertUtil.convertListTo(userPictures, UserPicturesDTO::new));
|
vo.setUserPicturesList(BeanConvertUtil.convertListTo(userPictures, UserPicturesDTO::new));
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.xq.domain.User;
|
import com.ruoyi.xq.domain.User;
|
||||||
import com.ruoyi.xq.dto.admin.user.UserAdminVo;
|
import com.ruoyi.xq.dto.admin.user.UserAdminVo;
|
||||||
|
import com.ruoyi.xq.dto.app.user.HomePageReq;
|
||||||
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserListVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,4 +17,6 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
public interface UserMapper extends BaseMapper<User> {
|
public interface UserMapper extends BaseMapper<User> {
|
||||||
|
|
||||||
Page<UserAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") UserAdminVo bo);
|
Page<UserAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") UserAdminVo bo);
|
||||||
|
|
||||||
|
Page<HomeUserListVo> homePageApp(@Param("build") Page<Object> build, @Param("params") HomePageReq params);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.ruoyi.xq.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.xq.domain.UserStar;
|
||||||
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserListVo;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.UserStarQuery;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.vo.UserStarListVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户关注Mapper接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-17
|
||||||
|
*/
|
||||||
|
public interface UserStarMapper extends BaseMapper<UserStar> {
|
||||||
|
|
||||||
|
Page<UserStarListVo> selectMyStar(@Param("build") Page<Object> build, @Param("query") UserStarQuery query);
|
||||||
|
|
||||||
|
Page<UserStarListVo> selectStarMe(@Param("build") Page<Object> build, @Param("query") UserStarQuery query);
|
||||||
|
}
|
||||||
@@ -16,7 +16,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface UserPicturesService extends IService<UserPictures> {
|
public interface UserPicturesService extends IService<UserPictures> {
|
||||||
|
|
||||||
List<UserPictures> listByUserId(Long userId);
|
List<UserPictures> listByUserIdAuditingAndSuccess(Long userId);
|
||||||
|
|
||||||
|
List<UserPictures> listByUserIdSuccess(Long userId);
|
||||||
|
|
||||||
Page<UserPicturesAdminVo> pageAdmin(PageQuery pageQuery, UserPicturesAdminVo bo);
|
Page<UserPicturesAdminVo> pageAdmin(PageQuery pageQuery, UserPicturesAdminVo bo);
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import com.ruoyi.common.core.domain.PageQuery;
|
|||||||
import com.ruoyi.xq.domain.User;
|
import com.ruoyi.xq.domain.User;
|
||||||
import com.ruoyi.xq.dto.admin.user.UserAdminVo;
|
import com.ruoyi.xq.dto.admin.user.UserAdminVo;
|
||||||
import com.ruoyi.xq.dto.admin.user.req.UpdateMobileAdminReq;
|
import com.ruoyi.xq.dto.admin.user.req.UpdateMobileAdminReq;
|
||||||
|
import com.ruoyi.xq.dto.app.user.HomePageReq;
|
||||||
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserListVo;
|
||||||
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,4 +33,8 @@ public interface UserService extends IService<User> {
|
|||||||
void resetNickname(Long userId);
|
void resetNickname(Long userId);
|
||||||
|
|
||||||
Page<UserAdminVo> pageAdmin(PageQuery pageQuery, UserAdminVo bo);
|
Page<UserAdminVo> pageAdmin(PageQuery pageQuery, UserAdminVo bo);
|
||||||
|
|
||||||
|
Page<HomeUserListVo> homePage(HomePageReq params);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.xq.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.xq.domain.UserStar;
|
||||||
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserListVo;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.UserStarQuery;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.UserStarReq;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.vo.UserStarListVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户关注Service接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-17
|
||||||
|
*/
|
||||||
|
public interface UserStarService extends IService<UserStar> {
|
||||||
|
|
||||||
|
void starUpdate(UserStarReq req);
|
||||||
|
|
||||||
|
Page<UserStarListVo> pageApp(PageQuery pageQuery, UserStarQuery query);
|
||||||
|
}
|
||||||
@@ -26,7 +26,14 @@ import java.util.List;
|
|||||||
public class UserPicturesServiceImpl extends ServiceImpl<UserPicturesMapper,UserPictures> implements UserPicturesService {
|
public class UserPicturesServiceImpl extends ServiceImpl<UserPicturesMapper,UserPictures> implements UserPicturesService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserPictures> listByUserId(Long userId) {
|
public List<UserPictures> listByUserIdAuditingAndSuccess(Long userId) {
|
||||||
|
return this.list(Wrappers.lambdaQuery(UserPictures.class)
|
||||||
|
.eq(UserPictures::getUserId, userId)
|
||||||
|
.in(UserPictures::getAuditStatus, AuditEnum.AUDITING.getCode(), AuditEnum.SUCCESS.getCode()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserPictures> listByUserIdSuccess(Long userId) {
|
||||||
return this.list(Wrappers.lambdaQuery(UserPictures.class)
|
return this.list(Wrappers.lambdaQuery(UserPictures.class)
|
||||||
.eq(UserPictures::getUserId, userId)
|
.eq(UserPictures::getUserId, userId)
|
||||||
.in(UserPictures::getAuditStatus, AuditEnum.AUDITING.getCode(), AuditEnum.SUCCESS.getCode()));
|
.in(UserPictures::getAuditStatus, AuditEnum.AUDITING.getCode(), AuditEnum.SUCCESS.getCode()));
|
||||||
|
|||||||
@@ -12,15 +12,20 @@ import com.ruoyi.common.exception.base.BaseException;
|
|||||||
import com.ruoyi.common.utils.BeanConvertUtil;
|
import com.ruoyi.common.utils.BeanConvertUtil;
|
||||||
import com.ruoyi.xq.domain.User;
|
import com.ruoyi.xq.domain.User;
|
||||||
import com.ruoyi.xq.domain.UserInfo;
|
import com.ruoyi.xq.domain.UserInfo;
|
||||||
|
import com.ruoyi.xq.domain.UserPictures;
|
||||||
import com.ruoyi.xq.dto.admin.user.UserAdminVo;
|
import com.ruoyi.xq.dto.admin.user.UserAdminVo;
|
||||||
import com.ruoyi.xq.dto.admin.user.req.UpdateMobileAdminReq;
|
import com.ruoyi.xq.dto.admin.user.req.UpdateMobileAdminReq;
|
||||||
|
import com.ruoyi.xq.dto.app.user.HomePageReq;
|
||||||
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserListVo;
|
||||||
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
|
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
|
||||||
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
||||||
import com.ruoyi.xq.enums.userinfo.UserGenderEnum;
|
import com.ruoyi.xq.enums.userinfo.UserGenderEnum;
|
||||||
import com.ruoyi.xq.manager.SystemConfigManager;
|
import com.ruoyi.xq.manager.SystemConfigManager;
|
||||||
import com.ruoyi.xq.mapper.UserMapper;
|
import com.ruoyi.xq.mapper.UserMapper;
|
||||||
import com.ruoyi.xq.service.UserInfoService;
|
import com.ruoyi.xq.service.UserInfoService;
|
||||||
|
import com.ruoyi.xq.service.UserPicturesService;
|
||||||
import com.ruoyi.xq.service.UserService;
|
import com.ruoyi.xq.service.UserService;
|
||||||
|
import com.ruoyi.xq.util.BirthdayUtil;
|
||||||
import com.ruoyi.yunxin.client.ImUserRefClient;
|
import com.ruoyi.yunxin.client.ImUserRefClient;
|
||||||
import com.ruoyi.yunxin.req.UpdateUinfoReq;
|
import com.ruoyi.yunxin.req.UpdateUinfoReq;
|
||||||
import com.ruoyi.yunxin.resp.YxCommonR;
|
import com.ruoyi.yunxin.resp.YxCommonR;
|
||||||
@@ -28,7 +33,10 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户管理Service业务层处理
|
* 用户管理Service业务层处理
|
||||||
@@ -41,10 +49,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements UserService {
|
public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements UserService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserInfoService userInfoService;
|
private UserInfoService userInfoService;
|
||||||
@Autowired
|
@Resource
|
||||||
private ImUserRefClient userRefClient;
|
private ImUserRefClient userRefClient;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemConfigManager systemConfigManager;
|
private SystemConfigManager systemConfigManager;
|
||||||
|
@Autowired
|
||||||
|
private UserPicturesService userPicturesService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getByUsername(String username) {
|
public User getByUsername(String username) {
|
||||||
@@ -75,6 +85,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
|||||||
HomeUserVo result = new HomeUserVo();
|
HomeUserVo result = new HomeUserVo();
|
||||||
BeanConvertUtil.copyProperties(userInfo,result);
|
BeanConvertUtil.copyProperties(userInfo,result);
|
||||||
BeanConvertUtil.copyProperties(user,result);
|
BeanConvertUtil.copyProperties(user,result);
|
||||||
|
List<UserPictures> userPicturesList = userPicturesService.listByUserIdSuccess(userId);
|
||||||
|
result.setUserPictureList(userPicturesList.stream().map(UserPictures::getPicture).collect(Collectors.toList()));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,4 +162,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
|||||||
public Page<UserAdminVo> pageAdmin(PageQuery pageQuery, UserAdminVo bo) {
|
public Page<UserAdminVo> pageAdmin(PageQuery pageQuery, UserAdminVo bo) {
|
||||||
return baseMapper.pageAdmin(pageQuery.build(), bo);
|
return baseMapper.pageAdmin(pageQuery.build(), bo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<HomeUserListVo> homePage(HomePageReq params) {
|
||||||
|
Page<HomeUserListVo> page = baseMapper.homePageApp(params.build(), params);
|
||||||
|
List<HomeUserListVo> records = page.getRecords();
|
||||||
|
for (HomeUserListVo record : records) {
|
||||||
|
record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday()));
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.ruoyi.xq.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.xq.domain.User;
|
||||||
|
import com.ruoyi.xq.domain.UserStar;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.UserStarQuery;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.UserStarReq;
|
||||||
|
import com.ruoyi.xq.dto.app.userstar.vo.UserStarListVo;
|
||||||
|
import com.ruoyi.xq.mapper.UserStarMapper;
|
||||||
|
import com.ruoyi.xq.service.UserService;
|
||||||
|
import com.ruoyi.xq.service.UserStarService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户关注Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserStarServiceImpl extends ServiceImpl<UserStarMapper,UserStar> implements UserStarService {
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @Schema(description = "1-关注 2-取消关注")
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void starUpdate(UserStarReq req) {
|
||||||
|
User user = userService.getById(req.getUserId());
|
||||||
|
User starUser = userService.getById(req.getStarUserId());
|
||||||
|
if(user == null || starUser == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Integer star = req.getStar();
|
||||||
|
if(star == null){
|
||||||
|
throw new ServiceException("参数异常");
|
||||||
|
}
|
||||||
|
if(req.getStar().equals(1)){ // 关注
|
||||||
|
this.remove(Wrappers.lambdaQuery(UserStar.class)
|
||||||
|
.eq(UserStar::getUserId, req.getUserId())
|
||||||
|
.eq(UserStar::getStarUserId, req.getStarUserId()));
|
||||||
|
UserStar userStar = new UserStar();
|
||||||
|
userStar.setUserId(user.getId());
|
||||||
|
userStar.setUsercode(user.getUsercode());
|
||||||
|
userStar.setStarUserId(starUser.getId());
|
||||||
|
userStar.setStarUserCode(starUser.getUsercode());
|
||||||
|
this.save(userStar);
|
||||||
|
}else if(req.getStar().equals(2)){
|
||||||
|
this.remove(Wrappers.lambdaQuery(UserStar.class)
|
||||||
|
.eq(UserStar::getUserId, req.getUserId())
|
||||||
|
.eq(UserStar::getStarUserId, req.getStarUserId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<UserStarListVo> pageApp(PageQuery pageQuery, UserStarQuery query) {
|
||||||
|
if(query.getQueryType() == null){
|
||||||
|
throw new ServiceException("参数异常");
|
||||||
|
}
|
||||||
|
if(query.getQueryType() == 1){
|
||||||
|
return baseMapper.selectMyStar(pageQuery.build(),query);
|
||||||
|
}else if(query.getQueryType() == 2){
|
||||||
|
return baseMapper.selectStarMe(pageQuery.build(),query);
|
||||||
|
}else{
|
||||||
|
throw new ServiceException("参数异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
ruoyi-xq/src/main/java/com/ruoyi/xq/util/BirthdayUtil.java
Normal file
15
ruoyi-xq/src/main/java/com/ruoyi/xq/util/BirthdayUtil.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.xq.util;
|
||||||
|
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class BirthdayUtil {
|
||||||
|
public static String getMinBirthday(LocalDate localDate){
|
||||||
|
if(localDate == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String year = localDate.getYear() + "";
|
||||||
|
return year.substring(year.length() - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,4 +20,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
order by t1.id desc
|
order by t1.id desc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="homePageApp" resultType="com.ruoyi.xq.dto.app.user.vo.HomeUserListVo">
|
||||||
|
select t1.id as user_id, t1.avatar, t1.gender, t1.nickname, t1.birthday, t1.residence_city,
|
||||||
|
t1.education, t1.profession, if(t2.card_num_auth = 1, 1, 0) as cardNumAuthBool
|
||||||
|
from xq_user t1
|
||||||
|
join xq_user_auth t2 on t1.id = t2.user_id
|
||||||
|
where t1.type = 0 and t1.status = 0
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
23
ruoyi-xq/src/main/resources/mapper/xq/UserStarMapper.xml
Normal file
23
ruoyi-xq/src/main/resources/mapper/xq/UserStarMapper.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?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.xq.mapper.UserStarMapper">
|
||||||
|
|
||||||
|
<select id="selectMyStar" resultType="com.ruoyi.xq.dto.app.userstar.vo.UserStarListVo">
|
||||||
|
select t2.id as user_id, t2.avatar, t2.gender, t2.nickname, t2.birthday, t2.residence_city,
|
||||||
|
t2.education, t2.profession
|
||||||
|
from xq_user_star t1
|
||||||
|
join xq_user t2 on t1.star_user_id = t2.id
|
||||||
|
where t1.user_id = #{query.userId}
|
||||||
|
</select>
|
||||||
|
<select id="selectStarMe" resultType="com.ruoyi.xq.dto.app.userstar.vo.UserStarListVo">
|
||||||
|
select t2.id as user_id, t2.avatar, t2.gender, t2.nickname, t2.birthday, t2.residence_city,
|
||||||
|
t2.education, t2.profession
|
||||||
|
from xq_user_star t1
|
||||||
|
join xq_user t2 on t1.user_id = t2.id
|
||||||
|
where t1.star_user_id = #{query.userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user