合并分支 'dev_20230216' 到 'master'

Dev 20230216

查看合并请求 laws-foton-slrs/foton-slrs-system-rest!96
This commit is contained in:
高嵩
2023-06-02 11:50:51 +08:00
5 changed files with 22 additions and 21 deletions
@@ -71,7 +71,7 @@ public class SarBussStandFileController extends BaseController<SarBussStandFile>
@ApiOperation(value = "|SarBussStandFileEO|批量修改加密文件不能打开问题")
@GetMapping("/batchUpdateSarBussFile")
/*@RequiresPermissions("lawss:sarLawsFile:list")*/
public ResponseMessage<SarBussStandFile> batchUpdateSarBussFile() throws Exception {
public ResponseMessage<List<SarBussStandFile>> batchUpdateSarBussFile() throws Exception {
return sarBussStandFileEOService.batchUpdateSarBussFile();
}
}
@@ -18,5 +18,5 @@ public interface ISarBussStandFileService extends IService<SarBussStandFile> {
List<SarBussStandFile> selectFileByAttId(String attId) throws Exception;
ResponseMessage<SarBussStandFile> batchUpdateSarBussFile();
ResponseMessage<List<SarBussStandFile>> batchUpdateSarBussFile();
}
@@ -49,30 +49,25 @@ public class SarBussStandFileServiceImpl extends ServiceImpl<SarBussStandFileDao
}
@Override
public ResponseMessage<SarBussStandFile> batchUpdateSarBussFile() {
public ResponseMessage<List<SarBussStandFile>> batchUpdateSarBussFile() {
List<SarBussStandFile> objects = new ArrayList<>();
QueryWrapper<SarBussStandFile> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("USE_MODEL","SOURCE_FILE");
// objectQueryWrapper.eq("FILE_SUFFIX","docx");
objectQueryWrapper.ne("FILE_SUFFIX","pdf");
objectQueryWrapper.ne("FILE_SUFFIX","PDF");
objectQueryWrapper.ne("FILE_SUFFIX","xls");
objectQueryWrapper.ne("FILE_SUFFIX","XLS");
List<SarBussStandFile> sarBussStandFiles = sarStandFileEODao.selectList(objectQueryWrapper);
if(!sarBussStandFiles.isEmpty()){
for (SarBussStandFile data: sarBussStandFiles){
QueryWrapper<SarBussStandFile> objectQueryWrapperSarBussStandFile = new QueryWrapper<>();
objectQueryWrapperSarBussStandFile.eq("USE_MODEL","SOURCE_FILE");
objectQueryWrapperSarBussStandFile.eq("ORI_ATT_ID",data.getOriAttId());
// objectQueryWrapper.eq("FILE_SUFFIX","docx");
objectQueryWrapperSarBussStandFile.ne("FILE_SUFFIX","pdf");
objectQueryWrapperSarBussStandFile.ne("FILE_SUFFIX","PDF");
List<SarBussStandFile> sarBussStandFilesList = sarStandFileEODao.selectList(objectQueryWrapper);
if(!sarBussStandFilesList.isEmpty() && sarBussStandFilesList.size()==1){
objectQueryWrapperSarBussStandFile.eq("USE_MODEL","WEB_FILE");
List<SarBussStandFile> sarBussStandFilesList = sarStandFileEODao.selectList(objectQueryWrapperSarBussStandFile);
if(sarBussStandFilesList.isEmpty() && sarBussStandFilesList.size()==0){
AttFileVo attFileVo = attFileEOService.wordConversionFilePdf(data.getOriAttId());
if(attFileVo!=null){
SarBussStandFile sarBussStandFile = new SarBussStandFile();
//sarBussStandFile.setId();
String uuId = com.adc.da.util.utils.UUID.randomUUID(20);
sarBussStandFile.setId(uuId);
sarBussStandFile.setStandId(data.getStandId());
@@ -88,14 +83,14 @@ public class SarBussStandFileServiceImpl extends ServiceImpl<SarBussStandFileDao
sarBussStandFile.setOriAttId(data.getOriAttId());
objects.add(sarBussStandFile);
sarStandFileEODao.insert(sarBussStandFile);
logger.info("======================================正在转换=================================");
logger.info("======================================文件正在转换=================================");
}else {
logger.info("======================================word.doc转换失败=================================");
logger.info("======================================word.doc文件转换失败 数据为空=================================");
}
}
}
}
logger.info("======================================转换完成================================="+objects.toString());
return Result.success();
return Result.success(objects);
}
}
@@ -4898,15 +4898,13 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
objectQueryWrapper.eq("ORI_ATT_ID",fileId);
objectQueryWrapper.eq("USE_MODEL","SOURCE_FILE");
objectQueryWrapper.eq("FILE_SUFFIX","docx");
// objectQueryWrapper.ne("FILE_SUFFIX","pdf");
// objectQueryWrapper.ne("FILE_SUFFIX","PDF");
List<SarBussStandFile> sarBussStandFiles = sarBussStandFileEODao.selectList(objectQueryWrapper);
// 为空暂不处理 不为空则意味pdf生成失败
if(!sarBussStandFiles.isEmpty()) {
QueryWrapper<SarBussStandFile> objectQueryWrapperSarBussStandFile = new QueryWrapper<>();
objectQueryWrapperSarBussStandFile.eq("ORI_ATT_ID", sarBussStandFiles.get(0).getOriAttId());
objectQueryWrapperSarBussStandFile.eq("USE_MODEL", "WEB_FILE");
List<SarBussStandFile> sarBussStandFilesList = sarBussStandFileEODao.selectList(objectQueryWrapperSarBussStandFile);
if(!sarBussStandFilesList.isEmpty() && sarBussStandFilesList.size()==1){
if(sarBussStandFilesList.isEmpty() && sarBussStandFilesList.size()==0){
AttFileVo attFileVo = attFileEOService.wordConversionFilePdf(sarBussStandFiles.get(0).getOriAttId());
if(attFileVo!=null){
SarBussStandFile sarBussStandFile = new SarBussStandFile();
@@ -601,15 +601,19 @@ public class AttFileEOServiceImpl extends ServiceImpl<AttFileEODao, AttFileEO> i
AttFileVo attFileVoPdf = null;
if(fileInfo != null){
File fileWord = new File(src+fileInfo.getFilePath()+fileInfo.getFileName());
logger.info("==================================fileWord文件路径========================"+src+fileInfo.getFilePath()+fileInfo.getFileName());
AttFileVo attFileVo = saveFileInfo(fileWord);
// 保存后 开始转换为 pdf版本
File inputWord = new File(src+attFileVo.getFilePath()+attFileVo.getFileName());
logger.info("==================================inputWord文件路径========================"+src+attFileVo.getFilePath()+attFileVo.getFileName());
String filePdfName = "";
if(StringUtils.isNotBlank(attFileVo.getFileName())){
String[] split = attFileVo.getFileName().split("\\.");
filePdfName = split[0]+".pdf";
}
File outputFile = new File(src+fileInfo.getFilePath(),filePdfName);
File outputFile = new File(src+fileInfo.getFilePath()+filePdfName);
logger.info("==================================outputFile文件路径========================"+src+fileInfo.getFilePath()+filePdfName);
try {
InputStream docxInputStream = new FileInputStream(inputWord);
OutputStream outputStream = new FileOutputStream(outputFile);
@@ -627,6 +631,10 @@ public class AttFileEOServiceImpl extends ServiceImpl<AttFileEODao, AttFileEO> i
deleteById(attFileVo.getId());
logger.info("==================================word.docx删除成功========================");
}
if (outputFile.exists()) {
outputFile.delete();
logger.info("==================================word.pdf删除成功========================");
}
}
}