|
@@ -149,39 +149,53 @@ public class ImageClassificationFileController extends BladeController {
|
|
Workbook workbook = null;
|
|
Workbook workbook = null;
|
|
|
|
|
|
List<String> pdfFileList = new ArrayList<>();
|
|
List<String> pdfFileList = new ArrayList<>();
|
|
- //每个图片就是一个文件
|
|
|
|
- for(String uri : uris){
|
|
|
|
|
|
+ //两个图片一组
|
|
|
|
+ List<List<String>> groupUrls = CommonUtil.getBatchSize(JSONObject.parseArray(JSONObject.toJSONString(uris), String.class), 2);
|
|
|
|
+ for(List<String> urls : groupUrls){
|
|
try{
|
|
try{
|
|
//创建模板Workbook
|
|
//创建模板Workbook
|
|
modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
|
|
modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
|
|
workbook = WorkbookFactory.create(modInput);
|
|
workbook = WorkbookFactory.create(modInput);
|
|
- CreationHelper helper = workbook.getCreationHelper();
|
|
|
|
- Sheet sheet = workbook.getSheetAt(0);
|
|
|
|
- Drawing<?> drawing = sheet.createDrawingPatriarch();
|
|
|
|
- ClientAnchor anchor = helper.createClientAnchor();
|
|
|
|
- anchor.setRow1(0);
|
|
|
|
- anchor.setCol1(0);
|
|
|
|
-
|
|
|
|
- //创建图片
|
|
|
|
- drawing.createPicture(anchor, workbook.addPicture(CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(uri)), Workbook.PICTURE_TYPE_PNG));
|
|
|
|
- //图片定位
|
|
|
|
- FileUtils.imageOrientation(sheet, anchor, new DataVO(0, 0));
|
|
|
|
-
|
|
|
|
- //定位其它信息
|
|
|
|
- //文字说明
|
|
|
|
- sheet.getRow(1).getCell(6).setCellValue(file.getTextContent());
|
|
|
|
- //照片号
|
|
|
|
- sheet.getRow(20).getCell(6).setCellValue(file.getPhotoCode());
|
|
|
|
- //底片号
|
|
|
|
- sheet.getRow(24).getCell(6).setCellValue(file.getFilmCode());
|
|
|
|
- //题名
|
|
|
|
- sheet.getRow(28).getCell(0).setCellValue(file.getTitle());
|
|
|
|
- //参见号
|
|
|
|
- sheet.getRow(28).getCell(4).setCellValue(file.getSeeAlsoCode());
|
|
|
|
- //拍摄时间
|
|
|
|
- sheet.getRow(30).getCell(4).setCellValue(DateUtil.format(file.getShootingTime(), "yyyy-MM-dd"));
|
|
|
|
- //参见号
|
|
|
|
- sheet.getRow(32).getCell(4).setCellValue(file.getShootingUser());
|
|
|
|
|
|
+
|
|
|
|
+ for(int i = 0, l = urls.size(); i < l; i ++){
|
|
|
|
+ try{
|
|
|
|
+ CreationHelper helper = workbook.getCreationHelper();
|
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
|
+ Drawing<?> drawing = sheet.createDrawingPatriarch();
|
|
|
|
+ ClientAnchor anchor = helper.createClientAnchor();
|
|
|
|
+ if(i == 0){
|
|
|
|
+ anchor.setRow1(0);
|
|
|
|
+ anchor.setCol1(0);
|
|
|
|
+ } else {
|
|
|
|
+ anchor.setRow1(28);
|
|
|
|
+ anchor.setCol1(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //创建图片
|
|
|
|
+ drawing.createPicture(anchor, workbook.addPicture(CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(urls.get(i))), Workbook.PICTURE_TYPE_PNG));
|
|
|
|
+ //图片定位
|
|
|
|
+ FileUtils.imageOrientation(sheet, anchor, i == 1 ? new DataVO(0, 0) : new DataVO(1, 28));
|
|
|
|
+
|
|
|
|
+ //定位其它信息
|
|
|
|
+ //文字说明
|
|
|
|
+ sheet.getRow(i == 0 ? 1 : 29).getCell(i == 0 ? 5 : 0).setCellValue(file.getTextContent());
|
|
|
|
+ //照片号
|
|
|
|
+ sheet.getRow(i == 0 ? 11 : 39).getCell(i == 0 ? 5 : 0).setCellValue(file.getPhotoCode());
|
|
|
|
+ //底片号
|
|
|
|
+ sheet.getRow(i == 0 ? 17 : 45).getCell(i == 0 ? 5 : 0).setCellValue(file.getFilmCode());
|
|
|
|
+ //题名
|
|
|
|
+ sheet.getRow(i == 0 ? 23 : 51).getCell(i == 0 ? 0 : 3).setCellValue(file.getTitle());
|
|
|
|
+ //参见号
|
|
|
|
+ sheet.getRow(i == 0 ? 23 : 51).getCell(i == 0 ? 3 : 0).setCellValue(file.getSeeAlsoCode());
|
|
|
|
+ //拍摄时间
|
|
|
|
+ sheet.getRow(i == 0 ? 25 : 53).getCell(i == 0 ? 3 : 0).setCellValue(DateUtil.format(file.getShootingTime(), "yyyy-MM-dd"));
|
|
|
|
+ //拍摄者
|
|
|
|
+ sheet.getRow(i == 0 ? 27 : 55).getCell(i == 0 ? 3 : 0).setCellValue(file.getShootingUser());
|
|
|
|
+
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
String locationFile = "/Users/doc/print/" + SnowFlakeUtil.getId() + ".xlsx";
|
|
String locationFile = "/Users/doc/print/" + SnowFlakeUtil.getId() + ".xlsx";
|
|
outputStream = new FileOutputStream(locationFile);
|
|
outputStream = new FileOutputStream(locationFile);
|
|
@@ -199,7 +213,7 @@ public class ImageClassificationFileController extends BladeController {
|
|
pdfFileList.add(bladeFile.getPdfUrl());
|
|
pdfFileList.add(bladeFile.getPdfUrl());
|
|
}
|
|
}
|
|
|
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
+ } catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
} finally {
|
|
} finally {
|
|
if(outputStream != null){
|
|
if(outputStream != null){
|
|
@@ -268,15 +282,6 @@ public class ImageClassificationFileController extends BladeController {
|
|
//为空,说明初始化
|
|
//为空,说明初始化
|
|
//获取根节点
|
|
//获取根节点
|
|
rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
|
|
rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
|
|
-// if(rootTreeNode != null && rootTreeNode.size() != 0){
|
|
|
|
-// rootTreeNode.forEach(vo -> {
|
|
|
|
-// //获取一级子节点
|
|
|
|
-// List<WbsTreeContractTreeVOS> treeNodes = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, vo.getId());
|
|
|
|
-// if(treeNodes != null && treeNodes.size() != 0){
|
|
|
|
-// vo.setChildren(treeNodes);
|
|
|
|
-// }
|
|
|
|
-// });
|
|
|
|
-// }
|
|
|
|
} else {
|
|
} else {
|
|
//不为空,获取其下子节点
|
|
//不为空,获取其下子节点
|
|
rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
|
|
rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
|
|
@@ -510,6 +515,7 @@ public class ImageClassificationFileController extends BladeController {
|
|
@ApiOperation(value = "修改影音资料信息", notes = "传入表单数据")
|
|
@ApiOperation(value = "修改影音资料信息", notes = "传入表单数据")
|
|
public R<Boolean> update(@Valid @RequestBody ImageClassificationFileVO fileVO){
|
|
public R<Boolean> update(@Valid @RequestBody ImageClassificationFileVO fileVO){
|
|
ImageClassificationFile newData = this.copyBeanData(fileVO, false);
|
|
ImageClassificationFile newData = this.copyBeanData(fileVO, false);
|
|
|
|
+ newData.setMargePdfUrl("");
|
|
return R.data(this.imageClassificationFileService.updateById(newData));
|
|
return R.data(this.imageClassificationFileService.updateById(newData));
|
|
}
|
|
}
|
|
|
|
|