feat:搜索
This commit is contained in:
1 parent
bb6bad33b2
commit
334c9223c6
6 files changed
+64
-9
No files matched your search
+3
-6
@@ -2,17 +2,11 @@ package cn.iocoder.yudao.module.member.controller.admin.recent.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -26,6 +20,9 @@ public class RecentPageReqVO extends PageParam {
|
||||
@Schema(description = "用户编号")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "性别")
|
||||
private Integer memberSex;
|
||||
|
||||
@Schema(description = "用户昵称")
|
||||
private String memberNickname;
|
||||
|
||||
|
||||
+3
@@ -27,6 +27,9 @@ public class AppMemberUserUpdateReqVO {
|
||||
@Schema(description = "身高(cm)")
|
||||
private Double height;
|
||||
|
||||
@Schema(description = "用户性别")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "体重(kg)")
|
||||
private Double weight;
|
||||
|
||||
|
||||
+5
@@ -33,10 +33,12 @@ public class AppViewController {
|
||||
List<Map<String, String>> menu = new ArrayList<>();
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "100");
|
||||
put("search-action", "DYNAMIC_RECOMMEND");
|
||||
put("label", "推荐");
|
||||
}});
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "200");
|
||||
put("search-action", "DYNAMIC_NEARBY");
|
||||
put("label", "附近");
|
||||
}});
|
||||
return success(menu);
|
||||
@@ -48,14 +50,17 @@ public class AppViewController {
|
||||
List<Map<String, String>> menu = new ArrayList<>();
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "1000");
|
||||
put("search-action", "SQUARE_SQUARE");
|
||||
put("label", "广场");
|
||||
}});
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "2000");
|
||||
put("search-action", "SQUARE_NEW_TIME");
|
||||
put("label", "最近");
|
||||
}});
|
||||
menu.add(new HashMap<String, String>() {{
|
||||
put("code", "3000");
|
||||
put("search-action", "SQUARE_NEW_PERSON");
|
||||
put("label", "新人");
|
||||
}});
|
||||
return success(menu);
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ public interface RecentMapper extends BaseMapperX<RecentDO> {
|
||||
.likeIfExists(MemberUserDO::getNickname, reqVO.getMemberNickname())
|
||||
.eqIfExists(RecentDO::getMemberId, reqVO.getMemberId())
|
||||
.eqIfExists(RecentDO::getDescription, reqVO.getDescribe())
|
||||
.eqIfExists(MemberUserDO::getSex, reqVO.getMemberSex())
|
||||
.likeIfExists(RecentDO::getIssueProvince, reqVO.getIssueProvince())
|
||||
.likeIfExists(RecentDO::getIssueCity, reqVO.getIssueCity())
|
||||
.likeIfExists(RecentDO::getIssueDistrict, reqVO.getIssueDistrict())
|
||||
|
||||
+14
-1
@@ -15,12 +15,14 @@ import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberRecentTagDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.recent.OperationMapper;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberRecentTagMapper;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
|
||||
import cn.iocoder.yudao.module.member.enums.MemberErrorCode;
|
||||
import cn.iocoder.yudao.module.member.enums.MemberRecentOperateEnum;
|
||||
import cn.iocoder.yudao.module.member.enums.MemberRecentSceneEnum;
|
||||
import cn.iocoder.yudao.module.member.service.location.LocationService;
|
||||
import cn.iocoder.yudao.module.member.service.thirdauth.ThirdAuthService;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import cn.iocoder.yudao.module.system.enums.common.SexEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -42,7 +44,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@@ -69,6 +70,7 @@ public class RecentServiceImpl implements RecentService {
|
||||
|
||||
@Resource
|
||||
private ThirdAuthService thirdAuthService;
|
||||
private MemberUserMapper memberUserMapper;
|
||||
|
||||
/**
|
||||
* 创建朋友圈
|
||||
@@ -245,7 +247,18 @@ public class RecentServiceImpl implements RecentService {
|
||||
*/
|
||||
@Override
|
||||
public PageResult<RecentPageResVo> quickPage(AppRecentQuickPageVO bean) {
|
||||
// 查询当前用户信息
|
||||
MemberUserDO operationUser = memberUserService.getUser(bean.getOperationMemberId());
|
||||
|
||||
RecentPageReqVO result = BeanUtil.toBean(bean, RecentPageReqVO.class);
|
||||
|
||||
// 只查询异性
|
||||
if (ObjectUtil.isNotEmpty(operationUser.getSex())) {
|
||||
SexEnum sexEnum = SexEnum.valueOfSex(operationUser.getSex());
|
||||
SexEnum targetSex = SexEnum.negation(sexEnum.getSex());
|
||||
result.setMemberSex(targetSex.getSex());
|
||||
}
|
||||
|
||||
PageResult<RecentDO> recentPageList = recentMapper.selectPage(result);
|
||||
List<RecentPageResVo> resultList = BeanUtils.toBean(recentPageList.getList(), RecentPageResVo.class);
|
||||
// 为RecentPageResVo设置Member信息
|
||||
|
||||
+38
-2
@@ -1,8 +1,11 @@
|
||||
package cn.iocoder.yudao.module.system.enums.common;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 性别的枚举值
|
||||
*
|
||||
@@ -12,9 +15,13 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum SexEnum {
|
||||
|
||||
/** 男 */
|
||||
/**
|
||||
* 男
|
||||
*/
|
||||
MALE(1),
|
||||
/** 女 */
|
||||
/**
|
||||
* 女
|
||||
*/
|
||||
FEMALE(2),
|
||||
/* 未知 */
|
||||
UNKNOWN(0);
|
||||
@@ -24,4 +31,33 @@ public enum SexEnum {
|
||||
*/
|
||||
private final Integer sex;
|
||||
|
||||
/**
|
||||
* 判断是否为男性
|
||||
*/
|
||||
public static boolean isMale(Integer sex) {
|
||||
return MALE.getSex().equals(sex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为女性
|
||||
*/
|
||||
public static boolean isFemale(Integer sex) {
|
||||
return FEMALE.getSex().equals(sex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取反
|
||||
*/
|
||||
public static SexEnum negation(Integer sex) {
|
||||
if(ObjectUtil.isEmpty(sex) || ObjectUtil.equals(sex, UNKNOWN.getSex())){
|
||||
return UNKNOWN;
|
||||
}
|
||||
return isMale(sex) ? FEMALE : MALE;
|
||||
}
|
||||
|
||||
public static SexEnum valueOfSex(Integer sex) {
|
||||
return Arrays.asList(values()).stream().filter(v -> ObjectUtil.equals(v.getSex(), sex)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user