线程是否执行完毕修改.修改错误
This commit is contained in:
parent
168d63a9ca
commit
87ab23652a
@ -273,12 +273,12 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
* for (String user : sendList) { try { SendOARead(jsonObject, instanceById,
|
||||
* user, "批量推送"); } catch (Exception e) { // TODO: handle exception } }
|
||||
*/
|
||||
/*List<BO> bo_eu_oa_read_test = SDK.getBOAPI().query("BO_EU_OA_READ_TEST").connection(open).list();
|
||||
List<BO> bo_eu_oa_read_test = SDK.getBOAPI().query("BO_EU_OA_READ_TEST").connection(open).list();
|
||||
ArrayList<String> sendLists = new ArrayList<String>();
|
||||
for (BO uid:bo_eu_oa_read_test) {
|
||||
sendLists.add(uid.getString("USER_ID"));
|
||||
}*/
|
||||
new_uid = new_uid.join(",", sendList);
|
||||
}
|
||||
new_uid = new_uid.join(",", sendLists);
|
||||
long startTimes = System.currentTimeMillis();
|
||||
String[] users = new_uid.split(",");
|
||||
System.out.println("new_uid>>>>>>>>>>>>>>"+users.length);
|
||||
@ -543,88 +543,95 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
|
||||
public void course(List<String[]> list,long startTime,JSONObject jsonObject,ProcessExecutionContext processExecutionContext,ArrayList<String> sendList){
|
||||
// 创建线程来实现为每100人为一个的线程跑待阅
|
||||
ProcessInstance instanceById = processExecutionContext.getProcessInstance();
|
||||
final boolean[] flag = {false};
|
||||
ExecutorService service = Executors.newFixedThreadPool(5);
|
||||
int m = 0;
|
||||
for (String[] resrt:list
|
||||
) {
|
||||
int finalM = m;
|
||||
final boolean[] filnaflag = {flag[0]};
|
||||
service.execute(new Runnable() {
|
||||
@Override
|
||||
@Override
|
||||
|
||||
public void run() {
|
||||
public void run() {
|
||||
System.out.println("最后一个数组是什么>>>>>>>"+Arrays.asList(resrt).size());
|
||||
String userIds = "";
|
||||
userIds = StringUtils.join(resrt, ",");
|
||||
System.out.println("userIDs>>>>>>>>>>>>>>>"+userIds);
|
||||
String userIds = "";
|
||||
userIds = StringUtils.join(resrt, ",");
|
||||
System.out.println("userIDs>>>>>>>>>>>>>>>"+userIds);
|
||||
try {
|
||||
filnaflag[0] = false;
|
||||
SendOARead(jsonObject, processExecutionContext.getProcessInstance(), userIds,"批量推送");
|
||||
flag[0] = true;
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
m++;
|
||||
}
|
||||
try {
|
||||
// 等待所有的任务执行完毕,最多等待1小时
|
||||
if (service.awaitTermination(12, TimeUnit.HOURS)) {
|
||||
List<RowMap> List = DBSql.getMaps("SELECT NAME FROM BO_EU_READ_COUNT WHERE PROCESSID = '"
|
||||
+ instanceById.getId() + "' AND RESULT = '待处理'");
|
||||
if (List.size() != 0) {
|
||||
System.err.println(instanceById.getTitle() + "批量推送失败后执行二次推送=======>" + List.size());
|
||||
for (RowMap rowMap : List) {
|
||||
try {
|
||||
ArrayList<String> secondUserList = new ArrayList<String>();
|
||||
secondUserList.add(rowMap.getString("NAME"));
|
||||
System.err.println(instanceById.getTitle() + "二次推送账号=======>" + secondUserList);
|
||||
|
||||
BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processExecutionContext.getProcessInstance().getId()).addQuery("TASKSTATUS=",2).detail();
|
||||
if(executiveTaskBO!=null){
|
||||
List<BO> recordFailLists = new ArrayList<BO>();
|
||||
for(RowMap oneuserId:List){
|
||||
BO bo = new BO();
|
||||
bo.set("TITLE", processExecutionContext.getProcessInstance().getTitle());
|
||||
bo.set("NAME", oneuserId.getString("NAME"));
|
||||
bo.set("TYPE", "批量推送");
|
||||
bo.set("RESULT", "待处理");
|
||||
bo.set("PROCESSID", processExecutionContext.getProcessInstance().getId());
|
||||
bo.set("DEPNAME", SDK.getORGAPI().getUser(oneuserId.getString("NAME")).getDepartmentId());
|
||||
recordFailLists.add(bo);
|
||||
}
|
||||
SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, processExecutionContext.getProcessInstance().getId(), processExecutionContext.getProcessInstance().getCreateUser());
|
||||
return;
|
||||
if (service.isTerminated()){
|
||||
|
||||
try {
|
||||
// 等待所有的任务执行完毕,最多等待1小时
|
||||
List<RowMap> List = DBSql.getMaps("SELECT NAME FROM BO_EU_READ_COUNT WHERE PROCESSID = '"
|
||||
+ instanceById.getId() + "' AND RESULT = '待处理'");
|
||||
if (List.size() != 0) {
|
||||
System.err.println(instanceById.getTitle() + "批量推送失败后执行二次推送=======>" + List.size());
|
||||
for (RowMap rowMap : List) {
|
||||
try {
|
||||
ArrayList<String> secondUserList = new ArrayList<String>();
|
||||
secondUserList.add(rowMap.getString("NAME"));
|
||||
System.err.println(instanceById.getTitle() + "二次推送账号=======>" + secondUserList);
|
||||
|
||||
BO executiveTaskBO=SDK.getBOAPI().query("BO_ACT_EXECUTIVE_TASK").addQuery("TASKID=",processExecutionContext.getProcessInstance().getId()).addQuery("TASKSTATUS=",2).detail();
|
||||
if(executiveTaskBO!=null){
|
||||
List<BO> recordFailLists = new ArrayList<BO>();
|
||||
for(RowMap oneuserId:List){
|
||||
BO bo = new BO();
|
||||
bo.set("TITLE", processExecutionContext.getProcessInstance().getTitle());
|
||||
bo.set("NAME", oneuserId.getString("NAME"));
|
||||
bo.set("TYPE", "批量推送");
|
||||
bo.set("RESULT", "待处理");
|
||||
bo.set("PROCESSID", processExecutionContext.getProcessInstance().getId());
|
||||
bo.set("DEPNAME", SDK.getORGAPI().getUser(oneuserId.getString("NAME")).getDepartmentId());
|
||||
recordFailLists.add(bo);
|
||||
}
|
||||
|
||||
secondSendOARead(jsonObject, instanceById, secondUserList, "单个账号推送");
|
||||
} catch (Exception e) { // TODO: handle exception
|
||||
SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, processExecutionContext.getProcessInstance().getId(), processExecutionContext.getProcessInstance().getCreateUser());
|
||||
return;
|
||||
}
|
||||
|
||||
secondSendOARead(jsonObject, instanceById, secondUserList, "单个账号推送");
|
||||
} catch (Exception e) { // TODO: handle exception
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
long endTimes = System.currentTimeMillis();
|
||||
// 存入日志
|
||||
createReadLog(processExecutionContext, jsonObject, sendList, startTime, endTimes);
|
||||
System.err.println(instanceById.getTitle() + "推送OA待阅执行完毕====>" + "用时:"
|
||||
+ (endTimes - startTime) / 1000 / 60 + "分钟");
|
||||
}
|
||||
|
||||
long endTimes = System.currentTimeMillis();
|
||||
// 存入日志
|
||||
createReadLog(processExecutionContext, jsonObject, sendList, startTime, endTimes);
|
||||
System.err.println(instanceById.getTitle() + "推送OA待阅执行完毕====>" + "用时:"
|
||||
+ (endTimes - startTime) / 1000 / 60 + "分钟");
|
||||
|
||||
|
||||
|
||||
//发送消息通知
|
||||
List<BO> readCountBO=SDK.getBOAPI().query("BO_EU_READ_COUNT").addQuery("PROCESSID=",processExecutionContext.getProcessInstance().getId()).list();
|
||||
if(readCountBO.size()>0){
|
||||
SDK.getNotificationAPI().sendMessage("admin", "admin", "文件名称:"+processExecutionContext.getProcessInstance().getTitle()+"文件有失败记录,请及时处理!!!");
|
||||
}
|
||||
//发送消息通知
|
||||
List<BO> readCountBO=SDK.getBOAPI().query("BO_EU_READ_COUNT").addQuery("PROCESSID=",processExecutionContext.getProcessInstance().getId()).list();
|
||||
if(readCountBO.size()>0){
|
||||
SDK.getNotificationAPI().sendMessage("admin", "admin", "文件名称:"+processExecutionContext.getProcessInstance().getTitle()+"文件有失败记录,请及时处理!!!");
|
||||
}
|
||||
|
||||
//更新任务状态
|
||||
int r1 = DBSql.update("UPDATE BO_ACT_EXECUTIVE_TASK SET ISTASKEND='2' WHERE TASKID ='" + processExecutionContext.getProcessInstance().getId() + "'");
|
||||
//更新任务状态
|
||||
int r1 = DBSql.update("UPDATE BO_ACT_EXECUTIVE_TASK SET ISTASKEND='2' WHERE TASKID ='" + processExecutionContext.getProcessInstance().getId() + "'");
|
||||
|
||||
} else {
|
||||
System.out.println("超过等待时间,部分任务未执行完毕");
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("等待中断异常");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
System.out.println("等待中断异常");
|
||||
} else {
|
||||
System.out.println("超过等待时间,部分任务未执行完毕");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ import com.microsoft.schemas.office.office.CTIdMap;
|
||||
import com.spire.presentation.*;
|
||||
import com.spire.presentation.drawing.FillFormatType;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
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;
|
||||
@ -419,184 +420,188 @@ public class UpFileExcelAndPptController {
|
||||
String[] fileNames ={dcContext.getFilePath(),dcContext_old.getFilePath()} ;
|
||||
String mergedFileName = dcContext.getPath()+"dc.pptx";
|
||||
|
||||
try (FileOutputStream outputStream = new FileOutputStream(mergedFileName)) {
|
||||
XMLSlideShow mergedSlideShow = new XMLSlideShow();
|
||||
if (name.endsWith(".pptx")){
|
||||
try (FileOutputStream outputStream = new FileOutputStream(mergedFileName)) {
|
||||
XMLSlideShow mergedSlideShow = new XMLSlideShow();
|
||||
|
||||
for (String fileName : fileNames) {
|
||||
XMLSlideShow slideShow = new XMLSlideShow(new FileInputStream(fileName));
|
||||
for (XSLFSlide slide : slideShow.getSlides()) {
|
||||
mergedSlideShow.setPageSize(slideShow.getPageSize());
|
||||
XSLFSlide newSlide = mergedSlideShow.createSlide().importContent(slide);
|
||||
copyConditionalFormatting(slide, newSlide);
|
||||
copyImages(slide, newSlide);
|
||||
for (String fileName : fileNames) {
|
||||
XMLSlideShow slideShow = new XMLSlideShow(new FileInputStream(fileName));
|
||||
for (XSLFSlide slide : slideShow.getSlides()) {
|
||||
mergedSlideShow.setPageSize(slideShow.getPageSize());
|
||||
XSLFSlide newSlide = mergedSlideShow.createSlide().importContent(slide);
|
||||
copyConditionalFormatting(slide, newSlide);
|
||||
copyImages(slide, newSlide);
|
||||
|
||||
}
|
||||
}
|
||||
mergedSlideShow.write(outputStream);
|
||||
mergedSlideShow.close();
|
||||
outputStream.close();
|
||||
//生成之后的数据pptx
|
||||
XMLSlideShow slideShows = new XMLSlideShow(new FileInputStream(mergedFileName));
|
||||
SDK.getLogAPI().consoleInfo("开始执行了吗");
|
||||
// 获取幻灯片列表
|
||||
List<XSLFSlide> slides = slideShows.getSlides();
|
||||
SDK.getLogAPI().consoleInfo("幻灯片的大小是多少>>>>>>>"+slides.size());
|
||||
//移动倒数第二个至第一张幻灯
|
||||
XSLFSlide secondslide = slides.get(slides.size()-2);
|
||||
slideShows.setSlideOrder(secondslide, 0);
|
||||
}
|
||||
}
|
||||
mergedSlideShow.write(outputStream);
|
||||
mergedSlideShow.close();
|
||||
outputStream.close();
|
||||
//生成之后的数据pptx
|
||||
XMLSlideShow slideShows = new XMLSlideShow(new FileInputStream(mergedFileName));
|
||||
SDK.getLogAPI().consoleInfo("开始执行了吗");
|
||||
// 获取幻灯片列表
|
||||
List<XSLFSlide> slides = slideShows.getSlides();
|
||||
SDK.getLogAPI().consoleInfo("幻灯片的大小是多少>>>>>>>"+slides.size());
|
||||
//移动倒数第二个至第一张幻灯
|
||||
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());
|
||||
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 XSLFTable) {
|
||||
XSLFTable table = (XSLFTable) shape;
|
||||
for (XSLFTableRow row : table.getRows()) {
|
||||
for (XSLFTableCell cell : row.getCells()) {
|
||||
for (XSLFTextParagraph paragraph : cell.getTextParagraphs()) {
|
||||
for (XSLFTextRun textRun : paragraph.getTextRuns()) {
|
||||
String text = textRun.getRawText();
|
||||
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 XSLFTable) {
|
||||
XSLFTable table = (XSLFTable) shape;
|
||||
for (XSLFTableRow row : table.getRows()) {
|
||||
for (XSLFTableCell cell : row.getCells()) {
|
||||
for (XSLFTextParagraph paragraph : cell.getTextParagraphs()) {
|
||||
for (XSLFTextRun textRun : paragraph.getTextRuns()) {
|
||||
String text = textRun.getRawText();
|
||||
|
||||
// 根据需要替换参数
|
||||
// 根据需要替换参数
|
||||
|
||||
String L1 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L1'");
|
||||
String L2 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L2'");
|
||||
String L3 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L3'");
|
||||
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 L1 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L1'");
|
||||
String L2 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L2'");
|
||||
String L3 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L3'");
|
||||
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 file_date = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID IN('effective_date','form_effective_date') ");
|
||||
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(P_versions)) {
|
||||
text = text.replace("{{file_version}}", P_versions);
|
||||
} else {
|
||||
text = text.replace("{{file_version}}", "");
|
||||
}
|
||||
if (UtilString.isNotEmpty(file_date)) {
|
||||
text = text.replace("{{file_data}}", file_date);
|
||||
} else {
|
||||
text = text.replace("{{file_data}}", "");
|
||||
}
|
||||
if (UtilString.isNotEmpty(file_number)) {
|
||||
if (UtilString.isNotEmpty(P_versions)) {
|
||||
text = text.replace("{{file_version}}", P_versions);
|
||||
} else {
|
||||
text = text.replace("{{file_version}}", "");
|
||||
}
|
||||
if (UtilString.isNotEmpty(file_date)) {
|
||||
text = text.replace("{{file_data}}", file_date);
|
||||
} else {
|
||||
text = text.replace("{{file_data}}", "");
|
||||
}
|
||||
if (UtilString.isNotEmpty(file_number)) {
|
||||
|
||||
text = text.replace("{{file_code}}", file_number);
|
||||
} else {
|
||||
text = text.replace("{{file_code}}", "");
|
||||
}
|
||||
if (UtilString.isNotEmpty(fanwei)) {
|
||||
text = text.replace("{{file_code}}", file_number);
|
||||
} else {
|
||||
text = text.replace("{{file_code}}", "");
|
||||
}
|
||||
if (UtilString.isNotEmpty(fanwei)) {
|
||||
|
||||
text = text.replace("{{fanwei}}", fanwei);
|
||||
} else {
|
||||
text = text.replace("{{fanwei}}", "");
|
||||
}
|
||||
text = text.replace("{{fanwei}}", fanwei);
|
||||
} else {
|
||||
text = text.replace("{{fanwei}}", "");
|
||||
}
|
||||
|
||||
text = text.replace("{{L1}}", L1);
|
||||
text = text.replace("{{L2}}", L2);
|
||||
text = text.replace("{{L3}}", L3);
|
||||
text = text.replace("{{L4}}", L4);
|
||||
textRun.setText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
text = text.replace("{{L1}}", L1);
|
||||
text = text.replace("{{L2}}", L2);
|
||||
text = text.replace("{{L3}}", L3);
|
||||
text = text.replace("{{L4}}", L4);
|
||||
textRun.setText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XSLFTable tables = (XSLFTable) shape;
|
||||
XSLFTableRow firstRow = tables.getRows().get(1);
|
||||
// 获取表格的第一行
|
||||
for (int i = 0; i < versionHistoryTable.size(); i++) {
|
||||
XSLFTable tables = (XSLFTable) shape;
|
||||
XSLFTableRow firstRow = tables.getRows().get(1);
|
||||
// 获取表格的第一行
|
||||
for (int i = 0; i < versionHistoryTable.size(); i++) {
|
||||
|
||||
|
||||
JSONObject obj2 = versionHistoryTable.getJSONObject(i);
|
||||
// 替换参数
|
||||
if (i==0){
|
||||
for (int col = 0; col < firstRow.getCells().size(); col++) {
|
||||
XSLFTableCell cell = firstRow.getCells().get(col);
|
||||
String text = cell.getText();
|
||||
JSONObject obj2 = versionHistoryTable.getJSONObject(i);
|
||||
// 替换参数
|
||||
if (i==0){
|
||||
for (int col = 0; col < firstRow.getCells().size(); col++) {
|
||||
XSLFTableCell cell = firstRow.getCells().get(col);
|
||||
String text = cell.getText();
|
||||
|
||||
text = text.replace("{{version}}", obj2.getString("P_versions"));
|
||||
text = text.replace("{{company}}", obj2.getString("Issuing_department"));
|
||||
text = text.replace("{{creauser}}", obj2.getString("Drafted_and_revised_by"));
|
||||
text = text.replace("{{date}}", obj2.getString("Drafted_and_revised_date"));
|
||||
text = text.replace("{{shen_user}}",obj2.getString("auditor") );
|
||||
text = text.replace("{{fuhe_user}}", obj2.getString("reviewer"));
|
||||
text = text.replace("{{shenpi_user}}", obj2.getString("approver"));
|
||||
text = text.replace("{{person}}", obj2.getString("Contents_and_reasons_for_revision"));
|
||||
cell.setText(text);
|
||||
text = text.replace("{{version}}", obj2.getString("P_versions"));
|
||||
text = text.replace("{{company}}", obj2.getString("Issuing_department"));
|
||||
text = text.replace("{{creauser}}", obj2.getString("Drafted_and_revised_by"));
|
||||
text = text.replace("{{date}}", obj2.getString("Drafted_and_revised_date"));
|
||||
text = text.replace("{{shen_user}}",obj2.getString("auditor") );
|
||||
text = text.replace("{{fuhe_user}}", obj2.getString("reviewer"));
|
||||
text = text.replace("{{shenpi_user}}", obj2.getString("approver"));
|
||||
text = text.replace("{{person}}", obj2.getString("Contents_and_reasons_for_revision"));
|
||||
cell.setText(text);
|
||||
|
||||
}
|
||||
}else {
|
||||
XSLFTableRow newRow = table.addRow();
|
||||
}
|
||||
}else {
|
||||
XSLFTableRow newRow = table.addRow();
|
||||
|
||||
// 复制单元格
|
||||
for (int col = 0; col < firstRow.getCells().size(); col++) {
|
||||
XSLFTableCell cell = firstRow.getCells().get(col);
|
||||
XSLFTableCell newCell = newRow.addCell();
|
||||
newCell.setText(cell.getText());
|
||||
}
|
||||
for (int col = 0; col < newRow.getCells().size(); col++) {
|
||||
XSLFTableCell cell = newRow.getCells().get(col);
|
||||
String text = cell.getText();
|
||||
// 复制单元格
|
||||
for (int col = 0; col < firstRow.getCells().size(); col++) {
|
||||
XSLFTableCell cell = firstRow.getCells().get(col);
|
||||
XSLFTableCell newCell = newRow.addCell();
|
||||
newCell.setText(cell.getText());
|
||||
}
|
||||
for (int col = 0; col < newRow.getCells().size(); col++) {
|
||||
XSLFTableCell cell = newRow.getCells().get(col);
|
||||
String text = cell.getText();
|
||||
|
||||
text = text.replace("{{version}}", obj2.getString("P_versions"));
|
||||
text = text.replace("{{company}}", obj2.getString("Issuing_department"));
|
||||
text = text.replace("{{creauser}}", obj2.getString("Drafted_and_revised_by"));
|
||||
text = text.replace("{{date}}", obj2.getString("Drafted_and_revised_date"));
|
||||
text = text.replace("{{shen_user}}",obj2.getString("auditor") );
|
||||
text = text.replace("{{fuhe_user}}", obj2.getString("reviewer"));
|
||||
text = text.replace("{{shenpi_user}}", obj2.getString("approver"));
|
||||
text = text.replace("{{person}}", obj2.getString("Contents_and_reasons_for_revision"));
|
||||
cell.setText(text);
|
||||
text = text.replace("{{version}}", obj2.getString("P_versions"));
|
||||
text = text.replace("{{company}}", obj2.getString("Issuing_department"));
|
||||
text = text.replace("{{creauser}}", obj2.getString("Drafted_and_revised_by"));
|
||||
text = text.replace("{{date}}", obj2.getString("Drafted_and_revised_date"));
|
||||
text = text.replace("{{shen_user}}",obj2.getString("auditor") );
|
||||
text = text.replace("{{fuhe_user}}", obj2.getString("reviewer"));
|
||||
text = text.replace("{{shenpi_user}}", obj2.getString("approver"));
|
||||
text = text.replace("{{person}}", obj2.getString("Contents_and_reasons_for_revision"));
|
||||
cell.setText(text);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
SDK.getLogAPI().consoleInfo("asddasdasdas");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SDK.getLogAPI().consoleInfo("asddasdasdas");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 获取PPT的第一页
|
||||
// 获取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());
|
||||
slideShows.write(out);
|
||||
slideShows.close();
|
||||
out.close();
|
||||
SDK.getLogAPI().consoleInfo("移动文件位置替换完成");
|
||||
// 替换文本框中的参数
|
||||
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());
|
||||
slideShows.write(out);
|
||||
slideShows.close();
|
||||
out.close();
|
||||
SDK.getLogAPI().consoleInfo("移动文件位置替换完成");
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
@ -605,6 +610,8 @@ public class UpFileExcelAndPptController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 更新幻灯片ID列表
|
||||
// 更新幻灯片ID列表
|
||||
// 移动幻灯片位置
|
||||
|
||||
Loading…
Reference in New Issue
Block a user