PAL资产库批量更新文件

This commit is contained in:
Mr-wang 2023-08-30 12:31:14 +08:00
parent 5cfdf752fe
commit ae5c140b95
32 changed files with 858 additions and 18930 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -93,7 +93,6 @@ public class ijob implements IJob {
System.out.println("titile==============" + pc.getTitle());
System.out.println("sendList==============" + sendList.toString());
System.out.println("sendList.size()==============" + sendList.size());
List<String> finalLists = new ArrayList<>();
ProcessInstance boProcessInstance = SDK.getProcessAPI()
.createBOProcessInstance("obj_c14a0187c4d0463baa22752711f65947", "admin", "OA补充发送手动清单");
@ -138,7 +137,16 @@ public class ijob implements IJob {
continue;
}
}*/
list.add("10056870");
// list.add("10056870");
/* List<RowMap> maps = DBSql.getMaps("SELECT distinct user_id FROM BO_ACT_DATAID where PROCESSID = '" + cc + "' ");*/
for (String uid:
sendList) {
BO bo_eu_require_data = SDK.getBOAPI().query("BO_EU_REQUIRE_DATA", true).addQuery("PROCESS_ID = ", cc).addQuery("USER_ID = ", uid).detail();
if (bo_eu_require_data==null){
list.add(uid);
}
}
System.out.println("新list>>>>>>"+list.size());
System.out.println("剩余需要发送的人员清单>>>>>>>>>>>"+list.toString());

View File

@ -2213,7 +2213,7 @@ y7fdOgAAAABJRU5ErkJggk==
</w:rPr>
<w:t>${position}</w:t>
</w:r>
<w:r>
<!--<w:r>
<w:rPr>
<w:rFonts w:ascii="宋体" w:h-ansi="宋体" w:cs="黑体" w:hint="fareast"/>
<wx:font wx:val="宋体"/>
@ -2223,7 +2223,7 @@ y7fdOgAAAABJRU5ErkJggk==
<w:sz-cs w:val="22"/>
</w:rPr>
<w:t>岗位流程职责说明书</w:t>
</w:r>
</w:r>-->
</w:p>
</w:tc>
</w:tr>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -34,9 +34,6 @@ import com.actionsoft.sdk.local.api.Logger;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.yili.publishevent.util.DownloadUtil;
import com.awspaas.yili.publishevent.util.HttpUtil;
import com.awspaas.yili.publishevent.util.UtilUrl;
import com.google.common.io.ByteStreams;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;

View File

@ -3687,14 +3687,14 @@ public class CoEPALController {
DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me);
return web.getModelingGuideCarousel(step, modelType);
}
/**
/*
*//**
* 检查用户是否第一次创建模型
*
* @param me me
* @param methodId 模型类型
* @return {@link String}
*/
*//*
@Mapping("com.actionsoft.apps.coe.pal_guide_check_create")
public String checkUserFirstCreateModel(UserContext me, String methodId, String type) {
DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me);
@ -3702,7 +3702,7 @@ public class CoEPALController {
}
/**
*//**
* 批量创建流程手册
*
* @param me
@ -3710,12 +3710,12 @@ public class CoEPALController {
* @param teamId
* @param wsId
* @return
*/
*//*
@Mapping("com.actionsoft.apps.coe.pal.publisher_output_pr_reports_create")
public String createOutputPrReports(UserContext me, String uuids, String teamId, String wsId) {
DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me);
return web.createOutputPrReports(wsId, teamId, uuids);
}
}*/
/**

View File

@ -18,7 +18,7 @@
$.each(filePaths, function(index, val) {
if(val.video == undefined ){
$(".focus").append("<li><div><h3 id='picTitle' >"+val.picTitle+"</h3></div>" +
"<div style='top:5px;position: relative'><a href='#'><img src='"+val.picture+"' alt=''></a><div></li>");
"<div style='top:5px;position: relative'><a href='#'><img src='"+val.picture+"' alt='' onclick='previewImg('+val.picture+')'></a><div></li>");
}else{
$(".focus").append("<li><div><h3 id='picTitle' >"+val.picTitle+"</h3></div>" +
"<div style='top:5px;position: relative'><video width='500' height='280' controls><source src="+val.video+" type='video/mp4'>您的浏览器不支持 video 标签。</video></div></li>");
@ -181,6 +181,10 @@
}, 15);
}
function previewImg (imgsrc) {
window.location.href = imgsrc;
}
//});
</script>
<style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -1,116 +0,0 @@
package com.awspaas.user.apps.app.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONObject;
/**
* 修改文件状态
* @author lihongyu
*
*/
@Controller
public class UpateFileStateController {
private static Logger logger = LoggerFactory.getLogger(UpateFileStateController.class);
// 修改文件发布状态
@Mapping("com.awspaas.user.apps.app.controller.updatePalFileState")
public ResponseObject checkIsSend(String sid, String plId, String state, String type) {
System.err.println("修改文件状态========>"+plId+"/"+state+"/"+type);
ResponseObject ro = ResponseObject.newOkResponse();
int count = 0;
if ("1".equals(type)) {
String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISPUBLISH = '" + state + "' WHERE ID = '"
+ plId + "'";
count += DBSql.update(updataSql);
String id = DBSql.getString("SELECT ID FROM APP_ACT_COE_PAL_PUBLISH_LIST WHERE PALREPOSITORYID='" + plId + "'");
if (UtilString.isNotEmpty(id)) {
String sqlt = "UPDATE BO_EU_PAL_FILE1 SET FILESTATE = '" + state + "' WHERE FILEID = '" + plId + "'";
DBSql.update(sqlt);
PALRepositoryModel model = PALRepositoryCache.getCache().get(plId);
if("control.policy".equals(model.getMethodId())||"process.flowchart".equals(model.getMethodId())||"data.form".equals(model.getMethodId())||"process.epc".equals(model.getMethodId())) {
String taskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin", "", plId);
//刷新预览加载的表
String sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + taskId + "' WHERE PLID = '" + plId + "'";
DBSql.update(sqlr);
System.err.println("重新生成手册:" + model.getName() + "--->taskId" + taskId);
DBSql.update(
"UPDATE BO_ACT_COE_PUBLISH_N SET TASKID='" + taskId + "'WHERE PUBLISHFILEID ='" + plId + "'");
count += DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId
+ "'WHERE PALREPOSITORYID='" + plId + "'");
}
} else {
//SDK.getPALPublishAPI().publishPALRepository(publishInfo, publishList)
}
} else if("2".equals(type)) {
//修改流程文件的审批状态
String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISAPPROVAL = '" + state + "' WHERE ID = '" + plId
+ "'";
System.err.println("审批改为设计=======>"+updataSql);
count += DBSql.update(updataSql);
}
if (count > 0) {
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存开始===========>");
PALRepositoryCache.getCache().reload();
/*
* TeamPermCache.getCache().reload(); TeamMemberPermCache.getCache().reload();
* PublishHistoryCache.getCache().reload();
* PublishUserGroupCache.getCache().reload();
* PublishUserGroupPermCache.getCache().reload();
* PublishUserGroupRoleCache.getCache().reload();
* PALDesignerFileCache.getCache().reload();
* PALDesignerFileDragModelCache.getCache().reload();
* PALRepositoryRemoveCache.getCache().reload();
* CoeDesignerShapeCache.getCache().reload();
* DesignerShapeRelationCache.getCache().reload();
* PALRepositoryPropertyCache.getCache().reload();
* PALRepositoryAttributeCache.getCache().reload();
* PALRepositoryShapeConfigCache.getCache().reload();
* PALRepositoryShapeAttributeCache.getCache().reload();
* CoeProcessLevelCorrelateCache.getCache().reload();
* CoeDesignerImageCache.getCache().reload();
*/
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
ro.put("result", "ok");
} else {
ro.put("result", "error");
}
return ro;
}
private String createOutputReport(PALRepositoryModel model, String wsId, String userId, String teamId, String uuid) {
String taskId = "";
if (model.getMethodId().contains("process.")) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
taskId = object.getJSONObject("data").getString("taskId");
}
} else if ("data.form".equals(model.getMethodId())) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
taskId = object.getJSONObject("data").getString("taskId");
}
} else if ("control.policy".equals(model.getMethodId())) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
taskId = object.getJSONObject("data").getString("taskId");
}
}
return taskId;
}
}

View File

@ -0,0 +1,9 @@
package com.awspaas.user.apps.app.controller;
public class test {
public static void main(String[] args) {
String name = "11.7 流程管理";
String name1 = name.substring(name.lastIndexOf(".") + 2).trim();
System.out.println("name>>>>>>>"+name1);
}
}

View File

