Compare commits

..

6 Commits

@ -135,39 +135,7 @@ wx-dump-4j是一款基于Java开发的微信数据分析工具。它准确显示
本软件仅供技术研究和教育目的使用,旨在解密用户个人微信聊天记录。严禁将本软件用于任何非法目的,包括但不限于侵犯隐私权或非授权数据访问。作为软件开发者,我不对因使用或滥用本软件产生的任何形式的损失或损害承担责任。
## ⛵欢迎贡献!
如果你发现任何错误🔍或者有改进建议🛠️,欢迎提交 issue 或者 pull request。你的反馈📢对于我非常宝贵💎
## 💻我的 GitHub 统计
[![Star History Chart](https://api.star-history.com/svg?repos=xuchengsheng/wx-dump-4j&type=Date)](https://star-history.com/#xuchengsheng/wx-dump-4j&Date)
## 🎉Stargazers
[![Stargazers123 repo roster for @xuchengsheng/wx-dump-4j](https://reporoster.com/stars/xuchengsheng/wx-dump-4j)](https://github.com/xuchengsheng/wx-dump-4j/stargazers)
## 🎉Forkers
[![Forkers repo roster for @xuchengsheng/wx-dump-4j](https://reporoster.com/forks/xuchengsheng/wx-dump-4j)](https://github.com/xuchengsheng/wx-dump-4j/network/members)
## 🍱请我吃盒饭?
作者晚上还要写博客✍️,平时还需要工作💼,如果帮到了你可以请作者吃个盒饭🥡
<div>
<img alt="logo" src="image/WeChatPay.png" style="width: 240px;height: 260px">
<img alt="logo" src="image/Alipay.png" style="width: 240px;height: 260px">
</div>
## ⭐️扫码关注微信公众号
关注后,回复关键字📲 **加群**📲,即可加入我们的技术交流群,与更多开发者一起交流学习。
在此我们真诚地邀请您访问我们的GitHub项目页面如果您觉得***wx-dump-4j***对您有帮助,请顺手点个⭐️**Star**⭐️!每一颗星星都是我们前进的动力,是对我们努力的最大肯定。非常感谢您的支持!
<div>
<img alt="logo" src="image/wechat-mp.png" height="180px">>
</div>
## 👀 演示图

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

@ -12,25 +12,35 @@ import java.net.UnknownHostException;
import java.util.Date;
/**
* @author xcs
* @date 20231221 1702
**/
@SpringBootApplication
@EnableTransactionManagement
*
* Spring
*/
@SpringBootApplication // 指定这是一个Spring Boot应用
@EnableTransactionManagement // 启用事务管理
public class WxDumpApplication {
/**
*
* Spring
* @param args
* @throws UnknownHostException
*/
public static void main(String[] args) throws UnknownHostException {
long startTime = System.currentTimeMillis();
ConfigurableApplicationContext context = SpringApplication.run(WxDumpApplication.class, args);
long endTime = System.currentTimeMillis();
long startTime = System.currentTimeMillis(); // 记录启动开始时间
ConfigurableApplicationContext context = SpringApplication.run(WxDumpApplication.class, args); // 启动Spring应用
long endTime = System.currentTimeMillis(); // 记录启动结束时间
// 获取应用的端口和上下文路径
String port = context.getEnvironment().getProperty("server.port", "8080");
String contextPath = context.getEnvironment().getProperty("server.servlet.context-path", "");
// 获取本地主机地址
String localHostAddress = InetAddress.getLocalHost().getHostAddress();
// 构建本地和网络访问的URL
String localUrl = "http://localhost:" + port + contextPath;
String networkUrl = "http://" + localHostAddress + ":" + port + contextPath;
// 打印启动信息
System.out.println("DONE successfully in " + (endTime - startTime) + "ms");
System.out.println("Time: " + new Date());
System.out.println("╔════════════════════════════════════════════════════╗");
@ -39,6 +49,6 @@ public class WxDumpApplication {
System.out.println("║ > Network: " + networkUrl + " ");
System.out.println("║ ║");
System.out.println("║ Now you can open browser with the above addresses↑ ║");
System.out.println("╚════════════════════════════════════════════════════╝");
System.out.println("╚══════════════════════════════════════════════════╝");
}
}
}

@ -8,8 +8,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* MybatisPlus
*
* @author xcs
* @date 20231229 1610
**/

@ -3,18 +3,16 @@ package com.xcs.wx.repository;
import com.xcs.wx.domain.ChatRoomInfo;
/**
* Repository
*
* @author xcs
* @date 2023122118:38:19
* 访
*
*/
public interface ChatRoomInfoRepository {
/**
*
*
* @param chatRoomName
* @return ChatRoomInfo
*
*
* @param chatRoomName
* @return ChatRoomInfonull
*/
ChatRoomInfo queryChatRoomInfo(String chatRoomName);
}
}

@ -9,40 +9,37 @@ import com.xcs.wx.domain.vo.ExportChatRoomVO;
import java.util.List;
/**
* Repository
*
* @author xcs
* @date 2023122118:38:19
* 访
*/
public interface ChatRoomRepository {
/**
*
*
* @param chatRoomDTO
* @return ChatRoom
*
*
* @param chatRoomDTO
* @return PageChatRoomVO
*/
Page<ChatRoomVO> queryChatRoom(ChatRoomDTO chatRoomDTO);
/**
*
*
* @param chatRoomName
* @return ChatRoom
*
*
* @param chatRoomName
* @return ChatRoomnull
*/
ChatRoom queryChatRoomDetail(String chatRoomName);
/**
*
*
* @return
*
*
* @return
*/
int countChatRoom();
/**
*
*
* @return ExportChatRoomVO
*
*
* @return ExportChatRoomVO
*/
List<ExportChatRoomVO> exportChatRoom();
}
}

@ -1,18 +1,16 @@
package com.xcs.wx.repository;
/**
* Repository
*
* @author xcs
* @date 202461815:31:54
* 访
*
*/
public interface ContactHeadImgRepository {
/**
*
*
* @param usrName
* @return
*
*
* @param usrName
* @return null
*/
byte[] getContactHeadImg(String usrName);
}
}

@ -4,26 +4,24 @@ import java.util.List;
import java.util.Map;
/**
* Repository
*
* @author xcs
* @date 2023122118:38:19
* URL访URL
* URL
*/
public interface ContactHeadImgUrlRepository {
/**
*
*
* @param usrNames
* @return
* URL
* URLURL
* @param usrNames URL
* @return MapURLURLnull
*/
Map<String, String> queryHeadImgUrl(List<String> usrNames);
/**
*
*
* @param userName
* @return
* URL
* URL
* @param userName URL
* @return URLURLnull
*/
String queryHeadImgUrlByUserName(String userName);
}
}

@ -6,24 +6,22 @@ import java.util.List;
import java.util.Map;
/**
* Repository
*
* @author xcs
* @date 2023122217:27:24
* 访
*
*/
public interface ContactLabelRepository {
/**
*
*
* @return Map
*
* MapID
* @return MapMap
*/
Map<String, String> queryContactLabelAsMap();
/**
*
*
* @return ContactLabel
*
* ListContactLabelID
* @return ContactLabelListList
*/
List<ContactLabel> queryContactLabelAsList();
}
}

@ -11,70 +11,67 @@ import java.util.Map;
import java.util.Set;
/**
* Repository
*
* @author xcs
* @date 20231222 1420
**/
* 访
*
*/
public interface ContactRepository {
/**
*
*
* @param contactDTO
* @return ContactVO
*
*
* @param contactDTO
* @return PageContactVO
*/
Page<ContactVO> queryContact(ContactDTO contactDTO);
/**
*
*
* @return AllContactVO
*
*
* @return AllContactVO
*/
List<AllContactVO> queryAllContact();
/**
*
*
* @param userName
* @return
*
*
* @param userName
* @return null
*/
String getContactNickname(String userName);
/**
*
*
* @param userName
* @return
* getContactNickname
* @param userName
* @return null
*/
String getNickName(String userName);
/**
* Id
*
* @return Contact
* ID
* ID
* @return ID
*/
Set<String> getContactWithMp();
/**
*
*
* @param userNames
* @return
*
*
* @param userNames
* @return Mapnull
*/
Map<String, String> getContactNickname(List<String> userNames);
/**
*
*
* @return
*
*
* @return
*/
int countContact();
/**
*
*
* @return ExportContactVO
*
*
* @return ExportContactVO
*/
List<ExportContactVO> exportContact();
}
}

