huangjn 3 vuotta sitten
vanhempi
commit
a0aefefceb

+ 45 - 39
blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java

@@ -149,39 +149,53 @@ public class ImageClassificationFileController extends BladeController {
 							Workbook workbook = null;
 
 							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{
 									//创建模板Workbook
 									modInput = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
 									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";
 									outputStream = new FileOutputStream(locationFile);
@@ -199,7 +213,7 @@ public class ImageClassificationFileController extends BladeController {
 										pdfFileList.add(bladeFile.getPdfUrl());
 									}
 
-								}catch (Exception e){
+								} catch (Exception e){
 									e.printStackTrace();
 								} finally {
 									if(outputStream != null){
@@ -268,15 +282,6 @@ public class ImageClassificationFileController extends BladeController {
 			//为空,说明初始化
 			//获取根节点
 			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 {
 			//不为空,获取其下子节点
 			rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
@@ -510,6 +515,7 @@ public class ImageClassificationFileController extends BladeController {
 	@ApiOperation(value = "修改影音资料信息", notes = "传入表单数据")
 	public R<Boolean> update(@Valid @RequestBody ImageClassificationFileVO fileVO){
 		ImageClassificationFile newData = this.copyBeanData(fileVO, false);
+		newData.setMargePdfUrl("");
 		return R.data(this.imageClassificationFileService.updateById(newData));
 	}
 

+ 15 - 8
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -85,7 +85,7 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 			//拼接填报人信息
 			String fileUser = user.getUserId() + "-" + user.getNickName();
 			if(StringUtils.isNotEmpty(oldData.getFileUserIdAndName())){
-				if(!oldData.getFileUserIdAndName().contains(fileUser)){
+				if(!oldData.getFileUserIdAndName().contains(user.getUserId().toString())){
 					//不包含,拼接
 					oldData.setFileUserIdAndName(oldData.getFileUserIdAndName() + "," + fileUser);
 				}
@@ -119,7 +119,7 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 			//流程状态,默认未上报
 			newData.setStatus(0);
 			//填报人ID及姓名
-			newData.setFileUserIdAndName(user.getUserId() + "-" + user.getUserName());
+			newData.setFileUserIdAndName(user.getUserId() + "-" + user.getNickName());
 			//数据源类型
 			newData.setSourceType(sourceType);
 			newData.setCreateUser(user.getUserId());
@@ -158,13 +158,17 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 				});
 				//二次去重
 				HashSet<String> hashSet = new HashSet<>(userList);
+				List<String> users = new ArrayList<>();
 				hashSet.forEach(user -> {
 					String[] array = user.split("-");
-					User bUser = this.userClient.userInfoById(Long.parseLong(array[0])).getData();
-					if(bUser != null){
-						result.add(new FileUserVO(array[0], bUser.getRealName()));
-					} else {
-						result.add(new FileUserVO(array[0], array[1]));
+					if(!users.contains(array[0])){
+						User bUser = this.userClient.userInfoById(Long.parseLong(array[0])).getData();
+						if(bUser != null){
+							result.add(new FileUserVO(array[0], bUser.getRealName()));
+						} else {
+							result.add(new FileUserVO(array[0], array[1]));
+						}
+						users.add(array[0]);
 					}
 				});
 			}
@@ -211,7 +215,10 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 					String[] fileUserIdAndNames = fileUserIdAndName.split(",");
 					List<String> names = new ArrayList<>();
 					for(String str : fileUserIdAndNames){
-						names.add(str.split("-")[1]);
+						String[] strs = str.split("-");
+						if(!names.contains(strs[1])){
+							names.add(strs[1]);
+						}
 					}
 					//只拼接名字
 					vor.setFileUserIdAndName(String.join(",", names));