111
This commit is contained in:
1 parent
6359352abe
commit
dc6c24eb48
13 files changed
+111
-56
No files matched your search
+1
-1
@@ -27,7 +27,7 @@ public enum MemberRecentOperateEnum {
|
||||
*/
|
||||
RECENT_SHIELD("3", "屏蔽"),
|
||||
/**
|
||||
* 用户-收藏
|
||||
* 用户-收藏(个人中心我喜欢)
|
||||
*/
|
||||
MEMBER_COLLECT("4", "收藏"),
|
||||
/**
|
||||
|
||||
+6
-7
@@ -55,17 +55,16 @@ public class RecentPageResVo extends RecentDO {
|
||||
@Schema(description = "城市")
|
||||
private String memberCity;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private Double memberLat;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private Double memberLng;
|
||||
|
||||
@Schema(description = "最近登录时间")
|
||||
private LocalDateTime appRefreshDate;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class LocationVo {
|
||||
|
||||
@Schema(description = "距离(千米)")
|
||||
private Double distance;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class OperationTotal {
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ public class AppUploadReqVo {
|
||||
private String bizType;
|
||||
|
||||
@Schema(description = "资源类型")
|
||||
@NotEmpty(message = "上传途径不能为空")
|
||||
@NotNull(message = "上传途径不能为空")
|
||||
private PhotoResourceTypeEnum resourceType;
|
||||
|
||||
@Schema(description = "资源地址")
|
||||
|
||||
+11
@@ -8,6 +8,10 @@ import cn.iocoder.yudao.module.member.controller.admin.recent.vo.OperationTotalG
|
||||
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.RecentPageResVo;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.RecentSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.recent.vo.*;
|
||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppMemberUserInfoRespVO;
|
||||
import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.enums.MemberRecentSceneEnum;
|
||||
import cn.iocoder.yudao.module.member.service.recent.RecentService;
|
||||
import cn.iocoder.yudao.module.member.service.recent.ViewRecordService;
|
||||
@@ -103,6 +107,13 @@ public class AppRecentController {
|
||||
return success(recentService.evaluatePage(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/getById")
|
||||
@Operation(summary = "根据id查询用户信息")
|
||||
public CommonResult<RecentPageResVo> getUserInfoById(@RequestParam("id") Long id) {
|
||||
RecentPageResVo user = recentService.getRecentUserByUserId(id);
|
||||
return success(user);
|
||||
}
|
||||
|
||||
@GetMapping("/total")
|
||||
@Operation(summary = "朋友圈我喜欢的、喜欢我的等总数统计")
|
||||
public CommonResult<OperationTotalGroupRecentRespVO> total() {
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
||||
import cn.iocoder.yudao.module.member.service.recent.RecentService;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
+2
-1
@@ -27,7 +27,8 @@ public interface PhotoMapper extends BaseMapperX<PhotoDO> {
|
||||
.eqIfPresent(PhotoDO::getIssueDistrict, reqVO.getIssueDistrict())
|
||||
.eqIfPresent(PhotoDO::getIssueAddress, reqVO.getIssueAddress())
|
||||
.betweenIfPresent(PhotoDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PhotoDO::getId));
|
||||
.orderByAsc(PhotoDO::getCreateTime)
|
||||
.orderByAsc(PhotoDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
+5
-5
@@ -33,11 +33,6 @@ public interface LocationService {
|
||||
*/
|
||||
LocationDO getLocation(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户最后位置记录
|
||||
*/
|
||||
LocationDO getLastByMemberId(Long memberId);
|
||||
|
||||
/**
|
||||
* 获得当前用户位置记录
|
||||
*/
|
||||
@@ -48,6 +43,11 @@ public interface LocationService {
|
||||
*/
|
||||
List<LocationDO> getLastLocationList(List<Long> memberIds);
|
||||
|
||||
/**
|
||||
* 获得用户最后位置记录
|
||||
*/
|
||||
LocationDO getLastByMemberId(Long memberId);
|
||||
|
||||
/**
|
||||
* 获得用户位置记录分页
|
||||
*/
|
||||
|
||||
+16
-13
@@ -22,6 +22,8 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.location.LocationMapper;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@@ -96,19 +98,6 @@ public class LocationServiceImpl implements LocationService {
|
||||
return locationMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得用户最后位置记录
|
||||
*/
|
||||
@Override
|
||||
public LocationDO getLastByMemberId(Long memberId) {
|
||||
return locationMapper.selectOne(new LambdaQueryWrapperX<LocationDO>()
|
||||
.eq(LocationDO::getMemberId, memberId)
|
||||
.orderByDesc(LocationDO::getCreateTime)
|
||||
.orderByDesc(LocationDO::getId)
|
||||
.last(" LIMIT 1")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得当前用户位置记录
|
||||
*/
|
||||
@@ -133,6 +122,20 @@ public class LocationServiceImpl implements LocationService {
|
||||
return locationMapper.getLastLocationList(memberIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得用户最后位置记录
|
||||
*/
|
||||
@Override
|
||||
public LocationDO getLastByMemberId(Long memberId) {
|
||||
if (ObjectUtil.isEmpty(memberId)) return null;
|
||||
List<Long> memberIds = Arrays.asList(memberId);
|
||||
List<LocationDO> locationList = locationMapper.getLastLocationList(memberIds);
|
||||
if (ObjectUtil.isEmpty(locationList)) {
|
||||
return null;
|
||||
}
|
||||
return locationList.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<LocationDO> getLocationPage(LocationPageReqVO pageReqVO) {
|
||||
return locationMapper.selectPage(pageReqVO);
|
||||
|
||||
+17
@@ -2,12 +2,14 @@ package cn.iocoder.yudao.module.member.service.photo;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.api.thirdauth.ThirdAuthVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.photo.vo.AppCountResVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.photo.vo.AppUploadReqVo;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.enums.MemberErrorCode;
|
||||
import cn.iocoder.yudao.module.member.enums.photo.PhotoBizTypeEnum;
|
||||
import cn.iocoder.yudao.module.member.enums.photo.PhotoResourceTypeEnum;
|
||||
import cn.iocoder.yudao.module.member.service.thirdauth.ThirdAuthService;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -22,6 +24,8 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.photo.PhotoMapper;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
@@ -36,6 +40,8 @@ public class PhotoServiceImpl implements PhotoService {
|
||||
|
||||
@Resource
|
||||
private MemberUserService memberUserService;
|
||||
@Resource
|
||||
private ThirdAuthService thirdAuthService;
|
||||
|
||||
@Override
|
||||
public Long createPhoto(PhotoSaveReqVO createReqVO) {
|
||||
@@ -51,6 +57,17 @@ public class PhotoServiceImpl implements PhotoService {
|
||||
*/
|
||||
@Override
|
||||
public Long appUpload(AppUploadReqVo dto) {
|
||||
// 校验图片
|
||||
if (ObjectUtil.equals(dto.getResourceType(), PhotoResourceTypeEnum.IMAGE)) {
|
||||
ThirdAuthVo textRes = thirdAuthService.imageAuditSync(dto.getAddress());
|
||||
// 处理文字
|
||||
if (ObjectUtil.isEmpty(textRes)) {
|
||||
throw exception(MemberErrorCode.CHECK_TEXT_NOT_PASS, "未知错误");
|
||||
}
|
||||
if (textRes.isError() && ObjectUtil.isNotEmpty(textRes.getFirstErrorMsg())) {
|
||||
throw exception(MemberErrorCode.CHECK_TEXT_NOT_PASS, textRes.getFirstErrorMsg());
|
||||
}
|
||||
}
|
||||
PhotoDO photo = BeanUtils.toBean(dto, PhotoDO.class);
|
||||
photoMapper.insert(photo);
|
||||
return photo.getId();
|
||||
|
||||
+6
@@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.member.controller.app.recent.vo.AppRecentViewReco
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.recent.RecentDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
|
||||
/**
|
||||
* 朋友圈 Service 接口
|
||||
@@ -85,6 +86,11 @@ public interface RecentService {
|
||||
*/
|
||||
PageResult<OperationRespVO> evaluatePage(@Valid AppRecentLikeReqVo dto);
|
||||
|
||||
/**
|
||||
* 查询朋友圈用户
|
||||
*/
|
||||
RecentPageResVo getRecentUserByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 朋友圈我喜欢的、喜欢我的等总数统计
|
||||
*/
|
||||
|
||||
+34
-18
@@ -415,6 +415,21 @@ public class RecentServiceImpl implements RecentService {
|
||||
return new PageResult<>(resultList, pageList.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询朋友圈用户
|
||||
*/
|
||||
@Override
|
||||
public RecentPageResVo getRecentUserByUserId(Long userId) {
|
||||
RecentPageResVo result = new RecentPageResVo();
|
||||
result.setMemberId(userId);
|
||||
// 添加用户信息
|
||||
convertRecentPageResVoSetupMember(result);
|
||||
// 查询用户最新的位置
|
||||
LocationDO currentUserLastLocation = locationService.getCurrentUserLastLocation();
|
||||
convertRecentPageResVoSetupLocation(result, currentUserLastLocation);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 朋友圈我喜欢的、喜欢我的等总数统计
|
||||
*/
|
||||
@@ -456,6 +471,8 @@ public class RecentServiceImpl implements RecentService {
|
||||
memberVO.setMemberWeight(member.getWeight());
|
||||
memberVO.setMemberSex(member.getSex());
|
||||
memberVO.setAppRefreshDate(member.getAppRefreshDate());
|
||||
memberVO.setMemberLat(member.getLat());
|
||||
memberVO.setMemberLng(member.getLng());
|
||||
entity.setMember(memberVO);
|
||||
}
|
||||
}
|
||||
@@ -501,6 +518,12 @@ public class RecentServiceImpl implements RecentService {
|
||||
memberVO.setMemberNickname(member.getNickname());
|
||||
memberVO.setMemberAge(member.getAge());
|
||||
memberVO.setMemberOcc(member.getOcc());
|
||||
memberVO.setMemberHeight(member.getHeight());
|
||||
memberVO.setMemberWeight(member.getWeight());
|
||||
memberVO.setMemberSex(member.getSex());
|
||||
memberVO.setAppRefreshDate(member.getAppRefreshDate());
|
||||
memberVO.setMemberLat(member.getLat());
|
||||
memberVO.setMemberLng(member.getLng());
|
||||
detail.setMember(memberVO);
|
||||
}
|
||||
}
|
||||
@@ -558,32 +581,25 @@ public class RecentServiceImpl implements RecentService {
|
||||
*/
|
||||
private void convertRecentPageResVoSetupLocation(List<RecentPageResVo> list, LocationDO selfLocation) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
List<Long> memberIds = list.stream().map(RecentPageResVo::getMemberId).distinct().filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
|
||||
List<LocationDO> LocationList = locationService.getLastLocationList(memberIds);
|
||||
Map<Long, LocationDO> LocationMap = IterUtil.toMap(LocationList, LocationDO::getMemberId);
|
||||
if (ObjectUtil.isEmpty(LocationMap)) return;
|
||||
for (RecentPageResVo entity : list) {
|
||||
LocationDO targetLocation = LocationMap.get(entity.getMemberId());
|
||||
|
||||
RecentPageResVo.LocationVo locationVo = new RecentPageResVo.LocationVo();
|
||||
if (ObjectUtil.isEmpty(targetLocation)) {
|
||||
// entity.setLocation(locationVo);
|
||||
RecentPageResVo.MemberVo targetLocation = entity.getMember();
|
||||
if (ObjectUtil.isAllNotEmpty(targetLocation.getMemberLat(), targetLocation.getMemberLng())) {
|
||||
continue;
|
||||
}
|
||||
double distance = NumberUtils.getDistance(targetLocation.getLat(), targetLocation.getLon(), selfLocation.getLat(), selfLocation.getLon());
|
||||
locationVo.setDistance(distance);
|
||||
// entity.setLocation(locationVo);
|
||||
double distance = NumberUtils.getDistance(targetLocation.getMemberLat(), targetLocation.getMemberLng(), selfLocation.getLat(), selfLocation.getLon());
|
||||
entity.setDistance(distance);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 为RecentPageResVo设置Location信息
|
||||
*/
|
||||
private void convertRecentPageResVoSetupLocation(RecentPageResVo detail, LocationDO selfLocation) {
|
||||
if (ObjectUtil.isEmpty(detail)) return;
|
||||
LocationDO targetLocation = locationService.getLastByMemberId(detail.getMemberId());
|
||||
if (ObjectUtil.isNotEmpty(targetLocation)) {
|
||||
RecentPageResVo.LocationVo locationVo = new RecentPageResVo.LocationVo();
|
||||
double distance = NumberUtils.getDistance(targetLocation.getLat(), targetLocation.getLon(), selfLocation.getLat(), selfLocation.getLon());
|
||||
locationVo.setDistance(distance);
|
||||
// detail.setLocation(locationVo);
|
||||
RecentPageResVo.MemberVo member = detail.getMember();
|
||||
if (ObjectUtil.isAllNotEmpty(member.getMemberLng(), member.getMemberLat())) {
|
||||
double distance = NumberUtils.getDistance(member.getMemberLat(), member.getMemberLng(), selfLocation.getLat(), selfLocation.getLon());
|
||||
detail.setDistance(distance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-8
@@ -44,17 +44,18 @@
|
||||
|
||||
<select id="totalGroupRecentByUser"
|
||||
resultType="cn.iocoder.yudao.module.member.controller.admin.recent.vo.OperationTotalGroupRecentRespVO">
|
||||
select sum(if(a.biz_type = '1', 1, 0)) as likeTotal,
|
||||
sum(if(a.biz_type = '1' and a.operator_member_id = #{userId}, 1, 0)) as likeItTotal,
|
||||
sum(if(a.biz_type = '1' and a.member_id = #{userId}, 1, 0)) as likeMeTotal,
|
||||
sum(if(a.biz_type = '2', 1, 0)) as reportTotal,
|
||||
sum(if(a.biz_type = '3', 1, 0)) as shieldTotal,
|
||||
sum(if(a.biz_type = '4', 1, 0)) as collectTotal,
|
||||
a.biz_type as bizType,
|
||||
a.member_recent_id as memberRecentId
|
||||
select sum(if(a.biz_type = '1', 1, 0)) as likeTotal,
|
||||
sum(if(a.biz_type = '4' and a.operator_member_id = #{userId}, 1, 0)) as likeItTotal,
|
||||
sum(if(a.biz_type = '4' and a.member_id = #{userId}, 1, 0)) as likeMeTotal,
|
||||
sum(if(a.biz_type = '2', 1, 0)) as reportTotal,
|
||||
sum(if(a.biz_type = '3', 1, 0)) as shieldTotal,
|
||||
sum(if(a.biz_type = '4', 1, 0)) as collectTotal,
|
||||
a.biz_type as bizType,
|
||||
a.member_recent_id as memberRecentId
|
||||
from member_operation a
|
||||
where a.deleted = 0
|
||||
and (a.operator_member_id = #{userId} or a.member_id = #{userId})
|
||||
and a.operator_member_id != a.member_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -250,8 +250,8 @@ pf4j:
|
||||
pluginsDir: ../plugins
|
||||
|
||||
chat:
|
||||
base-url: http://127.0.0.1:8888
|
||||
# base-url: http://chatsever.zianxin.com
|
||||
# base-url: http://127.0.0.1:8888
|
||||
base-url: http://chatsever.zianxin.com
|
||||
app-key: 4H2HkBLygMsxaQKO
|
||||
app-secret: JIizm84av3TK5xaQdsng7X5mqLPjbeQ0
|
||||
|
||||
|
||||
Reference in new issue
Block a user