@ -6,17 +6,16 @@ import com.xcs.wx.domain.dto.RecoverContactDTO;
import java.util.List;
/**
* Repository
*
* @author xcs
* @date 202461415:18:11
**/
* 访FTS
* DTO
*/
public interface FTSContactContentRepository {
/**
*
*
* @return FTSContactContent
* DTO
*
* @param recoverContactDTO
* @return FTSContactContent
*/
List<FTSContactContent> queryContactContent(RecoverContactDTO recoverContactDTO);
}
}

@ -3,17 +3,15 @@ package com.xcs.wx.repository;
import java.util.List;
/**
* 使 Repository
*
* @author xcs
* @date 202412311:20:56
* 使访使
* 使
*/
public interface FTSRecentUsedRepository {
/**
* 使
*
* @return
* 使
* 使
* @return 使
*/
List<String> queryRecentUsedKeyWord();
}
}

@ -5,18 +5,16 @@ import com.xcs.wx.domain.Feeds;
import com.xcs.wx.domain.dto.FeedsDTO;
/**
* Repository
*
* @author xcs
* @date 20240103 1656
**/
* 访
*
*/
public interface FeedsRepository {
/**
*
*
* @param feedsDTO
* @return Feeds
*
*
* @param feedsDTO
* @return PageFeeds
*/
Page<Feeds> queryFeeds(FeedsDTO feedsDTO);
}
}

@ -1,18 +1,16 @@
package com.xcs.wx.repository;
/**
* Repository
*
* @author xcs
* @date 20240103 1656
**/
* 访
* MD5
*/
public interface HardLinkImageAttributeRepository {
/**
*
*
* @param md5 md5
* @return
* MD5
* MD5访
* @param md5 MD5
* @return null
*/
String queryHardLinkImage(byte[] md5);
}
}

@ -1,18 +1,16 @@
package com.xcs.wx.repository;
/**
* Repository
*
* @author xcs
* @date 20240103 1656
**/
* 访
* MD5
*/
public interface HardLinkVideoAttributeRepository {
/**
*
*
* @param md5 md5
* @return
* MD5
* MD5访
* @param md5 MD5
* @return null
*/
String queryHardLinkVideo(byte[] md5);
}
}

@ -8,62 +8,60 @@ import com.xcs.wx.domain.vo.TopContactsVO;
import java.util.List;
/**
* Repository
*
* @author xcs
* @date 2023122515:31:37
* 访
*
*/
public interface MsgRepository {
/**
* talker
*
* @param talker
* @param nextSequence
* @return Msg
*
*
* @param talker
* @param nextSequence
* @return Msg
*/
List<Msg> queryMsgByTalker(String talker, Long nextSequence);
/**
*
*
* @param talker
* @return Msg
*
* 便
* @param talker
* @return Msg
*/
List<Msg> exportMsg(String talker);
/**
*
*
* @return MsgTypeDistributionVO
*
*
* @return MsgTypeDistributionVO
*/
List<MsgTypeDistributionVO> msgTypeDistribution();
/**
* 15
*
* @return MsgTrendVO
* 15
* 15
* @return CountRecentMsgsVO
*/
List<CountRecentMsgsVO> countRecentMsgs();
/**
* 10
*
* @return MsgRankVO
* 10
*
* @return TopContactsVO
*/
List<TopContactsVO> topContacts();
/**
*
*
* @return
*
*
* @return
*/
int countSent();
/**
*
*
* @return
*
*
* @return
*/
int countReceived();
}
}

@ -5,17 +5,15 @@ import com.xcs.wx.domain.vo.SessionVO;
import java.util.List;
/**
* Repository
*
* @author xcs
* @date 2023122117:33:19
* 访
*
*/
public interface SessionRepository {
/**
*
*
* @return Session
*
*
* @return SessionVO
*/
List<SessionVO> querySession();
}
}

@ -1,18 +1,16 @@
package com.xcs.wx.repository;
/**
* SQLite Repository
*
* @author xcs
* @date 202461309:19:24
* SQLiteSQLite
* SQLite
*/
public interface SqliteMasterRepository {
/**
*
*
* @param tableName
* @return
* SQLite
* SQLite
* @param tableName
* @return truefalse
*/
boolean isTableExists(String tableName);
}
}

