init
This commit is contained in:
@@ -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)));
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,14 @@ public class HomeAppController {
|
||||
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")
|
||||
@Operation(summary = "查询用户主页信息")
|
||||
|
||||
@@ -4,8 +4,11 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
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.service.AgreementSettingService;
|
||||
import com.ruoyi.xq.service.AreaCodeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
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.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/setting")
|
||||
@Tag(name = "获取设置相关接口")
|
||||
@@ -21,6 +26,8 @@ public class SettingAppController {
|
||||
|
||||
@Autowired
|
||||
private AgreementSettingService agreementSettingService;
|
||||
@Autowired
|
||||
private AreaCodeService areaCodeService;
|
||||
|
||||
@GetMapping("/agreement/user")
|
||||
@Operation(summary = "获取用户协议")
|
||||
@@ -46,4 +53,12 @@ public class SettingAppController {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
56
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/AreaCode.java
Normal file
56
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/AreaCode.java
Normal 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;
|
||||
|
||||
}
|
||||
@@ -83,17 +83,27 @@ public class User implements Serializable {
|
||||
*/
|
||||
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已完成")
|
||||
private Integer finishBaseStatus;
|
||||
|
||||
/**
|
||||
* 基础信息完成进度
|
||||
*/
|
||||
private Integer baseStep;
|
||||
/**
|
||||
* 邀请人
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,9 +1,60 @@
|
||||
package com.ruoyi.xq.dto.app.user;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class UpdateBaseInfoReq {
|
||||
@Schema(description = "基础信息保存进度")
|
||||
private Integer baseStep;
|
||||
@Schema(description = "为谁征婚")
|
||||
private Integer forPersonals;
|
||||
@Schema(description = "性别 0-未知 1-女 2-男")
|
||||
@@ -27,12 +29,12 @@ public class UpdateBaseInfoReq {
|
||||
* 居住地
|
||||
*/
|
||||
@Schema(description = "居住地")
|
||||
private String residence;
|
||||
private String residenceCode;
|
||||
/**
|
||||
* 户籍地
|
||||
*/
|
||||
@Schema(description = "户籍地")
|
||||
private String address;
|
||||
private String addressCode;
|
||||
/**
|
||||
* 学历
|
||||
*/
|
||||
|
||||
@@ -28,9 +28,9 @@ public class UpdateUserFullInfoReq {
|
||||
private Integer somatotype;
|
||||
|
||||
@Schema(description = "居住地")
|
||||
private String residence;
|
||||
private String residenceCode;
|
||||
@Schema(description = "户籍地")
|
||||
private String address;
|
||||
private String addressCode;
|
||||
@Schema(description = "学历")
|
||||
private Integer education;
|
||||
@Schema(description = "婚况")
|
||||
|
||||
@@ -40,10 +40,16 @@ public class CurrentUserInfoVo {
|
||||
private LocalDate birthday;
|
||||
@Schema(description = "年龄")
|
||||
private Integer age;
|
||||
// @Schema(description = "城市ID")
|
||||
// private Integer cityId;
|
||||
@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 不可用
|
||||
*/
|
||||
@@ -51,6 +57,8 @@ public class CurrentUserInfoVo {
|
||||
private Integer status;
|
||||
@Schema(description = "基础资料是否完成 0 未完成 1已完成")
|
||||
private Integer finishBaseStatus;
|
||||
@Schema(description = "基础信息完成进度")
|
||||
private Integer baseStep;
|
||||
|
||||
@Schema(description = "imToken")
|
||||
private String imToken;
|
||||
@@ -63,7 +71,6 @@ public class CurrentUserInfoVo {
|
||||
|
||||
@Schema(description = "最大认证数量")
|
||||
private Integer maxAuthNum = 8;
|
||||
|
||||
/**
|
||||
* 相册
|
||||
*/
|
||||
|
||||
@@ -23,8 +23,10 @@ public class HomeUserListVo {
|
||||
private LocalDate birthday;
|
||||
@Schema(description = "生日-缩减显示")
|
||||
private String birthdayStr;
|
||||
@Schema(description = "居住城市")
|
||||
private String residenceCity;
|
||||
@Schema(description = "年龄")
|
||||
private Integer age;
|
||||
@Schema(description = "居住城市名称")
|
||||
private String residenceCityName;
|
||||
@Schema(description = "学历")
|
||||
private Integer education;
|
||||
@Schema(description = "职业")
|
||||
|
||||
@@ -57,13 +57,17 @@ public class HomeUserVo {
|
||||
/**
|
||||
* 居住地
|
||||
*/
|
||||
@Schema(description = "居住地")
|
||||
private String residence;
|
||||
@Schema(description = "居住地名称")
|
||||
private String residenceName;
|
||||
@Schema(description = "居住地编码")
|
||||
private String residenceCode;
|
||||
/**
|
||||
* 户籍地
|
||||
*/
|
||||
@Schema(description = "户籍地")
|
||||
private String address;
|
||||
@Schema(description = "户籍地名称")
|
||||
private String addressName;
|
||||
@Schema(description = "户籍地编码")
|
||||
private String addressCode;
|
||||
/**
|
||||
* 学历
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ruoyi.xq.dto.common.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MinUser {
|
||||
private Long id;
|
||||
private String usercode;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.BeanConvertUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.xq.domain.*;
|
||||
import com.ruoyi.xq.dto.app.common.UserPicturesDTO;
|
||||
import com.ruoyi.xq.dto.app.user.AddPicturesReq;
|
||||
@@ -48,6 +49,8 @@ public class CurrentUserManager {
|
||||
private UserInfoAuditService userInfoAuditService;
|
||||
@Autowired
|
||||
private SystemConfigManager systemConfigManager;
|
||||
@Autowired
|
||||
private AreaCodeService areaCodeService;
|
||||
|
||||
|
||||
public CurrentUserFullInfoVo currentFullInfo(){
|
||||
@@ -94,9 +97,14 @@ public class CurrentUserManager {
|
||||
vo.setGender(user.getGender());
|
||||
vo.setBirthday(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.setFinishBaseStatus(user.getFinishBaseStatus());
|
||||
vo.setBaseStep(user.getBaseStep());
|
||||
vo.setImToken(user.getImToken());
|
||||
List<UserPictures> userPictures = userPicturesService.listByUserIdAuditingAndSuccess(user.getId());
|
||||
vo.setUserPicturesList(BeanConvertUtil.convertListTo(userPictures, UserPicturesDTO::new));
|
||||
@@ -115,19 +123,30 @@ public class CurrentUserManager {
|
||||
String cos = systemConfigManager.getSystemConfig(SystemConfigEnum.COS_DOMAIN);
|
||||
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);
|
||||
userService.updateById(updateUser);
|
||||
|
||||
UserInfo updateUserInfo = BeanConvertUtil.convertTo(req, UserInfo::new);
|
||||
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||
updateUserInfo.setId(userInfo.getId());
|
||||
userInfoService.updateById(updateUserInfo);
|
||||
|
||||
// 检查finishStatus
|
||||
boolean finishBaseStatus = true;
|
||||
User user = userService.getById(userId);
|
||||
if(user.getForPersonals() == null || user.getGender() == 0
|
||||
|| user.getBirthday() == null || user.getHeight() == null
|
||||
|| user.getWeight() == null || user.getResidence() == null
|
||||
|| user.getAddress() == null || user.getEducation() == null
|
||||
|| user.getWeight() == null || user.getResidenceCode() == null
|
||||
|| user.getAddressCode() == null || user.getEducation() == null
|
||||
|| user.getMarriage() == null || user.getProfession() == null
|
||||
|| user.getAnnualIncome() == null || user.getUsercode() == null){
|
||||
finishBaseStatus = false;
|
||||
@@ -214,8 +233,18 @@ public class CurrentUserManager {
|
||||
public void updateInfo(UpdateUserFullInfoReq req) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
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);
|
||||
userService.updateById(updateUser);
|
||||
|
||||
UserInfo updateUserInfo = BeanConvertUtil.convertTo(req, UserInfo::new);
|
||||
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||
updateUserInfo.setId(userInfo.getId());
|
||||
|
||||
@@ -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> {
|
||||
|
||||
}
|
||||
@@ -6,8 +6,11 @@ import com.ruoyi.xq.domain.User;
|
||||
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 com.ruoyi.xq.dto.common.user.MinUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户管理Mapper接口
|
||||
*
|
||||
@@ -19,4 +22,8 @@ public interface UserMapper extends BaseMapper<User> {
|
||||
Page<UserAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") UserAdminVo bo);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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.vo.HomeUserListVo;
|
||||
import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
|
||||
import com.ruoyi.xq.dto.common.user.MinUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户管理Service接口
|
||||
@@ -18,6 +21,8 @@ import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
|
||||
*/
|
||||
public interface UserService extends IService<User> {
|
||||
|
||||
MinUser getMinUserById(Long userId);
|
||||
|
||||
User getByUsername(String username);
|
||||
|
||||
void resetPassword(Long userId, String password);
|
||||
@@ -36,5 +41,6 @@ public interface UserService extends IService<User> {
|
||||
|
||||
Page<HomeUserListVo> homePage(HomePageReq params);
|
||||
|
||||
List<HomeUserListVo> vipHomePage();
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.exception.base.BaseException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.BeanConvertUtil;
|
||||
import com.ruoyi.xq.domain.User;
|
||||
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.vo.HomeUserListVo;
|
||||
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.userinfo.UserGenderEnum;
|
||||
import com.ruoyi.xq.manager.SystemConfigManager;
|
||||
@@ -63,6 +65,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
|
||||
@Override
|
||||
public MinUser getMinUserById(Long userId){
|
||||
return baseMapper.getMinUserById(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getByUsername(String username) {
|
||||
return this.getOne(Wrappers.lambdaQuery(User.class)
|
||||
@@ -172,12 +179,29 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
||||
|
||||
@Override
|
||||
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);
|
||||
List<HomeUserListVo> records = page.getRecords();
|
||||
List<Long> userIdArray = new ArrayList<>();
|
||||
for (HomeUserListVo record : records) {
|
||||
userIdArray.add(record.getUserId());
|
||||
record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday()));
|
||||
record.setAge(BirthdayUtil.getAge(record.getBirthday()));
|
||||
}
|
||||
List<UserVip> vips = userVipService.listUserVipMaster(userIdArray);
|
||||
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;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,10 @@ public class BirthdayUtil {
|
||||
return year.substring(year.length() - 2);
|
||||
}
|
||||
|
||||
public static Integer getAge(LocalDate birthday) {
|
||||
if(birthday == null){
|
||||
return null;
|
||||
}
|
||||
return LocalDate.now().getYear() - birthday.getYear();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user