制度正文附件批量上传
This commit is contained in:
parent
3656f581c4
commit
57a1964b2b
@ -74,6 +74,35 @@ public class DataMigrationController {
|
|||||||
ResponseObject ro = ResponseObject.newOkResponse();
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
return ro.toString();
|
return ro.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* by lhy 制度正文附件上传
|
||||||
|
* @param me
|
||||||
|
* @param wsId
|
||||||
|
* @param groupValue
|
||||||
|
* @param fileValue
|
||||||
|
* @param fileName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.controlPolicyFile_import")
|
||||||
|
public String conrlyFileImport(UserContext me,String wsId,String groupValue,String fileValue,String fileName){
|
||||||
|
//new ReadTable().getTableInfo(me,wsId,groupValue,fileValue,fileName);
|
||||||
|
Thread thread =new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
String[] fileNameArr = fileName.split(",");
|
||||||
|
for(String name : fileNameArr){
|
||||||
|
new ReadTable().controlPolicyFile_import(me,wsId,groupValue,fileValue,name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
thread.setPriority(8);
|
||||||
|
thread.start();
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* by bzp 表单属性文件上传 解析文件
|
* by bzp 表单属性文件上传 解析文件
|
||||||
|
|||||||
@ -1,5 +1,30 @@
|
|||||||
package com.actionsoft.apps.coe.pal.datamigration.util.readtable;
|
package com.actionsoft.apps.coe.pal.datamigration.util.readtable;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.poi.hwpf.HWPFDocument;
|
||||||
|
import org.apache.poi.hwpf.usermodel.CharacterRun;
|
||||||
|
import org.apache.poi.hwpf.usermodel.Paragraph;
|
||||||
|
import org.apache.poi.hwpf.usermodel.Range;
|
||||||
|
import org.apache.poi.hwpf.usermodel.Table;
|
||||||
|
import org.apache.poi.hwpf.usermodel.TableCell;
|
||||||
|
import org.apache.poi.hwpf.usermodel.TableRow;
|
||||||
|
|
||||||
|
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||||
import com.actionsoft.apps.coe.pal.datamigration.model.po.WordAttribute;
|
import com.actionsoft.apps.coe.pal.datamigration.model.po.WordAttribute;
|
||||||
import com.actionsoft.apps.coe.pal.datamigration.model.po.WordField;
|
import com.actionsoft.apps.coe.pal.datamigration.model.po.WordField;
|
||||||
import com.actionsoft.apps.coe.pal.datamigration.util.ShapeUtil;
|
import com.actionsoft.apps.coe.pal.datamigration.util.ShapeUtil;
|
||||||
@ -8,7 +33,12 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPI
|
|||||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
||||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
|
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
|
||||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.upfile.constant.CoeFileConstant;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
|
||||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||||
|
import com.actionsoft.bpms.bo.engine.BO;
|
||||||
import com.actionsoft.bpms.server.UserContext;
|
import com.actionsoft.bpms.server.UserContext;
|
||||||
import com.actionsoft.bpms.server.fs.DCContext;
|
import com.actionsoft.bpms.server.fs.DCContext;
|
||||||
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
|
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
|
||||||
@ -20,13 +50,8 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.aspose.words.Document;
|
import com.aspose.words.Document;
|
||||||
import com.aspose.words.SaveFormat;
|
import com.aspose.words.SaveFormat;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.poi.hwpf.HWPFDocument;
|
|
||||||
import org.apache.poi.hwpf.usermodel.*;
|
|
||||||
|
|
||||||
import java.io.*;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author baizp
|
* @author baizp
|
||||||
@ -67,7 +92,61 @@ public class ReadTable {
|
|||||||
idToNameMap.put(wordAttribute.getType(), wordAttribute.getTitle());
|
idToNameMap.put(wordAttribute.getType(), wordAttribute.getTitle());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void controlPolicyFile_import(UserContext userContext, String wsId, String groupValue, String fileValue, String fileName) {
|
||||||
|
HashMap<String,Object> logMaps = new HashMap<String,Object>();
|
||||||
|
logMaps.put("FILENAME", fileName);
|
||||||
|
try {
|
||||||
|
String substring = fileName.substring(0,fileName.indexOf(".xml"));
|
||||||
|
PALRepositoryModel palRepositoryModel = ReadWordUtil.getRepositoryByName(wsId, substring);
|
||||||
|
if(null==palRepositoryModel) {
|
||||||
|
logMaps.put("UPFILESTATE", "文件没有匹配到制度模型!");
|
||||||
|
}else {
|
||||||
|
String id = palRepositoryModel.getId();
|
||||||
|
logMaps.put("PALID",id);
|
||||||
|
//查询对应绩效模型中数据模型进行填充数据
|
||||||
|
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(id, 0);
|
||||||
|
String shpId = "";
|
||||||
|
String define = defineModel.getDefinition();
|
||||||
|
JSONObject definition = JSONObject.parseObject(define);
|
||||||
|
JSONObject elements = definition.getJSONObject("elements");
|
||||||
|
for (String key : elements.keySet()) {
|
||||||
|
JSONObject shape1 = elements.getJSONObject(key);
|
||||||
|
if("regulation".equals(shape1.getString("name"))) {
|
||||||
|
shpId = key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if("".equals(shpId)) {
|
||||||
|
logMaps.put("UPFILESTATE", "模型中没有对应的形状!");
|
||||||
|
}else {
|
||||||
|
DCPluginProfile dcProfilepdfdoc = DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal.datamigration", "migration");
|
||||||
|
//将文件挂载到附件里面
|
||||||
|
DCContext dcContextorigin = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, fileName);
|
||||||
|
InputStream originfile = SDK.getDCAPI().read(dcContextorigin);
|
||||||
|
try {
|
||||||
|
boolean writeFileTodisk = new ReadWordUtil().writeFileTodisk(userContext, shpId, fileName, originfile, id, "s");
|
||||||
|
if(writeFileTodisk) {
|
||||||
|
logMaps.put("UPFILESTATE", "上传成功!");
|
||||||
|
}else {
|
||||||
|
logMaps.put("UPFILESTATE", "上传失败!");
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}finally {
|
||||||
|
SDK.getBOAPI().createDataBO("BO_ACT_DATAMIGRATION_LOG_T", new BO().setAll(logMaps), userContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void getTableInfo(UserContext userContext, String wsId, String groupValue, String fileValue, String fileName) {
|
public void getTableInfo(UserContext userContext, String wsId, String groupValue, String fileValue, String fileName) {
|
||||||
DCPluginProfile dcProfilepdf = DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal.datamigration", "migration");
|
DCPluginProfile dcProfilepdf = DCProfileManager.getDCProfile("com.actionsoft.apps.coe.pal.datamigration", "migration");
|
||||||
DCContext dcContextpdf = new DCContext(userContext, dcProfilepdf, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, fileName);
|
DCContext dcContextpdf = new DCContext(userContext, dcProfilepdf, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, fileName);
|
||||||
|
|||||||
@ -335,7 +335,6 @@ public class ReadWordUtil {
|
|||||||
* RowMap map = DBSql.getMap(sql); if(map!=null) { String sqls = ""; }else { }
|
* RowMap map = DBSql.getMap(sql); if(map!=null) { String sqls = ""; }else { }
|
||||||
*/
|
*/
|
||||||
SDK.getBOAPI().createDataBO("BO_ACT_DATAMIGRATION_LOG_S", new BO().setAll(logMaps), userContext);
|
SDK.getBOAPI().createDataBO("BO_ACT_DATAMIGRATION_LOG_S", new BO().setAll(logMaps), userContext);
|
||||||
System.err.println("=======logMaps======="+logMaps);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
<div class="edit" >
|
<div class="edit" >
|
||||||
<div id="edithtml"></div>
|
<div id="edithtml"></div>
|
||||||
|
|
||||||
<div class="poster-btn" >展开更多</div>
|
<div class="poster-btn" >收起</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="up" >
|
<div class="up" >
|
||||||
@ -41,17 +41,21 @@
|
|||||||
value="<#sid>">
|
value="<#sid>">
|
||||||
<script>
|
<script>
|
||||||
$(function (){
|
$(function (){
|
||||||
|
debugger
|
||||||
// alert($("#ProcessTile").val());
|
// alert($("#ProcessTile").val());
|
||||||
// alert(JSON.parse($("#jsonlist").val()));
|
// alert(JSON.parse($("#jsonlist").val()));
|
||||||
|
|
||||||
var code = $("#subString").val();
|
var code = $("#subString").val();
|
||||||
$('#edithtml').html(code)
|
$('#edithtml').html(code)
|
||||||
if(code.length ==0){
|
if(code.length ==0){
|
||||||
$('#edithtml').css('height',0)
|
//$('#edithtml').css('height',0)
|
||||||
|
$('#edithtml').css('height','8rem')
|
||||||
}else{
|
}else{
|
||||||
$('#edithtml').css('height','8rem')
|
$('#edithtml').css('height','auto')
|
||||||
|
|
||||||
}
|
}
|
||||||
$(".poster-btn").click(function(){
|
$(".poster-btn").click(function(){
|
||||||
|
|
||||||
if ($(this).text() == "展开更多") {
|
if ($(this).text() == "展开更多") {
|
||||||
$(this).text("收起");
|
$(this).text("收起");
|
||||||
$("#edithtml").css("height","auto");
|
$("#edithtml").css("height","auto");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user