增加导出3d采集zip数据

This commit is contained in:
gaoben 2023-04-12 16:21:53 +08:00
parent d02e78c8ab
commit 08e5a3e44d
1 changed files with 67 additions and 0 deletions

View File

@ -199,4 +199,71 @@ public class TenRecordController extends AbstractController {
return R.ok().put("data",count); return R.ok().put("data",count);
} }
@PostMapping("/copy3dZip")
public R copy3dZip(@RequestParam("yearMonth") String yearMonth){
String tenantId = getUser().getTenantId()+"";
int count = 0;
String[] yearMonthArray = yearMonth.split("-");
int year = Integer.parseInt(yearMonthArray[0]);
int month = Integer.parseInt(yearMonthArray[1]);
//yyyy-MM-dd
String yearMonthLastDay = DateUtils.getLastDayOfMonth(year,month);
String start = yearMonth+"-01 00:00:0l";
String end = yearMonthLastDay+" 23:59:59";
List<TenRecordEntity> monthRecords = tenRecordService.getMonthRecords(start,end,tenantId);
for(TenRecordEntity recordEntity: monthRecords){
//识别照片
// if (recordEntity.getRecordFace()!=null && recordEntity.getRecordFace().length()>0) {
// String srcFileStr = globalValue.getMinioPath()+"/"+recordEntity.getRecordFace();
// try {
// File srcFile = new File(srcFileStr);
// if(srcFile.exists()){
// // images/836267246392180742/836268331420876805/b8c6fa0e9cf54f56ae9189024f0e9058.jpg
// String userDir = recordEntity.getRecordFace().split("/")[2];
// String disPath = "imagebak/"+yearMonth+"/"+userDir;
// File disPathFile = new File(disPath);
// FileUtils.forceMkdir(disPathFile);
//
// FileUtils.copyFileToDirectory(srcFile,disPathFile);
// FileUtils.deleteQuietly(srcFile);
// count++;
// }
// }catch (Exception e){
// e.printStackTrace();
// }
// }
//3d数据zip
if (recordEntity.getSourceFile()!=null && recordEntity.getSourceFile().length()>0) {
String srcFileStr = globalValue.getMinioPath()+"/"+recordEntity.getSourceFile();
try {
File srcFile = new File(srcFileStr);
if(srcFile.exists()){
// images/836267246392180742/836268331420876805/b8c6fa0e9cf54f56ae9189024f0e9058.jpg
String userDir = recordEntity.getRecordFace().split("/")[2];
String disPath = "imagebak/"+yearMonth+"/"+userDir;
File disPathFile = new File(disPath);
FileUtils.forceMkdir(disPathFile);
FileUtils.copyFileToDirectory(srcFile,disPathFile);
// FileUtils.deleteQuietly(srcFile);
count++;
}
}catch (Exception e){
e.printStackTrace();
}
}
}
return R.ok().put("data",count);
}
} }