init
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user