添加上传文件后缀名称,以及上传名称和日期顺序放反

This commit is contained in:
高保安
2025-12-23 16:46:14 +08:00
parent 9eeb7829dc
commit 0b71330b52
11 changed files with 45 additions and 4 deletions

View File

@@ -150,6 +150,10 @@
<optional>true</optional>
<version>1.18.40</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>

View File

@@ -4,6 +4,7 @@ package com.realtime.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.realtime.model.pojo.ChatList;
import com.realtime.model.query.ChatListPageQueryReq;
import com.realtime.model.query.GetSessionIdReq;
import com.realtime.service.ChatListService;
import com.realtime.sysconst.Result;
import com.realtime.vo.ChatListInfoVo;
@@ -44,4 +45,9 @@ public class ChatListController {
Result<String> updateChatList(@RequestBody List<ChatList> chatList){
return chatListService.updateChatListFName(chatList);
}
@PostMapping("/querySessionId")
Result<Long> querySessionId(@RequestBody GetSessionIdReq getSessionIdReq){
return chatListService.querySessionId(getSessionIdReq);
}
}

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.realtime.model.pojo.ChatList;
import com.realtime.model.query.ChatListPageQueryReq;
import com.realtime.model.query.GetSessionIdReq;
import com.realtime.vo.ChatListInfoVo;
import org.apache.ibatis.annotations.Param;
@@ -15,6 +16,8 @@ public interface ChatListMapper extends BaseMapper<ChatList> {
IPage<ChatListInfoVo> getChatList(@Param("reqPage") IPage<ChatListPageQueryReq> page, @Param("req") ChatListPageQueryReq chatListPageQueryReq);
void deleteFriend(@Param("id") String id,@Param("receiver") String receiver);
Long querySessionId(@Param("req") GetSessionIdReq getSessionIdReq);
}

View File

@@ -15,5 +15,5 @@ public class BaseTeamReq implements Serializable {
* 访问令牌
*/
@JsonProperty("access_token")
private String accessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiNjhlNzY0ZjBmOTU0ODg3MWMyMmY5M2I4IiwibGFzdExvZ2luIjoiMTc2NTQzNDMyNy41MjA5ODYifQ.Vj0ovpCsziFzeR2qroYnN-3KevR78krx-rDFQ9BKlgU";
private String accessToken;
}

View File

@@ -0,0 +1,9 @@
package com.realtime.model.query;
import lombok.Data;
@Data
public class GetSessionIdReq {
private String senderId;
private String receiverId;
}

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.realtime.model.pojo.ChatList;
import com.realtime.model.query.ChatListPageQueryReq;
import com.realtime.model.query.GetSessionIdReq;
import com.realtime.sysconst.Result;
import com.realtime.vo.ChatListInfoVo;
@@ -25,4 +26,6 @@ public interface ChatListService extends IService<ChatList> {
Result<String> deleteSignChatList(ChatList ids);
Result<Long> querySessionId(GetSessionIdReq getSessionIdReq);
}

View File

@@ -9,6 +9,7 @@ import com.realtime.mappers.ChatListMapper;
import com.realtime.model.pojo.ChatList;
import com.realtime.model.pojo.FriendRelationship;
import com.realtime.model.query.ChatListPageQueryReq;
import com.realtime.model.query.GetSessionIdReq;
import com.realtime.service.ChatListService;
import com.realtime.service.FriendRelationshipService;
import com.realtime.sysconst.Result;
@@ -140,6 +141,11 @@ public class ChatListServiceImpl extends ServiceImpl<ChatListMapper, ChatList>
return Result.success("ok");
}
@Override
public Result<Long> querySessionId(GetSessionIdReq getSessionIdReq) {
return Result.success(baseMapper.querySessionId(getSessionIdReq));
}
}

View File

@@ -69,7 +69,7 @@ public class FileServiceImpl implements FileService {
String originalFilename = file.getOriginalFilename();
assert originalFilename != null;
UploadVo uploadVo = new UploadVo();
String storeFileName = originalFilename + Instant.now().getEpochSecond();
String storeFileName = Instant.now().getEpochSecond() +originalFilename;
String url = generateFileUrl(storeFileName);
uploadVo.setName(originalFilename);
uploadVo.setUrl(url);

View File

@@ -14,6 +14,7 @@ public class SessionUtils {
public static final Map<String, Channel> userIdChannelMap = new ConcurrentHashMap<>();
/**
* groupId ---> channelgroup 群聊ID和群聊ChannelGroup映射
*/

View File

@@ -11,7 +11,7 @@ file:
picMaxSize: 104857600 # 100MB
picMaxCount: 1
picAllowedFormats: png,jpg
allowedFormats: doc,docx,xls,xlsx,ppt,pptx,txt,jpg,jpeg,png,gif,svg,mp3,mp4,zip,rar,exe,dmg,apk,md
allowedFormats: doc,docx,xls,xlsx,ppt,pptx,txt,jpg,jpeg,png,gif,svg,mp3,mp4,zip,rar,exe,dmg,apk,md,py,html
spring:
servlet:
multipart:

View File

@@ -13,7 +13,10 @@
</sql>
<delete id="deleteFriend">
delete from chat_list lt where lt.sender = #{id} and lt.receiver = #{receiver}
delete
from chat_list lt
where lt.sender = #{id}
and lt.receiver = #{receiver}
</delete>
<resultMap id="getChatListMap" type="chatListInfoVo"/>
@@ -35,4 +38,10 @@
from chat_list ch
where ch.sender = #{req.sendId}
</select>
<select id="querySessionId" resultType="java.lang.Long">
select session_id
from chat_list ch
where ch.sender = #{req.senderId}
and ch.receiver = #{req.receiverId}
</select>
</mapper>