Merge branch 'apps_dev' of https://e.coding.net/yilidev/yilipalkaifa/apps into apps_dev

This commit is contained in:
446052889@qq.com 2022-09-15 12:31:32 +08:00
commit 6e90ec158f
9 changed files with 128 additions and 17 deletions

View File

@ -74,6 +74,35 @@ public class DataMigrationController {
ResponseObject ro = ResponseObject.newOkResponse();
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 表单属性文件上传 解析文件

View File

@ -1,5 +1,30 @@
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.WordField;
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.util.CoeDesignerUtil;
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.bpms.bo.engine.BO;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.fs.DCContext;
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
@ -20,13 +50,8 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aspose.words.Document;
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 java.util.*;
import lombok.extern.slf4j.Slf4j;
/**
* @author baizp
@ -67,7 +92,61 @@ public class ReadTable {
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) {
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);

View File

@ -335,7 +335,6 @@ public class ReadWordUtil {
* RowMap map = DBSql.getMap(sql); if(map!=null) { String sqls = ""; }else { }
*/
SDK.getBOAPI().createDataBO("BO_ACT_DATAMIGRATION_LOG_S", new BO().setAll(logMaps), userContext);
System.err.println("=======logMaps======="+logMaps);
}
}

View File

@ -22,8 +22,8 @@
const production = true;
const devUserInfo = {};
</script>
<script type="module" crossorigin src="../apps/com.actionsoft.apps.coe.pal.datamigration/main/js/entry-index-aef0a9e8.js"></script>
<link rel="stylesheet" href="../apps/com.actionsoft.apps.coe.pal.datamigration/main/assets/asset-style-78f11733.css">
<script type="module" crossorigin src="../apps/com.actionsoft.apps.coe.pal.datamigration/main/js/entry-index-a5439d0f.js"></script>
<link rel="stylesheet" href="../apps/com.actionsoft.apps.coe.pal.datamigration/main/assets/asset-style-de410bb8.css">
</head>
<body style="margin:0;">
<div id="app"></div>

View File

@ -24,7 +24,7 @@
<div class="edit" >
<div id="edithtml"></div>
<div class="poster-btn" >展开更多</div>
<div class="poster-btn" >收起</div>
</div>
</div>
<div class="up" >
@ -41,17 +41,21 @@
value="<#sid>">
<script>
$(function (){
debugger
// alert($("#ProcessTile").val());
// alert(JSON.parse($("#jsonlist").val()));
var code = $("#subString").val();
$('#edithtml').html(code)
if(code.length ==0){
$('#edithtml').css('height',0)
//$('#edithtml').css('height',0)
$('#edithtml').css('height','8rem')
}else{
$('#edithtml').css('height','8rem')
$('#edithtml').css('height','auto')
}
$(".poster-btn").click(function(){
if ($(this).text() == "展开更多") {
$(this).text("收起");
$("#edithtml").css("height","auto");