This commit is contained in:
张良(004796)
2024-03-19 15:20:14 +08:00
parent 6fa752d8a8
commit 979d89eeac
25 changed files with 549 additions and 26 deletions

View File

@@ -0,0 +1,95 @@
package com.ruoyi.xq.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
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.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.xq.domain.AreaCode;
import com.ruoyi.xq.service.AreaCodeService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
/**
* 行政区划
*
* @author 77
* @date 2024-03-19
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/xq/areaCode")
public class AreaCodeController extends BaseController {
private final AreaCodeService areaCodeService;
/**
* 查询行政区划列表
*/
@SaCheckPermission("xq:areaCode:list")
@GetMapping("/list")
public TableDataInfo<AreaCode> list(AreaCode bo, PageQuery pageQuery) {
Page<AreaCode> page = areaCodeService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
return TableDataInfo.build(page);
}
/**
* 获取行政区划详细信息
*
* @param code 主键
*/
@SaCheckPermission("xq:areaCode:query")
@GetMapping("/{code}")
public R<AreaCode> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Integer code) {
return R.ok(areaCodeService.getById(code));
}
/**
* 新增行政区划
*/
@SaCheckPermission("xq:areaCode:add")
@Log(title = "行政区划", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody AreaCode bo) {
return toAjax(areaCodeService.save(bo));
}
/**
* 修改行政区划
*/
@SaCheckPermission("xq:areaCode:edit")
@Log(title = "行政区划", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AreaCode bo) {
return toAjax(areaCodeService.updateById(bo));
}
/**
* 删除行政区划
*
* @param codes 主键串
*/
@SaCheckPermission("xq:areaCode:remove")
@Log(title = "行政区划", businessType = BusinessType.DELETE)
@DeleteMapping("/{codes}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Integer[] codes) {
return toAjax(areaCodeService.removeBatchByIds(Arrays.asList(codes)));
}
}

View File

@@ -40,6 +40,14 @@ public class HomeAppController {
return R.ok(PageModel.build(vo)); return R.ok(PageModel.build(vo));
} }
@GetMapping("/vip/page")
@Operation(summary = "首页查询VIP推荐用户-分页")
@Log(title = "首页查询VIP推荐用户-分页", businessType = BusinessType.OTHER, isSaveDb = false)
public R<List<HomeUserListVo>> vipPage(){
List<HomeUserListVo> vo = userService.vipHomePage();
return R.ok(vo);
}
@GetMapping("/user/info") @GetMapping("/user/info")
@Operation(summary = "查询用户主页信息") @Operation(summary = "查询用户主页信息")

View File

@@ -4,8 +4,11 @@ import cn.dev33.satoken.annotation.SaIgnore;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
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.AreaCode;
import com.ruoyi.xq.dto.app.areacode.AreaCodeQuery;
import com.ruoyi.xq.dto.app.setting.AgreementDTO; import com.ruoyi.xq.dto.app.setting.AgreementDTO;
import com.ruoyi.xq.service.AgreementSettingService; import com.ruoyi.xq.service.AgreementSettingService;
import com.ruoyi.xq.service.AreaCodeService;
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;
@@ -13,6 +16,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController @RestController
@RequestMapping("/api/setting") @RequestMapping("/api/setting")
@Tag(name = "获取设置相关接口") @Tag(name = "获取设置相关接口")
@@ -21,6 +26,8 @@ public class SettingAppController {
@Autowired @Autowired
private AgreementSettingService agreementSettingService; private AgreementSettingService agreementSettingService;
@Autowired
private AreaCodeService areaCodeService;
@GetMapping("/agreement/user") @GetMapping("/agreement/user")
@Operation(summary = "获取用户协议") @Operation(summary = "获取用户协议")
@@ -46,4 +53,12 @@ public class SettingAppController {
return R.ok(new AgreementDTO(anchorJoinAgreement)); return R.ok(new AgreementDTO(anchorJoinAgreement));
} }
@GetMapping("/areaCode/list")
@Operation(summary = "获取省市区编码接口")
@Log(title = "获取省市区编码接口", businessType = BusinessType.OTHER, isSaveDb = false)
public R<List<AreaCode>> listAreaCode(AreaCodeQuery query){
List<AreaCode> list = areaCodeService.listAreaCode(query);
return R.ok(list);
}
} }