@ -6,33 +6,30 @@ import com.xcs.wx.domain.vo.ChatRoomVO;
import com.xcs.wx.domain.vo.PageVO;
/**
*
*
* @author xcs
* @date 2023123118:18:58
*
*/
public interface ChatRoomService {
/**
*
*
* @param chatRoomDTO
* @return ChatRoomVO
*
*
* @param chatRoomDTO
* @return PageVO
*/
PageVO<ChatRoomVO> queryChatRoom(ChatRoomDTO chatRoomDTO);
/**
*
*
* @param chatRoomName
* @return ChatRoomDetailVO
*
*
* @param chatRoomName
* @return ChatRoomDetailVO
*/
ChatRoomDetailVO queryChatRoomDetail(String chatRoomName);
/**
*
*
* @return excel
* Excel
* Excel便线
* @return Excel访
*/
String exportChatRoom();
}
}

@ -1,18 +1,16 @@
package com.xcs.wx.service;
/**
*
*
* @author xcs
* @date 2023123118:18:58
*
*
*/
public interface ContactHeadImgService {
/**
*
*
* @param userName
* @return
*
* 便
* @param userName
* @return null
*/
byte[] avatar(String userName);
}
}

@ -5,17 +5,16 @@ import com.xcs.wx.domain.vo.ContactLabelVO;
import java.util.List;
/**
*
*
* @author xcs
* @date 2023123118:18:58
*
*
*/
public interface ContactLabelService {
/**
*
*
* @return ContactLabel
*
*
* 便
* @return ContactLabelVO
*/
List<ContactLabelVO> queryContactLabel();
}
}

@ -9,39 +9,36 @@ import com.xcs.wx.domain.vo.PageVO;
import java.util.List;
/**
*
*
* @author xcs
* @date 2023122214:49:52
*
*/
public interface ContactService {
/**
*
*
* @param contactDTO
* @return ContactVO
*
*
* @param contactDTO
* @return PageVOContactVO
*/
PageVO<ContactVO> queryContact(ContactDTO contactDTO);
/**
*
*
* @return AllContactVO
*
*
* @return AllContactVO
*/
List<AllContactVO> queryAllContact();
/**
*
*
* @return ContactLabel
*
* 便
* @return ContactLabelVO
*/
List<ContactLabelVO> queryContactLabel();
/**
*
*
* @return excel
* Excel
* Excel便线
* @return Excel访
*/
String exportContact();
}
}

@ -5,45 +5,43 @@ import com.xcs.wx.domain.vo.*;
import java.util.List;
/**
*
*
* @author xcs
* @date 202412317:24:36
*
* 使
*/
public interface DashboardService {
/**
*
*
* @return StatsPanelVO
*
*
* @return StatsPanelVO
*/
StatsPanelVO statsPanel();
/**
*
*
* @return MsgTypeDistributionVO
*
*
* @return MsgTypeDistributionVO
*/
List<MsgTypeDistributionVO> msgTypeDistribution();
/**
*
*
* @return MsgTrendVO
*
*
* @return CountRecentMsgsVO
*/
List<CountRecentMsgsVO> countRecentMsgs();
/**
*
*
* @return MsgTrendVO
*
*
* @return TopContactsVO
*/
List<TopContactsVO> topContacts();
/**
* 使
*
* @return
* 使
* 使
* @return RecentUsedKeyWordVO使
*/
List<RecentUsedKeyWordVO> queryRecentUsedKeyWord();
}
}

@ -7,26 +7,25 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import java.util.List;
/**
*
*
* @author xcs
* @date 2023122519:28:37
*
*
*/
public interface DatabaseService {
/**
*
*
* @param emitter sse
* @param decryptDTO
* SSE
* SseEmitterDecryptDTO
* SSE
* @param emitter SseEmitter
* @param decryptDTO
*/
void decrypt(SseEmitter emitter, DecryptDTO decryptDTO);
/**
*
*
* @param wxId wxId
* @return DatabaseVO
* ID
* ID
* @param wxId ID
* @return DatabaseVO
*/
List<DatabaseVO> getDatabase(String wxId);
}
}

@ -3,18 +3,17 @@ package com.xcs.wx.service;
import com.xcs.wx.domain.bo.DecryptBO;
/**
*
*
* @author xcs
* @date 2023121019:27:01
*
*
*/
public interface DecryptService {
/**
*
*
* @param password
* @param decryptBO
*
* 使DecryptBO
*
* @param password
* @param decryptBO
*/
void wechatDecrypt(String password, DecryptBO decryptBO);
}
}

@ -5,18 +5,17 @@ import com.xcs.wx.domain.vo.FeedsVO;
import com.xcs.wx.domain.vo.PageVO;
/**
*
*
* @author xcs
* @date 20241317:25:26
*
*
*/
public interface FeedsService {
/**
*
*
* @param feedsDTO
* @return FeedsVO
*
* FeedsDTO
*
* @param feedsDTO
* @return PageVO
*/
PageVO<FeedsVO> queryFeeds(FeedsDTO feedsDTO);
}
}

@ -4,34 +4,32 @@ import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
/**
*
*
* @author xcs
* @date 202411822:06:46
*
* MD5
*/
public interface ImageService {
/**
* Md5
*
* @param md5 md5
* @return ResponseEntity
* MD5
* MD5HTTP
* @param md5 MD5
* @return ResponseEntityHTTP
*/
ResponseEntity<Resource> downloadImgMd5(String md5);
/**
*
*
* @param path
* @return ResponseEntity
*
* HTTP
* @param path URL
* @return ResponseEntityHTTP
*/
ResponseEntity<Resource> downloadImg(String path);
/**
*
*
* @param localPath
* @return ResponseEntity
*
* HTTP
* @param localPath
* @return ResponseEntityHTTP
*/
ResponseEntity<Resource> downloadImgFormLocal(String localPath);
}
}

@ -5,27 +5,27 @@ import com.xcs.wx.domain.vo.MsgVO;
import java.util.List;
/**
*
*
* @author xcs
* @date 2023122515:05:09
*
*
*/
public interface MsgService {
/**
*
*
* @param talker Id
* @param nextSequence
* @return MsgVO
* ID
*
*
* @param talker ID
* @param nextSequence
* @return MsgVO
*/
List<MsgVO> queryMsg(String talker, Long nextSequence);
/**
*
*
* @param talker Id
* @return
*
* 便
* Excel
* @param talker ID
* @return 访
*/
String exportMsg(String talker);
}
}

