Compare commits

..

2 Commits

Author SHA1 Message Date
yzh fb40df393b init
1 year ago
yzh d595f139fd init
1 year ago

@ -135,7 +135,39 @@ 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.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

@ -12,35 +12,25 @@ import java.net.UnknownHostException;
import java.util.Date;
/**
*
* Spring
*/
@SpringBootApplication // 指定这是一个Spring Boot应用
@EnableTransactionManagement // 启用事务管理
* @author xcs
* @date 20231221 1702
**/
@SpringBootApplication
@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); // 启动Spring应用
long endTime = System.currentTimeMillis(); // 记录启动结束时间
long startTime = System.currentTimeMillis();
ConfigurableApplicationContext context = SpringApplication.run(WxDumpApplication.class, args);
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("╔════════════════════════════════════════════════════╗");
@ -49,6 +39,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,6 +8,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* MybatisPlus
*
* @author xcs
* @date 20231229 1610
**/

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

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

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

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

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

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

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

@ -3,15 +3,17 @@ 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,16 +5,18 @@ 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 PageFeeds
*
*
* @param feedsDTO
* @return Feeds
*/
Page<Feeds> queryFeeds(FeedsDTO feedsDTO);
}
}

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

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

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

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

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

@ -6,30 +6,33 @@ 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 PageVO
*
*
* @param chatRoomDTO
* @return ChatRoomVO
*/
PageVO<ChatRoomVO> queryChatRoom(ChatRoomDTO chatRoomDTO);
/**
*
*
* @param chatRoomName
* @return ChatRoomDetailVO
*
*
* @param chatRoomName
* @return ChatRoomDetailVO
*/
ChatRoomDetailVO queryChatRoomDetail(String chatRoomName);
/**
* Excel
* Excel便线
* @return Excel访
*
*
* @return excel
*/
String exportChatRoom();
}
}

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

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

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

@ -5,43 +5,45 @@ 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 CountRecentMsgsVO
*
*
* @return MsgTrendVO
*/
List<CountRecentMsgsVO> countRecentMsgs();
/**
*
*
* @return TopContactsVO
*
*
* @return MsgTrendVO
*/
List<TopContactsVO> topContacts();
/**
* 使
* 使
* @return RecentUsedKeyWordVO使
* 使
*
* @return
*/
List<RecentUsedKeyWordVO> queryRecentUsedKeyWord();
}
}

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

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

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

@ -4,32 +4,34 @@ import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
/**
*
* MD5
*
*
* @author xcs
* @date 202411822:06:46
*/
public interface ImageService {
/**
* MD5
* MD5HTTP
* @param md5 MD5
* @return ResponseEntityHTTP
* Md5
*
* @param md5 md5
* @return ResponseEntity
*/
ResponseEntity<Resource> downloadImgMd5(String md5);
/**
*
* HTTP
* @param path URL
* @return ResponseEntityHTTP
*
*
* @param path
* @return ResponseEntity
*/
ResponseEntity<Resource> downloadImg(String path);
/**
*
* HTTP
* @param localPath
* @return ResponseEntityHTTP
*
*
* @param localPath
* @return ResponseEntity
*/
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 {
/**
* ID
*
*
* @param talker ID
* @param nextSequence
* @return MsgVO
*
*
* @param talker Id
* @param nextSequence
* @return MsgVO
*/
List<MsgVO> queryMsg(String talker, Long nextSequence);
/**
*
* 便
* Excel
* @param talker ID
* @return 访
*
*
* @param talker Id
* @return
*/
String exportMsg(String talker);
}
}

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

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

