|
@@ -92,15 +92,15 @@ public class FileUpdateInfoServiceImpl implements FileUpdateInfoService {
|
|
|
if (!localFile.exists()) {
|
|
|
// 如果本地文件不存在,设置状态为“待更新”
|
|
|
fileUpdateInfo.setRemoteMd5(remoteFileMd5);
|
|
|
- fileUpdateInfo.setUpdateStatus(0);
|
|
|
+ fileUpdateInfo.setUpdateStatus(0); // 设置为待更新
|
|
|
fileUpdateInfoMapper.updateById(fileUpdateInfo);
|
|
|
- return true;
|
|
|
+ return true; // 需要更新
|
|
|
} else {
|
|
|
// 如果本地文件存在,比较 MD5 值
|
|
|
String localFileMd5 = DigestUtils.md5Hex(new FileInputStream(localFile));
|
|
|
boolean isUpdateRequired = !localFileMd5.equals(remoteFileMd5);
|
|
|
fileUpdateInfo.setRemoteMd5(remoteFileMd5);
|
|
|
- fileUpdateInfo.setUpdateStatus(isUpdateRequired ? 1 : 0);
|
|
|
+ fileUpdateInfo.setUpdateStatus(isUpdateRequired ? 0 : 1); // 0表示待更新,1表示无需更新
|
|
|
fileUpdateInfoMapper.updateById(fileUpdateInfo);
|
|
|
return isUpdateRequired;
|
|
|
}
|