@ -6,24 +6,23 @@ import com.xcs.wx.domain.vo.RecoverContactVO;
import java.util.List;
/**
*
*
* @author xcs
* @date 202461415:28:11
*
*
*/
public interface RecoverContactService {
/**
*
*
* @return RecoverContactVO
* DTO
* 便
* @param recoverContactDTO
* @return RecoverContactVO
*/
List<RecoverContactVO> queryRecoverContact(RecoverContactDTO recoverContactDTO);
/**
*
*
* @return
*
* 便线
* @return 访
*/
String exportRecoverContact();
}
}

@ -5,17 +5,16 @@ import com.xcs.wx.domain.vo.SessionVO;
import java.util.List;
/**
*
*
* @author xcs
* @date 20231221 1716
**/
*
*
*/
public interface SessionService {
/**
*
*
* @return SessionVO
*
*
*
* @return SessionVO
*/
List<SessionVO> querySession();
}
}

@ -7,66 +7,64 @@ import com.xcs.wx.domain.vo.UserVO;
import java.util.List;
/**
*
*
* @author xcs
* @date 20231221 1716
**/
*
*/
public interface UserService {
/**
*
*
* @return
*
*
* @return UserInfoVO
*/
UserInfoVO userInfo();
/**
*
*
* @return
* URL
* 便
* @return URL
*/
String avatar();
/**
*
*
* @return
*
*
* @return
*/
String nickname();
/**
*
*
* @return wxIds
*
*
* @return UserVO
*/
List<UserVO> users();
/**
*
*
* @param wxId wxId
*
*
* @param wxId ID
*/
void switchUser(String wxId);
/**
*
*
* @return wxId
* ID
* ID
* @return ID
*/
String currentUser();
/**
*
*
* @param userBO
*
*
* @param userBO
*/
void saveUser(UserBO userBO);
/**
*
*
* @param wxId wxId
*
*
* @param wxId ID
* @return
*/
String getBasePath(String wxId);
}
}

@ -5,66 +5,63 @@ import com.xcs.wx.domain.vo.WeChatConfigVO;
import java.util.List;
/**
*
*
* @author xcs
* @date 2023122509:37:30
*
*/
public interface WeChatService {
/**
*
*
* @return WeChatDTO
*
*
* @return WeChatConfigVO
*/
List<WeChatConfigVO> readWeChatConfig();
/**
* ID
*
* @return ID
* ID
* ID
* @return ID
*/
List<Integer> wechatPid();
/**
* ID
*
* @param pid ID
* @return 0
* ID
*
* @param pid ID
* @return 0
*/
long baseAddress(int pid);
/**
* ID
*
*
* @param pid ID
* @return null
* @return null
*/
String getVersion(int pid);
/**
* IDID
*
* @param pid ID
* @return ID
* ID
* @param pid ID
* @return ID
*/
String getWxId(int pid);
/**
*
*
* @param pid ID
*
* @param pid ID
* @param address
* @return null
* @return null
*/
String getInfo(int pid, long address);
/**
*
*
* @param pid ID
* @param dbPath
* @return null
*
* 访访
* @param pid ID
* @param dbPath
* @return null
*/
String getKey(int pid, String dbPath);
}
}