@ -5,63 +5,66 @@ import com.xcs.wx.domain.vo.WeChatConfigVO;
import java.util.List;
/**
*
*
*
* @author xcs
* @date 2023122509:37:30
*/
public interface WeChatService {
/**
*
*
* @return WeChatConfigVO
*
*
* @return WeChatDTO
*/
List<WeChatConfigVO> readWeChatConfig();
/**
* ID
* ID
* @return 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
* ID
* @param pid ID
* @return 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,33 +28,24 @@ 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) {
// 查询群聊
@ -84,13 +75,6 @@ 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) {
// 查询群聊详情
@ -107,12 +91,6 @@ public class ChatRoomServiceImpl implements ChatRoomService {
.orElse(null);
}
/**
*
* Excel
*
* @return Excel
*/
@Override
public String exportChatRoom() {
// 文件路径
@ -136,9 +114,8 @@ public class ChatRoomServiceImpl implements ChatRoomService {
/**
*
* VO
*
* @param chatRoomDetailVo VO
* @param chatRoomDetailVo VO
*/
private void populateChatRoomDetails(ChatRoomDetailVO chatRoomDetailVo) {
// 群标题
@ -151,9 +128,8 @@ public class ChatRoomServiceImpl implements ChatRoomService {
/**
*
* VO
*
* @param chatRoomDetailVo VO
* @param chatRoomDetailVo VO
*/
private void populateChatRoomInfo(ChatRoomDetailVO chatRoomDetailVo) {
// 查询群公告
@ -174,9 +150,8 @@ public class ChatRoomServiceImpl implements ChatRoomService {
/**
*
* VO
*
* @param chatRoomDetailVo VO
* @param chatRoomDetailVo VO
*/
private void populateChatRoomMember(ChatRoomDetailVO chatRoomDetailVo) {
try {
@ -199,7 +174,6 @@ public class ChatRoomServiceImpl implements ChatRoomService {
/**
*
*
*
* @param roomData
* @return
@ -218,4 +192,4 @@ public class ChatRoomServiceImpl implements ChatRoomService {
}
return chatRoomProto.getMembersList().size();
}
}
}

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

@ -12,8 +12,7 @@ import java.util.List;
import java.util.Optional;
/**
*
*
*
*
* @author xcs
* @date 2023123118:18:58
@ -22,31 +21,13 @@ 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,37 +19,18 @@ 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) {
// 分页查询联系人
@ -72,23 +53,11 @@ 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() {
// 查询标签
@ -99,12 +68,6 @@ public class ContactServiceImpl implements ContactService {
.orElse(Collections.emptyList());
}
/**
*
* Excel
*
* @return Excel
*/
@Override
public String exportContact() {
// 文件路径
@ -118,4 +81,4 @@ public class ContactServiceImpl implements ContactService {
// 返回写入后的文件
return filePath;
}
}
}

@ -15,45 +15,21 @@ 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() {
// 联系人数量
@ -68,60 +44,48 @@ 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()
@ -129,4 +93,4 @@ public class DashboardServiceImpl implements DashboardService {
.map(RecentUsedKeyWordVO::new)
.collect(Collectors.toList());
}
}
}

@ -42,36 +42,19 @@ 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) {
// 文件分隔符
@ -138,13 +121,6 @@ public class DatabaseServiceImpl implements DatabaseService, ApplicationRunner {
}
}
/**
*
* ID
*
* @param wxId ID
* @return
*/
@Override
public List<DatabaseVO> getDatabase(String wxId) {
String dbPath = DirUtil.getDbDir(wxId);
@ -170,28 +146,21 @@ public class DatabaseServiceImpl implements DatabaseService, ApplicationRunner {
/**
* db
*
*
* @param stream
* @param stream
* @param outputPath
* @return BO
* @return DecryptBO
*/
private List<DecryptBO> getWeChatDb(Stream<Path> stream, String outputPath) {
return stream.filter(file -> !Files.isDirectory(file))
// 过滤出文件名以.db结尾的文件
.filter(file -> file.toString().endsWith(".db"))
// 将每个符合条件的文件路径映射为DecryptBO对象
// 将每个符合条件的文件路径映射为DecryptDTO对象
.map(item -> new DecryptBO(item.toString(), outputPath + FileUtil.getName(item.toString())))
// 转换成List
.collect(Collectors.toList());
}
/**
*
*
*
* @param args
*/
@Override
public void run(ApplicationArguments args) {
// 获取当前工作目录下的 db 目录
@ -217,7 +186,6 @@ public class DatabaseServiceImpl implements DatabaseService, ApplicationRunner {
/**
*
*
*
* @param dbPath
*/
@ -239,9 +207,8 @@ 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(Default
DataSourceCreator.class);
DefaultDataSourceCreator dataSourceCreator = SpringUtil.getBean(DefaultDataSourceCreator.class);
DataSource dataSource = dataSourceCreator.createDataSource(sourceProperty);
dynamicRoutingDataSource.addDataSource(sourceProperty.getPoolName(), dataSource);
}
}
}

@ -21,7 +21,9 @@ import java.util.Arrays;
/**
*
*
*
* @author xcs
* @date 2023122511:09:07
*/
@Slf4j
@Service
@ -48,13 +50,6 @@ 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文件
@ -149,7 +144,6 @@ public class DecryptServiceImpl implements DecryptService {
/**
*
* 0
*
* @param page
* @return truefalse
@ -165,7 +159,6 @@ public class DecryptServiceImpl implements DecryptService {
/**
* 使AES/CBC/NoPadding
*
*
* @param key
* @param iv
@ -180,4 +173,4 @@ public class DecryptServiceImpl implements DecryptService {
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
return cipher.doFinal(input);
}
}
}

@ -24,52 +24,23 @@ 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) {
// 查询朋友圈
@ -127,10 +98,9 @@ public class FeedsServiceImpl implements FeedsService {
/**
*
* TimelineObjectBOFeedsMediaVO
*
* @param timelineObjectBO 线
* @return
* @param timelineObjectBO
* @return FeedsMediaVO
*/
private List<FeedsMediaVO> getMedia(TimelineObjectBO timelineObjectBO) {
List<FeedsMediaVO> feedsMediaVos = new ArrayList<>();
@ -153,10 +123,9 @@ public class FeedsServiceImpl implements FeedsService {
/**
*
* TimelineObjectBOFeedsLocationVO
*
* @param timelineObjectBO 线
* @return
* @param timelineObjectBO
* @return FeedsLocationVO
*/
private FeedsLocationVO getLocation(TimelineObjectBO timelineObjectBO) {
TimelineObjectBO.Location location = timelineObjectBO.getLocation();
@ -175,10 +144,9 @@ public class FeedsServiceImpl implements FeedsService {
/**
* xml
* XMLTimelineObjectBO
*
* @param xml xml
* @return 线
* @return TimelineObjectBO
*/
private TimelineObjectBO parseXmlToObj(String xml) {
try {
@ -190,4 +158,4 @@ public class FeedsServiceImpl implements FeedsService {
}
return null;
}
}
}

@ -22,36 +22,23 @@ 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)) {
@ -67,13 +54,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))));
@ -84,13 +71,6 @@ public class ImageServiceImpl implements ImageService {
return ResponseEntity.notFound().build();
}
/**
*
*
*
* @param path
* @return
*/
@Override
public ResponseEntity<Resource> downloadImg(String path) {
// 获取用户信息
@ -100,7 +80,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))));
@ -111,13 +91,6 @@ public class ImageServiceImpl implements ImageService {
return ResponseEntity.notFound().build();
}
/**
*
*
*
* @param localPath
* @return
*/
@Override
public ResponseEntity<Resource> downloadImgFormLocal(String localPath) {
try {
@ -135,13 +108,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))));
@ -151,4 +124,4 @@ public class ImageServiceImpl implements ImageService {
// 默认返回404
return ResponseEntity.notFound().build();
}
}
}

