Merge remote-tracking branch 'origin/dev_foton_GJB'

# Conflicts:
#	adc-da-main/src/main/resources/application.properties
This commit is contained in:
高嵩
2023-02-13 09:25:44 +08:00
7 changed files with 168 additions and 12 deletions
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.List;
public interface IAttFileEOService extends IService<AttFileEO> {
@@ -30,4 +31,5 @@ public interface IAttFileEOService extends IService<AttFileEO> {
public AttFileVo insertFileInfo(File file,String fileName);
void downLoadFileList(List<AttFileEO> multiFileInfos, String fileNowPath) throws IOException;
}
@@ -20,6 +20,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
@@ -426,7 +428,30 @@ public class AttFileEOServiceImpl extends ServiceImpl<AttFileEODao, AttFileEO> i
}
return fileObj;
}
public void downLoadFileList(List<AttFileEO> AttFileList,String fileNowPath) throws IOException {
for(AttFileEO fileExportDto : AttFileList){
String oldPath = filePath+ "/" + fileExportDto.getFilePath() + fileExportDto.getFileName();
String newPath = fileNowPath + "/" + fileExportDto.getOldFileName();
File oldFile = new File(oldPath);
if (oldFile.exists()){
copyFile1(oldPath, newPath);
}
}
}
public static void copyFile1(String srcPath, String destPath) throws IOException {
// 打开输入流
FileInputStream fis = new FileInputStream(srcPath);
// 打开输出流
FileOutputStream fos = new FileOutputStream(destPath);
// 读取和写入信息
int len = 0;
while ((len = fis.read()) != -1) {
fos.write(len);
}
// 关闭流 先开后关 后开先关
fos.close(); // 后开先关
fis.close(); // 先开后关
}
/**
@@ -21,7 +21,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
@@ -142,6 +144,7 @@ public class PersonCollectEOServiceImpl extends ServiceImpl<PersonCollectEODao,
List<String> ids = new ArrayList<>(Arrays.asList(modeType.split(",")));
wrapper.in("collect_type",ids);
}
wrapper.orderByDesc("creation_Time");
if (pageNo != null) {
basePage.setPage(pageNo);
@@ -156,6 +159,22 @@ public class PersonCollectEOServiceImpl extends ServiceImpl<PersonCollectEODao,
IPage<TsPersonCollect> page = this.page(new Page<>(basePage.getPage(), basePage.getPageSize()), wrapper);
//三天以内收藏的 标题名称后面加 new 一小时3600000 一天时间戳 为 86400000
long newTime = 86400000;
Date date = new Date();
long time = date.getTime();
for (TsPersonCollect data : page.getRecords()){
long creationTime = data.getCreationTime().getTime();
if(creationTime + newTime == time || creationTime + newTime > time){
StringBuffer sb = new StringBuffer();
sb.append("<span style=\'color:red\'>"+"(new)"+"</span>").append(data.getCollectTitle());
data.setCollectTitle(sb.toString());
}
}
return Result.success(page);
}