|
@@ -60,6 +60,20 @@ public class ZhcxPersistentManageServiceImpl extends ServiceImpl<ZhcxPersistentM
|
|
map.put("period","第"+period+"期");
|
|
map.put("period","第"+period+"期");
|
|
List<ZhcxPersistentManageDo> list = zhcxPersistentManageDao.listData(map);
|
|
List<ZhcxPersistentManageDo> list = zhcxPersistentManageDao.listData(map);
|
|
if(list.size() > 0){
|
|
if(list.size() > 0){
|
|
|
|
+ list.forEach(ev ->{
|
|
|
|
+ String sitepic = ev.getSitepic();
|
|
|
|
+ if(StringUtils.isNotBlank(sitepic)){
|
|
|
|
+ String[] splits = sitepic.split("\\^_\\^");
|
|
|
|
+ Optional<String> firstId = Arrays.stream(splits)
|
|
|
|
+ .filter(s -> s.contains(".jpg")
|
|
|
|
+ || s.contains(".jpeg")
|
|
|
|
+ || s.contains(".png"))
|
|
|
|
+ .findFirst();
|
|
|
|
+ if(firstId.isPresent()){
|
|
|
|
+ ev.setSitepic(firstId.get());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
Map<String, List<ZhcxPersistentManageDo>> groupList = list.stream()
|
|
Map<String, List<ZhcxPersistentManageDo>> groupList = list.stream()
|
|
.collect(Collectors.groupingBy(ZhcxPersistentManageDo::getFill));
|
|
.collect(Collectors.groupingBy(ZhcxPersistentManageDo::getFill));
|
|
Date[] weekDates = getWeekDates(Integer.parseInt(year), Integer.parseInt(period));
|
|
Date[] weekDates = getWeekDates(Integer.parseInt(year), Integer.parseInt(period));
|
|
@@ -357,28 +371,35 @@ public class ZhcxPersistentManageServiceImpl extends ServiceImpl<ZhcxPersistentM
|
|
String rectifystatus = staf.getRectifystatus();
|
|
String rectifystatus = staf.getRectifystatus();
|
|
if(StringUtils.isNotBlank(sitepic)){
|
|
if(StringUtils.isNotBlank(sitepic)){
|
|
String[] splits = StringUtils.toString(sitepic, "").split("\\^_\\^");
|
|
String[] splits = StringUtils.toString(sitepic, "").split("\\^_\\^");
|
|
- String[] imgIds = splits[0].split("-;-");
|
|
|
|
- SysFileItemDo fileItemDo = sysFileItemService.getById(imgIds[1]);
|
|
|
|
- if(fileItemDo != null){
|
|
|
|
- BufferedInputStream inputStream = FileUtil.getInputStream(fileItemDo.getFullpath());
|
|
|
|
- // 使用DocumentBuilder插入图片
|
|
|
|
- DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
|
-
|
|
|
|
- // 找到包含"pic"的占位符的单元格
|
|
|
|
- Cell cellWithPicPlaceholder = null;
|
|
|
|
- for (Cell cell : newRow.getCells()) {
|
|
|
|
- if (cell.getRange().getText().contains("pic")) {
|
|
|
|
- cellWithPicPlaceholder = cell;
|
|
|
|
- break;
|
|
|
|
|
|
+ Optional<String> firstId = Arrays.stream(splits)
|
|
|
|
+ .filter(s -> s.contains(".jpg")
|
|
|
|
+ || s.contains(".jpeg")
|
|
|
|
+ || s.contains(".png"))
|
|
|
|
+ .findFirst();
|
|
|
|
+ if(firstId.isPresent()){
|
|
|
|
+ String[] imgIds = firstId.get().split("-;-");
|
|
|
|
+ SysFileItemDo fileItemDo = sysFileItemService.getById(imgIds[1]);
|
|
|
|
+ if(fileItemDo != null){
|
|
|
|
+ BufferedInputStream inputStream = FileUtil.getInputStream(fileItemDo.getFullpath());
|
|
|
|
+ // 使用DocumentBuilder插入图片
|
|
|
|
+ DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
|
+
|
|
|
|
+ // 找到包含"pic"的占位符的单元格
|
|
|
|
+ Cell cellWithPicPlaceholder = null;
|
|
|
|
+ for (Cell cell : newRow.getCells()) {
|
|
|
|
+ if (cell.getRange().getText().contains("pic")) {
|
|
|
|
+ cellWithPicPlaceholder = cell;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- if (cellWithPicPlaceholder != null) {
|
|
|
|
- // 清除占位符
|
|
|
|
- cellWithPicPlaceholder.getRange().replace("pic", "");
|
|
|
|
- // 移动到单元格并插入图片
|
|
|
|
- builder.moveTo(cellWithPicPlaceholder.getFirstParagraph());
|
|
|
|
- builder.insertImage(inputStream, 100, 80); // 设置图片宽度和高度
|
|
|
|
|
|
+ if (cellWithPicPlaceholder != null) {
|
|
|
|
+ // 清除占位符
|
|
|
|
+ cellWithPicPlaceholder.getRange().replace("pic", "");
|
|
|
|
+ // 移动到单元格并插入图片
|
|
|
|
+ builder.moveTo(cellWithPicPlaceholder.getFirstParagraph());
|
|
|
|
+ builder.insertImage(inputStream, 100, 80); // 设置图片宽度和高度
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|