init
This commit is contained in:
@@ -7,25 +7,22 @@ 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.domain.Dynamic;
|
||||
import com.ruoyi.xq.dto.app.dynamic.AddDynamicReq;
|
||||
import com.ruoyi.xq.dto.app.dynamic.DynamicListVo;
|
||||
import com.ruoyi.xq.dto.app.dynamic.DynamicQuery;
|
||||
import com.ruoyi.xq.dto.app.dynamic.*;
|
||||
import com.ruoyi.xq.service.DynamicService;
|
||||
import com.ruoyi.xq.service.DynamicStarService;
|
||||
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.*;
|
||||
|
||||
import javax.servlet.Registration;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/dynamic")
|
||||
@Tag(name = "动态相关接口")
|
||||
public class DynamicAppController {
|
||||
@Autowired
|
||||
private DynamicService dynamicService;
|
||||
@Autowired
|
||||
private DynamicStarService dynamicStarService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增动态")
|
||||
@@ -36,11 +33,39 @@ public class DynamicAppController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/star")
|
||||
@Operation(summary = "点赞动态")
|
||||
@Log(title = "点赞动态", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<Void> starDynamic(@RequestBody DynamicStarReq req){
|
||||
Long userId = LoginHelper.getUserId();
|
||||
if(req.getStar() == null){
|
||||
return R.fail();
|
||||
}
|
||||
if(req.getStar() == 1){
|
||||
dynamicStarService.star(req.getDynamicId(),userId);
|
||||
return R.ok();
|
||||
}
|
||||
if(req.getStar() == 2){
|
||||
dynamicStarService.unStar(req.getDynamicId(),userId);
|
||||
return R.ok();
|
||||
}
|
||||
return R.fail();
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "动态列表-分页")
|
||||
@Log(title = "动态列表-分页", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<PageModel<DynamicListVo>> page(PageQuery pageQuery, DynamicQuery dynamicQuery){
|
||||
dynamicQuery.initBirthdayByAge();
|
||||
Page<DynamicListVo> page = dynamicService.pageApp(pageQuery, dynamicQuery);
|
||||
return R.ok(PageModel.build(page));
|
||||
}
|
||||
|
||||
@GetMapping("/myStarDynamic")
|
||||
@Operation(summary = "我收到的动态点赞-分页")
|
||||
@Log(title = "我收到的动态点赞-分页", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<PageModel<MyStarDynamicListVO>> myStarDynamic(PageQuery pageQuery, MyStarDynamicQuery dynamicQuery){
|
||||
Page<MyStarDynamicListVO> page = dynamicStarService.myStarDynamic(pageQuery, dynamicQuery);
|
||||
return R.ok(PageModel.build(page));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class HomeAppController {
|
||||
@Operation(summary = "首页查询用户-分页")
|
||||
@Log(title = "首页查询用户-分页", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<PageModel<HomeUserListVo>> userPage(@RequestBody HomePageReq homePageReq){
|
||||
homePageReq.initBirthdayByAge();
|
||||
Page<HomeUserListVo> vo = userService.homePage(homePageReq);
|
||||
return R.ok(PageModel.build(vo));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ruoyi.xq.controller.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/invite")
|
||||
@Tag(name = "邀请推广接口")
|
||||
public class InviteAppController {
|
||||
|
||||
|
||||
}
|
||||
@@ -3,12 +3,16 @@ package com.ruoyi.xq.controller.app;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.xq.domain.UserExtend;
|
||||
import com.ruoyi.xq.dto.app.common.IdsReq;
|
||||
import com.ruoyi.xq.dto.app.user.*;
|
||||
import com.ruoyi.xq.dto.app.user.vo.AccountInfoVO;
|
||||
import com.ruoyi.xq.dto.app.user.vo.CurrentUserFullInfoVo;
|
||||
import com.ruoyi.xq.dto.app.user.vo.CurrentUserInfoVo;
|
||||
import com.ruoyi.xq.dto.app.user.vo.UserAuthInfoVo;
|
||||
import com.ruoyi.xq.manager.CurrentUserManager;
|
||||
import com.ruoyi.xq.service.UserExtendService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -24,6 +28,8 @@ import java.util.stream.Collectors;
|
||||
public class UserAppController {
|
||||
@Autowired
|
||||
private CurrentUserManager currentUserManager;
|
||||
@Autowired
|
||||
private UserExtendService userExtendService;
|
||||
|
||||
@GetMapping("/user/query/homeInfo")
|
||||
@Operation(summary = "当前用户信息")
|
||||
@@ -33,6 +39,18 @@ public class UserAppController {
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
||||
@GetMapping("/user/account/info")
|
||||
@Operation(summary = "当前用户信息的账户余额情况")
|
||||
@Log(title = "当前用户信息的账户余额情况", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
public R<AccountInfoVO> accountInfo(){
|
||||
UserExtend userExtend = userExtendService.getByUserId(LoginHelper.getUserId());
|
||||
AccountInfoVO accountInfoVO = new AccountInfoVO();
|
||||
accountInfoVO.setUserId(userExtend.getUserId());
|
||||
accountInfoVO.setIncomeCoin(userExtend.getIncomeCoin());
|
||||
accountInfoVO.setWxTransNum(userExtend.getWxTransNum());
|
||||
return R.ok(accountInfoVO);
|
||||
}
|
||||
|
||||
@GetMapping("/user/query/fullInfo")
|
||||
@Operation(summary = "当前用户的详细信息")
|
||||
@Log(title = "当前用户的详细信息", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
|
||||
42
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/DynamicStar.java
Normal file
42
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/DynamicStar.java
Normal file
@@ -0,0 +1,42 @@
|
||||
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_dynamic_star
|
||||
*
|
||||
* @author 77
|
||||
* @date 2024-03-25
|
||||
*/
|
||||
@Data
|
||||
@TableName("xq_dynamic_star")
|
||||
public class DynamicStar implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 点赞用户ID
|
||||
*/
|
||||
private Long starUserId;
|
||||
/**
|
||||
* 点赞用户号
|
||||
*/
|
||||
private String starUsercode;
|
||||
/**
|
||||
* 动态ID
|
||||
*/
|
||||
private Long dynamicId;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -46,6 +46,9 @@ public class DynamicListVo {
|
||||
@Schema(description = "内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "点赞数")
|
||||
private Long starNum;
|
||||
|
||||
@Schema(description = "图片列表")
|
||||
private List<String> imageList;
|
||||
|
||||
|
||||
@@ -3,14 +3,38 @@ package com.ruoyi.xq.dto.app.dynamic;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class DynamicQuery {
|
||||
@Schema(hidden = true)
|
||||
private LocalDate birthdayBegin;
|
||||
@Schema(hidden = true)
|
||||
private LocalDate birthdayEnd;
|
||||
|
||||
|
||||
@Schema(description = "性别 1-女 2-男")
|
||||
private Integer gender;
|
||||
|
||||
@Schema(description = "居住城市")
|
||||
private String residenceCity;
|
||||
@Schema(description = "年龄-开始")
|
||||
private Integer ageBegin;
|
||||
@Schema(description = "年龄-结束")
|
||||
private Integer ageEnd;
|
||||
|
||||
@Schema(description = "居住地")
|
||||
private String residenceCode;
|
||||
|
||||
@Schema(description = "1-最新发布 2-热门动态")
|
||||
private Integer sortBy = 1;
|
||||
|
||||
public void initBirthdayByAge(){
|
||||
if(this.ageBegin != null && this.ageBegin > 0){
|
||||
this.birthdayEnd = LocalDate.now().plusYears(-ageBegin);
|
||||
}
|
||||
if(this.ageEnd != null && this.ageEnd > 0){
|
||||
this.birthdayBegin= LocalDate.now().plusYears(-ageEnd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.xq.dto.app.dynamic;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DynamicStarReq {
|
||||
@Schema(description = "动态ID")
|
||||
private Long dynamicId;
|
||||
@Schema(description = "1-点赞 2-取消点赞")
|
||||
private Integer star;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.xq.dto.app.dynamic;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MyStarDynamicListVO {
|
||||
@Schema(description = "点赞用户ID")
|
||||
private Long starUserId;
|
||||
@Schema(description = "点赞用户编号")
|
||||
private String starUsercode;
|
||||
@Schema(description = "点赞用户昵称")
|
||||
private String starNickname;
|
||||
@Schema(description = "点赞用户头像")
|
||||
private String starAvatar;
|
||||
@Schema(description = "点赞动态ID")
|
||||
private Long dynamicId;
|
||||
@Schema(description = "图片列表")
|
||||
private List<String> imageList;
|
||||
@Schema(description = "点赞时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.xq.dto.app.dynamic;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
@Data
|
||||
public class MyStarDynamicQuery {
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
}
|
||||
@@ -55,6 +55,14 @@ public class HomePageReq extends PageQuery {
|
||||
private Integer carStatus;
|
||||
@Schema(description = "户籍地")
|
||||
private String addressCode;
|
||||
}
|
||||
|
||||
public void initBirthdayByAge(){
|
||||
if(this.ageBegin != null && this.ageBegin > 0){
|
||||
this.birthdayEnd = LocalDate.now().plusYears(-ageBegin);
|
||||
}
|
||||
if(this.ageEnd != null && this.ageEnd > 0){
|
||||
this.birthdayBegin= LocalDate.now().plusYears(-ageEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.xq.dto.app.user.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class AccountInfoVO {
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
@Schema(description = "收益的余额")
|
||||
private BigDecimal incomeCoin;
|
||||
/**
|
||||
* 交换微信次数
|
||||
*/
|
||||
@Schema(description = "交换微信次数")
|
||||
private Integer wxTransNum;
|
||||
}
|
||||
@@ -4,7 +4,9 @@ import com.ruoyi.xq.dto.app.common.UserPicturesDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -71,6 +73,24 @@ public class CurrentUserInfoVo {
|
||||
|
||||
@Schema(description = "最大认证数量")
|
||||
private Integer maxAuthNum = 8;
|
||||
|
||||
@Schema(description = "是否开通VIP")
|
||||
private Boolean openVip = false;
|
||||
@Schema(description = "vip等级")
|
||||
private Integer vipType;
|
||||
@Schema(description = "vip到期时间")
|
||||
private LocalDateTime vipTimeout;
|
||||
|
||||
/**
|
||||
* 收益的余额
|
||||
*/
|
||||
@Schema(description = "收益的余额")
|
||||
private BigDecimal incomeCoin;
|
||||
/**
|
||||
* 交换微信次数
|
||||
*/
|
||||
@Schema(description = "交换微信次数")
|
||||
private Integer wxTransNum;
|
||||
/**
|
||||
* 相册
|
||||
*/
|
||||
|
||||
@@ -225,4 +225,12 @@ public class HomeUserVo {
|
||||
@Schema(description = "择偶条件-购车情况")
|
||||
private Integer filterCarStatus;
|
||||
|
||||
@Schema(description = "是否开通VIP")
|
||||
private Boolean openVip = false;
|
||||
/**
|
||||
* @see com.ruoyi.xq.enums.vip.VipTypeEnum
|
||||
*/
|
||||
@Schema(description = "开通的VIP类型")
|
||||
private Integer vipType;
|
||||
|
||||
}
|
||||
|
||||
17
ruoyi-xq/src/main/java/com/ruoyi/xq/enums/ErrorEnum.java
Normal file
17
ruoyi-xq/src/main/java/com/ruoyi/xq/enums/ErrorEnum.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.xq.enums;
|
||||
|
||||
import com.ruoyi.common.exception.IErrorService;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ErrorEnum implements IErrorService {
|
||||
VIP_AUTH(600100,"权限不足,需要开通VIP")
|
||||
;
|
||||
private final Integer code;
|
||||
private final String text;
|
||||
|
||||
ErrorEnum(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,10 @@ public class CurrentUserManager {
|
||||
private SystemConfigManager systemConfigManager;
|
||||
@Autowired
|
||||
private AreaCodeService areaCodeService;
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
@Autowired
|
||||
private UserExtendService userExtendService;
|
||||
|
||||
|
||||
public CurrentUserFullInfoVo currentFullInfo(){
|
||||
@@ -108,6 +112,15 @@ public class CurrentUserManager {
|
||||
vo.setImToken(user.getImToken());
|
||||
List<UserPictures> userPictures = userPicturesService.listByUserIdAuditingAndSuccess(user.getId());
|
||||
vo.setUserPicturesList(BeanConvertUtil.convertListTo(userPictures, UserPicturesDTO::new));
|
||||
UserVip userVip = userVipService.getByUserVipMaster(userId);
|
||||
if(userVip != null){
|
||||
vo.setOpenVip(true);
|
||||
vo.setVipType(userVip.getVipType());
|
||||
vo.setVipTimeout(userVip.getVipTimeout());
|
||||
}
|
||||
UserExtend userExtend = userExtendService.getByUserId(userId);
|
||||
vo.setIncomeCoin(userExtend.getIncomeCoin());
|
||||
vo.setWxTransNum(userExtend.getWxTransNum());
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
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.DynamicStar;
|
||||
import com.ruoyi.xq.dto.app.dynamic.DynamicListVo;
|
||||
import com.ruoyi.xq.dto.app.dynamic.MyStarDynamicListVO;
|
||||
import com.ruoyi.xq.dto.app.dynamic.MyStarDynamicQuery;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 动态点赞Mapper接口
|
||||
*
|
||||
* @author 77
|
||||
* @date 2024-03-25
|
||||
*/
|
||||
public interface DynamicStarMapper extends BaseMapper<DynamicStar> {
|
||||
|
||||
Page<MyStarDynamicListVO> myStarDynamic(@Param("build") Page<Object> build, @Param("query") MyStarDynamicQuery query);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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.DynamicStar;
|
||||
import com.ruoyi.xq.dto.app.dynamic.DynamicListVo;
|
||||
import com.ruoyi.xq.dto.app.dynamic.MyStarDynamicListVO;
|
||||
import com.ruoyi.xq.dto.app.dynamic.MyStarDynamicQuery;
|
||||
|
||||
/**
|
||||
* 动态点赞Service接口
|
||||
*
|
||||
* @author 77
|
||||
* @date 2024-03-25
|
||||
*/
|
||||
public interface DynamicStarService extends IService<DynamicStar> {
|
||||
|
||||
void star(Long dynamicId,Long starUserId);
|
||||
|
||||
void unStar(Long dynamicId, Long starUserId);
|
||||
|
||||
Page<MyStarDynamicListVO> myStarDynamic(PageQuery pageQuery, MyStarDynamicQuery dynamicQuery);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
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.xq.domain.DynamicImage;
|
||||
import com.ruoyi.xq.domain.DynamicStar;
|
||||
import com.ruoyi.xq.dto.app.dynamic.DynamicListVo;
|
||||
import com.ruoyi.xq.dto.app.dynamic.MyStarDynamicListVO;
|
||||
import com.ruoyi.xq.dto.app.dynamic.MyStarDynamicQuery;
|
||||
import com.ruoyi.xq.dto.common.user.MinUser;
|
||||
import com.ruoyi.xq.mapper.DynamicStarMapper;
|
||||
import com.ruoyi.xq.service.DynamicImageService;
|
||||
import com.ruoyi.xq.service.DynamicStarService;
|
||||
import com.ruoyi.xq.service.UserService;
|
||||
import com.ruoyi.xq.util.AgeUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 动态点赞Service业务层处理
|
||||
*
|
||||
* @author 77
|
||||
* @date 2024-03-25
|
||||
*/
|
||||
@Service
|
||||
public class DynamicStarServiceImpl extends ServiceImpl<DynamicStarMapper,DynamicStar> implements DynamicStarService {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private DynamicImageService dynamicImageService;
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void star(Long dynamicId, Long starUserId) {
|
||||
MinUser user = userService.getMinUserById(starUserId);
|
||||
if(user == null){
|
||||
return;
|
||||
}
|
||||
this.remove(Wrappers.lambdaQuery(DynamicStar.class).eq(DynamicStar::getDynamicId, dynamicId)
|
||||
.eq(DynamicStar::getStarUserId, starUserId));
|
||||
DynamicStar dynamicStar = new DynamicStar();
|
||||
dynamicStar.setStarUserId(user.getId());
|
||||
dynamicStar.setStarUsercode(user.getUsercode());
|
||||
dynamicStar.setDynamicId(dynamicId);
|
||||
this.save(dynamicStar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unStar(Long dynamicId, Long starUserId) {
|
||||
this.remove(Wrappers.lambdaQuery(DynamicStar.class).eq(DynamicStar::getDynamicId, dynamicId)
|
||||
.eq(DynamicStar::getStarUserId, starUserId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<MyStarDynamicListVO> myStarDynamic(PageQuery pageQuery, MyStarDynamicQuery dynamicQuery) {
|
||||
Page<MyStarDynamicListVO> result = baseMapper.myStarDynamic(pageQuery.build(), dynamicQuery);
|
||||
List<MyStarDynamicListVO> records = result.getRecords();
|
||||
if(CollectionUtils.isEmpty(records)){
|
||||
return result;
|
||||
}
|
||||
List<Long> dynamicIds = records.stream().map(MyStarDynamicListVO::getDynamicId).collect(Collectors.toList());
|
||||
List<DynamicImage> list = dynamicImageService.list(Wrappers.lambdaQuery(DynamicImage.class).in(DynamicImage::getDynamicId, dynamicIds));
|
||||
Map<Long, List<DynamicImage>> map = list.stream().collect(Collectors.groupingBy(DynamicImage::getDynamicId));
|
||||
for (MyStarDynamicListVO record : records) {
|
||||
List<DynamicImage> images = map.get(record.getDynamicId());
|
||||
if(images == null){
|
||||
images = new ArrayList<>();
|
||||
}
|
||||
record.setImageList(images.stream().map(DynamicImage::getUrl).collect(Collectors.toList()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ 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.common.user.MinUser;
|
||||
import com.ruoyi.xq.enums.ErrorEnum;
|
||||
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
||||
import com.ruoyi.xq.enums.userinfo.UserGenderEnum;
|
||||
import com.ruoyi.xq.manager.SystemConfigManager;
|
||||
@@ -101,6 +102,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
||||
BeanConvertUtil.copyProperties(user,result);
|
||||
List<UserPictures> userPicturesList = userPicturesService.listByUserIdSuccess(userId);
|
||||
result.setUserPictureList(userPicturesList.stream().map(UserPictures::getPicture).collect(Collectors.toList()));
|
||||
UserVip userVip = userVipService.getByUserVipMaster(user.getId());
|
||||
if(userVip != null){
|
||||
result.setOpenVip(true);
|
||||
result.setVipType(userVip.getVipType());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -187,11 +193,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
||||
vipQuery.getCarStatus() != null || StringUtils.isNotEmpty(vipQuery.getAddressCode())){
|
||||
Long userId = LoginHelper.getUserId();
|
||||
if(userId == null){
|
||||
throw new ServiceException("开通VIP才能开通查询",600100);
|
||||
throw new ServiceException(ErrorEnum.VIP_AUTH);
|
||||
}
|
||||
UserVip userVip = userVipService.getByUserVipMaster(userId);
|
||||
if(userVip == null){
|
||||
throw new ServiceException("开通VIP才能开通查询",600100);
|
||||
throw new ServiceException(ErrorEnum.VIP_AUTH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,17 +22,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="sort" column="sort"/>
|
||||
</resultMap>
|
||||
<select id="pageApp" resultType="com.ruoyi.xq.dto.app.dynamic.DynamicListVo">
|
||||
select t1.id, t1.content, t1.user_id,t1.create_time,
|
||||
t2.avatar, t2.nickname, t2.birthday, t2.gender, t2.residence_city, t2.education,
|
||||
t2.profession
|
||||
select t1.id, t1.content, t1.user_id,t1.create_time as create_time,
|
||||
t2.avatar, t2.nickname, t2.birthday, t2.gender, t2.residence_city_name, t2.education,
|
||||
t2.profession,ifnull(count(t3.id),0) as star_num
|
||||
from xq_dynamic t1
|
||||
join xq_user t2 on t1.user_id = t2.id
|
||||
left join xq_dynamic_star t3 on t1.id = t3.dynamic_id
|
||||
where t1.audit_status = 2 and t2.status = 0
|
||||
<where>
|
||||
<if test="query.gender != null">
|
||||
and t2.gender = #{query.gender}
|
||||
</if>
|
||||
<if test="query.birthdayBegin != null">
|
||||
and t2.birthday >= #{query.birthdayBegin}
|
||||
</if>
|
||||
<if test="query.birthdayEnd != null">
|
||||
<![CDATA[
|
||||
and t2.birthday <= #{query.birthdayEnd}
|
||||
]]>
|
||||
</if>
|
||||
<if test="query.residenceCode != null and query.residenceCode != ''">
|
||||
and t1.residence_code like concat(#{query.residenceCode},'%')
|
||||
</if>
|
||||
</where>
|
||||
group by t1.id
|
||||
<choose>
|
||||
<when test="query.sortBy != null and query.sortBy == 2">
|
||||
order by star_num desc
|
||||
</when>
|
||||
<otherwise>
|
||||
order by create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<select id="pageAdmin" resultType="com.ruoyi.xq.dto.admin.dynamic.DynamicAdminVo">
|
||||
select t1.*, t2.nickname, t2.mobile,t2.avatar
|
||||
|
||||
28
ruoyi-xq/src/main/resources/mapper/xq/DynamicStarMapper.xml
Normal file
28
ruoyi-xq/src/main/resources/mapper/xq/DynamicStarMapper.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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.DynamicStarMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.xq.domain.DynamicStar" id="DynamicStarResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="starUserId" column="star_user_id"/>
|
||||
<result property="starUsercode" column="star_usercode"/>
|
||||
<result property="dynamicId" column="dynamic_id"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
<select id="myStarDynamic" resultType="com.ruoyi.xq.dto.app.dynamic.MyStarDynamicListVO">
|
||||
select
|
||||
t3.id as star_user_id, t3.usercode as star_usercode,
|
||||
t3.nickname as star_nickname, t3.avatar as star_avatar,
|
||||
t1.dynamic_id, t1.create_time
|
||||
from xq_dynamic_star t1
|
||||
join xq_dynamic t2 on t1.dynamic_id = t2.id
|
||||
join xq_user t3 on t1.star_user_id = t3.id
|
||||
where t2.audit_status = 2 and t2.user_id = #{query.userId}
|
||||
order by t1.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and t1.education = #{params.education}
|
||||
</if>
|
||||
<if test="params.residenceCode != null and params.residenceCode != ''">
|
||||
and t1.education like concat(#{params.residenceCode},'%')
|
||||
and t1.residence_code like concat(#{params.residenceCode},'%')
|
||||
</if>
|
||||
<if test="params.vipQuery != null">
|
||||
<if test="params.vipQuery.profession != null and params.vipQuery.profession != ''">
|
||||
|
||||
Reference in New Issue
Block a user