|
|
|
@ -33,7 +33,9 @@ import com.engine.organization.util.tree.SearchTreeUtil;
|
|
|
|
|
import com.engine.organization.util.word.CustomXWPFDocument;
|
|
|
|
|
import com.engine.organization.util.word.WordUtil;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.poi.xwpf.usermodel.Document;
|
|
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
|
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFPictureData;
|
|
|
|
|
import org.apache.xmlbeans.XmlOptions;
|
|
|
|
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBody;
|
|
|
|
|
import weaver.general.GCONST;
|
|
|
|
@ -315,6 +317,17 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
CustomXWPFDocument src2Document = doucDocument2;
|
|
|
|
|
CTBody src2Body = src2Document.getDocument().getBody();
|
|
|
|
|
XWPFParagraph p2 = src2Document.createParagraph();
|
|
|
|
|
|
|
|
|
|
//处理合并后文档图片冲突
|
|
|
|
|
List<XWPFPictureData> allPictures = src2Document.getAllPictures();
|
|
|
|
|
Map<String, String> map = new HashMap();
|
|
|
|
|
for (XWPFPictureData picture : allPictures) {
|
|
|
|
|
String before = src2Document.getRelationId(picture);
|
|
|
|
|
//将原文档中的图片加入到目标文档中
|
|
|
|
|
String after = src1Document.addPictureData(picture.getData(), Document.PICTURE_TYPE_JPEG);
|
|
|
|
|
map.put(before, after);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XmlOptions optionsOuter = new XmlOptions();
|
|
|
|
|
optionsOuter.setSaveOuter();
|
|
|
|
|
String appendString = src2Body.xmlText(optionsOuter);
|
|
|
|
@ -323,6 +336,19 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
String mainPart = srcString.substring(srcString.indexOf(">") + 1, srcString.lastIndexOf("<"));
|
|
|
|
|
String sufix = srcString.substring(srcString.lastIndexOf("<"));
|
|
|
|
|
String addPart = appendString.substring(appendString.indexOf(">") + 1, appendString.lastIndexOf("<"));
|
|
|
|
|
if (map != null && !map.isEmpty()) {
|
|
|
|
|
ListIterator<Map.Entry<String, String>> i = new ArrayList<>(map.entrySet()).listIterator(map.size());
|
|
|
|
|
LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap<String, String>();
|
|
|
|
|
while (i.hasPrevious()) {
|
|
|
|
|
Map.Entry<String, String> entry = i.previous();
|
|
|
|
|
linkedHashMap.put(entry.getKey(), entry.getValue());
|
|
|
|
|
}
|
|
|
|
|
Iterator it1 = linkedHashMap.entrySet().iterator();
|
|
|
|
|
while (it1.hasNext()) {
|
|
|
|
|
Map.Entry<String, String> entry = (Map.Entry<String, String>) it1.next();
|
|
|
|
|
addPart = addPart.replace("<a:blip r:embed=\"" + entry.getKey(), "<a:blip r:embed=\"" + entry.getValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
CTBody makeBody = CTBody.Factory.parse(prefix + mainPart + addPart + sufix);
|
|
|
|
|
src1Body.set(makeBody);
|
|
|
|
|
return src1Document;
|
|
|
|
|