@ -174,7 +174,7 @@ public class ReportPrController {
* @param wsid
* @return
*/
@Mapping("com.awspaas.user.apps.coe.pal.output.zd_systemManualTextExport")
/*@Mapping("com.awspaas.user.apps.coe.pal.output.zd_systemManualTextExport")
public String systemManualTextExport(UserContext me) {
ResponseObject ro = null;
ro = ResponseObject.newOkResponse();
@ -185,14 +185,14 @@ public class ReportPrController {
return ro.toString();
}
/**
*//**
* 制度手册正文导出
*
* @param me
* @param teamId
* @param wsid
* @return
*/
*//*
@Mapping("com.awspaas.user.apps.coe.pal.output.zd_systemManualTextExportoOnce")
public String systemManualTextExportoOnce(UserContext me, String targetFileId) {
ResponseObject ro = null;
@ -201,7 +201,7 @@ public class ReportPrController {
String result = institutionalTextWeb.systemManualTextExportoOnce(targetFileId);
ro.put("result", result);
return ro.toString();
}
}*/
/**

View File

@ -38,6 +38,7 @@ public class SynFileStateJob implements IJob {
Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(id);
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
// 发布部门
String dempId = "";
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
if (null != Issuing_department && !Issuing_department.equals("")) {
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
@ -45,9 +46,10 @@ public class SynFileStateJob implements IJob {
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
for (Object PUBDEPTO : PUBDEPTJA) {
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
String dempId = PUBDEPTJO.getString("id");
count2 += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = '"+dempId+"' WHERE ID = '"+id+"'");
dempId += PUBDEPTJO.getString("id")+",";
}
dempId = dempId.substring(0,dempId.length()-1);
count2 += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('"+dempId+"') WHERE ID = '"+id+"'");
}
}

View File

@ -1662,19 +1662,31 @@ public class DataViewService extends ActionWeb {
}
try {
List<RowMap> maps = null;
if (json.size() < 450) {
String sqltt = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND EXT5 = '1' AND EXT6 IN ("
+sqlParm+ ") AND PLMETHODID in ('process.epc','control.policy','process.flowchart')";
SDK.getLogAPI().consoleInfo("sql11111111111111>>>>>>>>>>>>>>"+sqltt);
maps = DBSql.getMaps(sqltt);
} else {
String sqltt = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND EXT6 IS NOT NULL AND PLMETHODID in ('process.epc','control.policy','process.flowchart')";
String sqltt = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE,EXT6 FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND EXT6 IS NOT NULL AND PLMETHODID in ('process.epc','control.policy','process.flowchart')";
SDK.getLogAPI().consoleInfo("sql>>>>>>>>>>>>>>"+sqltt);
maps = DBSql.getMaps(sqltt);
List<RowMap> maps = DBSql.getMaps(sqltt);
SDK.getLogAPI().consoleInfo("maps是多少个>>>>>>>>>>>>"+maps.size());
List<RowMap> last_maps = new LinkedList<>();
for (RowMap map:
maps) {
String ext6 = map.getString("EXT6");
if (ext6.contains(",")){
String[] split = ext6.split(",");
for (String departId:
split) {
if (deptString.contains(departId)){
last_maps.add(map);
break;
}
}
}else {
if (deptString.contains(ext6)){
last_maps.add(map);
continue;
}
}
}
SDK.getLogAPI().consoleInfo("");
for (RowMap rowMap : maps) {
for (RowMap rowMap : last_maps) {
String id = rowMap.getString("FILEID");
PALRepositoryModel model = PALRepositoryCache.getCache().get(id);
if (model != null) {
@ -1707,6 +1719,7 @@ public class DataViewService extends ActionWeb {
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
fileRowMaps = fileHandleRowMaps;

View File

@ -22,6 +22,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.apps.yili.reportform.util.TreeUtil;
import org.springframework.util.StringUtils;
import java.sql.Connection;
import java.util.*;
@ -193,6 +194,7 @@ public class ToPageService extends ActionWeb {
ro.put("departId",list.toString());
String sb = getAppendOrAndInString(list);
String like2 = getAppendOrAndInStringLike(list);
ro.put("sb",sb);
ro.put("frameIDtoFrameView",frameIDtoFrameView);
System.out.println("======frameIDtoFrameView======" + frameIDtoFrameView);
@ -225,10 +227,10 @@ public class ToPageService extends ActionWeb {
List<RowMap> fileRowMaps =null;
//List<RowMap> fileRowMaps = DBSql.getMaps("SELECT FILEID,PLPARENTID,PLNAME,PLMETHODID,SUPPORTFILE,PUBDEPT,PUBDATETIME,PLORDERINDEX,PLLEVEL,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE PLPARENTID=? AND FILESTATE='1' AND (PLMETHODID='process.epc' OR PLMETHODID='process.flowchart' OR PLMETHODID='control.policy') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams);
if (sb.contains("'")){
fileRowMaps = DBSql.getMaps("SELECT ID AS FILEID,PLPARENTID,PLNAME,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID=? AND ISPUBLISH = 1 OR "+sb+" OR EXT6 LIKE '"+sb
+"' AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams);
fileRowMaps = DBSql.getMaps("SELECT ID AS FILEID,PLPARENTID,PLNAME,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE,EXT6 FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID=? AND ISPUBLISH = 1 "+
"AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams);
} else {
fileRowMaps = DBSql.getMaps("SELECT ID AS FILEID,PLPARENTID,PLNAME,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID=? AND ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams);
fileRowMaps = DBSql.getMaps("SELECT ID AS FILEID,PLPARENTID,PLNAME,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE,EXT6 FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID=? AND ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams);
}
System.out.println("fileRowMaps>>>>>>>>>>"+fileRowMaps);
ArrayList<RowMap> fileHandleRowMaps = new ArrayList<>();
@ -237,6 +239,23 @@ public class ToPageService extends ActionWeb {
if (null != fileRowMaps && !fileRowMaps.isEmpty()) {
fileHandleRowMaps = new ArrayList<>();
for (RowMap fileRowMap : fileRowMaps) {
String file_depart = fileRowMap.getString("EXT6");
file_depart = file_depart.substring(0,file_depart.length()-1);
if (file_depart.contains(",")){
String[] split = file_depart.split(",");
for (String depart:
split) {
if (UtilString.isNotEmpty(depart) ){
if (!list.contains(depart)){
continue;
}
}
}
}else {
if (!StringUtils.isEmpty(file_depart) &&!list.contains(file_depart)){
continue;
}
}
String FILEID = fileRowMap.getString("FILEID");
Integer PLLEVEL = fileRowMap.getInt("PLLEVEL");
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
@ -427,4 +446,36 @@ public class ToPageService extends ActionWeb {
return returnString;
}
private static String getAppendOrAndInStringLike(List<String> list){
StringBuffer sb=new StringBuffer();
String returnString="";
for(int i=0;i<list.size();i++){
if(i==0){
sb.append(" INSTR (',' || "+list.get(0)+", ");
sb.append(" '");
}
sb.append(list.get(i).toString());
if(i>=28&&i<list.size()-1){
if(i%28==0){
sb.append("|| ',', ',' || EXT6 || ',') >0 or ");
sb.append("INSTR (',' || value1,value2 || ',', ',' || EXT6 || ','");
sb.append(" '");
}else{
sb.append(",");
}
}else{
if(i<list.size()-1){
sb.append(",");
}
}
if(i==list.size()-1){
sb.substring(0,sb.length()-1);
sb.append("'");
}
}
sb.append("')>0");
returnString=sb.toString();
return returnString;
}
}

View File

@ -23,20 +23,19 @@ import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.bpa.util.HSSFUtils;
import com.awspaas.user.bpa.util.Utils;
import org.apache.poi.hslf.usermodel.*;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.sl.draw.binding.CTGeomGuideList;
import org.apache.poi.sl.usermodel.TableCell;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xslf.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xssf.usermodel.*;
import org.docx4j.dml.CTTableCell;
import org.openxmlformats.schemas.presentationml.x2006.main.CTPresentationProperties;
import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMaster;
import org.springframework.util.StringUtils;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.io.*;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
@ -50,10 +49,14 @@ public class UpdatePptxAndExcelAslp implements ASLP {
@Override
@Meta(parameter = { "name: 'sid', required: true, desc: 'sid'",
"name: 'pl_uuid', required: true, desc: '文件id'",
"name: 'fil_path', required: true, desc: '文件保存地址'",
"name: 'file_url', required: true, desc: '文件路径(不包含文件名称)'",
"name: 'shape_uuid', required: true, desc: '文件内容id'",
"name: 'file_data', required: true, desc: '文件名称'" })
public ResponseObject call(Map<String, Object> params) {
ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
String pl_uuid1 = SDK.getAppAPI().getProperty("com.awspaas.user.apps.new_performance_indicator_library", "pl_uuid");
String shape_uuid1 = SDK.getAppAPI().getProperty("com.awspaas.user.apps.new_performance_indicator_library", "shape_uuid");
String sid = (String) params.get("sid");
if (!SDK.getPortalAPI().checkSession(sid)) {
ro = ResponseObject.newErrResponse("sid无效");
@ -61,14 +64,14 @@ public class UpdatePptxAndExcelAslp implements ASLP {
}
String pl_uuid = params.get("pl_uuid").toString();
String shape_uuid = params.get("shape_uuid").toString();
if (params.get("shape_uuid").toString().contains("obj_")){
if (params.get("shape_uuid").toString().contains("obj_")) {
String name = null;
try {
name = URLDecoder.decode(params.get("file_data").toString(), StandardCharsets.UTF_8.toString());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
System.out.println("filename>>>>>>>>>>>"+name);
System.out.println("filename>>>>>>>>>>>" + name);
UpfileModel model = new UpfileModel();
model.setUuid(UUIDGener.getUUID());
model.setPl_uuid(pl_uuid);
@ -79,21 +82,21 @@ public class UpdatePptxAndExcelAslp implements ASLP {
model.setType("s");
// model.setFileType(fileType);
model.setFileName(name);
DCContext dcContext = getDCContext(model,UserContext.fromSessionId(sid));
if (name.endsWith(".xlsx")||name.endsWith(".xls")){
DCContext dcContext = getDCContext(model, UserContext.fromSessionId(sid));
if (name.endsWith(".xlsx") || name.endsWith(".xls")) {
try {
//d1d4b52a-d6e2-4a6f-acac-37e07d2ae6e5
UpfileModel model_old = new UpfileModel();
model_old.setUuid(UUIDGener.getUUID());
model_old.setPl_uuid("f9df56d7-a6b2-442c-9898-822619057493");
model_old.setShape_uuid("obj_7ebfdb24f36e469cb841988cbda035c8");
model_old.setPl_uuid(pl_uuid1);
model_old.setShape_uuid(shape_uuid1);
model_old.setDownload(1);
model_old.setCreateUser(UserContext.fromSessionId(sid).getUID());
model_old.setCreateTime(new Timestamp(System.currentTimeMillis()));
model_old.setType("s");
model_old.setFileName("制度文件模版"+name.substring(name.lastIndexOf(".")));
DCContext dcContext_old = getDCContext(model_old,UserContext.fromSessionId(sid));
model_old.setFileName("制度文件模版" + name.substring(name.lastIndexOf(".")));
DCContext dcContext_old = getDCContext(model_old, UserContext.fromSessionId(sid));
// 读取模版文件的Excel文件
String[] filePaths = {dcContext.getFilePath(),
dcContext_old.getFilePath()};
@ -107,17 +110,17 @@ public class UpdatePptxAndExcelAslp implements ASLP {
String path = dcContext.getPath();
String fileName = name;
if (name.contains(".xlsx")){
Utils.mergeExcel(list, path, fileName);
FileInputStream file = new FileInputStream(new File(dcContext.getFilePath()));
if (name.contains(".xlsx")) {
Utils.mergeExcel(list, params.get("file_url").toString(), fileName);
FileInputStream file = new FileInputStream(new File(params.get("fil_path").toString()));
XSSFWorkbook workbook = new XSSFWorkbook(file);
// FileInputStream file2 = new FileInputStream(new File(dcContext.getFilePath()));
// XSSFWorkbook workbook2 = new XSSFWorkbook(file2);
// 创建两个新的Sheet页
// Sheet sheet1 = workbook.createSheet("封面");
// Sheet sheet2 = workbook.createSheet("修订记录");
workbook.setSheetOrder("封面",0);
workbook.setSheetOrder("修订记录",1);
workbook.setSheetOrder("封面", 0);
workbook.setSheetOrder("修订记录", 1);
// 向新Sheet页中填充数据
// fillData(sheet1);
// fillData(sheet2);
@ -128,7 +131,6 @@ public class UpdatePptxAndExcelAslp implements ASLP {
// workbook.close();
try {
// 获取指定的 sheet
@ -139,27 +141,27 @@ public class UpdatePptxAndExcelAslp implements ASLP {
//
//
String file_number = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID IN ('file_number','form_number')");
if (StringUtils.isEmpty(file_number)){
if (StringUtils.isEmpty(file_number)) {
replaceParameter(sheet, "{{file_code}}", "");
}else {
} else {
replaceParameter(sheet, "{{file_code}}", file_number);
}
//这个是替换生效日期
String file_date = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID IN('effective_date','form_effective_date') ");
if (UtilString.isNotEmpty(file_date)){
if (UtilString.isNotEmpty(file_date)) {
replaceParameter(sheet, "{{file_date}}", file_date);
}else {
} else {
replaceParameter(sheet, "{{file_date}}", "");
}
//这个是替换适用范围
//
String fanwei = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID in( 'application','form_Scope_application')");
if (UtilString.isNotEmpty(fanwei)){
if (UtilString.isNotEmpty(fanwei)) {
replaceParameter(sheet, "{{fanwei}}", fanwei);
}else {
} else {
replaceParameter(sheet, "{{fanwei}}", "");
}
//这个是替换L1-L4
@ -189,7 +191,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
int dataStartRow = 3; // 假设数据从第四行开始
// 定义要替换的参数数组
String[] parameters = {"{{number}}", "{{version}}", "{{company}}","{{creauser}}","{{date}}","{{shen_user}}","{{fuhe_user}}","{{shenpi_user}}","{{person}}"};
String[] parameters = {"{{number}}", "{{version}}", "{{company}}", "{{creauser}}", "{{date}}", "{{shen_user}}", "{{fuhe_user}}", "{{shenpi_user}}", "{{person}}"};
/*// 定义要插入的数据数组
String[][] data = {
@ -199,10 +201,10 @@ public class UpdatePptxAndExcelAslp implements ASLP {
};
*/
PALRepositoryModel palRepositoryModel = PALRepositoryCache.getCache().get(pl_uuid);
PALRepositoryModel palRepositoryModel = PALRepositoryCache.getCache().get(pl_uuid);
JSONArray versionHistoryTable = getVersionHistoryTable(palRepositoryModel);
String[][] strArray2 = new String[versionHistoryTable.size()][];
System.out.println("jsonArray>>>>>>>>>>"+versionHistoryTable.toString());
System.out.println("jsonArray>>>>>>>>>>" + versionHistoryTable.toString());
/**
* [{"approver":"任国梁","Drafted_and_revised_date":"2023年5月08日"
@ -213,7 +215,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
for (int i = 0; i < versionHistoryTable.size(); i++) {
JSONObject obj2 = versionHistoryTable.getJSONObject(i);
String[] strArray = new String[9];
strArray[0] = String.valueOf(i+1);
strArray[0] = String.valueOf(i + 1);
strArray[1] = obj2.getString("P_versions");
strArray[2] = obj2.getString("Issuing_department");
strArray[3] = obj2.getString("Drafted_and_revised_by");
@ -221,7 +223,19 @@ public class UpdatePptxAndExcelAslp implements ASLP {
strArray[5] = obj2.getString("auditor");
strArray[6] = obj2.getString("reviewer");
strArray[7] = obj2.getString("approver");
strArray[8] = obj2.getString("Contents_and_reasons_for_revision");
String str2 = "";
for (int ia = 0; ia < obj2.getString("Contents_and_reasons_for_revision").length(); ia += 19) {
if (ia + 19 < obj2.getString("Contents_and_reasons_for_revision").length()) {
str2 += obj2.getString("Contents_and_reasons_for_revision").substring(ia, ia + 19) + "\n";
} else {
str2 += obj2.getString("Contents_and_reasons_for_revision").substring(ia) + "\n";
}
}
SDK.getLogAPI().consoleInfo("str2>>>>>>>>>>>>>>" + str2);
strArray[8] = str2;
lists.add(strArray);
strArray2[i] = strArray;
}
@ -237,32 +251,32 @@ public class UpdatePptxAndExcelAslp implements ASLP {
// 循环插入数据
for (int i = 0; i < datas.length; i++) {
insertData(sheet_xd, datas[i], dataStartRow + i);
insertData(workbook, sheet_xd, datas[i], dataStartRow + i);
}
// 保存修改后的 Excel 文件
FileOutputStream outputStream = new FileOutputStream(dcContext.getFilePath());
FileOutputStream outputStream = new FileOutputStream(params.get("fil_path").toString());
workbook.write(outputStream);
workbook.close();
outputStream.close();
System.out.println("封面参数替换完成!");
}catch (Exception e){
} catch (Exception e) {
}
}else {
HSSFUtils.mergeExcel(list, path, fileName);
FileInputStream file = new FileInputStream(new File(dcContext.getFilePath()));
} else {
HSSFUtils.mergeExcel(list, params.get("file_url").toString(), fileName);
FileInputStream file = new FileInputStream(new File(params.get("fil_path").toString()));
HSSFWorkbook workbook = new HSSFWorkbook(file);
// FileInputStream file2 = new FileInputStream(new File(dcContext.getFilePath()));
// XSSFWorkbook workbook2 = new XSSFWorkbook(file2);
// 创建两个新的Sheet页
// Sheet sheet1 = workbook.createSheet("封面");
// Sheet sheet2 = workbook.createSheet("修订记录");
workbook.setSheetOrder("封面",0);
workbook.setSheetOrder("修订记录",1);
workbook.setSheetOrder("封面", 0);
workbook.setSheetOrder("修订记录", 1);
// 向新Sheet页中填充数据
// fillData(sheet1);
// fillData(sheet2);
@ -273,7 +287,6 @@ public class UpdatePptxAndExcelAslp implements ASLP {
// workbook.close();
try {
// 获取指定的 sheet
@ -282,26 +295,26 @@ public class UpdatePptxAndExcelAslp implements ASLP {
// 查找并替换参数
//这个是替换文件编码
String file_number = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID IN('form_number','file_number')");
if (StringUtils.isEmpty(file_number)){
if (StringUtils.isEmpty(file_number)) {
replaceParameter(sheet, "{{file_code}}", "");
}else {
} else {
replaceParameter(sheet, "{{file_code}}", file_number);
}
//这个是替换生效日期
String file_date = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID IN('effective_date','form_effective_date')");
if (UtilString.isNotEmpty(file_date)){
if (UtilString.isNotEmpty(file_date)) {
replaceParameter(sheet, "{{file_date}}", file_date);
}else {
} else {
replaceParameter(sheet, "{{file_date}}", "");
}
//这个是替换适用范围
String fanwei = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID in( 'application','form_Scope_application')");
if (UtilString.isNotEmpty(fanwei)){
if (UtilString.isNotEmpty(fanwei)) {
replaceParameter(sheet, "{{fanwei}}", fanwei);
}else {
} else {
replaceParameter(sheet, "{{fanwei}}", "");
}
//这个是替换L1-L4
@ -331,7 +344,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
int dataStartRow = 3; // 假设数据从第四行开始
// 定义要替换的参数数组
String[] parameters = {"{{number}}", "{{version}}", "{{company}}","{{creauser}}","{{date}}","{{shen_user}}","{{fuhe_user}}","{{shenpi_user}}","{{person}}"};
String[] parameters = {"{{number}}", "{{version}}", "{{company}}", "{{creauser}}", "{{date}}", "{{shen_user}}", "{{fuhe_user}}", "{{shenpi_user}}", "{{person}}"};
/*// 定义要插入的数据数组
String[][] data = {
@ -341,10 +354,10 @@ public class UpdatePptxAndExcelAslp implements ASLP {
};
*/
PALRepositoryModel palRepositoryModel = PALRepositoryCache.getCache().get(pl_uuid);
PALRepositoryModel palRepositoryModel = PALRepositoryCache.getCache().get(pl_uuid);
JSONArray versionHistoryTable = getVersionHistoryTable(palRepositoryModel);
String[][] strArray2 = new String[versionHistoryTable.size()][];
System.out.println("jsonArray>>>>>>>>>>"+versionHistoryTable.toString());
System.out.println("jsonArray>>>>>>>>>>" + versionHistoryTable.toString());
/**
* [{"approver":"任国梁","Drafted_and_revised_date":"2023年5月08日"
@ -355,7 +368,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
for (int i = 0; i < versionHistoryTable.size(); i++) {
JSONObject obj2 = versionHistoryTable.getJSONObject(i);
String[] strArray = new String[9];
strArray[0] = String.valueOf(i+1);
strArray[0] = String.valueOf(i + 1);
strArray[1] = obj2.getString("P_versions");
strArray[2] = obj2.getString("Issuing_department");
strArray[3] = obj2.getString("Drafted_and_revised_by");
@ -363,7 +376,18 @@ public class UpdatePptxAndExcelAslp implements ASLP {
strArray[5] = obj2.getString("auditor");
strArray[6] = obj2.getString("reviewer");
strArray[7] = obj2.getString("approver");
strArray[8] = obj2.getString("Contents_and_reasons_for_revision");
String str2 = "";
for (int ia = 0; ia < obj2.getString("Contents_and_reasons_for_revision").length(); ia += 19) {
if (ia + 19 < obj2.getString("Contents_and_reasons_for_revision").length()) {
str2 += obj2.getString("Contents_and_reasons_for_revision").substring(ia, ia + 19) + "\n";
} else {
str2 += obj2.getString("Contents_and_reasons_for_revision").substring(ia) + "\n";
}
}
SDK.getLogAPI().consoleInfo("str2>>>>>>>>>>>>>>" + str2);
strArray[8] = str2;
lists.add(strArray);
strArray2[i] = strArray;
}
@ -379,25 +403,24 @@ public class UpdatePptxAndExcelAslp implements ASLP {
// 循环插入数据
for (int i = 0; i < datas.length; i++) {
insertData(sheet_xd, datas[i], dataStartRow + i);
insertData(workbook, sheet_xd, datas[i], dataStartRow + i);
}
// 保存修改后的 Excel 文件
FileOutputStream outputStream = new FileOutputStream(dcContext.getFilePath());
FileOutputStream outputStream = new FileOutputStream(params.get("fil_path").toString());
workbook.write(outputStream);
workbook.close();
outputStream.close();
System.out.println("封面参数替换完成!");
}catch (Exception e){
} catch (Exception e) {
}
}
//Utils.mergeExcel(list,path+fileName);
//Open the first excel file.
@ -407,24 +430,24 @@ public class UpdatePptxAndExcelAslp implements ASLP {
System.out.println("Excel文件修改成功");
} catch ( Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}else if (name.endsWith(".pptx")||name.endsWith(".ppt")){
} else if (name.endsWith(".pptx") || name.endsWith(".ppt")) {
UpfileModel model_old = new UpfileModel();
model_old.setUuid(UUIDGener.getUUID());
model_old.setPl_uuid("f9df56d7-a6b2-442c-9898-822619057493");
model_old.setShape_uuid("obj_7ebfdb24f36e469cb841988cbda035c8");
model_old.setPl_uuid(pl_uuid1);
model_old.setShape_uuid(shape_uuid1);
model_old.setDownload(1);
model_old.setCreateUser(UserContext.fromSessionId(sid).getUID());
model_old.setCreateTime(new Timestamp(System.currentTimeMillis()));
model_old.setType("s");
model_old.setFileName("ppt版本模板"+name.substring(name.lastIndexOf(".")));
DCContext dcContext_old = getDCContext(model_old,UserContext.fromSessionId(sid));
String[] fileNames ={dcContext.getFilePath(),dcContext_old.getFilePath()} ;
String mergedFileName = dcContext.getPath()+"dc.pptx";
model_old.setFileName("ppt版本模板" + name.substring(name.lastIndexOf(".")));
DCContext dcContext_old = getDCContext(model_old, UserContext.fromSessionId(sid));
String[] fileNames = {dcContext.getFilePath(), dcContext_old.getFilePath()};
String mergedFileName = dcContext.getPath() + "dc.pptx";
if (name.endsWith(".pptx")||name.endsWith(".ppt")){
if (name.endsWith(".pptx") || name.endsWith(".ppt")) {
try (FileOutputStream outputStream = new FileOutputStream(mergedFileName)) {
XMLSlideShow mergedSlideShow = new XMLSlideShow();
@ -446,16 +469,35 @@ public class UpdatePptxAndExcelAslp implements ASLP {
SDK.getLogAPI().consoleInfo("开始执行了吗");
// 获取幻灯片列表
List<XSLFSlide> slides = slideShows.getSlides();
SDK.getLogAPI().consoleInfo("幻灯片的大小是多少>>>>>>>"+slides.size());
SDK.getLogAPI().consoleInfo("幻灯片的大小是多少>>>>>>>" + slides.size());
//移动倒数第二个至第一张幻灯
XSLFSlide secondslide = slides.get(slides.size()-2);
XSLFSlide secondslide = slides.get(slides.size() - 2);
slideShows.setSlideOrder(secondslide, 0);
PALRepositoryModel palRepositoryModel = PALRepositoryCache.getCache().get(pl_uuid);
JSONArray versionHistoryTable = getVersionHistoryTable(palRepositoryModel);
System.out.println("jsonArray>>>>>>>>>>"+versionHistoryTable.toString());
String process_name = DBSql.getString("select PLNAME from app_act_coe_pal_repository where ID = '" + pl_uuid + "'");
for (XSLFSlide slide : slides) {
for (XSLFShape shape : slide.getShapes()) {
if (shape instanceof XSLFTextShape) {
XSLFTextShape textShape = (XSLFTextShape) shape;
for (XSLFTextParagraph paragraph : textShape.getTextParagraphs()) {
for (XSLFTextRun textRun : paragraph.getTextRuns()) {
String text = textRun.getRawText();
// 根据需要替换参数
text = text.replace("{{process_name}}", process_name);
textRun.setText(text);
}
}
}
}
}
XSLFSlide secondslide_last = slides.get(slides.size() - 1);
slideShows.setSlideOrder(secondslide_last, 1);
List<XSLFSlide> newSlides = new ArrayList<>();
PALRepositoryModel palRepositoryModel = PALRepositoryCache.getCache().get(pl_uuid);
JSONArray versionHistoryTable = getVersionHistoryTable(palRepositoryModel);
System.out.println("jsonArray>>>>>>>>>>" + versionHistoryTable.toString());
int q = 0;
for (XSLFSlide slide : slides) {
for (XSLFShape shape : slide.getShapes()) {
@ -475,7 +517,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
String L4 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L4'");
String fanwei = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID in( 'application','form_Scope_application')");
String file_number = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID IN('form_number','file_number')");
String P_versions = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID IN('P_versions')");
String P_versions = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID IN('P_versions','versions')");
String file_date = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID IN('effective_date','form_effective_date') ");
@ -512,7 +554,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
}
}
if (q!=0) {
if (q != 0) {
XSLFTable tables = (XSLFTable) shape;
XSLFTableRow firstRow = tables.getRows().get(1);
@ -543,7 +585,6 @@ public class UpdatePptxAndExcelAslp implements ASLP {
for (int i = 0; i < versionHistoryTable.size(); i++) {
JSONObject obj2 = versionHistoryTable.getJSONObject(i);
// 替换参数
if (i == 0) {
@ -564,7 +605,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
}
} else {
System.out.println("版本2的时候怎么不进");
XSLFTableRow newRow = table.getRows().get(i+1);
XSLFTableRow newRow = table.getRows().get(i + 1);
for (int col = 0; col < newRow.getCells().size(); col++) {
XSLFTableCell cell = newRow.getCells().get(col);
String text = cell.getText();
@ -578,10 +619,10 @@ public class UpdatePptxAndExcelAslp implements ASLP {
text = text.replace("{{shenpi_user}}", obj2.getString("approver"));
text = text.replace("{{person}}", obj2.getString("Contents_and_reasons_for_revision"));
cell.setText(text);
// XSLFTableRow row = table.getRows().get(i);
}
}
}
}
SDK.getLogAPI().consoleInfo("asddasdasdas");
@ -591,38 +632,47 @@ public class UpdatePptxAndExcelAslp implements ASLP {
q++;
}
// 获取当前幻灯片中的表格对象
// 获取PPT的第一页
// 替换文本框中的参数
for (XSLFSlide slide : slides) {
for (XSLFShape shape : slide.getShapes()) {
if (shape instanceof XSLFTextShape) {
XSLFTextShape textShape = (XSLFTextShape) shape;
for (XSLFTextParagraph paragraph : textShape.getTextParagraphs()) {
for (XSLFTextRun textRun : paragraph.getTextRuns()) {
String text = textRun.getRawText();
// 根据需要替换参数
text = text.replace("{{process_name}}", process_name);
textRun.setText(text);
}
}
}
}
}
XSLFSlide secondslide_last = slides.get(slides.size()-1);
slideShows.setSlideOrder(secondslide_last, 1);
FileOutputStream out = new FileOutputStream(dcContext.getFilePath());
FileOutputStream out = new FileOutputStream(params.get("fil_path").toString());
slideShows.write(out);
slideShows.close();
out.close();
FileInputStream fileInputStream = new FileInputStream(params.get("fil_path").toString());
// 打开现有PPTX文件
XMLSlideShow ppt = new XMLSlideShow(fileInputStream);
// 获取要复制的幻灯片
XSLFSlide sourceSlide = ppt.getSlides().get(1);
// 复制幻灯片
XSLFSlide newSlide = ppt.createSlide(sourceSlide.getSlideLayout());
// 复制表格
copyTable(sourceSlide, newSlide);
// 获取复制出来的幻灯片中的表格
XSLFTable table = (XSLFTable) newSlide.getShapes().get(0);
// 删除表格中的指定行假设要删除第2行
// 获取要删除的行假设要删除第2行
//XSLFTableRow rowToRemove = table.getRows().get(1);
// 获取所在的形状并删除指定行
// table.getRows().remove(rowToRemove);
table.getCTTable().getTrList().remove(1);
// 保存修改后的PPTX文件
FileOutputStream fileOutputStream = new FileOutputStream(params.get("fil_path").toString());
ppt.write(fileOutputStream);
fileOutputStream.close();
SDK.getLogAPI().consoleInfo("移动文件位置替换完成");
} catch (IOException e) {
e.printStackTrace();
}
@ -634,6 +684,49 @@ public class UpdatePptxAndExcelAslp implements ASLP {
}
private static void copyTable(XSLFSlide sourceSlide, XSLFSlide newSlide) {
for (XSLFShape shape : sourceSlide.getShapes()) {
if (shape instanceof XSLFTable) {
XSLFTable sourceTable = (XSLFTable) shape;
// 创建一个新表格并复制原表格的属性
XSLFTable newTable = newSlide.createTable();
newTable.setAnchor(sourceTable.getAnchor());
// 复制表格的行和单元格
for (int rowIndex = 0; rowIndex < sourceTable.getNumberOfRows(); rowIndex++) {
XSLFTableRow sourceRow = sourceTable.getRows().get(rowIndex);
XSLFTableRow newRow = newTable.addRow();
for (XSLFTableCell sourceCell : sourceRow.getCells()) {
XSLFTableCell newCell = newRow.addCell();
// 复制单元格的文本内容
// newCell.setText(sourceCell.getText());
// 设置单元格样式
newCell.setVerticalAlignment(sourceCell.getVerticalAlignment());
newCell.setLineColor(sourceCell.getLineColor());
//newCell.setBorderWidth(sourceCell.getBorderWidth());
// 复制单元格的样式属性
XSLFTextParagraph sourceParagraph = sourceCell.getTextParagraphs().get(0);
XSLFTextParagraph newParagraph = newCell.addNewTextParagraph();
XSLFTextRun newTextRun = newParagraph.addNewTextRun();
newTextRun.setText(sourceParagraph.getText());
newTextRun.setFontColor(sourceParagraph.getTextRuns().get(0).getFontColor());
// 继续复制其他属性...
}
}
}
}
}
private static void copyConditionalFormatting(HSLFSlide sourceSlide, HSLFSlide targetSlide) {
List<HSLFShape> shapes = sourceSlide.getShapes();
for (HSLFShape shape : shapes) {
@ -840,7 +933,11 @@ public class UpdatePptxAndExcelAslp implements ASLP {
String cellValue = cell.getStringCellValue();
if (cellValue.contains(parameter)) {
XSSFCellStyle cellStyle = cell.getCellStyle();
// cellStyle.cloneStyleFrom(cell.getCellStyle()); // 复制原有的单元格样式
cell.setCellValue(cellValue.replace(parameter, replacement));
cellStyle.setWrapText(true);
cell.setCellStyle(cellStyle);
}
}
@ -866,7 +963,11 @@ public class UpdatePptxAndExcelAslp implements ASLP {
String cellValue = cell.getStringCellValue();
if (cellValue.contains(parameter)) {
HSSFCellStyle cellStyle = cell.getCellStyle();
//cellStyle.cloneStyleFrom(cell.getCellStyle()); // 复制原有的单元格样式
cell.setCellValue(cellValue.replace(parameter, replacement));
cellStyle.setWrapText(true);
cell.setCellStyle(cellStyle);
}
}
@ -876,11 +977,31 @@ public class UpdatePptxAndExcelAslp implements ASLP {
* @param rowData
* @param row
*/
private static void insertData(XSSFSheet sheet, String[] rowData, int row) {
private static void insertData(XSSFWorkbook workbook, XSSFSheet sheet, String[] rowData, int row) {
XSSFRow newRow = sheet.createRow(row);
for (int i = 0; i < rowData.length; i++) {
XSSFCell cell = newRow.createCell(i);
XSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.cloneStyleFrom(cell.getCellStyle());
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cell.setCellValue(rowData[i]);
// 自动调整列宽
//sheet.setColumnWidth(8, 100 * 256);
// 计算行数和行高
int rowNum = cell.getStringCellValue().split("\n").length;
float rowHeightInPoints = sheet.getDefaultRowHeightInPoints();
float rowHeight = rowNum * rowHeightInPoints;
// 设置行高
newRow.setHeightInPoints(rowHeight);
cellStyle.setWrapText(true);
cell.setCellStyle(cellStyle);
}
}
@ -890,11 +1011,31 @@ public class UpdatePptxAndExcelAslp implements ASLP {
* @param rowData
* @param row
*/
private static void insertData(HSSFSheet sheet, String[] rowData, int row) {
private static void insertData(HSSFWorkbook workbook, HSSFSheet sheet, String[] rowData, int row) {
HSSFRow newRow = sheet.createRow(row);
for (int i = 0; i < rowData.length; i++) {
HSSFCell cell = newRow.createCell(i);
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.cloneStyleFrom(cell.getCellStyle());
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cell.setCellValue(rowData[i]);
// 自动调整列宽
// sheet.setColumnWidth(8, 100 * 256);
// 计算行数和行高
int rowNum = cell.getStringCellValue().split("\n").length;
float rowHeightInPoints = sheet.getDefaultRowHeightInPoints();
float rowHeight = rowNum * rowHeightInPoints;
// 设置行高
newRow.setHeightInPoints(rowHeight);
cellStyle.setWrapText(true);
cell.setCellStyle(cellStyle);
}
}
@ -910,7 +1051,10 @@ public class UpdatePptxAndExcelAslp implements ASLP {
if (CellType.forInt(cell.getCellType()) == CellType.STRING) {
String cellValue = cell.getStringCellValue();
if (cellValue.contains(parameter)) {
CellStyle cellStyle = cell.getCellStyle();
cell.setCellValue(cellValue.replace(parameter, replacement));
cellStyle.setWrapText(true);
cell.setCellStyle(cellStyle);
}
}
}
@ -929,7 +1073,10 @@ public class UpdatePptxAndExcelAslp implements ASLP {
if (CellType.forInt(cell.getCellType()) == CellType.STRING) {
String cellValue = cell.getStringCellValue();
if (cellValue.contains(parameter)) {
CellStyle cellStyle = cell.getCellStyle();
cell.setCellValue(cellValue.replace(parameter, replacement));
cellStyle.setWrapText(true);
cell.setCellStyle(cellStyle);
}
}
}

View File

@ -1,10 +1,12 @@
package com.awspaas.user.apps.app.controller;
package com.awspaas.user.bpa.controller;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.sdk.local.api.BOQueryAPI;
import com.alibaba.fastjson.JSONArray;
import com.awspaas.user.apps.yili.reportform.util.RepositoryAttribute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -22,6 +24,8 @@ import com.alibaba.fastjson.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 修改文件状态
@ -42,7 +46,6 @@ public class UpateFileStateController {
String[] plIdList = plIds.split(",");
for (String plId : plIdList){
String date = simpleDateFormat.format(new Date());
if ("1".equals(type)) {
BO bo_eu_pal_repository = SDK.getBOAPI().query("BO_EU_PAL_REPOSITORY").addQuery("PLID = ", plId).detail();
@ -54,7 +57,10 @@ public class UpateFileStateController {
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '"+state+"',MODIFYDATE = TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '"+plId+"'");
count = DBSql.update(updataSql);
String sqlt = "UPDATE BO_EU_PAL_FILE1 SET FILESTATE = '" + state + "' WHERE FILEID = '" + plId + "'";
DBSql.update(sqlt);
int update = DBSql.update(sqlt);
if (update==0){
}
/*
String id = DBSql.getString("SELECT ID FROM APP_ACT_COE_PAL_PUBLISH_LIST WHERE PALREPOSITORYID='" + plId + "'");
* if (UtilString.isNotEmpty(id)) { PALRepositoryModel model =
@ -73,10 +79,13 @@ public class UpateFileStateController {
* DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId +
* "'WHERE PALREPOSITORYID='" + plId + "'"); } }
*/
PALRepositoryCache.getCache().reload();
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
if (model!=null){
PALRepositoryCache.getCache().put(plId,model);
}
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
if(Integer.valueOf(state) == 1){
UpdateDept(model,plId);
createPermScopeData(plId , me);
SDK.getLogAPI().consoleInfo("修改为发布状态后同步权限数据到权限阅览成功===========>");
}
@ -89,11 +98,14 @@ public class UpateFileStateController {
+ "'";
System.err.println("审批改为设计=======>" + updataSql);
count = DBSql.update(updataSql);
PALRepositoryCache.getCache().reload();
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
if (model!=null){
PALRepositoryCache.getCache().put(plId,model);
}
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
} else if ("3".equals(type)) {
// 重新生成手册
PALRepositoryModel model = PALRepositoryCache.getCache().get(plId);
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
String taskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin", "", plId);
System.err.println("======手动生成手册id======"+taskId);
// 刷新预览加载的表
@ -123,7 +135,10 @@ public class UpateFileStateController {
+ "'";
System.err.println("停用改设计=======>" + updataSql);
count = DBSql.update(updataSql);
PALRepositoryCache.getCache().reload();
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
if (model!=null){
PALRepositoryCache.getCache().put(plId,model);
}
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
}
}
@ -170,6 +185,11 @@ public class UpateFileStateController {
BO scopeBo = new BO();
scopeBo.set("PALVERSIONID" , plVersionid);
scopeBo.set("PALNAME" , parentModel.getName());
String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '"+palId+"'";
RowMap map = DBSql.getMap(sql);
if (map!=null){
scopeBo.set("ORGPERM" ,map.getString("EXT6"));
}
ProcessInstance processInst = SDK.getProcessAPI().createBOProcessInstance("obj_e076b01bd0d04bc39e5af12e2c8c188c", me.getUID(), "权限阅览");
SDK.getBOAPI().create("BO_ACT_PUBLISH_PERM_SCOPE", scopeBo, processInst, me);
}
@ -199,4 +219,60 @@ public class UpateFileStateController {
return taskId;
}
public void UpdateDept(PALRepositoryModel palRepositoryModel,String id){
int count = 0;
int count2 = 0;
try {
Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(id);
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
// 发布部门
String dempId = "";
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
if (null != Issuing_department && !Issuing_department.equals("")) {
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
SDK.getLogAPI().consoleInfo(Issuing_department.toString());
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
for (Object PUBDEPTO : PUBDEPTJA) {
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
dempId += PUBDEPTJO.getString("id")+",";
}
dempId = dempId.substring(0,dempId.length()-1);
count2 += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('"+dempId+"') WHERE ID = '"+id+"'");
}
}
}
} catch (Exception e) {
// TODO: handle exception
}
// String methodId = palRepositoryModel.getMethodId();
String plVersionId = palRepositoryModel.getVersionId();
String sqly = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + plVersionId + "'";
List<RowMap> maps = DBSql.getMaps(sqly);
if (maps.size() > 1) {
String sqlu = "SELECT ID FROM (SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '"
+ plVersionId + "' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2";
String palId = DBSql.getString(sqlu);
if (UtilString.isNotEmpty(palId)) {
if (!id.equals(palId)) {
count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+id+"'");
// continue;
} else {
count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+id+"'");
}
}
}
//刷新状态
if(palRepositoryModel.isStop()) {
count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+id+"'");
}
}
}

View File

@ -0,0 +1,289 @@
package com.awspaas.user.bpa.job;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.sql.Timestamp;
import java.util.*;
/**
* @author:lihongyu
* @create: 2022-11-03 11:32
* @Description: 全量同步文件
*/
@DisallowConcurrentExecution
public class UpdateSreJob implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
syncNodeData();
}
//同步节点数据到 BO_EU_PAL_FILENODE6
public void syncNodeData() {
//DBSql.update("DELETE FROM BO_EU_NODESYN_EXCEPTION");
//DBSql.update("DELETE FROM BO_EU_PAL_FILENODE6");
HashMap<String, Object> dataMap = new HashMap<>();
ArrayList<String> fromNodeDataIDMaps = new ArrayList<>();
ArrayList<Map<String, ?>> oldNodeDataMaps = new ArrayList<>();
ArrayList<Map<String, ?>> newNodeDataMaps = new ArrayList<>();
ArrayList<Map<String, ?>> delNodeDataMaps = new ArrayList<>();
String wsId = "7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
//总文件集合
List<PALRepositoryModel> palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getAllCoeProcessLevelByWsId(wsId);
long startTime = System.currentTimeMillis();
List<String> nodeIdList = DBSql.getList("SELECT NODEID FROM BO_EU_PAL_FILENODE6", String.class);
List<String> nodeIdList_PLID = DBSql.getList("SELECT PLID FROM BO_EU_PAL_FILENODE6", String.class);
for (PALRepositoryModel fileModel : palRepositoryModels) {
List<Map<String, Object>> nodeElements = new ArrayList<>();
String PLMETHODID = fileModel.getMethodId();
String FILEID = fileModel.getId();
String PLNAME = fileModel.getName();
//String plRid = fileModel.getPlRid();
/*
* if(!fileModel.isPublish()) { continue; }
*/
/*
* String sql =
* "SELECT ID FROM (SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLRID = '"
* +plRid+"' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2"; String
* palId = DBSql.getString(sql); if(UtilString.isNotEmpty(palId)) {
* if(!FILEID.equals(palId)) {
* SDK.getLogAPI().consoleInfo("同步数据发现旧版本文件名称:"+PLNAME+"——文件id"+FILEID); String
* dsql = "DELETE FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+FILEID+"'";
* DBSql.update(dsql); continue; } }
*/
Timestamp MODIFYDATETIME = fileModel.getModifyDate();
//更新/新增节点
nodeElements = new ArrayList<>();
if(PLMETHODID.equals("process.epc")||PLMETHODID.equals("process.flowchart")) {
try {
nodeElements = CoeDesignerUtil.getShapeMessageJson4(FILEID);
} catch (Exception e) {
SDK.getLogAPI().consoleInfo("获取节点属性过程中,"+"文件ID"+PLNAME+"=======>获取节点形状属性异常");
}
//System.err.println(PLNAME+"======nodeElements1=======>"+nodeElements);
}
//制度类型
/*
* nodeElements = new ArrayList<>(); if (PLMETHODID.equals("control.policy")) {
* try { nodeElements = CoeDesignerUtil.getShapeMessageJson4(FILEID); } catch
* (Exception e) { SDK.getLogAPI().consoleInfo("获取制度类型过程中," + "文件ID" + FILEID +
* "获取节点形状属性异常"); }
* //System.err.println(PLNAME+"======nodeElements2=======>"+nodeElements); }
*/
//同步角色岗位
if (null != nodeElements && !nodeElements.isEmpty()) {
for (Map<String, Object> nodeElement : nodeElements) {
String NODETYPE = String.valueOf(nodeElement.get("type"));
if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node") || NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) {
//节点信息
String NODEID = String.valueOf(nodeElement.get("id"));
String NODENAME = String.valueOf(nodeElement.get("name"));
//形状属性数组
JSONArray attributesArray = JSON.parseArray(String.valueOf(nodeElement.get("attributes")));
//形状属性信息系统活动序号活动描述角色岗位
String ITSYSVAL = "";
String ACTIVITYNUMBER = "";
String ACTIVITYDESC = "";
String ROLE = "";
String ROLENAME = "";
String POST = "";
String POSTNAME = "";
if (null != attributesArray && !attributesArray.isEmpty()) {
for (Object attribute : attributesArray) {
JSONObject attributeJO = JSON.parseObject(String.valueOf(attribute));
String SHAPEATTRKEY = attributeJO.getString("key");
if (SHAPEATTRKEY.equals("information_systems")) {
ITSYSVAL = attributeJO.getString("value");
}
if (SHAPEATTRKEY.equals("activity_number")) {
ACTIVITYNUMBER = attributeJO.getString("value");
}
if (SHAPEATTRKEY.equals("activity_description")) {
ACTIVITYDESC = attributeJO.getString("value");
}
if (SHAPEATTRKEY.equals("role")) {
String nodeRoleText = attributeJO.getString("value");
ROLE = nodeRoleText;
if (null!=ROLE && !ROLE.equals("")) {
List<RowMap> roleFileRowMaps = new ArrayList<>();
try {
roleFileRowMaps = DBSql.getMaps("SELECT RELATIONFILEID FROM APP_ACT_COE_PAL_SHAPE_RLAT WHERE FILEID='"+FILEID+"' AND ATTRID='role'");
} catch (Exception e) {
SDK.getLogAPI().consoleInfo("获取流程节点角色属性关联文件时"+"文件名称:"+PLNAME+"___文件ID"+FILEID+"___节点ID"+NODEID+"异常");
}
if (null!=roleFileRowMaps && !roleFileRowMaps.isEmpty()) {
for (RowMap roleFileRowMap : roleFileRowMaps) {
String RELATIONFILEID = roleFileRowMap.getString("RELATIONFILEID");
//角色文件属性
List<Map<String, Object>> roleShapes = new ArrayList<>();
try {
roleShapes = CoeDesignerUtil.getShapeMessageJson4(RELATIONFILEID);
} catch (Exception e) {
//SDK.getLogAPI().consoleInfo("获取关联角色文件属性"+"文件ID"+RELATIONFILEID+"异常");
}
if (null != roleShapes && !roleShapes.isEmpty()) {
for (Map<String, Object> roleShape : roleShapes) {
String roleFileNodeName = String.valueOf(roleShape.get("name"));
if (nodeRoleText.contains(roleFileNodeName)) {
//角色节点形状属性
JSONArray roleShapeJA = null;
try {
roleShapeJA = JSONArray.parseArray(String.valueOf(roleShape.get("attributes")));
} catch (Exception e) {
SDK.getLogAPI().consoleInfo("获取角色节点形状属性jsonArray"+"文件ID"+RELATIONFILEID+"异常");
}
if (null != roleShapeJA && !roleShapeJA.isEmpty()) {
for (Object roleShapeO : roleShapeJA) {
JSONObject roleShapeJO = JSON.parseObject(String.valueOf(roleShapeO));
String roleShapeKey = roleShapeJO.getString("key");
if (roleShapeKey.equals("post")) {
//SDK.getLogAPI().consoleInfo("角色岗位"+roleShapeJO.getString("value"));
POST = roleShapeJO.getString("value");
}
if (roleShapeKey.equals("post_text")) {
//SDK.getLogAPI().consoleInfo("角色岗位文本"+roleShapeJO);
ROLENAME = roleShapeJO.getString("value");
POSTNAME = roleShapeJO.getString("value");
}
}
}
}
}
}
}
}
} else {
for (Object attribute1 : attributesArray) {
JSONObject attributeJO1 = JSON.parseObject(String.valueOf(attribute1));
String SHAPEATTRKEY1 = attributeJO1.getString("key");
if (SHAPEATTRKEY1.equals("post")) {
POST = attributeJO1.getString("value");
}
if (SHAPEATTRKEY1.equals("post_text")) {
POSTNAME = attributeJO1.getString("value");
}
}
}
}
}
}
fromNodeDataIDMaps.add(NODEID);
if (nodeIdList.contains(NODEID)&&nodeIdList_PLID.contains(FILEID)) {
dataMap = new HashMap<>();
Date nowDateJ = new Date(System.currentTimeMillis());
Timestamp nowDateTime = new Timestamp(nowDateJ.getTime());
dataMap.put("UPDATEDATE", nowDateTime);
dataMap.put("NODENAME", NODENAME);
dataMap.put("NODETYPE", NODETYPE);
dataMap.put("PLNAME", PLNAME);
dataMap.put("NODECATEGORY", PLMETHODID);
dataMap.put("ITSYSVAL", ITSYSVAL);
dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER);
dataMap.put("ACTIVITYDESC", ACTIVITYDESC);
dataMap.put("ROLE", ROLE);
dataMap.put("ROLENAME", ROLENAME);
dataMap.put("POST", POST);
dataMap.put("POSTNAME", POSTNAME);
dataMap.put("PLID", FILEID);
dataMap.put("NODEID", NODEID);
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
//System.err.println("更新节点信息===========>"+dataMap);
try {
DBSql.update("UPDATE BO_EU_PAL_FILENODE6 SET"
+ " NODENAME=:NODENAME, NODETYPE=:NODETYPE, PLNAME=:PLNAME, NODECATEGORY=:NODECATEGORY, ITSYSVAL=:ITSYSVAL, "
+ " ACTIVITYNUMBER=:ACTIVITYNUMBER, ACTIVITYDESC=:ACTIVITYDESC, ROLE=:ROLE, POST=:POST, ROLENAME=:ROLENAME, POSTNAME=:POSTNAME, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE "
+ " WHERE PLID=:PLID AND NODEID=:NODEID", dataMap);
} catch (Exception e) {
BO bo = new BO();
bo.set("PLID", FILEID);
bo.set("PLNAME", PLNAME);
bo.set("NODEID", NODEID);
bo.set("NODENAME", NODENAME);
bo.set("INFORMATION", e.getMessage());
SDK.getBOAPI().createDataBO("BO_EU_NODESYN_EXCEPTION", bo, UserContext.fromUID("admin"));
System.err.println("数据保存异常==========>"+e.getMessage()+"__活动描述"+ACTIVITYDESC);
}
} else {
dataMap = new HashMap<>();
String uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
dataMap.put("uuId", uuId);
dataMap.put("NODEID", NODEID);
dataMap.put("NODENAME", NODENAME);
dataMap.put("NODETYPE", NODETYPE);
dataMap.put("PLID", FILEID);
dataMap.put("PLNAME", PLNAME);
dataMap.put("NODECATEGORY", PLMETHODID);
dataMap.put("ITSYSVAL", ITSYSVAL);
dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER);
dataMap.put("ACTIVITYDESC", ACTIVITYDESC);
dataMap.put("ROLE", ROLE);
dataMap.put("POST", POST);
dataMap.put("ROLENAME", ROLENAME);
dataMap.put("POSTNAME", POSTNAME);
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
//System.err.println("同步节点信息===========>"+dataMap);
try {
DBSql.update("INSERT INTO BO_EU_PAL_FILENODE6"
+ " (ID, NODEID, NODENAME, NODETYPE, PLID, PLNAME, NODECATEGORY, ITSYSVAL, ACTIVITYNUMBER, ACTIVITYDESC, ROLE, POST, ROLENAME, POSTNAME, MODIFYDATETIME) "
+ " VALUES(:uuId, :NODEID, :NODENAME, :NODETYPE, :PLID, :PLNAME, :NODECATEGORY, :ITSYSVAL, :ACTIVITYNUMBER, :ACTIVITYDESC, :ROLE, :POST, :ROLENAME, :POSTNAME, :MODIFYDATETIME)", dataMap);
} catch (Exception e) {
BO bo = new BO();
bo.set("PLID", FILEID);
bo.set("PLNAME", PLNAME);
bo.set("NODEID", NODEID);
bo.set("NODENAME", NODENAME);
bo.set("INFORMATION", e.getMessage());
SDK.getBOAPI().createDataBO("BO_EU_NODESYN_EXCEPTION", bo, UserContext.fromUID("admin"));
System.err.println("数据保存异常==========>"+e.getMessage()+"__活动描述"+ACTIVITYDESC);
}
//newNodeDataMaps.add(dataMap);
}
}
}
}
}
//删除节点信息
if (null != nodeIdList && !nodeIdList.isEmpty()) {
for (String nodeIdOfList : nodeIdList) {
if (!fromNodeDataIDMaps.contains(nodeIdOfList)) {
dataMap = new HashMap<>();
dataMap.put("NODEID", nodeIdOfList);
//DBSql.update("DELETE FROM BO_EU_PAL_FILENODE6 WHERE NODEID=:NODEID", dataMap);
delNodeDataMaps.add(dataMap);
}
}
}
SDK.getLogAPI().consoleInfo("新增节点" + newNodeDataMaps.size());
SDK.getLogAPI().consoleInfo("修改节点" + oldNodeDataMaps.size());
SDK.getLogAPI().consoleInfo("删除节点" + delNodeDataMaps.size());
long endTime = System.currentTimeMillis();
SDK.getLogAPI().consoleInfo("结束时间" + endTime);
SDK.getLogAPI().consoleInfo("运行时间" + (endTime - startTime));
}
}