@ -28,24 +28,33 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*
* @author xcs
* @date 2023123118:18:58
*
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class ChatRoomServiceImpl implements ChatRoomService {
// 自动注入的群聊信息仓库,用于数据库操作
private final ChatRoomRepository chatRoomRepository;
// 用于转换群聊信息的映射器
private final ChatRoomMapping chatRoomMapping;
// 联系人信息仓库
private final ContactRepository contactRepository;
// 群聊信息仓库
private final ChatRoomInfoRepository chatRoomInfoRepository;
// 联系人头像URL仓库
private final ContactHeadImgUrlRepository contactHeadImgUrlRepository;
/**
*
* ChatRoomDTOVO
*
* @param chatRoomDTO
* @return VO
*/
@Override
public PageVO<ChatRoomVO> queryChatRoom(ChatRoomDTO chatRoomDTO) {
// 查询群聊
@ -75,6 +84,13 @@ public class ChatRoomServiceImpl implements ChatRoomService {
.orElse(new PageVO<>(chatRoomDTO.getCurrent(), chatRoomDTO.getPageSize(), 0L, null));
}
/**
*
* ChatRoomDetailVO
*
* @param chatRoomName
* @return VO
*/
@Override
public ChatRoomDetailVO queryChatRoomDetail(String chatRoomName) {
// 查询群聊详情
@ -91,6 +107,12 @@ public class ChatRoomServiceImpl implements ChatRoomService {
.orElse(null);
}
/**
*
* Excel
*
* @return Excel
*/
@Override
public String exportChatRoom() {
// 文件路径
@ -114,8 +136,9 @@ public class ChatRoomServiceImpl implements ChatRoomService {
/**
*
* VO
*
* @param chatRoomDetailVo VO
* @param chatRoomDetailVo VO
*/
private void populateChatRoomDetails(ChatRoomDetailVO chatRoomDetailVo) {
// 群标题
@ -128,8 +151,9 @@ public class ChatRoomServiceImpl implements ChatRoomService {
/**
*
* VO
*
* @param chatRoomDetailVo VO
* @param chatRoomDetailVo VO
*/
private void populateChatRoomInfo(ChatRoomDetailVO chatRoomDetailVo) {
// 查询群公告
@ -150,8 +174,9 @@ public class ChatRoomServiceImpl implements ChatRoomService {
/**
*
* VO
*
* @param chatRoomDetailVo VO
* @param chatRoomDetailVo VO
*/
private void populateChatRoomMember(ChatRoomDetailVO chatRoomDetailVo) {
try {
@ -174,6 +199,7 @@ public class ChatRoomServiceImpl implements ChatRoomService {
/**
*
*
*
* @param roomData
* @return
@ -192,4 +218,4 @@ public class ChatRoomServiceImpl implements ChatRoomService {
}
return chatRoomProto.getMembersList().size();
}
}
}

@ -8,19 +8,30 @@ import org.springframework.stereotype.Service;
/**
*
*
* @author xcs
* @date 2023123118:18:58
*
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class ContactHeadImgServiceImpl implements ContactHeadImgService {
private final ContactHeadImgRepository contactHeadImgService;
/**
*
*
*/
private final ContactHeadImgRepository contactHeadImgRepository; // 注意:变量名应与实际仓库接口名称保持一致
/**
*
*
*
* @param userName
* @return
*/
@Override
public byte[] avatar(String userName) {
return contactHeadImgService.getContactHeadImg(userName);
// 调用仓库方法获取头像数据
return contactHeadImgRepository.getContactHeadImg(userName);
}
}
}

@ -12,7 +12,8 @@ import java.util.List;
import java.util.Optional;
/**
*
*
*
*
* @author xcs
* @date 2023123118:18:58
@ -21,13 +22,31 @@ import java.util.Optional;
@RequiredArgsConstructor
public class ContactLabelServiceImpl implements ContactLabelService {
/**
*
*
*/
private final ContactLabelRepository contactLabelRepository;
/**
*
*
*/
private final ContactLabelMapping contactLabelMapping;
/**
*
* VO
*
* @return VO
*/
@Override
public List<ContactLabelVO> queryContactLabel() {
// 使用Optional.ofNullable来处理可能为null的结果
return Optional.ofNullable(contactLabelRepository.queryContactLabelAsList())
// 使用映射器将数据库实体转换为VO对象
.map(contactLabelMapping::convert)
// 如果转换结果为empty则返回一个空的不可变列表
.orElse(Collections.emptyList());
}
}
}

@ -19,18 +19,37 @@ import java.util.stream.Collectors;
/**
*
*
* @author xcs
* @date 20231222 1442
*
**/
@Service
@RequiredArgsConstructor
public class ContactServiceImpl implements ContactService {
/**
*
*
*/
private final ContactRepository contactRepository;
/**
*
*
*/
private final ContactLabelRepository contactLabelRepository;
/**
*
*
*/
private final ContactLabelMapping contactLabelMapping;
/**
*
* ContactDTOVO
*
* @param contactDTO
* @return VO
*/
@Override
public PageVO<ContactVO> queryContact(ContactDTO contactDTO) {
// 分页查询联系人
@ -53,11 +72,23 @@ public class ContactServiceImpl implements ContactService {
.orElse(new PageVO<>(contactDTO.getCurrent(), contactDTO.getPageSize(), 0L, null));
}
/**
*
* VO
*
* @return VO
*/
@Override
public List<AllContactVO> queryAllContact() {
return contactRepository.queryAllContact();
}
/**
*
* VO
*
* @return VO
*/
@Override
public List<ContactLabelVO> queryContactLabel() {
// 查询标签
@ -68,6 +99,12 @@ public class ContactServiceImpl implements ContactService {
.orElse(Collections.emptyList());
}
/**
*
* Excel
*
* @return Excel
*/
@Override
public String exportContact() {
// 文件路径
@ -81,4 +118,4 @@ public class ContactServiceImpl implements ContactService {
// 返回写入后的文件
return filePath;
}
}
}

@ -15,21 +15,45 @@ import java.util.stream.Collectors;
/**
*
*
* @author xcs
* @date 20240123 1724
* 使
**/
@Slf4j
@Service
@RequiredArgsConstructor
public class DashboardServiceImpl implements DashboardService {
/**
*
*
*/
private final MsgRepository msgRepository;
/**
*
*
*/
private final ContactRepository contactRepository;
/**
*
*
*/
private final ChatRoomRepository chatRoomRepository;
/**
* URL
* URL
*/
private final ContactHeadImgUrlRepository contactHeadImgUrlRepository;
/**
* 使
* 使
*/
private final FTSRecentUsedRepository recentUsedRepository;
/**
*
*
*
* @return
*/
@Override
public StatsPanelVO statsPanel() {
// 联系人数量
@ -44,48 +68,60 @@ public class DashboardServiceImpl implements DashboardService {
return new StatsPanelVO(contact, chatRoom, sent, received);
}
/**
*
*
*
* @return
*/
@Override
public List<MsgTypeDistributionVO> msgTypeDistribution() {
// 微信消息类型及其分布统计
return Opt.ofNullable(msgRepository.msgTypeDistribution())
// 重新分组一次
.map(msgTypes -> msgTypes.stream().collect(Collectors.groupingBy(MsgTypeDistributionVO::getType, Collectors.summingInt(MsgTypeDistributionVO::getValue))))
// 聚合并返回List
.map(summedMap -> summedMap.entrySet().stream().map(entry -> new MsgTypeDistributionVO(entry.getKey(), entry.getValue())).collect(Collectors.toList()))
// 默认值
.orElse(Collections.emptyList());
}
/**
*
*
*
* @return
*/
@Override
public List<CountRecentMsgsVO> countRecentMsgs() {
return msgRepository.countRecentMsgs();
}
/**
*
* 10
*
* @return
*/
@Override
public List<TopContactsVO> topContacts() {
// 最近一个月内微信互动最频繁的前10位联系人
return Opt.ofNullable(msgRepository.topContacts())
// 处理昵称&头像
.map(topContacts -> {
// 获取所有的用户名
List<String> userNames = topContacts.stream().map(TopContactsVO::getUserName).collect(Collectors.toList());
// 联系人昵称
Map<String, String> nicknameMap = contactRepository.getContactNickname(userNames);
// 联系人头像
Map<String, String> headImgUrlMap = contactHeadImgUrlRepository.queryHeadImgUrl(userNames);
// 遍历处理
for (TopContactsVO topContact : topContacts) {
// 设置昵称
topContact.setNickName(nicknameMap.get(topContact.getUserName()));
// 设置头像
topContact.setHeadImgUrl(headImgUrlMap.get(topContact.getUserName()));
}
return topContacts;
})
// 默认值
.orElse(Collections.emptyList());
}
/**
* 使
* 使
*
* @return 使
*/
@Override
public List<RecentUsedKeyWordVO> queryRecentUsedKeyWord() {
return recentUsedRepository.queryRecentUsedKeyWord()
@ -93,4 +129,4 @@ public class DashboardServiceImpl implements DashboardService {
.map(RecentUsedKeyWordVO::new)
.collect(Collectors.toList());
}
}
}

@ -42,19 +42,36 @@ import java.util.stream.Stream;
/**
*
*
* @author xcs
* @date 2023122519:30:26
*
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class DatabaseServiceImpl implements DatabaseService, ApplicationRunner {
/**
*
*
*/
private final DecryptService decryptService;
/**
*
*
*/
private final WeChatService weChatService;
/**
*
*
*/
private final UserService userService;
/**
*
*
*
* @param emitter SSE
* @param decryptDTO
*/
@Override
public void decrypt(SseEmitter emitter, DecryptDTO decryptDTO) {
// 文件分隔符
@ -121,6 +138,13 @@ public class DatabaseServiceImpl implements DatabaseService, ApplicationRunner {
}
}
/**
*
* ID
*
* @param wxId ID
* @return
*/
@Override
public List<DatabaseVO> getDatabase(String wxId) {
String dbPath = DirUtil.getDbDir(wxId);
@ -146,21 +170,28 @@ public class DatabaseServiceImpl implements DatabaseService, ApplicationRunner {
/**
* db
*
*
* @param stream
* @param stream
* @param outputPath
* @return DecryptBO
* @return BO
*/
private List<DecryptBO> getWeChatDb(Stream<Path> stream, String outputPath) {
return stream.filter(file -> !Files.isDirectory(file))
// 过滤出文件名以.db结尾的文件
.filter(file -> file.toString().endsWith(".db"))
// 将每个符合条件的文件路径映射为DecryptDTO对象
// 将每个符合条件的文件路径映射为DecryptBO对象
.map(item -> new DecryptBO(item.toString(), outputPath + FileUtil.getName(item.toString())))
// 转换成List
.collect(Collectors.toList());
}
/**
*
*
*
* @param args
*/
@Override
public void run(ApplicationArguments args) {
// 获取当前工作目录下的 db 目录
@ -186,6 +217,7 @@ public class DatabaseServiceImpl implements DatabaseService, ApplicationRunner {
/**
*
*
*
* @param dbPath
*/
@ -207,8 +239,9 @@ public class DatabaseServiceImpl implements DatabaseService, ApplicationRunner {
sourceProperty.setDriverClassName(SqliteConstant.DRIVER_CLASS_NAME);
sourceProperty.setPoolName(DSNameUtil.getDSName(wxId, dbName));
DynamicRoutingDataSource dynamicRoutingDataSource = SpringUtil.getBean(DynamicRoutingDataSource.class);
DefaultDataSourceCreator dataSourceCreator = SpringUtil.getBean(DefaultDataSourceCreator.class);
DefaultDataSourceCreator dataSourceCreator = SpringUtil.getBean(Default
DataSourceCreator.class);
DataSource dataSource = dataSourceCreator.createDataSource(sourceProperty);
dynamicRoutingDataSource.addDataSource(sourceProperty.getPoolName(), dataSource);
}
}
}

@ -21,9 +21,7 @@ import java.util.Arrays;
/**
*
*
* @author xcs
* @date 2023122511:09:07
*
*/
@Slf4j
@Service
@ -50,6 +48,13 @@ public class DecryptServiceImpl implements DecryptService {
*/
private static final int HASH_KEY_LENGTH = 32;
/**
*
* 使
*
* @param password
* @param decryptBO
*/
@Override
public void wechatDecrypt(String password, DecryptBO decryptBO) {
// 创建File文件
@ -144,6 +149,7 @@ public class DecryptServiceImpl implements DecryptService {
/**
*
* 0
*
* @param page
* @return truefalse
@ -159,6 +165,7 @@ public class DecryptServiceImpl implements DecryptService {
/**
* 使AES/CBC/NoPadding
*
*
* @param key
* @param iv
@ -173,4 +180,4 @@ public class DecryptServiceImpl implements DecryptService {
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
return cipher.doFinal(input);
}
}
}

@ -24,23 +24,52 @@ import java.util.Optional;
import java.util.stream.Collectors;
/**
*
*
* @author xcs
* @date 20241317:25:26
*
*
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class FeedsServiceImpl implements FeedsService {
/**
*
*
*/
private final FeedsRepository feedsRepository;
/**
*
*
*/
private final FeedsMapping feedsMapping;
/**
*
*
*/
private final ContactRepository contactRepository;
/**
* URL
* URL
*/
private final ContactHeadImgUrlRepository contactHeadImgUrlRepository;
/**
*
*
*/
private final HardLinkVideoAttributeRepository hardLinkVideoAttributeRepository;
/**
*
*
*/
private final HardLinkImageAttributeRepository hardLinkImageAttributeRepository;
/**
*
* FeedsDTOVO
*
* @param feedsDTO
* @return VO
*/
@Override
public PageVO<FeedsVO> queryFeeds(FeedsDTO feedsDTO) {
// 查询朋友圈
@ -98,9 +127,10 @@ public class FeedsServiceImpl implements FeedsService {
/**
*
* TimelineObjectBOFeedsMediaVO
*
* @param timelineObjectBO
* @return FeedsMediaVO
* @param timelineObjectBO 线
* @return
*/
private List<FeedsMediaVO> getMedia(TimelineObjectBO timelineObjectBO) {
List<FeedsMediaVO> feedsMediaVos = new ArrayList<>();
@ -123,9 +153,10 @@ public class FeedsServiceImpl implements FeedsService {
/**
*
* TimelineObjectBOFeedsLocationVO
*
* @param timelineObjectBO
* @return FeedsLocationVO
* @param timelineObjectBO 线
* @return
*/
private FeedsLocationVO getLocation(TimelineObjectBO timelineObjectBO) {
TimelineObjectBO.Location location = timelineObjectBO.getLocation();
@ -144,9 +175,10 @@ public class FeedsServiceImpl implements FeedsService {
/**
* xml
* XMLTimelineObjectBO
*
* @param xml xml
* @return TimelineObjectBO
* @return 线
*/
private TimelineObjectBO parseXmlToObj(String xml) {
try {
@ -158,4 +190,4 @@ public class FeedsServiceImpl implements FeedsService {
}
return null;
}
}
}

@ -22,23 +22,36 @@ import java.nio.file.Files;
import java.nio.file.Paths;
/**
*
*
* @author xcs
* @date 202411822:06:46
*
*
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class ImageServiceImpl implements ImageService {
/**
*
*
*/
private final HardLinkImageAttributeRepository hardLinkImageAttributeRepository;
/**
*
*
*/
private final UserService userService;
/**
* MD5
* MD5
*
* @param md5 MD5
* @return
*/
@Override
public ResponseEntity<Resource> downloadImgMd5(String md5) {
try {
// 查询数据库
// 查询数据库获取图片URL
String imgUrl = hardLinkImageAttributeRepository.queryHardLinkImage(HexUtil.decodeHex(md5));
// 查询结果为空返回404
if (StrUtil.isBlank(imgUrl)) {
@ -54,13 +67,13 @@ public class ImageServiceImpl implements ImageService {
}
// 获取图片文件夹地址
String outPath = DirUtil.getImgDir(wxId);
// 解密并返回
// 解密并返回图片路径
String imgPath = ImgDecoderUtil.decodeDat(filePath, outPath);
// 如果图片地址为空
if (imgPath == null) {
return ResponseEntity.notFound().build();
}
// 返回图片
// 返回图片资源
return ResponseEntity.ok()
.contentType(MediaType.IMAGE_JPEG)
.body(new InputStreamResource(Files.newInputStream(Paths.get(imgPath))));
@ -71,6 +84,13 @@ public class ImageServiceImpl implements ImageService {
return ResponseEntity.notFound().build();
}
/**
*
*
*
* @param path
* @return
*/
@Override
public ResponseEntity<Resource> downloadImg(String path) {
// 获取用户信息
@ -80,7 +100,7 @@ public class ImageServiceImpl implements ImageService {
try {
// 下载图片
HttpUtil.downloadFile(path, destPath);
// 返回图片
// 返回图片资源
return ResponseEntity.ok()
.contentType(MediaType.IMAGE_JPEG)
.body(new InputStreamResource(Files.newInputStream(Paths.get(destPath))));
@ -91,6 +111,13 @@ public class ImageServiceImpl implements ImageService {
return ResponseEntity.notFound().build();
}
/**
*
*
*
* @param localPath
* @return
*/
@Override
public ResponseEntity<Resource> downloadImgFormLocal(String localPath) {
try {
@ -108,13 +135,13 @@ public class ImageServiceImpl implements ImageService {
if (!FileUtil.exist(outPath)) {
FileUtil.mkdir(outPath);
}
// 解密并返回
// 解密并返回图片路径
String imgPath = ImgDecoderUtil.decodeDat(filePath, outPath);
// 如果图片地址为空
if (imgPath == null) {
return ResponseEntity.notFound().build();
}
// 返回图片
// 返回图片资源
return ResponseEntity.ok()
.contentType(MediaType.IMAGE_JPEG)
.body(new InputStreamResource(Files.newInputStream(Paths.get(imgPath))));
@ -124,4 +151,4 @@ public class ImageServiceImpl implements ImageService {
// 默认返回404
return ResponseEntity.notFound().build();
}
}
}

@ -30,20 +30,42 @@ import java.util.stream.Collectors;
/**
*
*
* @author xcs
* @date 20231225 1704
**/
*
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class MsgServiceImpl implements MsgService {
/**
*
*
*/
private final MsgRepository msgRepository;
/**
*
*
*/
private final MsgMapping msgMapping;
/**
* URL
* URL
*/
private final ContactHeadImgUrlRepository contactHeadImgUrlRepository;
/**
*
*
*/
private final ContactRepository contactRepository;
/**
*
*
*
* @param talker
* @param nextSequence
* @return
*/
@Override
public List<MsgVO> queryMsg(String talker, Long nextSequence) {
List<Msg> allData = msgRepository.queryMsgByTalker(talker, nextSequence);
@ -65,6 +87,13 @@ public class MsgServiceImpl implements MsgService {
}).collect(Collectors.toList());
}
/**
*
*
*
* @param talker
* @return
*/
@Override
public String exportMsg(String talker) {
List<Msg> msgList = msgRepository.exportMsg(talker);
@ -100,10 +129,11 @@ public class MsgServiceImpl implements MsgService {
/**
* Id
* ID
*
* @param talker
* @param msgVO VO
* @return wxId
* @param msgVO
* @return ID
*/
private String getChatWxId(String talker, MsgVO msgVO) {
// 我发送的消息
@ -129,11 +159,13 @@ public class MsgServiceImpl implements MsgService {
}
/**
*
*
* IDURL
*
* @param wxId
* @param wxId ID
* @return URL
*/
private String getChatAvatar(String wxId) {
return contactHeadImgUrlRepository.queryHeadImgUrlByUserName(wxId);
}
}
}

@ -20,20 +20,37 @@ import java.util.Set;
import java.util.stream.Collectors;
/**
*
*
* @author xcs
* @date 202461415:32:10
*
*
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class RecoverContactServiceImpl implements RecoverContactService {
/**
*
*
*/
private final FTSContactContentRepository ftsContactContentRepository;
/**
*
*
*/
private final ContactRepository contactRepository;
/**
*
*
*/
private final RecoverContactMapping recoverContactMapping;
/**
*
*
*
* @param recoverContactDTO
* @return
*/
@Override
public List<RecoverContactVO> queryRecoverContact(RecoverContactDTO recoverContactDTO) {
List<FTSContactContent> ftsContactContents = ftsContactContentRepository.queryContactContent(recoverContactDTO);
@ -44,6 +61,12 @@ public class RecoverContactServiceImpl implements RecoverContactService {
.collect(Collectors.toList());
}
/**
*
* Excel
*
* @return Excel
*/
@Override
public String exportRecoverContact() {
// 文件路径
@ -57,4 +80,4 @@ public class RecoverContactServiceImpl implements RecoverContactService {
// 返回写入后的文件
return filePath;
}
}
}

@ -14,9 +14,6 @@ import java.util.List;
/**
*
*
* @author xcs
* @date 20231221 1717
**/
@Service
@RequiredArgsConstructor

@ -28,18 +28,17 @@ import java.util.List;
import java.util.Optional;
/**
* UserService
*
* @author xcs
* @date 202461516:06:37
**/
* UserServiceImpl UserService
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {
//注入的 ContactHeadImgUrlRepository用于访问用户头像信息。
private final ContactHeadImgUrlRepository contactHeadImgUrlRepository;
//注入的 ContactRepository用于访问用户联系信息。
private final ContactRepository contactRepository;
//注入的 UserMapping用于转换用户信息的数据模型。
private final UserMapping userMapping;
@Override
@ -64,7 +63,10 @@ public class UserServiceImpl implements UserService {
}
return userMapping.convert(userBO);
}
/**
* URL
* @return URL null
*/
@Override
public String avatar() {
String wxId = currentUser();
@ -74,7 +76,10 @@ public class UserServiceImpl implements UserService {
}
return getAvatar(wxId);
}
/**
*
* @return null
*/
@Override
public String nickname() {
String wxId = currentUser();
@ -84,7 +89,10 @@ public class UserServiceImpl implements UserService {
}
return getNickName(wxId);
}
/**
*
* @return UserVO
*/
@Override
public List<UserVO> users() {
// 用户信息
@ -104,12 +112,18 @@ public class UserServiceImpl implements UserService {
}
return users;
}
/**
*
* @param wxId ID
*/
@Override
public void switchUser(String wxId) {
FileUtil.writeString(wxId, DirUtil.getSwitchUserDir(), "UTF-8");
}
/**
* ID
* @return ID null
*/
@Override
public String currentUser() {
// 获取用户切换配置目录
@ -123,12 +137,19 @@ public class UserServiceImpl implements UserService {
}
return FileUtil.readUtf8String(switchUserDir);
}
/**
*
* @param userBO
*/
@Override
public void saveUser(UserBO userBO) {
FileUtil.writeString(JSONUtil.toJsonStr(userBO), DirUtil.getUserDir(userBO.getWxId()), "UTF-8");
}
/**
*
* @param wxId ID
* @return null
*/
@Override
public String getBasePath(String wxId) {
String userDir = DirUtil.getUserDir(wxId);
@ -142,9 +163,8 @@ public class UserServiceImpl implements UserService {
}
/**
* Id
*
* @return wxIds
* ID
* @return ID
*/
private List<String> getWxIds() {
// 用户信息
@ -171,10 +191,9 @@ public class UserServiceImpl implements UserService {
}
/**
* wxId
*
* @param wxId wxId
* @return
* ID
* @param wxId ID
* @return URL
*/
private String getAvatar(String wxId) {
DynamicDataSourceContextHolder.push(DSNameUtil.getDSName(wxId, DataSourceType.MICRO_MSG_DB));
@ -184,10 +203,9 @@ public class UserServiceImpl implements UserService {
}
/**
* wxId
*
* @param wxId wxId
* @return
* ID
* @param wxId ID
* @return
*/
private String getNickName(String wxId) {
DynamicDataSourceContextHolder.push(DSNameUtil.getDSName(wxId, DataSourceType.MICRO_MSG_DB));

@ -29,48 +29,45 @@ import java.nio.file.Paths;
import java.util.*;
/**
*
*
* @author xcs
* @date 20231225 0937
**/
* ID
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class WeChatServiceImpl implements WeChatService {
/**
*
*
*/
private static final String EXE_NAME = "WeChat.exe";
/**
* dll
* dll
*/
private static final String MODULE_NAME = "WeChatWin.dll";
/**
*
*
*/
private static final String MY_DOCUMENT = "MyDocument:";
/**
* WeChat
* WeChat
*/
private static final String WECHAT_REG_PATH = "Software\\Tencent\\WeChat";
/**
*
*
*/
private static final String FILE_SAVE_PATH = "FileSavePath";
/**
* WeChat
* WeChat
*/
private static final String WECHAT_FILES_DIR = "\\WeChat Files";
/**
* WeChat
* WeChat
*/
private static final String CONFIG_FILE_PATH = "\\AppData\\Roaming\\Tencent\\WeChat\\All Users\\config\\3ebffe94.ini";
@ -78,7 +75,10 @@ public class WeChatServiceImpl implements WeChatService {
*
*/
private final WeChatOffsetProperties weChatOffsetConfig;
/**
* IDID
* @return
*/
@Override
public List<WeChatConfigVO> readWeChatConfig() {
// 获取微信进程Id
@ -123,10 +123,9 @@ public class WeChatServiceImpl implements WeChatService {
}
/**
*
*
* @param version
* @return null
*
* @param version
* @return null
*/
public WeChatOffsetProperties.VersionConfig getVersionConfig(String version) {
Map<String, WeChatOffsetProperties.VersionConfig> versionConfigMap = weChatOffsetConfig.getVersion();
@ -149,11 +148,10 @@ public class WeChatServiceImpl implements WeChatService {
}
/**
*
*
* @param version1 1
* @param version2 2
* @return true false
*
* @param version1 1
* @param version2 2
* @return true false
*/
private boolean isMatchingPrefix(String version1, String version2) {
return version1.substring(0, 5).equals(version2.substring(0, 5));
@ -161,8 +159,7 @@ public class WeChatServiceImpl implements WeChatService {
/**
* ID
*
* @return ID 0
* @return ID
*/
@Override
public List<Integer> wechatPid() {
@ -196,7 +193,6 @@ public class WeChatServiceImpl implements WeChatService {
/**
* ID
*
* @param pid ID
* @return 0
*/
@ -234,7 +230,6 @@ public class WeChatServiceImpl implements WeChatService {
/**
*
*
* @param pid ID
* @param address
* @return null

@ -22,27 +22,27 @@ public class DateFormatUtil {
DateTime dateTime = new DateTime(timestampInSeconds * 1000);
DateTime now = DateUtil.date();
// 如果时间是今天
// 如果是今天
if (DateUtil.isSameDay(dateTime, now)) {
return DateUtil.format(dateTime, "H:mm");
}
// 如果时间是昨天
// 如果是昨天
if (DateUtil.isSameDay(dateTime, DateUtil.yesterday())) {
return "昨天";
}
// 如果时间是本周(而不是昨天)
// 如果是本周(而不是昨天)
if (dateTime.isAfterOrEquals(DateUtil.beginOfWeek(now)) && DateUtil.isSameWeek(dateTime, now, true)) {
return DateUtil.dayOfWeekEnum(dateTime).toChinese("周");
}
// 如果时间不是本年
// 如果不是本年
if (dateTime.year() != now.year()) {
return DateUtil.format(dateTime, "yy年M月d日");
}
// 如果以上都不是,则显示月日
// 如果都不是,则显示月日
return DateUtil.format(dateTime, "M月d日");
}
}

@ -58,10 +58,6 @@ wechat-offset:
nickname: 93701080
account: 93700856
mobile: 93700888
"[3.9.12.15]":
nickname: 93813544
account: 93814880
mobile: 93813352
mybatis-plus:
global-config:
banner: off

Loading…
Cancel
Save