1、获取关注、粉丝列表、消息详细 返回参数统一

2、管理员系统 按用户名或用户邮箱 查询用户design频率
This commit is contained in:
2024-08-21 14:31:10 +08:00
parent 28df672a7d
commit c5da68dc47
8 changed files with 40 additions and 18 deletions

View File

@@ -51,7 +51,8 @@ public class ConvenientInquiryController {
@ApiOperation("获取指定时间区间内所有用户design的使用情况")
@GetMapping("/getDesignStatistic")
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime, @RequestParam String endTime) {
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime, @RequestParam String endTime,
@RequestParam(required = false) String userName, @RequestParam(required = false) String email) {
Long accountId = UserContext.getUserHolder().getId();
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
if (StringUtil.isNullOrEmpty(startTime)) startTime = "2024-02-01 00:00:00";
@@ -60,7 +61,7 @@ public class ConvenientInquiryController {
Date date = new Date();
endTime = simpleDateFormat.format(date);
}
List<UserDesignStatisticDTO> designStatistic = designMapper.getDesignStatistic(startTime, endTime);
List<UserDesignStatisticDTO> designStatistic = designMapper.getDesignStatistic(startTime, endTime, userName, email);
return Response.success(designStatistic);
} else {
return Response.fail("Sorry, you don't have permission");

View File

@@ -18,5 +18,5 @@ public interface DesignMapper extends CommonMapper<Design> {
//返回插入数据后生成的主键
Long insertDesign(Design design);
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime);
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, String userName, String email);
}

View File

@@ -11,14 +11,23 @@ import java.time.LocalDateTime;
@NoArgsConstructor
@AllArgsConstructor
public class AccountFollowVO {
private Long userId;
/**
* userId
*/
private Long senderId;
private String userName;
private String avatar;
/**
* followTime
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private LocalDateTime followTime;
private LocalDateTime createTime;
private Integer mutualFollowing;
/**
* mutualFollowing 互粉
*/
private Integer isFollow;
}

View File

@@ -8,13 +8,19 @@ import lombok.EqualsAndHashCode;
@Data
public class NotificationVO extends Notification {
private String senderUserName;
/**
* senderUserName
*/
private String userName;
private String senderUserAvatar;
// private String senderUserAvatar;
private String portfolioName;
private String senderAvatar;
/**
* sender头像
*/
private String avatar;
private Integer isFollow;

View File

@@ -82,8 +82,8 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
IPage<NotificationVO> convert = notificationPage.convert(o -> {
NotificationVO notificationVO = CopyUtil.copyObject(o, NotificationVO.class);
Account senderAccount = accountService.getById(notificationVO.getSenderId());
notificationVO.setSenderUserName(senderAccount.getUserName());
notificationVO.setSenderUserAvatar(StringUtils.isNullOrEmpty(senderAccount.getAvatar()) ? null : minioUtil.getPreSignedUrl(senderAccount.getAvatar(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
notificationVO.setUserName(senderAccount.getUserName());
// notificationVO.setSenderUserAvatar(StringUtils.isNullOrEmpty(senderAccount.getAvatar()) ? null : minioUtil.getPreSignedUrl(senderAccount.getAvatar(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
notificationVO.setPortfolioName(Objects.isNull(notificationVO.getPortfolioId()) ? null : portfolioService.getById(notificationVO.getPortfolioId()).getPortfolioName());
// 设置单个人 系统消息是否已读
if (notificationVO.getType().equals("system")){
@@ -94,7 +94,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
}
}else {
String avatar = StringUtil.isNullOrEmpty(senderAccount.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : senderAccount.getAvatar();
notificationVO.setSenderAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
notificationVO.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
}
return notificationVO;
});

View File

@@ -1062,8 +1062,8 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
followerList.forEach(follower -> {
String avatar = StringUtil.isNullOrEmpty(follower.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : follower.getAvatar();
follower.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
follower.setMutualFollowing(Objects.isNull(followeeMap.get(follower.getUserId())) ? 0 : 1);
follower.setFollowTime(followeeMap.get(follower.getUserId()));
follower.setIsFollow(Objects.isNull(followeeMap.get(follower.getSenderId())) ? 0 : 1);
// follower.setFollowTime(followeeMap.get(follower.getUserId()));
});
return followerList;
}

View File

@@ -39,6 +39,12 @@
</where>
and b.create_date not like '%:01'
and b.create_date not like '%:02'
<if test="userName != null and userName != '' ">
and a.user_name = #{userName}
</if>
<if test="email != null and email != '' ">
and a.user_email = #{email}
</if>
GROUP BY b.account_id
ORDER BY b.account_id asc) d
left join trial_order c on d.user_email = c.email

View File

@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ai.da.mapper.primary.UserFollowMapper">
<select id="getFolloweeListByFollower" resultType="com.ai.da.model.vo.AccountFollowVO">
SELECT a.id as user_id, a.user_name AS user_name, a.avatar AS avatar, b.create_time AS follow_time
SELECT a.id as sender_id, a.user_name AS user_name, a.avatar AS avatar, b.create_time AS create_time
FROM t_account a
INNER JOIN t_user_follow b ON a.id = b.followee_id
WHERE b.follower_id = #{followerAccountId}
@@ -12,7 +12,7 @@
LIMIT #{limit} OFFSET #{offset}
</select>
<select id="getFollowerListByFollowee" resultType="com.ai.da.model.vo.AccountFollowVO">
SELECT a.id as user_id, a.user_name AS user_name, a.avatar AS avatar, b.create_time AS follow_time
SELECT a.id as sender_id, a.user_name AS user_name, a.avatar AS avatar, b.create_time AS create_time
FROM t_account a
INNER JOIN t_user_follow b ON a.id = b.follower_id
WHERE b.followee_id = #{followeeAccountId}
@@ -23,7 +23,7 @@
</select>
<select id="getFolloweeListByName" resultType="com.ai.da.model.vo.AccountFollowVO">
SELECT a.id as user_id, a.user_name, a.avatar, b.create_time as follow_time
SELECT a.id as sender_id, a.user_name, a.avatar, b.create_time as create_time
FROM t_account a
INNER JOIN t_user_follow b ON a.id = b.followee_id
WHERE b.follower_id = #{followerId}
@@ -37,7 +37,7 @@
</select>
<select id="getFollowerListByName" resultType="com.ai.da.model.vo.AccountFollowVO">
SELECT a.id as user_id, a.user_name, a.avatar, b.create_time as follow_time
SELECT a.id as sender_id, a.user_name, a.avatar, b.create_time as create_time
FROM t_account a
INNER JOIN t_user_follow b ON a.id = b.follower_id
WHERE b.followee_id = #{followeeId}