View File

@ -0,0 +1,26 @@
package com.awspaas.user.bpa.util;
import com.actionsoft.bpms.util.UtilString;
import java.util.ArrayList;
public class test {
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<>();
list.add("1");
list.add("2");
list.add("3");
list.add("4");
String file_depart = "1,,";
String[] split = file_depart.split(",");
file_depart = file_depart.substring(0,file_depart.length()-1);
for (String depart:
split) {
if (UtilString.isNotEmpty(depart) ){
if (!list.contains(depart)){
continue;
}
}
}
}
}

View File

@ -60,23 +60,29 @@ public class WorkFlowAPI {
JSONObject results = new JSONObject(new LinkedHashMap<>());
System.out.println("这里是end_process流程的伊利OA数据");
//List<BO> bo_eu_oa_process = SDK.getBOAPI().query("BO_EU_MODEL", true).list();
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int q=0;
for (RowMap bos:maps
) {
if (q<=maps.size()){
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int size = 2;
int last_page = 1;
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
/*if (boss!=null&&boss.size()>0){
String pages = boss.get(0).getString("PAGES");
last_page = Integer.parseInt(pages);
size = last_page+1;
}else {
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
}*/
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
int size = Integer.valueOf(soap_page);
for (int j = last_page; j < size; j++) {
for (int j = 1; j < size; j++) {
int tale = Integer.valueOf(bos.getString("ID").trim());
int tale = Integer.valueOf(maps.get(0).getString("ID").trim());
jsonObject.put("workflowId", tale);
// jsonObject.put("workflowId",bo.getString("WORKFLOWID"));
@ -110,7 +116,9 @@ public class WorkFlowAPI {
// System.out.println("rootElement>>>>>>"+rootElement);
Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out");
String resultString = result.getData().toString();
/*
System.out.println("resultString=>>>>>>>>>>"+resultString);
*/
//if (!StringUtils.isEmpty(resultString)){
JSONObject jsonObject1 = JSON.parseObject(resultString);
String datas = jsonObject1.getString("datas");
@ -161,17 +169,17 @@ public class WorkFlowAPI {
end_process.put("warningtimedur", "");
jsonArray_new.add(end_process);
}
BO bo = new BO();
bo.set("WORKFLOWID",maps.get(0).getString("ID").trim());
bo.set("PAGES",size);
SDK.getBOAPI().createDataBO("BO_EU_OTHER_SYSTEM_PAGE",bo,UserContext.fromUID("admin"));
} else {
DBSql.update("update APP_ACT_BPAD_P_VER_ACTIVITY set EXT2 = '123' where ID = '"+maps.get(0).getString("ID")+"'");
break;
}
}
}else {
break;
}
q++;
}
System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.toString());
System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size());
return jsonArray_new.toString();
}
@ -188,26 +196,36 @@ public class WorkFlowAPI {
@Param String starttime,
@Param String endtime) throws DocumentException, ParseException {
System.out.println("这里是开始流程的接口数据传递");
SDK.getLogAPI().consoleInfo("开始流程的开始时间>>>>>>>>>>>"+System.currentTimeMillis());
long startTime = System.currentTimeMillis();
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject results = new JSONObject(new LinkedHashMap<>());
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int q = 0;
for (RowMap bos:maps
) {
if (q<=maps.size()){
int last_page = 1;
int size = 2;
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
/* if (boss!=null&&boss.size()>0){
String pages = boss.get(0).getString("PAGES");
last_page = Integer.parseInt(pages);
size = last_page+1;
}else {
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
}*/
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
int size = Integer.valueOf(soap_page);
size = Integer.valueOf(soap_page);
for (int j = 1; j < size; j++) {
for (int j = last_page; j < size; j++) {
int tale = Integer.valueOf(bos.getString("ID").trim());
int tale = Integer.valueOf(maps.get(0).getString("ID").trim());
BO bo = new BO();
UserContext userContexts = UserContext.fromUID("admin");
bo.set("WORKID",bos.getString("ID"));
bo.set("WORKID",maps.get(0).getString("ID"));
SDK.getBOAPI().createDataBO("BO_EU_TEST2",bo,userContexts);
jsonObject.put("workflowId", tale);
// jsonObject.put("workflowId",bo.getString("WORKFLOWID"));
@ -241,7 +259,7 @@ public class WorkFlowAPI {
// System.out.println("rootElement>>>>>>"+rootElement);
Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out");
String resultString = result.getData().toString();
System.out.println("resultString=>>>>>>>>>>"+resultString);
/* System.out.println("resultString=>>>>>>>>>>"+resultString);*/
//if (!StringUtils.isEmpty(resultString)){
JSONObject jsonObject1 = JSON.parseObject(resultString);
String datas = jsonObject1.getString("datas");
@ -282,13 +300,11 @@ public class WorkFlowAPI {
} else {
break;
}
}
}else {
break;
}
q++;
}
System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.toString());
System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size());
SDK.getLogAPI().consoleInfo("开始流程的结束时间>>>>>>>>>>>"+System.currentTimeMillis());
long endstime = System.currentTimeMillis();
SDK.getLogAPI().consoleInfo("开始流程所消耗的时间>>>>>>>>"+(endstime-startTime)+"ms");
return jsonArray_new.toString();
}
@ -300,21 +316,27 @@ public class WorkFlowAPI {
System.out.println("开始任务数据对应的json数据");
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject results = new JSONObject(new LinkedHashMap<>());
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int q=0;
for (RowMap bos:maps
) {
if (q<=maps.size()){
int last_page = 1;
int size = 2;
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
/* if (boss!=null&&boss.size()>0){
String pages = boss.get(0).getString("PAGES");
last_page = Integer.parseInt(pages);
size = last_page+1;
}else {
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
}*/
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
int size = Integer.valueOf(soap_page);
for (int j = 1; j < size; j++) {
int tale = Integer.valueOf(bos.getString("ID").trim());
size = Integer.valueOf(soap_page);
for (int j = last_page; j < size; j++) {
int tale = Integer.valueOf(maps.get(0).getString("ID").trim());
jsonObject.put("workflowId", tale);
// jsonObject.put("workflowId",bo.getString("WORKFLOWID"));
@ -348,7 +370,7 @@ public class WorkFlowAPI {
// System.out.println("rootElement>>>>>>"+rootElement);
Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out");
String resultString = result.getData().toString();
System.out.println("resultString=>>>>>>>>>>"+resultString);
/*System.out.println("resultString=>>>>>>>>>>"+resultString);*/
//if (!StringUtils.isEmpty(resultString)){
JSONObject jsonObject1 = JSON.parseObject(resultString);
String datas = jsonObject1.getString("datas");
@ -393,12 +415,8 @@ public class WorkFlowAPI {
break;
}
}
}else {
break;
}
q++;
}
System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.toString());
System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size());
return jsonArray_new.toString();
}
@ -429,20 +447,29 @@ public class WorkFlowAPI {
System.out.println("结束任务开始获取数据");
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject results = new JSONObject(new LinkedHashMap<>());
// List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int q=0;
for (RowMap bos:maps
) {
if (q<=maps.size()){
int last_page = 1;
int size =2;
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
/* if (boss!=null&&boss.size()>0){
String pages = boss.get(0).getString("PAGES");
last_page = Integer.parseInt(pages);
size = last_page+1;
}else {
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
int size = Integer.valueOf(soap_page);
size = Integer.valueOf(soap_page);
}*/
for (int j = 1; j < size; j++) {
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
int tale = Integer.valueOf(bos.getString("ID").trim());
size = Integer.valueOf(soap_page);
for (int j = last_page; j < size; j++) {
int tale = Integer.valueOf(maps.get(0).getString("ID").trim());
jsonObject.put("workflowId", tale);
// jsonObject.put("workflowId",bo.getString("WORKFLOWID"));
@ -476,7 +503,7 @@ public class WorkFlowAPI {
// System.out.println("rootElement>>>>>>"+rootElement);
Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out");
String resultString = result.getData().toString();
System.out.println("resultString=>>>>>>>>>>"+resultString);
// System.out.println("resultString=>>>>>>>>>>"+resultString);
//if (!StringUtils.isEmpty(resultString)){
JSONObject jsonObject1 = JSON.parseObject(resultString);
String datas = jsonObject1.getString("datas");
@ -535,12 +562,7 @@ public class WorkFlowAPI {
break;
}
}
}else {
break;
}
q++;
}
System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.toString());
System.out.println("task_end结束_jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size());
return jsonArray_new.toString();
}