@ -30,42 +30,20 @@ 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);
@ -87,13 +65,6 @@ public class MsgServiceImpl implements MsgService {
}).collect(Collectors.toList());
}
/**
*
*
*
* @param talker
* @return
*/
@Override
public String exportMsg(String talker) {
List<Msg> msgList = msgRepository.exportMsg(talker);
@ -129,11 +100,10 @@ public class MsgServiceImpl implements MsgService {
/**
* Id
* ID
*
* @param talker
* @param msgVO
* @return ID
* @param msgVO VO
* @return wxId
*/
private String getChatWxId(String talker, MsgVO msgVO) {
// 我发送的消息
@ -159,13 +129,11 @@ public class MsgServiceImpl implements MsgService {
}
/**
*
* IDURL
*
*
* @param wxId ID
* @return URL
* @param wxId
*/
private String getChatAvatar(String wxId) {
return contactHeadImgUrlRepository.queryHeadImgUrlByUserName(wxId);
}
}
}

@ -20,37 +20,20 @@ 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);
@ -61,12 +44,6 @@ public class RecoverContactServiceImpl implements RecoverContactService {
.collect(Collectors.toList());
}
/**
*
* Excel
*
* @return Excel
*/
@Override
public String exportRecoverContact() {
// 文件路径
@ -80,4 +57,4 @@ public class RecoverContactServiceImpl implements RecoverContactService {
// 返回写入后的文件
return filePath;
}
}
}

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

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

@ -29,45 +29,48 @@ import java.nio.file.Paths;
import java.util.*;
/**
* ID
*/
*
*
* @author xcs
* @date 20231225 0937
**/
@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";
@ -75,10 +78,7 @@ public class WeChatServiceImpl implements WeChatService {
*
*/
private final WeChatOffsetProperties weChatOffsetConfig;
/**
* IDID
* @return
*/
@Override
public List<WeChatConfigVO> readWeChatConfig() {
// 获取微信进程Id
@ -123,9 +123,10 @@ 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();
@ -148,10 +149,11 @@ 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));
@ -159,7 +161,8 @@ public class WeChatServiceImpl implements WeChatService {
/**
* ID
* @return ID
*
* @return ID 0
*/
@Override
public List<Integer> wechatPid() {
@ -193,6 +196,7 @@ public class WeChatServiceImpl implements WeChatService {
/**
* ID
*
* @param pid ID
* @return 0
*/
@ -230,6 +234,7 @@ 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,6 +58,10 @@ 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