View File

@@ -0,0 +1,56 @@
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.math.BigDecimal;
/**
* 行政区划对象 area_code
*
* @author 77
* @date 2024-03-19
*/
@Data
@TableName("area_code")
public class AreaCode implements Serializable {
private static final long serialVersionUID=1L;
/**
* 行政区划代码
*/
@TableId(value = "code")
private Integer code;
/**
* 名字
*/
private String name;
/**
* country:国家、province:省份直辖市会在province和city显示、city:市直辖市会在province和city显示、district:区县
*/
private String level;
/**
* 所属上级行政区划代码
*/
private Integer pcode;
/**
* 所属行政区划名字
*/
private String pname;
/**
* 行政区划完整名字
*/
private String fullname;
/**
* 经度
*/
private BigDecimal longitude;
/**
* 纬度
*/
private BigDecimal latitude;
}

View File

@@ -83,17 +83,27 @@ public class User implements Serializable {
*/ */
private Integer sign; private Integer sign;
/** /**
* 居住地 * 居住地(名称)
*/ */
private String residence; private String residenceName;
/** /**
* 户籍地 * 居住地代码
*/ */
private String address; private String residenceCode;
/** /**
* 居住城市 * 居住城市
*/ */
private String residenceCity; private String residenceCityName;
/**
* 户籍地(名称)
*/
private String addressName;
/**
* 户籍地代码
*/
private String addressCode;
/** /**
* 学历 * 学历
*/ */
@@ -129,6 +139,11 @@ public class User implements Serializable {
@Schema(description = "基础资料是否完成 0 未完成 1已完成") @Schema(description = "基础资料是否完成 0 未完成 1已完成")
private Integer finishBaseStatus; private Integer finishBaseStatus;
/**
* 基础信息完成进度
*/
private Integer baseStep;
/** /**
* 邀请人 * 邀请人
*/ */

View File

@@ -0,0 +1,10 @@
package com.ruoyi.xq.dto.app.areacode;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class AreaCodeQuery {
@Schema(description = "父级节点传0返回一级节点")
private Integer pcode;
}

View File

@@ -1,9 +1,60 @@
package com.ruoyi.xq.dto.app.user; package com.ruoyi.xq.dto.app.user;
import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.PageQuery;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.time.LocalDate;
@Data @Data
public class HomePageReq extends PageQuery { public class HomePageReq extends PageQuery {
@Schema(hidden = true)
private LocalDate birthdayBegin;
@Schema(hidden = true)
private LocalDate birthdayEnd;
@Schema(description = "年龄-开始")
private Integer ageBegin;
@Schema(description = "年龄-结束")
private Integer ageEnd;
@Schema(description = "身高-开始")
private Integer heightBegin;
@Schema(description = "身高-结束")
private Integer heightEnd;
@Schema(description = "体重-开始")
private Integer weightBegin;
@Schema(description = "体重-结束")
private Integer weightEnd;
@Schema(description = "性别")
private Integer gender;
@Schema(description = "婚况")
private Integer marriage;
@Schema(description = "教育")
private Integer education;
@Schema(description = "居住地")
private String residenceCode;
@Schema(description = "VIP查询限制")
private VipQuery vipQuery;
@Data
public static class VipQuery {
@Schema(description = "职业")
private String profession;
@Schema(description = "年收入")
private Integer annualIncome;
@Schema(description = "生效")
private Integer zodiac;
@Schema(description = "星座")
private Integer sign;
@Schema(description = "小孩情况")
private Integer childStatus;
@Schema(description = "购房情况")
private Integer housingStatus;
@Schema(description = "购车情况")
private Integer carStatus;
@Schema(description = "户籍地")
private String addressCode;
}
} }

View File

@@ -7,6 +7,8 @@ import java.time.LocalDate;
@Data @Data
public class UpdateBaseInfoReq { public class UpdateBaseInfoReq {
@Schema(description = "基础信息保存进度")
private Integer baseStep;
@Schema(description = "为谁征婚") @Schema(description = "为谁征婚")
private Integer forPersonals; private Integer forPersonals;
@Schema(description = "性别 0-未知 1-女 2-男") @Schema(description = "性别 0-未知 1-女 2-男")
@@ -27,12 +29,12 @@ public class UpdateBaseInfoReq {
* 居住地 * 居住地
*/ */
@Schema(description = "居住地") @Schema(description = "居住地")
private String residence; private String residenceCode;
/** /**
* 户籍地 * 户籍地
*/ */
@Schema(description = "户籍地") @Schema(description = "户籍地")
private String address; private String addressCode;
/** /**
* 学历 * 学历
*/ */

View File

@@ -28,9 +28,9 @@ public class UpdateUserFullInfoReq {
private Integer somatotype; private Integer somatotype;
@Schema(description = "居住地") @Schema(description = "居住地")
private String residence; private String residenceCode;
@Schema(description = "户籍地") @Schema(description = "户籍地")
private String address; private String addressCode;
@Schema(description = "学历") @Schema(description = "学历")
private Integer education; private Integer education;
@Schema(description = "婚况") @Schema(description = "婚况")

View File

@@ -40,10 +40,16 @@ public class CurrentUserInfoVo {
private LocalDate birthday; private LocalDate birthday;
@Schema(description = "年龄") @Schema(description = "年龄")
private Integer age; private Integer age;
// @Schema(description = "城市ID")
// private Integer cityId;
@Schema(description = "居住城市") @Schema(description = "居住城市")
private String residenceCity; private String residenceCityName;
@Schema(description = "居住地名称")
private String residenceName;
@Schema(description = "居住地编码")
private String residenceCode;
@Schema(description = "户籍地名称")
private String addressName;
@Schema(description = "户籍地编码")
private String addressCode;
/** /**
* 状态 0 可用 1 不可用 * 状态 0 可用 1 不可用
*/ */
@@ -51,6 +57,8 @@ public class CurrentUserInfoVo {
private Integer status; private Integer status;
@Schema(description = "基础资料是否完成 0 未完成 1已完成") @Schema(description = "基础资料是否完成 0 未完成 1已完成")
private Integer finishBaseStatus; private Integer finishBaseStatus;
@Schema(description = "基础信息完成进度")
private Integer baseStep;
@Schema(description = "imToken") @Schema(description = "imToken")
private String imToken; private String imToken;
@@ -63,7 +71,6 @@ public class CurrentUserInfoVo {
@Schema(description = "最大认证数量") @Schema(description = "最大认证数量")
private Integer maxAuthNum = 8; private Integer maxAuthNum = 8;
/** /**
* 相册 * 相册
*/ */

View File

@@ -23,8 +23,10 @@ public class HomeUserListVo {
private LocalDate birthday; private LocalDate birthday;
@Schema(description = "生日-缩减显示") @Schema(description = "生日-缩减显示")
private String birthdayStr; private String birthdayStr;
@Schema(description = "居住城市") @Schema(description = "年龄")
private String residenceCity; private Integer age;
@Schema(description = "居住城市名称")
private String residenceCityName;
@Schema(description = "学历") @Schema(description = "学历")
private Integer education; private Integer education;
@Schema(description = "职业") @Schema(description = "职业")

View File

@@ -57,13 +57,17 @@ public class HomeUserVo {
/** /**
* 居住地 * 居住地
*/ */
@Schema(description = "居住地") @Schema(description = "居住地名称")
private String residence; private String residenceName;
@Schema(description = "居住地编码")
private String residenceCode;
/** /**
* 户籍地 * 户籍地
*/ */
@Schema(description = "户籍地") @Schema(description = "户籍地名称")
private String address; private String addressName;
@Schema(description = "户籍地编码")
private String addressCode;
/** /**
* 学历 * 学历
*/ */

View File

@@ -0,0 +1,9 @@
package com.ruoyi.xq.dto.common.user;
import lombok.Data;
@Data
public class MinUser {
private Long id;
private String usercode;
}

View File

@@ -0,0 +1,19 @@
package com.ruoyi.xq.enums.common;
import lombok.Getter;
@Getter
public enum AreaCodeLevelEnum {
COUNTRY("country","国家"),
PROVINCE("province","省份"),
CITY("city",""),
DISTRICT("city","区县"),
;
private final String code;
private final String text;
AreaCodeLevelEnum(String code, String text) {
this.code = code;
this.text = text;
}
}

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.xq.domain.*; import com.ruoyi.xq.domain.*;
import com.ruoyi.xq.dto.app.common.UserPicturesDTO; import com.ruoyi.xq.dto.app.common.UserPicturesDTO;
import com.ruoyi.xq.dto.app.user.AddPicturesReq; import com.ruoyi.xq.dto.app.user.AddPicturesReq;
@@ -48,6 +49,8 @@ public class CurrentUserManager {
private UserInfoAuditService userInfoAuditService; private UserInfoAuditService userInfoAuditService;
@Autowired @Autowired
private SystemConfigManager systemConfigManager; private SystemConfigManager systemConfigManager;
@Autowired
private AreaCodeService areaCodeService;
public CurrentUserFullInfoVo currentFullInfo(){ public CurrentUserFullInfoVo currentFullInfo(){
@@ -94,9 +97,14 @@ public class CurrentUserManager {
vo.setGender(user.getGender()); vo.setGender(user.getGender());
vo.setBirthday(user.getBirthday()); vo.setBirthday(user.getBirthday());
vo.setAge(AgeUtil.getAge(user.getBirthday())); vo.setAge(AgeUtil.getAge(user.getBirthday()));
vo.setResidenceCity(user.getResidenceCity()); vo.setResidenceCityName(user.getResidenceCityName());
vo.setResidenceCode(user.getResidenceCode());
vo.setResidenceName(user.getResidenceName());
vo.setAddressCode(user.getAddressCode());
vo.setAddressName(user.getAddressName());
vo.setStatus(user.getStatus()); vo.setStatus(user.getStatus());
vo.setFinishBaseStatus(user.getFinishBaseStatus()); vo.setFinishBaseStatus(user.getFinishBaseStatus());
vo.setBaseStep(user.getBaseStep());
vo.setImToken(user.getImToken()); vo.setImToken(user.getImToken());
List<UserPictures> userPictures = userPicturesService.listByUserIdAuditingAndSuccess(user.getId()); List<UserPictures> userPictures = userPicturesService.listByUserIdAuditingAndSuccess(user.getId());
vo.setUserPicturesList(BeanConvertUtil.convertListTo(userPictures, UserPicturesDTO::new)); vo.setUserPicturesList(BeanConvertUtil.convertListTo(userPictures, UserPicturesDTO::new));
@@ -115,19 +123,30 @@ public class CurrentUserManager {
String cos = systemConfigManager.getSystemConfig(SystemConfigEnum.COS_DOMAIN); String cos = systemConfigManager.getSystemConfig(SystemConfigEnum.COS_DOMAIN);
updateUser.setAvatar(cos + userGenderEnum.getDefaultAvatar()); updateUser.setAvatar(cos + userGenderEnum.getDefaultAvatar());
} }
if(StringUtils.isNotEmpty(req.getAddressCode())){
AreaCode areaCode = areaCodeService.getById(req.getAddressCode());
updateUser.setAddressName(areaCode.getName());
}
if(StringUtils.isNotEmpty(req.getResidenceCode())){
AreaCode areaCode = areaCodeService.getById(req.getResidenceCode());
updateUser.setResidenceName(areaCode.getName());
updateUser.setResidenceCityName(areaCode.getPname());
}
updateUser.setId(userId); updateUser.setId(userId);
userService.updateById(updateUser); userService.updateById(updateUser);
UserInfo updateUserInfo = BeanConvertUtil.convertTo(req, UserInfo::new); UserInfo updateUserInfo = BeanConvertUtil.convertTo(req, UserInfo::new);
UserInfo userInfo = userInfoService.getByUserId(userId); UserInfo userInfo = userInfoService.getByUserId(userId);
updateUserInfo.setId(userInfo.getId()); updateUserInfo.setId(userInfo.getId());
userInfoService.updateById(updateUserInfo); userInfoService.updateById(updateUserInfo);
// 检查finishStatus // 检查finishStatus
boolean finishBaseStatus = true; boolean finishBaseStatus = true;
User user = userService.getById(userId); User user = userService.getById(userId);
if(user.getForPersonals() == null || user.getGender() == 0 if(user.getForPersonals() == null || user.getGender() == 0
|| user.getBirthday() == null || user.getHeight() == null || user.getBirthday() == null || user.getHeight() == null
|| user.getWeight() == null || user.getResidence() == null || user.getWeight() == null || user.getResidenceCode() == null
|| user.getAddress() == null || user.getEducation() == null || user.getAddressCode() == null || user.getEducation() == null
|| user.getMarriage() == null || user.getProfession() == null || user.getMarriage() == null || user.getProfession() == null
|| user.getAnnualIncome() == null || user.getUsercode() == null){ || user.getAnnualIncome() == null || user.getUsercode() == null){
finishBaseStatus = false; finishBaseStatus = false;
@@ -214,8 +233,18 @@ public class CurrentUserManager {
public void updateInfo(UpdateUserFullInfoReq req) { public void updateInfo(UpdateUserFullInfoReq req) {
Long userId = LoginHelper.getUserId(); Long userId = LoginHelper.getUserId();
User updateUser = BeanConvertUtil.convertTo(req, User::new); User updateUser = BeanConvertUtil.convertTo(req, User::new);
if(StringUtils.isNotEmpty(req.getAddressCode())){
AreaCode areaCode = areaCodeService.getById(req.getAddressCode());
updateUser.setAddressName(areaCode.getName());
}
if(StringUtils.isNotEmpty(req.getResidenceCode())){
AreaCode areaCode = areaCodeService.getById(req.getResidenceCode());
updateUser.setResidenceName(areaCode.getName());
updateUser.setResidenceCityName(areaCode.getPname());
}
updateUser.setId(userId); updateUser.setId(userId);
userService.updateById(updateUser); userService.updateById(updateUser);
UserInfo updateUserInfo = BeanConvertUtil.convertTo(req, UserInfo::new); UserInfo updateUserInfo = BeanConvertUtil.convertTo(req, UserInfo::new);
UserInfo userInfo = userInfoService.getByUserId(userId); UserInfo userInfo = userInfoService.getByUserId(userId);
updateUserInfo.setId(userInfo.getId()); updateUserInfo.setId(userInfo.getId());

View File

@@ -0,0 +1,14 @@
package com.ruoyi.xq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.xq.domain.AreaCode;
/**
* 行政区划Mapper接口
*
* @author 77
* @date 2024-03-19
*/
public interface AreaCodeMapper extends BaseMapper<AreaCode> {
}

View File

@@ -6,8 +6,11 @@ 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.HomePageReq;
import com.ruoyi.xq.dto.app.user.vo.HomeUserListVo; import com.ruoyi.xq.dto.app.user.vo.HomeUserListVo;
import com.ruoyi.xq.dto.common.user.MinUser;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 用户管理Mapper接口 * 用户管理Mapper接口
* *
@@ -19,4 +22,8 @@ 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); Page<HomeUserListVo> homePageApp(@Param("build") Page<Object> build, @Param("params") HomePageReq params);
List<HomeUserListVo> vipHomePage(@Param("limit") int limit);
MinUser getMinUserById(@Param("userId") Long userId);
} }

View File

@@ -0,0 +1,18 @@
package com.ruoyi.xq.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.xq.domain.AreaCode;
import com.ruoyi.xq.dto.app.areacode.AreaCodeQuery;
import java.util.List;
/**
* 行政区划Service接口
*
* @author 77
* @date 2024-03-19
*/
public interface AreaCodeService extends IService<AreaCode> {
List<AreaCode> listAreaCode(AreaCodeQuery query);
}

View File

@@ -9,6 +9,9 @@ import com.ruoyi.xq.dto.admin.user.req.UpdateMobileAdminReq;
import com.ruoyi.xq.dto.app.user.HomePageReq; 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.HomeUserListVo;
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo; import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
import com.ruoyi.xq.dto.common.user.MinUser;
import java.util.List;
/** /**
* 用户管理Service接口 * 用户管理Service接口
@@ -18,6 +21,8 @@ import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
*/ */
public interface UserService extends IService<User> { public interface UserService extends IService<User> {
MinUser getMinUserById(Long userId);
User getByUsername(String username); User getByUsername(String username);
void resetPassword(Long userId, String password); void resetPassword(Long userId, String password);
@@ -36,5 +41,6 @@ public interface UserService extends IService<User> {
Page<HomeUserListVo> homePage(HomePageReq params); Page<HomeUserListVo> homePage(HomePageReq params);
List<HomeUserListVo> vipHomePage();
} }

View File

@@ -0,0 +1,28 @@
package com.ruoyi.xq.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.xq.domain.AreaCode;
import com.ruoyi.xq.dto.app.areacode.AreaCodeQuery;
import com.ruoyi.xq.mapper.AreaCodeMapper;
import com.ruoyi.xq.service.AreaCodeService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 行政区划Service业务层处理
*
* @author 77
* @date 2024-03-19
*/
@Service
public class AreaCodeServiceImpl extends ServiceImpl<AreaCodeMapper,AreaCode> implements AreaCodeService {
@Override
public List<AreaCode> listAreaCode(AreaCodeQuery query) {
List<AreaCode> list = this.list(Wrappers.lambdaQuery(AreaCode.class)
.eq(AreaCode::getPcode, query.getPcode()));
return list;
}
}

View File

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.helper.LoginHelper;
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;
@@ -19,6 +20,7 @@ import com.ruoyi.xq.dto.admin.user.req.UpdateMobileAdminReq;
import com.ruoyi.xq.dto.app.user.HomePageReq; 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.HomeUserListVo;
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo; import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
import com.ruoyi.xq.dto.common.user.MinUser;
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;
@@ -63,6 +65,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
@Autowired @Autowired
private UserVipService userVipService; private UserVipService userVipService;
@Override
public MinUser getMinUserById(Long userId){
return baseMapper.getMinUserById(userId);
}
@Override @Override
public User getByUsername(String username) { public User getByUsername(String username) {
return this.getOne(Wrappers.lambdaQuery(User.class) return this.getOne(Wrappers.lambdaQuery(User.class)
@@ -172,12 +179,29 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
@Override @Override
public Page<HomeUserListVo> homePage(HomePageReq params) { public Page<HomeUserListVo> homePage(HomePageReq params) {
HomePageReq.VipQuery vipQuery = params.getVipQuery();
if(vipQuery != null){
if(StringUtils.isNotEmpty(vipQuery.getProfession()) ||
vipQuery.getAnnualIncome() != null || vipQuery.getZodiac() != null ||
vipQuery.getSign() != null || vipQuery.getChildStatus() != null || vipQuery.getHousingStatus() != null ||
vipQuery.getCarStatus() != null || StringUtils.isNotEmpty(vipQuery.getAddressCode())){
Long userId = LoginHelper.getUserId();
if(userId == null){
throw new ServiceException("开通VIP才能开通查询",600100);
}
UserVip userVip = userVipService.getByUserVipMaster(userId);
if(userVip == null){
throw new ServiceException("开通VIP才能开通查询",600100);
}
}
}
Page<HomeUserListVo> page = baseMapper.homePageApp(params.build(), params); Page<HomeUserListVo> page = baseMapper.homePageApp(params.build(), params);
List<HomeUserListVo> records = page.getRecords(); List<HomeUserListVo> records = page.getRecords();
List<Long> userIdArray = new ArrayList<>(); List<Long> userIdArray = new ArrayList<>();
for (HomeUserListVo record : records) { for (HomeUserListVo record : records) {
userIdArray.add(record.getUserId()); userIdArray.add(record.getUserId());
record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday())); record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday()));
record.setAge(BirthdayUtil.getAge(record.getBirthday()));
} }
List<UserVip> vips = userVipService.listUserVipMaster(userIdArray); List<UserVip> vips = userVipService.listUserVipMaster(userIdArray);
Map<Long, UserVip> userVipMap = vips.stream().collect(Collectors.toMap(UserVip::getUserId, Function.identity())); Map<Long, UserVip> userVipMap = vips.stream().collect(Collectors.toMap(UserVip::getUserId, Function.identity()));
@@ -190,4 +214,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
} }
return page; return page;
} }
@Override
public List<HomeUserListVo> vipHomePage() {
List<HomeUserListVo> result = baseMapper.vipHomePage(20);
for (HomeUserListVo record : result) {
record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday()));
record.setAge(BirthdayUtil.getAge(record.getBirthday()));
}
return null;
}
} }

View File

@@ -12,4 +12,10 @@ public class BirthdayUtil {
return year.substring(year.length() - 2); return year.substring(year.length() - 2);
} }
public static Integer getAge(LocalDate birthday) {
if(birthday == null){
return null;
}
return LocalDate.now().getYear() - birthday.getYear();
}
} }

View File

@@ -0,0 +1,19 @@
<?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.AreaCodeMapper">
<resultMap type="com.ruoyi.xq.domain.AreaCode" id="AreaCodeResult">
<result property="code" column="code"/>
<result property="name" column="name"/>
<result property="level" column="level"/>
<result property="pcode" column="pcode"/>
<result property="pname" column="pname"/>
<result property="fullname" column="fullname"/>
<result property="longitude" column="longitude"/>
<result property="latitude" column="latitude"/>
</resultMap>
</mapper>

View File

@@ -21,11 +21,80 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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 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, select t1.id as user_id, t1.avatar, t1.gender, t1.nickname, t1.birthday, t1.residence_city_name,
t1.education, t1.profession, if(t2.card_num_auth = 1, 1, 0) as cardNumAuthBool t1.education, t1.profession, if(t2.card_num_auth = 1, 1, 0) as cardNumAuthBool
from xq_user t1 from xq_user t1
join xq_user_auth t2 on t1.id = t2.user_id join xq_user_auth t2 on t1.id = t2.user_id
where t1.type = 0 and t1.status = 0 join xq_user_info t3 on t1.id = t3.user_id
where t1.type = 0 and t1.status = 0 and t1.finish_base_status = 1
<if test="params.birthdayBegin != null">
and t1.birthday >= #{params.birthdayBegin}
</if>
<if test="params.birthdayEnd != null">
and t1.birthday &lt;= #{params.birthdayEnd}
</if>
<if test="params.heightBegin != null">
and t1.height >= #{params.heightBegin}
</if>
<if test="params.heightEnd != null">
and t1.height &lt;= #{params.heightEnd}
</if>
<if test="params.weightBegin != null">
and t1.weight >= #{params.weightBegin}
</if>
<if test="params.weightEnd != null">
and t1.weight &lt;= #{params.weightEnd}
</if>
<if test="params.gender != null">
and t1.gender = #{params.gender}
</if>
<if test="params.marriage != null">
and t1.marriage = #{params.marriage}
</if>
<if test="params.education != null">
and t1.education = #{params.education}
</if>
<if test="params.residenceCode != null and params.residenceCode != ''">
and t1.education like concat(#{params.residenceCode},'%')
</if>
<if test="params.vipQuery != null">
<if test="params.vipQuery.profession != null and params.vipQuery.profession != ''">
and t1.profession = #{params.vipQuery.profession}
</if>
<if test="params.vipQuery.annualIncome != null">
and t1.annual_income = #{params.vipQuery.annualIncome}
</if>
<if test="params.vipQuery.zodiac != null">
and t1.zodiac = #{params.vipQuery.zodiac}
</if>
<if test="params.vipQuery.sign != null">
and t1.sign = #{params.vipQuery.sign}
</if>
<if test="params.vipQuery.childStatus != null">
and t3.child_status = #{params.vipQuery.childStatus}
</if>
<if test="params.vipQuery.housingStatus != null">
and t3.housing_status = #{params.vipQuery.housingStatus}
</if>
<if test="params.vipQuery.carStatus != null">
and t3.car_status = #{params.vipQuery.carStatus}
</if>
<if test="params.vipQuery.addressCode != null">
and t1.address_code like concat(#{params.vipQuery.addressCode},'%')
</if>
</if>
</select>
<select id="vipHomePage" 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_name,
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 and t1.finish_base_status = 1
and exists(select 1 from xq_user_vip p1 where p1.user_id = t1.id and p1.vip_status = 1 and p1.vip_timeout &lt;= now())
</select>
<select id="getMinUserById" resultType="com.ruoyi.xq.dto.common.user.MinUser">
select t1.id,t1.usercode
from xq_user t1
where t1.id = #{userId}
</select> </select>
</mapper> </mapper>

View File

@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select t1.user_id, max(t1.vip_type) as vip_type select t1.user_id, max(t1.vip_type) as vip_type
from xq_user_vip t1 from xq_user_vip t1
where where
and t1.vip_status = 1 t1.vip_status = 1
and t1.vip_timeout &lt;= now() and t1.vip_timeout &lt;= now()
and t1.user_id in and t1.user_id in
<foreach collection="userIdList" item="value" open="(" close=")" separator="," > <foreach collection="userIdList" item="value" open="(" close=")" separator="," >