diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/aslp/UpdatePptxAndExcelAslp.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/aslp/UpdatePptxAndExcelAslp.java deleted file mode 100644 index caaf6bbb..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/aslp/UpdatePptxAndExcelAslp.java +++ /dev/null @@ -1,1102 +0,0 @@ -package com.awspaas.user.bpa.aslp; - -import com.actionsoft.apps.coe.pal.constant.CoEConstant; -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.model.PALRepositoryModel; -import com.actionsoft.apps.coe.pal.pal.repository.upfile.constant.CoeFileConstant; -import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel; -import com.actionsoft.apps.resource.interop.aslp.ASLP; -import com.actionsoft.apps.resource.interop.aslp.Meta; -import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile; -import com.actionsoft.bpms.commons.mvc.view.ResponseObject; -import com.actionsoft.bpms.server.UserContext; -import com.actionsoft.bpms.server.fs.DCContext; -import com.actionsoft.bpms.server.fs.dc.DCProfileManager; -import com.actionsoft.bpms.util.DBSql; -import com.actionsoft.bpms.util.UUIDGener; -import com.actionsoft.bpms.util.UtilDate; -import com.actionsoft.bpms.util.UtilString; -import com.actionsoft.sdk.local.SDK; -import com.alibaba.fastjson.JSONArray; -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.*; -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.*; -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; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -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 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无效"); - return ro; - } - String pl_uuid = params.get("pl_uuid").toString(); - String shape_uuid = params.get("shape_uuid").toString(); - 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); - UpfileModel model = new UpfileModel(); - model.setUuid(UUIDGener.getUUID()); - model.setPl_uuid(pl_uuid); - model.setShape_uuid(shape_uuid); - model.setDownload(1); - model.setCreateUser(UserContext.fromSessionId(sid).getUID()); - model.setCreateTime(new Timestamp(System.currentTimeMillis())); - model.setType("s"); - // model.setFileType(fileType); - model.setFileName(name); - 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(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)); - // 读取模版文件的Excel文件 - String[] filePaths = {dcContext.getFilePath(), - dcContext_old.getFilePath()}; - - ArrayList list = new ArrayList<>(); - - for (String path : filePaths) { - list.add(path); - } - - String path = dcContext.getPath(); - String fileName = name; - - 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); - // 向新Sheet页中填充数据 - // fillData(sheet1); - // fillData(sheet2); - - // 保存修改后的Excel文件 - // FileOutputStream outputStream = new FileOutputStream(dcContext.getFilePath()); - // workbook.write(outputStream); - // workbook.close(); - - - try { - - // 获取指定的 sheet 页 - XSSFSheet sheet = workbook.getSheet("封面"); - - // 查找并替换参数 - //这个是替换文件编码 - // - // - 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)) { - replaceParameter(sheet, "{{file_code}}", ""); - } 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)) { - - replaceParameter(sheet, "{{file_date}}", file_date); - } 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)) { - - replaceParameter(sheet, "{{fanwei}}", fanwei); - } else { - replaceParameter(sheet, "{{fanwei}}", ""); - } - //这个是替换L1-L4 - String L1 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L1'"); - replaceParameter(sheet, "{{L1}}", L1); - String L2 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L2'"); - replaceParameter(sheet, "{{L2}}", L2); - String L3 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L3'"); - replaceParameter(sheet, "{{L3}}", L3); - String L4 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L4'"); - replaceParameter(sheet, "{{L4}}", L4); - //这个是替换流程名称 - String process_name = DBSql.getString("select PLNAME from app_act_coe_pal_repository where ID = '" + pl_uuid + "'"); - replaceParameter(sheet, "{{process_name}}", process_name); - file.close(); - - - XSSFSheet sheet_xd = workbook.getSheet("修订记录"); - - replaceParameter(sheet_xd, "{{process_name}}", process_name); - - // 获取参数所在的行和列 - int parameterRow = 3; // 假设参数在第二行 - int parameterCol = 0; // 假设参数在第一列 - - // 获取数据起始行 - int dataStartRow = 3; // 假设数据从第四行开始 - - // 定义要替换的参数数组 - String[] parameters = {"{{number}}", "{{version}}", "{{company}}", "{{creauser}}", "{{date}}", "{{shen_user}}", "{{fuhe_user}}", "{{shenpi_user}}", "{{person}}"}; - - /*// 定义要插入的数据数组 - String[][] data = { - {"John Doe", "30", "New York"}, - {"Jane Smith", "25", "London"}, - {"Michael Johnson", "40", "Sydney"} - }; -*/ - - PALRepositoryModel palRepositoryModel = PALRepositoryCache.getCache().get(pl_uuid); - JSONArray versionHistoryTable = getVersionHistoryTable(palRepositoryModel); - String[][] strArray2 = new String[versionHistoryTable.size()][]; - System.out.println("jsonArray>>>>>>>>>>" + versionHistoryTable.toString()); - - /** - * [{"approver":"任国梁","Drafted_and_revised_date":"2023年5月08日" - * ,"auditor":"杜薇","Issuing_department":"总部金融中心经营管理办公室", - * "reviewer":"/","Contents_and_reasons_for_revision":"新增","P_versions":"V1.0","Drafted_and_revised_by":"赵苗"}] - */ - List lists = new LinkedList<>(); - 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[1] = obj2.getString("P_versions"); - strArray[2] = obj2.getString("Issuing_department"); - strArray[3] = obj2.getString("Drafted_and_revised_by"); - strArray[4] = obj2.getString("Drafted_and_revised_date"); - strArray[5] = obj2.getString("auditor"); - strArray[6] = obj2.getString("reviewer"); - strArray[7] = obj2.getString("approver"); - - 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; - } - String[][] datas = strArray2; - - // 循环替换参数 - for (int i = 0; i < parameters.length; i++) { - String parameter = parameters[i]; - String replacement = datas[0][i]; - - replaceParameter(sheet_xd, parameter, replacement, parameterRow, parameterCol); - } - - // 循环插入数据 - for (int i = 0; i < datas.length; i++) { - insertData(workbook, sheet_xd, datas[i], dataStartRow + i); - } - - - // 保存修改后的 Excel 文件 - FileOutputStream outputStream = new FileOutputStream(params.get("fil_path").toString()); - workbook.write(outputStream); - workbook.close(); - outputStream.close(); - - System.out.println("封面参数替换完成!"); - - } catch (Exception e) { - - } - } 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); - // 向新Sheet页中填充数据 - // fillData(sheet1); - // fillData(sheet2); - - // 保存修改后的Excel文件 - // FileOutputStream outputStream = new FileOutputStream(dcContext.getFilePath()); - // workbook.write(outputStream); - // workbook.close(); - - - try { - - // 获取指定的 sheet 页 - HSSFSheet sheet = workbook.getSheet("封面"); - - // 查找并替换参数 - //这个是替换文件编码 - 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)) { - replaceParameter(sheet, "{{file_code}}", ""); - } 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)) { - - replaceParameter(sheet, "{{file_date}}", file_date); - } 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)) { - - replaceParameter(sheet, "{{fanwei}}", fanwei); - } else { - replaceParameter(sheet, "{{fanwei}}", ""); - } - //这个是替换L1-L4 - String L1 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L1'"); - replaceParameter(sheet, "{{L1}}", L1); - String L2 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L2'"); - replaceParameter(sheet, "{{L2}}", L2); - String L3 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L3'"); - replaceParameter(sheet, "{{L3}}", L3); - String L4 = DBSql.getString("select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '" + pl_uuid + "' and PROPERTYID = 'Process_Architecture_L4'"); - replaceParameter(sheet, "{{L4}}", L4); - //这个是替换流程名称 - String process_name = DBSql.getString("select PLNAME from app_act_coe_pal_repository where ID = '" + pl_uuid + "'"); - replaceParameter(sheet, "{{process_name}}", process_name); - file.close(); - - - HSSFSheet sheet_xd = workbook.getSheet("修订记录"); - replaceParameter(sheet_xd, "{{process_name}}", process_name); - - - // 获取参数所在的行和列 - int parameterRow = 3; // 假设参数在第二行 - int parameterCol = 0; // 假设参数在第一列 - - // 获取数据起始行 - int dataStartRow = 3; // 假设数据从第四行开始 - - // 定义要替换的参数数组 - String[] parameters = {"{{number}}", "{{version}}", "{{company}}", "{{creauser}}", "{{date}}", "{{shen_user}}", "{{fuhe_user}}", "{{shenpi_user}}", "{{person}}"}; - - /*// 定义要插入的数据数组 - String[][] data = { - {"John Doe", "30", "New York"}, - {"Jane Smith", "25", "London"}, - {"Michael Johnson", "40", "Sydney"} - }; -*/ - - PALRepositoryModel palRepositoryModel = PALRepositoryCache.getCache().get(pl_uuid); - JSONArray versionHistoryTable = getVersionHistoryTable(palRepositoryModel); - String[][] strArray2 = new String[versionHistoryTable.size()][]; - System.out.println("jsonArray>>>>>>>>>>" + versionHistoryTable.toString()); - - /** - * [{"approver":"任国梁","Drafted_and_revised_date":"2023年5月08日" - * ,"auditor":"杜薇","Issuing_department":"总部金融中心经营管理办公室", - * "reviewer":"/","Contents_and_reasons_for_revision":"新增","P_versions":"V1.0","Drafted_and_revised_by":"赵苗"}] - */ - List lists = new LinkedList<>(); - 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[1] = obj2.getString("P_versions"); - strArray[2] = obj2.getString("Issuing_department"); - strArray[3] = obj2.getString("Drafted_and_revised_by"); - strArray[4] = obj2.getString("Drafted_and_revised_date"); - strArray[5] = obj2.getString("auditor"); - strArray[6] = obj2.getString("reviewer"); - strArray[7] = obj2.getString("approver"); - 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; - } - String[][] datas = strArray2; - - // 循环替换参数 - for (int i = 0; i < parameters.length; i++) { - String parameter = parameters[i]; - String replacement = datas[0][i]; - - replaceParameter(sheet_xd, parameter, replacement, parameterRow, parameterCol); - } - - // 循环插入数据 - for (int i = 0; i < datas.length; i++) { - insertData(workbook, sheet_xd, datas[i], dataStartRow + i); - } - - - // 保存修改后的 Excel 文件 - FileOutputStream outputStream = new FileOutputStream(params.get("fil_path").toString()); - workbook.write(outputStream); - workbook.close(); - outputStream.close(); - - System.out.println("封面参数替换完成!"); - - } catch (Exception e) { - - } - } - - - //Utils.mergeExcel(list,path+fileName); - - //Open the first excel file. - - - // 读取上传的Excel文件 - - - System.out.println("Excel文件修改成功!"); - } catch (Exception e) { - e.printStackTrace(); - } - } else if (name.endsWith(".pptx") || name.endsWith(".ppt")) { - UpfileModel model_old = new UpfileModel(); - model_old.setUuid(UUIDGener.getUUID()); - 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"; - - if (name.endsWith(".pptx") || name.endsWith(".ppt")) { - 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); - - } - } - mergedSlideShow.write(outputStream); - mergedSlideShow.close(); - outputStream.close(); - //生成之后的数据pptx - XMLSlideShow slideShows = new XMLSlideShow(new FileInputStream(mergedFileName)); - SDK.getLogAPI().consoleInfo("开始执行了吗"); - // 获取幻灯片列表 - List slides = slideShows.getSlides(); - SDK.getLogAPI().consoleInfo("幻灯片的大小是多少>>>>>>>" + slides.size()); - //移动倒数第二个至第一张幻灯 - XSLFSlide secondslide = slides.get(slides.size() - 2); - slideShows.setSlideOrder(secondslide, 0); - 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 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()) { - 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','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') "); - - 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("{{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); - } - } - } - } - - if (q != 0) { - XSLFTable tables = (XSLFTable) shape; - - XSLFTableRow firstRow = tables.getRows().get(1); - // 获取表格的第一行 - for (int i = 1; i < versionHistoryTable.size(); i++) { - 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()); - newCell.setFillColor(cell.getFillColor()); - newCell.setBorderColor(XSLFTableCell.BorderEdge.bottom, cell.getBorderColor(XSLFTableCell.BorderEdge.bottom)); - newCell.setBorderColor(XSLFTableCell.BorderEdge.top, cell.getBorderColor(XSLFTableCell.BorderEdge.top)); - newCell.setBorderColor(XSLFTableCell.BorderEdge.left, cell.getBorderColor(XSLFTableCell.BorderEdge.left)); - newCell.setBorderColor(XSLFTableCell.BorderEdge.right, cell.getBorderColor(XSLFTableCell.BorderEdge.right)); - newCell.setBorderWidth(XSLFTableCell.BorderEdge.bottom, cell.getBorderWidth(XSLFTableCell.BorderEdge.bottom)); - newCell.setBorderWidth(XSLFTableCell.BorderEdge.top, cell.getBorderWidth(XSLFTableCell.BorderEdge.top)); - newCell.setBorderWidth(XSLFTableCell.BorderEdge.left, cell.getBorderWidth(XSLFTableCell.BorderEdge.left)); - newCell.setBorderWidth(XSLFTableCell.BorderEdge.right, cell.getBorderWidth(XSLFTableCell.BorderEdge.right)); - newCell.setVerticalAlignment(cell.getVerticalAlignment()); - newCell.setHorizontalCentered(cell.isHorizontalCentered()); - newCell.setLeftInset(cell.getLeftInset()); - newCell.setRightInset(cell.getRightInset()); - newCell.setTopInset(cell.getTopInset()); - newCell.setBottomInset(cell.getBottomInset()); - } - } - - 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(); - - 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 { - System.out.println("版本2的时候怎么不进"); - 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(); - - 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); - // XSLFTableRow row = table.getRows().get(i); - - } - } - } - } - SDK.getLogAPI().consoleInfo("asddasdasdas"); - } - - } - q++; - } - - // 获取当前幻灯片中的表格对象 - // 获取PPT的第一页 - - // 替换文本框中的参数 - - 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(); - } - } - } - } - - return null; - } - - - - 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 shapes = sourceSlide.getShapes(); - for (HSLFShape shape : shapes) { - if (shape instanceof HSLFTextShape) { - HSLFTextShape textShape = (HSLFTextShape) shape; - HSLFTextShape newShape = targetSlide.createTextBox(); - newShape.setText(textShape.getText()); - newShape.setTextPlaceholder(textShape.getTextPlaceholder()); - } else { - targetSlide.addShape(shape); - } - } - } - - - - private static HSLFTextShape getMatchingTextShape(HSLFSlide slide, HSLFTextShape sourceShape) { - List shapes = slide.getShapes(); - for (HSLFShape shape : shapes) { - if (shape instanceof HSLFTextShape) { - HSLFTextShape textShape = (HSLFTextShape) shape; - if (textShape.getTextParagraphs().size() == sourceShape.getTextParagraphs().size()) { - return textShape; - } - } - } - return null; - } - // 更新幻灯片ID列表 - // 更新幻灯片ID列表 - // 移动幻灯片位置 -// 移动幻灯片位置 - - private static void copyConditionalFormatting(XSLFSlide sourceSlide, XSLFSlide targetSlide) { - List shapes = sourceSlide.getShapes(); - for (XSLFShape shape : shapes) { - if (shape instanceof XSLFTextShape) { - XSLFTextShape textShape = (XSLFTextShape) shape; - XSLFTextShape newShape = getMatchingTextShape(targetSlide, textShape); - if (newShape != null && newShape.getXmlObject() != null && newShape.getXmlObject() != null) { - textShape.getXmlObject().set(newShape.getXmlObject()); - } - } - } - } - - private static XSLFTextShape getMatchingTextShape(XSLFSlide slide, XSLFTextShape sourceShape) { - List shapes = slide.getShapes(); - for (XSLFShape shape : shapes) { - if (shape instanceof XSLFTextShape) { - XSLFTextShape textShape = (XSLFTextShape) shape; - if (textShape.getTextParagraphs().size() == sourceShape.getTextParagraphs().size()) { - return textShape; - } - } - } - return null; - } - - private static void copyImages(XSLFSlide sourceSlide, XSLFSlide targetSlide) { - for (XSLFShape shape : sourceSlide.getShapes()) { - if (shape instanceof XSLFPictureShape) { - XSLFPictureShape pictureShape = (XSLFPictureShape) shape; - XSLFPictureData pictureData = pictureShape.getPictureData(); - - try { - byte[] pictureBytes = pictureData.getData(); - String pictureType = pictureData.getContentType(); - XSLFPictureData pictureIndex = targetSlide.getSlideShow().addPicture(pictureBytes, pictureData.getType()); - - XSLFPictureShape newPictureShape = targetSlide.createPicture(pictureIndex); - newPictureShape.setAnchor(pictureShape.getAnchor()); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - } - - - - - private static void copyImages(HSLFSlide sourceSlide, HSLFSlide targetSlide) { - for (HSLFShape shape : sourceSlide.getShapes()) { - if (shape instanceof HSLFPictureShape) { - HSLFPictureShape pictureShape = (HSLFPictureShape) shape; - HSLFPictureData pictureData = pictureShape.getPictureData(); - - try { - byte[] pictureBytes = pictureData.getData(); - String pictureType = pictureData.getContentType(); - HSLFPictureData pictureIndex = targetSlide.getSlideShow().addPicture(pictureBytes, pictureData.getType()); - - HSLFPictureShape newPictureShape = targetSlide.createPicture(pictureIndex); - newPictureShape.setAnchor(pictureShape.getAnchor()); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - } - - - /** - *获取修订记录 - * @param repositoryModel - * @return - */ - private JSONArray getVersionHistoryTable(PALRepositoryModel repositoryModel) { - JSONArray versionHistoryTable = new JSONArray();// 修订记录 - List list = PALRepositoryCache.getByVersionId(repositoryModel.getVersionId()); - list.sort((m1, m2)-> { - return m1.getVersion() - m2.getVersion() > 0 ? 1 : -1; - }); - for (PALRepositoryModel model : list) { - if(model.getVersion()>repositoryModel.getVersion()) { - continue; - } - JSONObject obj = new JSONObject(); - Map map = PALRepositoryQueryAPIManager.queryRepositoryAttributeById(model.getId()); - // 版本P_versions - String attr = "P_versions"; - String val = ""; - String plvers = model.getVersion()+""; - String plver = ""; - if (!"".equals(plvers)) { - if (plvers.length() > 1) { - plver = plvers.substring(0, 1) + "." - + plvers.substring(plvers.length() - 1, plvers.length()); - } else { - plver = plvers.substring(0, 1) + ".0"; - } - } - //val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", ""); - obj.put(attr, "V"+plver); - - // 拟制/修订单位Issuing_department - attr = "Issuing_department"; - val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", ""); - obj.put(attr, val); - // 拟制/修订人Drafted_and_revised_by - attr = "Drafted_and_revised_by"; - val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", ""); - obj.put(attr, val); - // 拟制/修订日期Drafted_and_revised_date - attr = "Drafted_and_revised_date"; - val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", ""); - if (UtilString.isNotEmpty(val)) { - try { - Timestamp timestamp = UtilDate.parseTsFromDateTime(val); - val = UtilDate.yearFormat(timestamp) + "年" + Integer.parseInt(UtilDate.monthFormat(timestamp)) + "月" + UtilDate.dayFormat(timestamp) + "日"; - } catch (Exception e) { - e.printStackTrace(); - } - } - obj.put(attr, val); - // 审核人auditor - attr = "auditor"; - val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", ""); - obj.put(attr, val); - // 复核人reviewer - attr = "reviewer"; - val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", ""); - obj.put(attr, val); - // 审批人approver - attr = "approver"; - val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", ""); - obj.put(attr, val); - // 修订内容及理由Contents_and_reasons_for_revision - attr = "Contents_and_reasons_for_revision"; - val = specialCharTransfer(map.containsKey(attr) ? (map.get(attr).getString("text")) : "").replace("\n", ""); - obj.put(attr, val); - - versionHistoryTable.add(obj); - } - return versionHistoryTable; - } - - public static String specialCharTransfer(String str) { - if (str == null || "".equals(str.trim())) { - return str; - } - return str.replace("&", "&"); - } - - /** - * 解决xlsx文件 - * @param sheet - * @param parameter - * @param replacement - * @param row - * @param col - */ - private static void replaceParameter(XSSFSheet sheet, String parameter, String replacement, int row, int col) { - XSSFRow rowData = sheet.getRow(row); - if (rowData == null) { - rowData = sheet.createRow(row); - } - - XSSFCell cell = rowData.getCell(col); - if (cell == null) { - cell = rowData.createCell(col); - } - - 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); - } - } - - - /** - * 解决xls文件的 - * @param sheet - * @param parameter - * @param replacement - * @param row - * @param col - */ - private static void replaceParameter(HSSFSheet sheet, String parameter, String replacement, int row, int col) { - HSSFRow rowData = sheet.getRow(row); - if (rowData == null) { - rowData = sheet.createRow(row); - } - - HSSFCell cell = rowData.getCell(col); - if (cell == null) { - cell = rowData.createCell(col); - } - - 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); - } - } - - /** - * 插入数据xlsx的 - * @param sheet - * @param rowData - * @param 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); - } - } - - /** - * 插入数据xls的 - * @param sheet - * @param rowData - * @param 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); - } - } - - /** - * 替换参数xlsx的 - * @param sheet - * @param parameter - * @param replacement - */ - private static void replaceParameter(XSSFSheet sheet, String parameter, String replacement) { - for (Row row : sheet) { - for (Cell cell : row) { - 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); - } - } - } - } - - } - /** - * 替换参数xls的 - * @param sheet - * @param parameter - * @param replacement - */ - private static void replaceParameter(HSSFSheet sheet, String parameter, String replacement) { - for (Row row : sheet) { - for (Cell cell : row) { - 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); - } - } - } - } - - } - - public DCContext getDCContext(UpfileModel model,UserContext userContext) { - DCContext dcContext = null; - DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE); - if (dcProfile != null) { - if ("f".equals(model.getType())) {// 文件 - dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", - model.getPl_uuid(), model.getFileName()); - } else {// 图形 - dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, model.getPl_uuid(), - model.getShape_uuid(), model.getFileName()); - } - } - return dcContext; - } - -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/at/GetOrgPostByName.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/at/GetOrgPostByName.java deleted file mode 100644 index 9881724f..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/at/GetOrgPostByName.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.awspaas.user.bpa.at; - -import com.actionsoft.bpms.bo.engine.BO; -import com.actionsoft.bpms.commons.at.AbstExpression; -import com.actionsoft.bpms.commons.at.ExpressionContext; -import com.actionsoft.exception.AWSExpressionException; -import com.actionsoft.sdk.local.SDK; - -public class GetOrgPostByName extends AbstExpression { - public GetOrgPostByName(ExpressionContext atContext, String expressionValue) { - super(atContext, expressionValue); - } - - @Override - public String execute(String s) throws AWSExpressionException { - String boName = getParameter(s,1); - String zd_name = getParameter(s,2); - String name = getParameter(s,3); - String set_name = getParameter(s,4); - String names = zd_name.concat(" = "); - BO detail = SDK.getBOAPI().query(boName, true).addQuery(names, name).detail(); - if (detail!=null){ - String set_name1 = detail.getString(set_name); - return set_name1; - }else { - return ""; - } - } -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/at/getSJNumsByprocess.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/at/getSJNumsByprocess.java deleted file mode 100644 index 6bc7e911..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/at/getSJNumsByprocess.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.awspaas.user.bpa.at; - -import com.actionsoft.bpms.bo.engine.BO; -import com.actionsoft.bpms.commons.at.AbstExpression; -import com.actionsoft.bpms.commons.at.ExpressionContext; -import com.actionsoft.bpms.util.DBSql; -import com.actionsoft.exception.AWSExpressionException; -import com.actionsoft.sdk.local.SDK; - -public class getSJNumsByprocess extends AbstExpression { - public getSJNumsByprocess(ExpressionContext atContext, String expressionValue) { - super(atContext, expressionValue); - } - - @Override - public String execute(String s) throws AWSExpressionException { - String bindid = getParameter(s,1); - BO bo_eu_pal_pulbish_success = SDK.getBOAPI().query("BO_EU_PAL_PULBISH_SUCCESS", true).addQuery("BINDID = ", bindid).detail(); - if (bo_eu_pal_pulbish_success!=null){ - String processid = bo_eu_pal_pulbish_success.getString("PROCESSID"); - String num = DBSql.getString("select count(user_id) AS NUMBERS from BO_ACT_DATAID where 1=1 AND PROCESSID = '" + processid + "'"); - String read_num = DBSql.getString("select count(user_id) AS NUMBERS from BO_ACT_ALREADY_DATAID where 1=1 AND PROCESSID = '" + processid + "'"); - Integer data = Integer.parseInt(num)+Integer.parseInt(read_num); - System.out.println("data>>>>>>>>>>>"+data - ); - return String.valueOf(data); - }else { - return ""; - } - - } -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/controller/GetOpenDataController.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/controller/GetOpenDataController.java deleted file mode 100644 index 2059f2fd..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/controller/GetOpenDataController.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.awspaas.user.bpa.controller; - -import com.actionsoft.bpms.bo.engine.BO; -import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance; -import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance; -import com.actionsoft.bpms.commons.database.RowMap; -import com.actionsoft.bpms.commons.mvc.view.ResponseObject; -import com.actionsoft.bpms.server.UserContext; -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.sdk.local.SDK; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.awspaas.user.bpa.util.PalUtil; - -@Controller -public class GetOpenDataController { - @Mapping("com.awspaas.user.bpa.controller.GetOpenDataController.getHtmlPage") - //./w?sid=@sid&cmd=CLIENT_BPM_WORKLIST_PROCESSINST_CREATE_AJAX_PREPAGE&processGroupId=obj_049cd0b7cd864c078ae35e4a79dc0a76&processDefId=obj_19f3b1d5083841a6a44af73400d5305e - public String getHtmlPage(String sid,String processDefId){ - ResponseObject ro = ResponseObject.newOkResponse(); - UserContext userContext = UserContext.fromSessionId(sid); - ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance(processDefId, userContext.getUID(), ""); - //SDK.getProcessAPI().start(processInstance); - TaskInstance taskInst = SDK.getProcessAPI().start(processInstance).fetchActiveTasks().get(0); - String formPage = SDK.getFormAPI().getFormPage(userContext, processInstance, taskInst, 1, 1, null, null); - return formPage; - } - - - // @Mapping("COE_PAL_OUTPUTREPORT_JSON_DATA") - @Mapping("com.actionsoft.apps.bpa.pal_report_json_data") - public String COEPALOutPutReportJsonData(UserContext me, String language, String templateOperate) { - PalUtil outPutReport = new PalUtil(); - return outPutReport.jsonData(me.getSessionId(),language, templateOperate); - } - - - @Mapping("com.actionsoft.apps.bpa.getSjNumByprocess") - public JSONObject getSjNumByprocess(String sid, String bindid) { - JSONObject result = new JSONObject(); - BO bo_eu_pal_pulbish_success = SDK.getBOAPI().query("BO_EU_PAL_PULBISH_SUCCESS", true).addQuery("BINDID = ", bindid).detail(); - if (bo_eu_pal_pulbish_success!=null){ - String processid = bo_eu_pal_pulbish_success.getString("PROCESSID"); - String num = DBSql.getString("select count(user_id) AS NUMBERS from BO_ACT_DATAID where 1=1 AND PROCESSID = '" + processid + "'"); - String read_num = DBSql.getString("select count(user_id) AS NUMBERS from BO_ACT_ALREADY_DATAID where 1=1 AND PROCESSID = '" + processid + "'"); - Integer data = Integer.parseInt(num)+Integer.parseInt(read_num); - bo_eu_pal_pulbish_success.set("SENDNUMSJ",data); - SDK.getBOAPI().update("BO_EU_PAL_PULBISH_SUCCESS",bo_eu_pal_pulbish_success); - result.put("data",data); - } - return result; - } - - @Mapping("com.actionsoft.apps.bpa.IsHidden_Modeling_Guidance") - public String IsHidden_Modeling_Guidance(String sid) { - String property = SDK.getAppAPI().getProperty("com.awspaas.user.apps.app20221008163300", "JM_HIDDEN"); - return property; - } - - @Mapping("com.awspaas.user.bpa.controller.GetOpenDataController.GetName") - public JSONObject GetName(String sid, String boName, String zd_name, String name, String set_name) { - //String boName = getParameter(s,1); - // String zd_name = getParameter(s,2); - // String name = getParameter(s,3); - // String set_name = getParameter(s,4); - String names = zd_name.concat(" = "); - JSONObject result= new JSONObject(); - if (boName.contains("BO_")&&( boName.lastIndexOf("1")!=(boName.length()-1))){ - BO detail = SDK.getBOAPI().query(boName, true).addQuery(names, name).detail(); - if (detail!=null){ - String set_name1 = detail.getString(set_name); - System.out.println("数据>>>>>>>>>"+set_name1); - - result.put("data",set_name1); - return result; - }else { - result.put("data",""); - return result; - } - }else { - boName= boName.substring(0,boName.lastIndexOf("1")); - String sql = boName+"'" + name + "'"; - System.out.println("sql = >>>>>>>>"+sql); - RowMap map = DBSql.getMap(sql); - System.out.println("map>>>>>>>>"+map); - if (map!=null){ - String set_name1 = map.getString(set_name); - System.out.println("数据>>>>>>>>>"+set_name1); - result.put("data",set_name1); - return result; - }else { - result.put("data",""); - return result; - } - } - } - - - @Mapping("com.awspaas.user.apps.app.controller.Delete_Pal_RePOSITORY") - public ResponseObject delete_pal(String sid,String plId) { - ResponseObject ro = ResponseObject.newOkResponse(); - String sql = "DELETE FROM BO_EU_PAL_REPOSITORY"; - int update = DBSql.update(sql); - if(update>0) { - ro.put("result", "ok"); - }else { - ro.put("result", "error"); - } - return ro; - } - - - - -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/controller/UpateFileStateController.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/controller/UpateFileStateController.java deleted file mode 100644 index a8f39c46..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/controller/UpateFileStateController.java +++ /dev/null @@ -1,278 +0,0 @@ -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; - -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; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.Map; - -/** - * 修改文件状态 - * @author lihongyu - * - */ -@Controller -public class UpateFileStateController { - private static Logger logger = LoggerFactory.getLogger(UpateFileStateController.class); - - // 修改文件发布状态 - @Mapping("com.awspaas.user.apps.app.controller.updatePalFileState_new") - public ResponseObject checkIsSend(UserContext me , String sid, String plIds, String state, String type) { - System.err.println("修改文件状态========>" + plIds + "/" + state + "/" + type); - ResponseObject ro = ResponseObject.newOkResponse(); - int count = 0; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - 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(); - bo_eu_pal_repository.set("ISPUBLISH",state); - SDK.getBOAPI().update("BO_EU_PAL_REPOSITORY",bo_eu_pal_repository); - //修改发布状态 - String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISPUBLISH = '" + state + "',MODIFYDATE = TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '" + plId - + "'"; - 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 + "'"; - 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 = - * 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 + "'"); } } - */ - 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("修改为发布状态后同步权限数据到权限阅览成功===========>"); - } - } else if ("2".equals(type)) { - BO bo_eu_pal_repository = SDK.getBOAPI().query("BO_EU_PAL_REPOSITORY").addQuery("PLID = ", plId).detail(); - bo_eu_pal_repository.set("ISAPPROVAL",state); - SDK.getBOAPI().update("BO_EU_PAL_REPOSITORY",bo_eu_pal_repository); - // 修改流程文件的审批状态 - String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISAPPROVAL = '" + state + "',MODIFYDATE =TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '" + plId - + "'"; - System.err.println("审批改为设计=======>" + updataSql); - count = DBSql.update(updataSql); - PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId); - if (model!=null){ - PALRepositoryCache.getCache().put(plId,model); - } - SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>"); - } else if ("3".equals(type)) { - // 重新生成手册 - PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId); - String taskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin", "", plId); - System.err.println("======手动生成手册id======"+taskId); - // 刷新预览加载的表 - String sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + taskId + "' WHERE PLID = '" + plId + "'"; - DBSql.update(sqlr); - String sql1 = "SELECT ID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID = '" + plId + "'"; - String sql2 = "SELECT ID FROM BO_ACT_COE_PUBLISH_C WHERE CHANGEDFILEIDNEW = '" + plId + "'"; - if (UtilString.isNotEmpty(DBSql.getString(sql1))) { - count = DBSql.update( - "UPDATE BO_ACT_COE_PUBLISH_N SET TASKID='" + taskId + "'WHERE PUBLISHFILEID ='" + plId + "'"); - } - if (UtilString.isNotEmpty(DBSql.getString(sql2))) { - count = DBSql.update( - "UPDATE BO_ACT_COE_PUBLISH_C SET TASKID='" + taskId + "'WHERE CHANGEDFILEIDNEW ='" + plId + "'"); - } - if (count != 0) { - DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId + "'WHERE PALREPOSITORYID='" - + plId + "'"); - } - System.err.println("重新生成手册成功=====》" + count); - }else if ("4".equals(type)) { - BO bo_eu_pal_repository = SDK.getBOAPI().query("BO_EU_PAL_REPOSITORY").addQuery("PLID = ", plId).detail(); - bo_eu_pal_repository.set("ISSTOP",state); - SDK.getBOAPI().update("BO_EU_PAL_REPOSITORY",bo_eu_pal_repository); - // 修改流程文件的停用状态 - String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISSTOP = '" + state + "',MODIFYDATE = TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '" + plId - + "'"; - System.err.println("停用改设计=======>" + updataSql); - count = DBSql.update(updataSql); - PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId); - if (model!=null){ - PALRepositoryCache.getCache().put(plId,model); - } - SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>"); - } - } - - - if (count > 0) { - /* - * 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(); - */ - - ro.put("result", "ok"); - } else { - ro.put("result", "error"); - } - return ro; - } - - /** - * 文件修改为发布状态时同步权限数据到权限阅览 - * - * @param palId palid - * @param me me - */ - private void createPermScopeData(String palId , UserContext me) { - PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(palId); - String plVersionid = parentModel.getVersionId(); - BO oldBo = (BO) ((BOQueryAPI) SDK.getBOAPI().query("BO_ACT_PUBLISH_PERM_SCOPE").addQuery("PALVERSIONID = ", plVersionid)).detail(); - if (oldBo == null) { - 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); - } - } - - 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; - } - - public void UpdateDept(PALRepositoryModel palRepositoryModel,String id){ - int count = 0; - int count2 = 0; - try { - Map 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 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+"'"); - - } - } - -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/CreateVER_ACTIVITYJob.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/CreateVER_ACTIVITYJob.java deleted file mode 100644 index de3a6731..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/CreateVER_ACTIVITYJob.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.awspaas.user.bpa.job; - -import com.actionsoft.bpms.bo.engine.BO; -import com.actionsoft.bpms.bpmn.engine.model.run.delegate.HistoryTaskInstance; -import com.actionsoft.bpms.schedule.IJob; -import com.actionsoft.bpms.server.UserContext; -import com.actionsoft.bpms.util.DBSql; -import com.actionsoft.bpms.util.UtilString; -import com.actionsoft.sdk.local.SDK; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.awspaas.user.bpa.util.UtilUrls; -import org.dom4j.Document; -import org.dom4j.DocumentHelper; -import org.dom4j.Element; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -import java.util.List; - -public class CreateVER_ACTIVITYJob implements IJob { - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - try { - DBSql.update("delete from APP_ACT_BPAD_P_VER_ACTIVITY"); - //jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() - //jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() - String xmlStr = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; - - System.out.println("参数==============="+xmlStr); - UserContext userContext = UserContext.fromUID("admin"); - //System.out.println("参数==============="+xmls); - //HttpClientUtil httpClientUtil = new HttpClientUtil(); - int timeout = 600000; - // HttpURLConnection 发送SOAP请求 - System.out.println("HttpURLConnection 发送SOAP请求"); - - String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); - - - Document document = DocumentHelper.parseText(postSoap); - Element rootElement = document.getRootElement(); - // System.out.println("rootElement>>>>>>"+rootElement); - Element result = rootElement.element("Body").element("getAllWfIdResponse").element("out"); - String resultString = result.getData().toString(); - //System.out.println("resultString=>>>>>>>>>>"+resultString); - JSONArray jsonArray = JSON.parseArray(resultString); - - for (int i=0;i { - public DimensionCache(CachePluginProfile configuration) { - super(configuration); - registeIndex(DimensionParentIndex.class, (CacheIndex)new DimensionParentIndex()); - } - - public List getDimensionListOfParent(String parentDimensionId) { - List list = iteratorToList(getCache().getByIndex(DimensionParentIndex.class, parentDimensionId)); - return list; - } - - protected void load() { - DimensionDao dimensionDao = new DimensionDao(); - IDaoQuery iDaoQuery = dimensionDao.query(); - List dimensionModels = iDaoQuery.list(); - for (DimensionModel dimensionModel : dimensionModels) - put(dimensionModel.getId(), (DimensionModel) dimensionModel, false); - } - - - - public static DimensionCache getCache() { - return (DimensionCache)CacheManager.getCache(DimensionCache.class); - } - - class DimensionParentIndex extends ListValueIndex { - public String key(DimensionModel t) { - return t.getParentId(); - } - } - } - - diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/DimensionDao.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/DimensionDao.java deleted file mode 100644 index 3adcad71..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/DimensionDao.java +++ /dev/null @@ -1,160 +0,0 @@ -/* */ package com.awspaas.user.bpa.job; -/* */ -/* */ import com.actionsoft.bpms.bo.engine.SQLNullValue; -/* */ import com.actionsoft.bpms.commons.database.RowMapper; -/* */ import com.actionsoft.bpms.commons.mvc.dao.DaoObject; -/* */ import com.actionsoft.bpms.util.DBSql; -/* */ import com.actionsoft.bpms.util.UUIDGener; -/* */ import com.actionsoft.bpms.util.UtilString; -/* */ import com.actionsoft.exception.AWSDataAccessException; -/* */ import com.actionsoft.exception.AWSException; -/* */ import java.io.Serializable; -/* */ import java.sql.Connection; -/* */ import java.sql.ResultSet; -/* */ import java.sql.SQLException; -/* */ import java.util.HashMap; -/* */ import java.util.Iterator; -/* */ import java.util.List; -/* */ import java.util.Map; -/* */ -/* */ public class DimensionDao extends DaoObject { -/* */ public int insert(Connection conn, DimensionModel model) throws AWSDataAccessException { -/* 40 */ if (UtilString.isEmpty(model.getId())) -/* 41 */ model.setId(UUIDGener.getUUID()); -/* 43 */ Map paraMap = new HashMap<>(); -/* 44 */ paraMap.put("ID", model.getId()); -/* 45 */ paraMap.put("DIMENSIONNAME", model.getDimensionName()); -/* 46 */ paraMap.put("CREATEUSER", model.getCreateUser()); -/* 47 */ paraMap.put("CREATETIME", model.getCreateTime()); -/* 48 */ paraMap.put("HOTSPOTDEFID", model.getHotspotDefId()); -/* 49 */ paraMap.put("ISENABLED", Integer.valueOf(model.getIsEnabled())); -/* 50 */ paraMap.put("ISEXAMINE", Integer.valueOf(model.getIsExamine())); -/* 52 */ if (model.getMemo() == null) { -/* 53 */ paraMap.put("MEMO", SQLNullValue.newInstance(12)); -/* */ } else { -/* 55 */ paraMap.put("MEMO", model.getMemo()); -/* */ } -/* 58 */ paraMap.put("PARENTID", model.getParentId()); -/* 59 */ paraMap.put("SHOWTYPE", Integer.valueOf(model.getShowType())); -/* 61 */ if (model.getLastUpdate() == null) { -/* 62 */ paraMap.put("LASTUPDATE", SQLNullValue.newInstance(91)); -/* */ } else { -/* 64 */ paraMap.put("LASTUPDATE", model.getLastUpdate()); -/* */ } -/* 67 */ paraMap.put("ORDERINDEX", Integer.valueOf(model.getOrderIndex())); -/* 69 */ int result = 0; -/* 70 */ if (conn == null) { -/* 71 */ result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap); -/* */ } else { -/* 73 */ result = DBSql.update(conn, DBSql.getInsertStatement(entityName(), paraMap), paraMap); -/* */ } -/* 75 */ if (result == 1) -/* 76 */ DimensionCache.getCache().put(model.getId(), (DimensionModel) model); -/* 78 */ return result; -/* */ } -/* */ -/* */ public int insert(DimensionModel model) throws AWSDataAccessException { -/* 83 */ return insert((Connection)null, model); -/* */ } -/* */ -/* */ public int update(Connection conn, DimensionModel model) throws AWSDataAccessException { -/* 96 */ if (UtilString.isEmpty(model.getId())) -/* 97 */ throw new AWSDataAccessException("Method getId() Does Not Allow Empty"); -/* 99 */ Map paraMap = new HashMap<>(); -/* 100 */ paraMap.put("DIMENSIONNAME", model.getDimensionName()); -/* 101 */ paraMap.put("CREATEUSER", model.getCreateUser()); -/* 102 */ paraMap.put("CREATETIME", model.getCreateTime()); -/* 103 */ paraMap.put("HOTSPOTDEFID", model.getHotspotDefId()); -/* 104 */ paraMap.put("ISENABLED", Integer.valueOf(model.getIsEnabled())); -/* 105 */ paraMap.put("ISEXAMINE", Integer.valueOf(model.getIsExamine())); -/* 106 */ paraMap.put("MEMO", model.getMemo()); -/* 107 */ paraMap.put("PARENTID", model.getParentId()); -/* 108 */ paraMap.put("SHOWTYPE", Integer.valueOf(model.getShowType())); -/* 109 */ if (model.getLastUpdate() == null) { -/* 110 */ paraMap.put("LASTUPDATE", SQLNullValue.newInstance(91)); -/* */ } else { -/* 112 */ paraMap.put("LASTUPDATE", model.getLastUpdate()); -/* */ } -/* 115 */ paraMap.put("ORDERINDEX", Integer.valueOf(model.getOrderIndex())); -/* 117 */ int result = 0; -/* 118 */ if (conn == null) { -/* 119 */ result = update(model.getId(), paraMap); -/* */ } else { -/* 121 */ result = update(conn, model.getId(), paraMap); -/* */ } -/* 123 */ if (result == 1) -/* 124 */ DimensionCache.getCache().put(model.getId(), (DimensionModel) model); -/* 126 */ return result; -/* */ } -/* */ -/* */ public int update(DimensionModel model) throws AWSDataAccessException { -/* 131 */ return update((Connection)null, model); -/* */ } -/* */ -/* */ public String entityName() { -/* 136 */ return "APP_ACT_KMS_DIMENSION"; -/* */ } -/* */ -/* */ public RowMapper rowMapper() { -/* 141 */ return new RowMapper() { -/* */ public DimensionModel mapRow(ResultSet rs, int rowNum) throws SQLException { -/* 144 */ return DimensionDao.this.record2Model(rs); -/* */ } -/* */ }; -/* */ } -/* */ -/* */ public DimensionModel record2Model(ResultSet rs) { -/* 150 */ DimensionModel dimensionModel = new DimensionModel(); -/* */ try { -/* 152 */ dimensionModel.setId(rs.getString("ID")); -/* 153 */ dimensionModel.setCreateTime(rs.getTimestamp("CREATETIME")); -/* 154 */ dimensionModel.setCreateUser(rs.getString("CREATEUSER")); -/* 155 */ dimensionModel.setDimensionName(rs.getString("DIMENSIONNAME")); -/* 156 */ dimensionModel.setHotspotDefId(rs.getString("HOTSPOTDEFID")); -/* 157 */ dimensionModel.setIsEnabled(rs.getInt("ISENABLED")); -/* 158 */ dimensionModel.setIsExamine(rs.getInt("ISEXAMINE")); -/* 159 */ dimensionModel.setLastUpdate(rs.getTimestamp("LASTUPDATE")); -/* 160 */ dimensionModel.setMemo(rs.getString("MEMO")); -/* 161 */ String parentId = rs.getString("PARENTID"); -/* 162 */ dimensionModel.setParentId((parentId == null) ? "" : parentId.trim()); -/* 163 */ dimensionModel.setShowType(rs.getInt("SHOWTYPE")); -/* 164 */ dimensionModel.setOrderIndex(rs.getInt("ORDERINDEX")); -/* 165 */ } catch (Exception e) { -/* 166 */ e.printStackTrace(); -/* 167 */ throw new AWSException(e); -/* */ } -/* 169 */ return dimensionModel; -/* */ } -/* */ -/* */ public int delete(List dimensionIdList) throws AWSDataAccessException { -/* 182 */ StringBuilder sqlWhere = new StringBuilder("("); -/* 183 */ for (int i = 0; i < dimensionIdList.size(); i++) -/* 184 */ sqlWhere.append("'" + (String)dimensionIdList.get(i) + "',"); -/* 186 */ String sqlWhere1 = sqlWhere.substring(0, sqlWhere.lastIndexOf(",")); -/* 187 */ sqlWhere1 = sqlWhere1 + ")"; -/* 188 */ String sql = "DELETE FROM " + entityName() + " WHERE " + pkFieldName() + " IN " + sqlWhere1; -/* 190 */ int result = DBSql.update(sql); -/* 192 */ DimensionCache dimensionCache = DimensionCache.getCache(); -/* 193 */ for (String id : dimensionIdList) -/* 194 */ dimensionCache.remove(id); -/* 196 */ return result; -/* */ } -/* */ -/* */ public void fillDescendantDimensions(String id, List dimensionIds) { -/* 207 */ Iterator iterator = DimensionCache.getCache().iterator(); -/* 208 */ while (iterator.hasNext()) { -/* 209 */ DimensionModel dimensionModel = iterator.next(); -/* 210 */ if (id.equals(dimensionModel.getParentId())) { -/* 211 */ dimensionIds.add(dimensionModel.getId()); -/* 212 */ String id1 = dimensionModel.getId(); -/* 213 */ fillDescendantDimensions(id1, dimensionIds); -/* */ } -/* */ } -/* */ } -/* */ } - - -/* Location: C:\Users\12976\Desktop\com.actionsoft.apps.kms.jar!\com\actionsoft\apps\kms\dao\DimensionDao.class - * Java compiler version: 8 (52.0) - * JD-Core Version: 1.1.3 - */ \ No newline at end of file diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/DimensionModel.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/DimensionModel.java deleted file mode 100644 index 136c80de..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/DimensionModel.java +++ /dev/null @@ -1,184 +0,0 @@ - package com.awspaas.user.bpa.job; - - import com.actionsoft.bpms.commons.mvc.model.IModelBean; - import com.actionsoft.bpms.commons.mvc.model.ModelBean; - import java.sql.Timestamp; - - public class DimensionModel extends ModelBean implements IModelBean, Cloneable { - private static final long serialVersionUID = 1L; - - public static final String ID = "ID"; - - public static final String DIMENSIONNAME = "DIMENSIONNAME"; - - public static final String PARENTID = "PARENTID"; - - public static final String SHOWTYPE = "SHOWTYPE"; - - public static final String ISEXAMINE = "ISEXAMINE"; - - public static final String MEMO = "MEMO"; - - public static final String CREATEUSER = "CREATEUSER"; - - public static final String CREATETIME = "CREATETIME"; - - public static final String LASTUPDATE = "LASTUPDATE"; - - public static final String HOTSPOTDEFID = "HOTSPOTDEFID"; - - public static final String ISENABLED = "ISENABLED"; - - public static final String ORDERINDEX = "ORDERINDEX"; - - private String id; - - private String dimensionName; - - private String parentId; - - private int showType; - - private int isExamine; - - private String memo; - - private String createUser; - - private Timestamp createTime; - - private Timestamp lastUpdate; - - private String hotspotDefId; - - private int isEnabled; - - private int orderIndex; - - private boolean hasPerm = true; - - public String getId() { - return this.id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDimensionName() { - if (this.dimensionName == null) -/* 55 */ this.dimensionName = ""; -/* 57 */ return this.dimensionName; - } - - public void setDimensionName(String dimensionName) { -/* 61 */ this.dimensionName = dimensionName; - } - - public String getParentId() { -/* 65 */ if (this.parentId == null) -/* 66 */ this.parentId = ""; -/* 68 */ return this.parentId; - } - - public void setParentId(String parentId) { -/* 72 */ this.parentId = parentId; - } - - public int getShowType() { -/* 76 */ return this.showType; - } - - public void setShowType(int showType) { -/* 80 */ this.showType = showType; - } - - public int getIsExamine() { -/* 84 */ return this.isExamine; - } - - public void setIsExamine(int isExamine) { -/* 88 */ this.isExamine = isExamine; - } - - public String getMemo() { -/* 92 */ if (this.memo == null) -/* 93 */ this.memo = ""; -/* 95 */ return this.memo; - } - - public void setMemo(String memo) { -/* 99 */ this.memo = memo; - } - - public String getCreateUser() { -/* 103 */ if (this.createUser == null) -/* 104 */ this.createUser = ""; -/* 106 */ return this.createUser; - } - - public void setCreateUser(String createUser) { -/* 110 */ this.createUser = createUser; - } - - public Timestamp getCreateTime() { -/* 114 */ return this.createTime; - } - - public void setCreateTime(Timestamp createTime) { -/* 118 */ this.createTime = createTime; - } - - public Timestamp getLastUpdate() { -/* 122 */ return this.lastUpdate; - } - - public void setLastUpdate(Timestamp lastUpdate) { -/* 126 */ this.lastUpdate = lastUpdate; - } - - public String getHotspotDefId() { -/* 130 */ if (this.hotspotDefId == null) -/* 131 */ this.hotspotDefId = ""; -/* 133 */ return this.hotspotDefId; - } - - public void setHotspotDefId(String hotspotDefId) { -/* 137 */ this.hotspotDefId = hotspotDefId; - } - - public int getIsEnabled() { -/* 141 */ return this.isEnabled; - } - - public void setIsEnabled(int isEnabled) { -/* 145 */ this.isEnabled = isEnabled; - } - - public int getOrderIndex() { -/* 149 */ return this.orderIndex; - } - - public void setOrderIndex(int orderIndex) { -/* 153 */ this.orderIndex = orderIndex; - } - - public boolean isHasPerm() { -/* 157 */ return this.hasPerm; - } - - public void setHasPerm(boolean hasPerm) { -/* 161 */ this.hasPerm = hasPerm; - } - - public DimensionModel clone() { - try { -/* 167 */ return (DimensionModel)super.clone(); -/* 168 */ } catch (CloneNotSupportedException e) { -/* 169 */ e.printStackTrace(); -/* 170 */ return null; - } - } - } - - diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/KnowMoveOther.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/KnowMoveOther.java deleted file mode 100644 index f726e299..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/KnowMoveOther.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.awspaas.user.bpa.job; - -import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; -import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory; -import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; -import com.actionsoft.bpms.commons.database.RowMap; -import com.actionsoft.bpms.commons.login.constant.LoginConst; -import com.actionsoft.bpms.commons.mvc.view.ResponseObject; -import com.actionsoft.bpms.schedule.IJob; -import com.actionsoft.bpms.server.SSOUtil; -import com.actionsoft.bpms.server.UserContext; -import com.actionsoft.bpms.util.DBSql; -import com.actionsoft.sdk.local.SDK; -import com.actionsoft.sdk.local.api.AppAPI; -import com.alibaba.fastjson.JSONArray; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -import java.math.BigDecimal; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -public class KnowMoveOther implements IJob { - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - //UserContext uc = UserContext.fromUID("admin"); - String sessionId = new SSOUtil().registerClientSessionNoPassword("admin", LoginConst.DEFAULT_LANG, "localhost", LoginConst.DEVICE_PC); - List palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getAllCoeProcessLevelByWsId("7d3ca852-a0bd-42e6-80b1-3dcea6f55083"); - if (palRepositoryModels.size()>0){ - for (PALRepositoryModel palRepositoryModel: - palRepositoryModels) { - boolean publish = palRepositoryModel.isPublish(); - if (publish) { - //in ('org.role','data.form','process.flowchart','process.epc','control.policy','process.evc','control.kpi') - if (palRepositoryModel.getMethodId().equals("org.role") || - palRepositoryModel.getMethodId().equals("data.form") || - palRepositoryModel.getMethodId().equals("process.flowchart") || - palRepositoryModel.getMethodId().equals("process.epc") || - palRepositoryModel.getMethodId().equals("control.policy") || - palRepositoryModel.getMethodId().equals("process.evc") || - palRepositoryModel.getMethodId().equals("control.kpi")) { - String ext4 = palRepositoryModel.getExt4(); - if (ext4 != null) { - String pal_sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + palRepositoryModel.getId() + "'"; - RowMap map = DBSql.getMap(pal_sql); - if (map != null) { - String parentId = map.getString("PLPARENTID"); - System.err.println("parentId>>>>>>>>>>>>>>>>" + parentId); - //PALRepositoryModel palRepositoryModel_parent = PALRepositoryCache.getCache().get(parentId); - String pal_parent_sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + parentId + "'"; - RowMap ext41 = DBSql.getMap(pal_parent_sql); - if (ext41 != null) { - - String parent_sql = "select DIMENSIONID FROM APP_ACT_KMS_PUBLISH WHERE CARDID = '" + ext4 + "'"; - String parent_demensionid = DBSql.getString(parent_sql); - if (parent_demensionid.equals(ext41.getString("EXT4"))) { - - } else { - System.out.println("PLname>>>>>>>>>>>>>>"+palRepositoryModel.getName()); - //先取消发布知识 - execute(sessionId, ext4); - JSONArray dimensionIDArray = new JSONArray(new LinkedList<>()); - dimensionIDArray.add(ext41.getString("EXT4")); - JSONArray knwlIDArray = new JSONArray(new LinkedList<>()); - knwlIDArray.add(ext4); - publishKnow(dimensionIDArray, knwlIDArray, sessionId); - } - } - } - }else { - String name = palRepositoryModel.getName(); - double version = palRepositoryModel.getVersion(); - BigDecimal bd = new BigDecimal(version); - String versions = bd.setScale(1, BigDecimal.ROUND_DOWN).toString(); - String card_name = name+"V"+versions; - String card_sql = "select * from APP_ACT_KMS_card where cardname = '"+card_name+"'"; - RowMap map = DBSql.getMap(card_sql); - if (map!=null){ - String id = map.getString("ID"); - int update = DBSql.update("update APP_ACT_COE_PAL_REPOSITORY set EXT4 = '" + id + "' where id = '" + palRepositoryModel.getId() + "'"); - System.out.println("更新空的EXT4到pal资产库中"+update); - //先取消发布知识 - String pal_sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + palRepositoryModel.getId() + "'"; - RowMap mapss = DBSql.getMap(pal_sql); - String parentId = mapss.getString("PLPARENTID"); - System.err.println("palRepositoryModel.getId()>>>>>>>>>>>>>>>>"+palRepositoryModel.getId()+">>>>>>>>>>>>parentId>>>>>>>>>>>>>>>>" + parentId); - //PALRepositoryModel palRepositoryModel_parent = PALRepositoryCache.getCache().get(parentId); - String pal_parent_sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + parentId + "'"; - RowMap ext41 = DBSql.getMap(pal_parent_sql); - System.out.println("PLname>>>>>>>>>>>>>>"+palRepositoryModel.getName()); - execute(sessionId, id); - JSONArray dimensionIDArray = new JSONArray(new LinkedList<>()); - dimensionIDArray.add(ext41.getString("EXT4")); - JSONArray knwlIDArray = new JSONArray(new LinkedList<>()); - knwlIDArray.add(id); - publishKnow(dimensionIDArray, knwlIDArray, sessionId); - } - } - } - } - } - } - } - - /** - * 先取消发布知识,然后重新发布知识 - * @param sid - * @param knwlId - */ - public void execute(String sid,String knwlId) { -// 调用App - String sourceAppId = "com.awspaas.user.apps.new_performance_indicator_library"; -// aslp服务地址 - String aslp = "aslp://com.actionsoft.apps.kms/CancelPublishKnwl"; -// 参数定义列表 - Map params = new HashMap(); -//sid,如果为空,则需要传createUser参数,非必填 - params.put("sid", sid); -//知识ID,必填 - params.put("knwlId", knwlId); - AppAPI appAPI = SDK.getAppAPI(); -//取消发布知识(全部维度) - ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); - boolean ok = ro.isOk(); - System.out.println("取消发布成功>>>>>>>>>>"+ok); - } - - /** - * 发布知识 - * @return - */ - public void publishKnow(JSONArray dimensionIDArray,JSONArray knwlIDArray,String sid) { -// 调用App - String sourceAppId = "com.awspaas.user.apps.new_performance_indicator_library"; -// aslp服务地址 - String aslp = "aslp://com.actionsoft.apps.kms/PublishKnwl"; -// 参数定义列表 - Map params = new HashMap(); -//要发布到的维度ID的JSON数组字符串,必填 - params.put("dimensionIDArray", dimensionIDArray); - -//要发布的知识ID的JSON数组字符串,必填 - params.put("knwlIDArray", knwlIDArray); -//sid,必填 - params.put("sid", sid); - AppAPI appAPI = SDK.getAppAPI(); -//发布知识 - ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); - boolean ok = ro.isOk(); - System.out.println("移动知识文件>>>>>>>>>"+ro); - } - -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/RemovedimensionJob.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/RemovedimensionJob.java deleted file mode 100644 index c8722b6b..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/RemovedimensionJob.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.awspaas.user.bpa.job; - -import com.actionsoft.bpms.commons.database.RowMap; -import com.actionsoft.bpms.schedule.IJob; -import com.actionsoft.bpms.util.DBSql; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -import java.util.List; - -public class RemovedimensionJob implements IJob { - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - String dimension_sql = "select * from APP_ACT_KMS_DIMENSION where ID not IN ('obj_6adcee05d6f740868b2ef901dbeb85ee') and ID != 'obj_6adcee05d6f740868b2ef901dbeb85ee'"; - List maps = DBSql.getMaps(dimension_sql); - for (RowMap map: maps) { - String id = map.getString("ID"); - List maps1 = DBSql.getMaps("select * from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '" + id + "'"); - System.out.println("maps1>>>>>>>>>>>>>>>>"+maps1); - if (maps1.size()>0){ - - }else { - int update = DBSql.update("delete from APP_ACT_KMS_DIMENSION where ID = '" + id + "'"); - System.out.println("删除无用的知识维度>>>>>>>>>>>>>>>"+update+"><<<<<<<<<<<<"+map.getString("DIMENSIONNAME")); - //DimensionCache.getCache().reload(); - - } - } - } -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/SaveMoreData.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/SaveMoreData.java deleted file mode 100644 index edb969a0..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/SaveMoreData.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.awspaas.user.bpa.job; - -import com.actionsoft.bpms.bo.engine.BO; -import com.actionsoft.bpms.commons.database.RowMap; -import com.actionsoft.bpms.org.model.UserModel; -import com.actionsoft.bpms.schedule.IJob; -import com.actionsoft.bpms.server.UserContext; -import com.actionsoft.bpms.util.DBSql; -import com.actionsoft.bpms.util.UUIDGener; -import com.actionsoft.bpms.util.UtilString; -import com.actionsoft.sdk.local.SDK; -import com.actionsoft.sdk.local.api.cc.RDSAPI; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.awspaas.user.bpa.util.UtilUrls; -import org.dom4j.Document; -import org.dom4j.DocumentException; -import org.dom4j.DocumentHelper; -import org.dom4j.Element; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -import java.sql.Connection; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; - -public class SaveMoreData implements IJob { - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - - String CC_ID = "58372e80-6456-40d7-9822-ec0f4e2cd7a7"; - RDSAPI rdsapi; - Connection connection = null; - rdsapi = SDK.getCCAPI().getRDSAPI(CC_ID); - connection = rdsapi.open(); - - List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc"); - - JSONArray jsonArray_new = new JSONArray(new LinkedList<>()); - JSONObject jsonObject = new JSONObject(new LinkedHashMap()); - List 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); - }*/ - - for (int c= 0;c\n" + - " " + - " " + - " " + - " " + - "" + jsonObject + "" + - " " + - " " + - " " + - ""; - - System.out.println("参数===============" + xmlStr); - //System.out.println("参数==============="+xmls); - //HttpClientUtil httpClientUtil = new HttpClientUtil(); - int timeout = 600000; - // HttpURLConnection 发送SOAP请求 - System.out.println("HttpURLConnection 发送SOAP请求"); - - String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); - - - Document document = null; - try { - document = DocumentHelper.parseText(postSoap); - } catch (DocumentException e) { - e.printStackTrace(); - } - Element rootElement = document.getRootElement(); - // 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"); - JSONArray jsonArray = JSONArray.parseArray(datas); - System.out.println("jsonArray>>>>>>>>>>>>>"+jsonArray.size()); - if (jsonArray != null && jsonArray.size() != 0) { - for (int i = 0; i < jsonArray.size(); i++) { - // JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId") - JSONObject end_process = new JSONObject(new LinkedHashMap<>()); - end_process.put("processinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId").toString().trim());//流程实例id - end_process.put("processdefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId").toString().trim());//流程定义id - RowMap workflowId = DBSql.getMap("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '" + JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId") + "'"); - if (workflowId!=null) { - end_process.put("processdefverid", workflowId.getString("PROCESSVERSION"));//流程版本定义 - } else { - end_process.put("processdefverid", "1"); - } - end_process.put("starttime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间 - end_process.put("endtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate"));//结束时间 - end_process.put("createtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//创建时间 - - - UserModel operatorWorkCode = SDK.getORGAPI().getUser(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString()); - if (operatorWorkCode != null) { - end_process.put("createuser", JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));//创建人 - UserContext userContext = UserContext.fromUID(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString()); - end_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id - end_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id - end_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id - } else { - end_process.put("createuser", "admin");//创建人 - UserContext userContext = UserContext.fromUID("admin"); - end_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id - end_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id - end_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id - } - end_process.put("activitydefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeName").toString());//角色id - end_process.put("state", JSONObject.parseObject(jsonArray.get(i).toString()).get("status")); - end_process.put("begintime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间 - end_process.put("taskinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("id"));//流程实例id - end_process.put("controlstate", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowType")); - end_process.put("actionname", JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeName")); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Date beginDate = null; - try { - beginDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate").toString()); - } catch (ParseException e) { - e.printStackTrace(); - } - if (UtilString.isNotEmpty(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString())) { - Date endDate = null; - try { - endDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString()); - if (endDate!=null){ - long dates = (endDate.getTime() - beginDate.getTime()) / (1000 * 60); - end_process.put("executecosttime", dates);//开始时间-结束时间如果结束时间为空,则这个时间也为空 - } - } catch (ParseException e) { - e.printStackTrace(); - } - - } else { - end_process.put("executecosttime", "");//开始时间-结束时间如果结束时间为空,则这个时间也为空 - } - end_process.put("timedur", ""); - end_process.put("warningtimedur", ""); - String sql = "insert into aws_bpa (ID,processinstid,processdefid,processdefverid,starttime,endtime," + - "createtime,createuser," + - "createuserorgid,createuserdeptid,createuserroleid," + - "controlstate,executecosttime,timedur,warningtimedur" + - ",actionname,activitydefid,begintime,state,taskinstid" + - ") values ('%s', '%s', '%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')"; - String id = UUIDGener.getUUID(); - int update = DBSql.update(connection, String.format(sql, id, - end_process.getString("processinstid"), - end_process.getString("processdefid"), - end_process.getString("processdefverid"), - end_process.getString("starttime"), - end_process.getString("endtime"), - end_process.getString("createtime"), - end_process.getString("createuser"), - end_process.getString("createuserorgid"), - end_process.getString("createuserdeptid"), - end_process.getString("createuserroleid"), - end_process.getString("controlstate"), - end_process.getString("executecosttime"), - end_process.getString("timedur"), - end_process.getString("warningtimedur"), - end_process.getString("operateType"), - end_process.getString("nodeid"), - end_process.getString("operateDate"), - end_process.getString("state"), - end_process.getString("taskinstid") - )); - System.out.println("是否插入一条数据>>>>>>>>>>" + update); - } - } else { - break; - } - } - } - } - -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/ThirdJob.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/ThirdJob.java deleted file mode 100644 index bd5f5ae9..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/ThirdJob.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.awspaas.user.bpa.job; - -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 com.awspaas.user.bpa.util.UtilUrls; -import org.dom4j.Document; -import org.dom4j.DocumentException; -import org.dom4j.DocumentHelper; -import org.dom4j.Element; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.UUID; - -public class ThirdJob implements IJob { - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - List app_act_bpad_p_ver_activity = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY"); - if (app_act_bpad_p_ver_activity!=null) { - JSONObject jsonObject = new JSONObject(new LinkedHashMap()); - for (RowMap bo : app_act_bpad_p_ver_activity - ) { - int j = 1; - int tale = Integer.valueOf(bo.getString("ID").trim()); - - jsonObject.put("workflowId", tale); - // jsonObject.put("workflowId",bo.getString("WORKFLOWID")); - //jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() - //jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() - jsonObject.put("pageIndex", j); - jsonObject.put("pageSize", 1000); - String xmlStr = "\n" + - " " + - " " + - " " + - " " + - "" + jsonObject + "" + - " " + - " " + - " " + - ""; - - System.out.println("参数===============" + xmlStr); - //System.out.println("参数==============="+xmls); - //HttpClientUtil httpClientUtil = new HttpClientUtil(); - int timeout = 600000; - // HttpURLConnection 发送SOAP请求 - System.out.println("HttpURLConnection 发送SOAP请求"); - - String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); - - - Document document = null; - try { - document = DocumentHelper.parseText(postSoap); - } catch (DocumentException e) { - e.printStackTrace(); - } - Element rootElement = document.getRootElement(); - // 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"); - System.out.println(""); - JSONArray jsonArray = JSONArray.parseArray(datas); - j++; - - if (jsonArray != null && jsonArray.size() != 0) { - UserContext userContext = UserContext.fromUID("admin"); - for (int i = 0; i < jsonArray.size(); i++) { - if (JSONObject.parseObject(jsonArray.get(i).toString()).get("ID")!=null&&JSONObject.parseObject(jsonArray.get(i).toString()).get("ID")!=""){ - String select_sql = "select * from APP_ACT_BPAD_P_VNODE_ACTIVITY where PROCESSVERID = '"+JSONObject.parseObject(jsonArray.get(i).toString()).get("ID")+"' AND ACTIVITYDEFID = '"+JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeid")+"'"; - RowMap map = DBSql.getMap(select_sql); - if (map == null) { - String id = UUID.randomUUID().toString(); - String insert_sql = "insert into APP_ACT_BPAD_P_VNODE_ACTIVITY(ID,PROCESSVERID,TASKNAME,ACTIVITYDEFID)values('"+id+"','"+JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId")+"','"+JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeName")+"','"+JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeid")+"')"; - DBSql.update(insert_sql); - } - }else { - String id = UUID.randomUUID().toString(); - String select_sql = "select * from APP_ACT_BPAD_P_VNODE_ACTIVITY where ACTIVITYDEFID = '"+JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeid")+"'"; - RowMap map = DBSql.getMap(select_sql); - if (map == null) { - - String insert_sql = "insert into APP_ACT_BPAD_P_VNODE_ACTIVITY(ID,PROCESSVERID,TASKNAME,ACTIVITYDEFID)values('"+id - +"','"+JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId")+"','"+JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeName")+"','"+JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeid")+"')"; - DBSql.update(insert_sql); - } - } - - } - } - } - } - } -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/UpdateSreJob.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/UpdateSreJob.java deleted file mode 100644 index 29d2f46d..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/UpdateSreJob.java +++ /dev/null @@ -1,289 +0,0 @@ -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 dataMap = new HashMap<>(); - ArrayList fromNodeDataIDMaps = new ArrayList<>(); - ArrayList> oldNodeDataMaps = new ArrayList<>(); - ArrayList> newNodeDataMaps = new ArrayList<>(); - ArrayList> delNodeDataMaps = new ArrayList<>(); - String wsId = "7d3ca852-a0bd-42e6-80b1-3dcea6f55083"; - //总文件集合 - List palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getAllCoeProcessLevelByWsId(wsId); - long startTime = System.currentTimeMillis(); - List nodeIdList = DBSql.getList("SELECT NODEID FROM BO_EU_PAL_FILENODE6", String.class); - List nodeIdList_PLID = DBSql.getList("SELECT PLID FROM BO_EU_PAL_FILENODE6", String.class); - for (PALRepositoryModel fileModel : palRepositoryModels) { - List> 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 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 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> roleShapes = new ArrayList<>(); - try { - roleShapes = CoeDesignerUtil.getShapeMessageJson4(RELATIONFILEID); - } catch (Exception e) { - - //SDK.getLogAPI().consoleInfo("获取关联角色文件属性"+"文件ID:"+RELATIONFILEID+"异常"); - } - if (null != roleShapes && !roleShapes.isEmpty()) { - for (Map 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)); - } - -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/plugins/Plugins.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/plugins/Plugins.java deleted file mode 100644 index c1a84791..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/plugins/Plugins.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.awspaas.user.bpa.plugins; - -import com.actionsoft.apps.listener.PluginListener; -import com.actionsoft.apps.resource.AppContext; -import com.actionsoft.apps.resource.plugin.profile.ASLPPluginProfile; -import com.actionsoft.apps.resource.plugin.profile.AWSPluginProfile; -import com.actionsoft.apps.resource.plugin.profile.AtFormulaPluginProfile; -import com.actionsoft.apps.resource.plugin.profile.HttpASLP; -import com.awspaas.user.bpa.aslp.UpdatePptxAndExcelAslp; -import com.awspaas.user.bpa.at.GetOrgPostByName; -import com.awspaas.user.bpa.at.getSJNumsByprocess; - -import java.util.ArrayList; -import java.util.List; - -public class Plugins implements PluginListener { - @Override - public List register(AppContext appContext) { - // 存放本应用的全部插件扩展点描述 - List list = new ArrayList(); - // 注册AT公式 - list.add(new AtFormulaPluginProfile("获取当前名称的数据", "@getOrgPostByName(*bo_name,*zd_nme,*name,*set_name)", - GetOrgPostByName.class.getName(), "获取当前名称的数据", "返回数据")); - list.add(new AtFormulaPluginProfile("获取已阅和待阅的总人数", "@getSJNumsByprocess(*bindid)", - getSJNumsByprocess.class.getName(), "获取已阅和待阅的总人数", "获取已阅和待阅的总人数")); - - list.add(new ASLPPluginProfile("UpdatePptxAndExcelAslp", UpdatePptxAndExcelAslp.class.getName(), "根据上传的文件进行更新相关的excel或者ppt", (HttpASLP)null)); - return list; - } -} \ No newline at end of file diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/1.html b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/1.html deleted file mode 100644 index c3bd4281..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/1.html +++ /dev/null @@ -1,2136 +0,0 @@ - - - - - - - - 流程文件发布申请 - - - - - [#AWSImport] [#AWSUIImport] - - - - - - - -
-
- - - - - - - - - - - - -
流程制度发布申请
- - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
基本信息
-
- - - - - - - - - - - - - - - -
[#APPLYUSERNAME][#CONTACT_WAY]
[#APPLYDATE][#IS_THE_UNIT]
-
-
-
-
-
-
-
流程/制度发布类型
-
- - - - - - - -
发布类型[#OPTIONTYPE]
-
-
-
-
-
提示:为落实公司经营管理纲要要求,建议识别本文件是否存在相关的流程制度,并审视评估是否需要优化整合,以实现流程制度的简洁高效。
- - - - - - - - - - - - - - - -
-
-
-
业务归属
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
流程架构  (选择待发布文件后自动带出)
-
-
[#LEVEL_1_PROCESS_NAME][#LEVEL_2_PROCESS_NAME][#LEVEL_3_PROCESS_NAME]
-
-
适用范围   (全部填写完成后,【流程审批】中流程责任人方可显示)
-
-
[#ADAPT_NAME_THE_COMPANY][#ADAPT_REGION_NAME][#APPLICABLE_PRODUCT]
-
-
-
-
-
-
-
流程/制度发布通知
-
- - - - - - - - - - - -
[#PROCESS_TITLE]
[#RELEASE_INSTRUCTIONS]
-
-
-
-
-
-
-
流程审批
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[#DEPARTMENT_PROOFREADER][#PROCESS_MANAGER]
[#INTERNAL_AUDITOR]
[#PROFESSIONAL_REVIEWER]
[#JOINT_REVIEWER][#CEO_APPROVE]
[#PERSON_THREE_LEVEL_PROCESS][#LEVEL_AUDIT_REQUIRED]
[#PROCESS_RESPONSIBLE_PERSON][#SECONDARY_AUDIT_REQUIRED]
[#RESPONSIBLE_PERSON1][#LEVEL_1_AUDIT_REQUIRED]
-
-
-
-
-
-
-
发送范围
-
- - - - - - - - - - - - - - - - - - -
[#CHOICEEFFECTIVEDATE][#EFFECTIVEDATE]
[#SEND_SCOP][#MARKAR]
- - - - - - - - - - - - - - - -
[#SEND_SCOPE_ORG]
[#SEND_SCOPE_POST]
[#SEND_SCOPE_LEVEL]
-
-
-
-
-
-
-
-
[#Actionsoft] - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/2.html b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/2.html deleted file mode 100644 index b9762b99..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/2.html +++ /dev/null @@ -1,2224 +0,0 @@ - - - - - - - - 流程文件发布申请 - - - - - [#AWSImport] [#AWSUIImport] - - - - - - - -
-
- - - - - - - - - - - - -
流程制度发布申请
- - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
基本信息
-
- - - - - - - - - - - - - - - -
[#APPLYUSERNAME][#CONTACT_WAY]
[#APPLYDATE][#IS_THE_UNIT]
-
-
-
-
-
-
-
流程/制度发布类型
-
- - - - - - - -
发布类型[#OPTIONTYPE]
-
-
-
-
-
提示:为落实公司经营管理纲要要求,建议识别本文件是否存在相关的流程制度,并审视评估是否需要优化整合,以实现流程制度的简洁高效。
- - - - - - - - - - - - - - - -
-
-
-
业务归属
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
流程架构  (选择待发布文件后自动带出)
-
-
[#LEVEL_1_PROCESS_NAME][#LEVEL_2_PROCESS_NAME][#LEVEL_3_PROCESS_NAME]
-
-
适用范围   (全部填写完成后,【流程审批】中流程责任人方可显示)
-
-
[#ADAPT_NAME_THE_COMPANY][#ADAPT_REGION_NAME][#APPLICABLE_PRODUCT]
-
-
-
-
-
-
-
流程/制度发布通知
-
- - - - - - - - - - - -
[#PROCESS_TITLE]
[#RELEASE_INSTRUCTIONS]
-
-
-
-
-
-
-
流程审批
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[#DEPARTMENT_PROOFREADER][#PROCESS_MANAGER]
[#INTERNAL_AUDITOR]
[#PROFESSIONAL_REVIEWER]
[#JOINT_REVIEWER][#CEO_APPROVE]
[#PERSON_THREE_LEVEL_PROCESS][#LEVEL_AUDIT_REQUIRED]
[#PROCESS_RESPONSIBLE_PERSON][#SECONDARY_AUDIT_REQUIRED]
[#RESPONSIBLE_PERSON1][#LEVEL_1_AUDIT_REQUIRED]
-
-
-
-
-
-
-
发送范围
-
- - - - - - - - - - - - - - - - - - -
[#CHOICEEFFECTIVEDATE][#EFFECTIVEDATE]
[#SEND_SCOP][#MARKAR]
- - - - - - - - - - - - - - - -
[#SEND_SCOPE_ORG]
[#SEND_SCOPE_POST]
[#SEND_SCOPE_LEVEL]
-
-
-
-
-
-
-
-
[#Actionsoft] - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/HSSFUtils.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/HSSFUtils.java deleted file mode 100644 index 6b0bc402..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/HSSFUtils.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.awspaas.user.bpa.util; - -import org.apache.poi.hssf.usermodel.*; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellType; -import org.apache.poi.ss.usermodel.DateUtil; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.util.CellRangeAddress; - -import java.io.*; -import java.util.Iterator; -import java.util.List; - -public class HSSFUtils { - - - - - - /** - * #合并多个excel文件 - * @param fileLists excel文件路径 - * @param path 目标文件保存目录 - * @param fileName 目标文件名称 - */ - public static void mergeExcel(List fileLists, String path, String fileName) { - // 创建新的excel工作簿 - HSSFWorkbook newExcelWorkBook = new HSSFWorkbook(); - // 遍历需要合并的excel文件 - for (String excelName : fileLists) { - try (InputStream in = new FileInputStream(excelName)) { - // 创建工作簿 - HSSFWorkbook tmpWorkBook = new HSSFWorkbook(in); - // 获取工作簿中的Sheet个数 - int len = tmpWorkBook.getNumberOfSheets(); - if (len <= 1) { - HSSFSheet tmpSheet = tmpWorkBook.getSheetAt(0); - HSSFSheet newExcelSheet = newExcelWorkBook.createSheet(tmpSheet.getSheetName()); - // 复制sheet内容 - copyExcelSheet(newExcelWorkBook, tmpSheet, newExcelSheet); - } else { - for (int i = 0; i < len; i++) { - HSSFSheet tmpSheet = tmpWorkBook.getSheetAt(i); - HSSFSheet newExcelSheet = newExcelWorkBook.createSheet(tmpSheet.getSheetName()); - // 复制sheet内容 - copyExcelSheet(newExcelWorkBook, tmpSheet, newExcelSheet); - } - } - // 关闭tmpWorkBook工作簿 - tmpWorkBook.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - // 新生成的excel文件 - if (!fileName.endsWith(".xlsx") && !fileName.endsWith(".xls")) { - fileName += ".xlsx"; - } - String excelFileName = path + File.separator + fileName; - // 判断文件是否存在 - File excelFile = new File(excelFileName); - if (excelFile.exists()) { - // 存在则删除 - excelFile.delete(); - } - // 使用输出流写出 - try (FileOutputStream fos = new FileOutputStream(excelFileName)) { - newExcelWorkBook.write(fos); - fos.flush(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - newExcelWorkBook.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - System.out.println("excel文件合并成功,合并后文件路径:" + excelFileName); - } - - /** - * #复制sheet到新的excel文件中 - * @param workbook excel工作簿 - * @param tmpSheet 来源sheet - * @param newExcelSheet 新生成的sheet - */ - public static void copyExcelSheet(HSSFWorkbook workbook, HSSFSheet tmpSheet, HSSFSheet newExcelSheet) { - // 合并单元格 - mergeSheetAllRegion(tmpSheet, newExcelSheet); - // 设置单元格列宽度 - // 获取最后一个单元格位置 - if (tmpSheet!=null) { - - - if (tmpSheet.getRow(tmpSheet.getFirstRowNum()) == null) { - - } else { - int len = tmpSheet.getRow(tmpSheet.getFirstRowNum()).getLastCellNum(); - for (int i = 0; i < len; i++) { - newExcelSheet.setColumnWidth(i, tmpSheet.getColumnWidth(i)); - } - // 复制每行内容 - Iterator it = tmpSheet.iterator(); - while (it.hasNext()) { - HSSFRow tmpRow = (HSSFRow) it.next(); - // 创建新行 - HSSFRow newExcelRow = newExcelSheet.createRow(tmpRow.getRowNum()); - // 复制行 - copyExcelRow(workbook, tmpRow, newExcelRow); - } - } - } - } - - /** - * #合并单元格 - * @param tmpSheet 来源sheet - * @param newExcelSheet 目标sheet - */ - private static void mergeSheetAllRegion(HSSFSheet tmpSheet, HSSFSheet newExcelSheet) { - int num = tmpSheet.getNumMergedRegions(); - CellRangeAddress cellRange = null; - for (int i = 0; i < num; i++) { - cellRange = tmpSheet.getMergedRegion(i); - newExcelSheet.addMergedRegion(cellRange); - } - } - - /** - * #复制excel中的行到新的sheet中 - * @param workbook 目标工作簿 - * @param tmpRow 来源excel行 - * @param newExcelRow 目标excel行 - */ - public static void copyExcelRow(HSSFWorkbook workbook, HSSFRow tmpRow, HSSFRow newExcelRow) { - // 设置行高 - newExcelRow.setHeight(tmpRow.getHeight()); - // 获取所有列 - Iterator it = tmpRow.cellIterator(); - while (it.hasNext()) { - HSSFCell tmpCell = (HSSFCell) it.next(); - // 创建单元格 - HSSFCell newExcelCell = newExcelRow.createCell(tmpCell.getColumnIndex()); - // 复制单元格 - copyExcelCell(workbook, tmpCell, newExcelCell); - } - } - - /** - * #复制单元格 - * @param workbook 目标工作簿 - * @param tmpCell 来源excel单元格 - * @param newExcelCell 目标excel单元格 - */ - public static void copyExcelCell(HSSFWorkbook workbook, HSSFCell tmpCell, HSSFCell newExcelCell) { - HSSFCellStyle newExcelStyle = workbook.createCellStyle(); - // 复制单元格样式 - newExcelStyle.cloneStyleFrom(tmpCell.getCellStyle()); - // 单元格样式 - newExcelCell.setCellStyle(newExcelStyle); - if (tmpCell.getCellComment() != null) { - newExcelCell.setCellComment(tmpCell.getCellComment()); - } - // 不同数据类型处理 - CellType tmpCellType = CellType.forInt(tmpCell.getCellType()); - - newExcelCell.setCellType(tmpCellType); - if (tmpCellType == CellType.NUMERIC) { - if (DateUtil.isCellDateFormatted(tmpCell)) { - newExcelCell.setCellValue(tmpCell.getDateCellValue()); - } else { - newExcelCell.setCellValue(tmpCell.getNumericCellValue()); - } - } else if (tmpCellType == CellType.STRING) { - newExcelCell.setCellValue(tmpCell.getRichStringCellValue()); - } else if (tmpCellType == CellType.BLANK) { - } else if (tmpCellType == CellType.BOOLEAN) { - newExcelCell.setCellValue(tmpCell.getBooleanCellValue()); - } else if (tmpCellType == CellType.ERROR) { - newExcelCell.setCellErrorValue(tmpCell.getErrorCellValue()); - } else if (tmpCellType == CellType.FORMULA) { - newExcelCell.setCellFormula(tmpCell.getCellFormula()); - } else { - } - } - -} \ No newline at end of file diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/PalUtil.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/PalUtil.java deleted file mode 100644 index d785c764..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/PalUtil.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.awspaas.user.bpa.util; - -import com.actionsoft.apps.coe.pal.constant.CoEConstant; -import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager; -import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile; -import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate; -import com.actionsoft.bpms.util.UtilString; -import com.actionsoft.sdk.local.SDK; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class PalUtil { - public String jsonData(String sid - ,String language, String templateOperate) { - // 多语言过滤, 暂时没有实现多语言 - if (!"cn".equals(language)) { - return ""; - } - List list = OutputAppManager.getList(); - JSONArray jsonArray = new JSONArray(); - - // 加载报告类型 - Map appMap = new HashMap(); - for (OutputAppProfile model : list) { - String appId = model.getAppContext().getId(); - //System.out.println("role>>>>>>>>>>"+model.getGroupName()); - if (model.getGroupName().contains("岗位手册")){ - appMap.put(appId.substring(appId.lastIndexOf(".") + 1), model); - } - } - String raciDataType = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.output.raci", "raciDataType");// raci - if (raciDataType == null) { - raciDataType = "pal"; - } - String orDataType = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.output.or", "orDataType");// or - if (orDataType == null) { - orDataType = "pal"; - } - for (Map.Entry entry : appMap.entrySet()) { - OutputAppProfile profile = entry.getValue(); - JSONObject json = new JSONObject(); - json.put("id", "output_" + entry.getKey()); - json.put("name", profile.getGroupName()); - json.put("open", true); - json.put("icon", "../apps/" + profile.getAppContext().getId() + "/img/parent16.png"); - jsonArray.add(json); - } - // 排序 pr or raci risk,加入制度手册与表单手册排序 - if (jsonArray != null && !jsonArray.isEmpty()) { - JSONArray temp = new JSONArray(); - String [] arr = { "output_or",}; - for (int i = 0; i < arr.length; i++) { - for (int j = 0; j < jsonArray.size(); j++) { - if (arr[i].equals(jsonArray.getJSONObject(j).getString("id"))) { - temp.add(jsonArray.getJSONObject(j)); - } - } - } - List tempList = Arrays.asList(arr); - for (int j = 0; j < jsonArray.size(); j++) { - if (!tempList.contains(jsonArray.getJSONObject(j).getString("id"))) { - temp.add(jsonArray.getJSONObject(j)); - } - } - jsonArray = temp; - } - // 加载每种报告类型中的具体类型 - for (OutputAppProfile model : list) { - createJsonData(jsonArray, model); - } - Map map = new HashMap(); - map.put("sid", sid); - map.put("treeData", jsonArray.toString()); - map.put("raciDataType", raciDataType); - map.put("orDataType", orDataType); - map.put("templateOperate", UtilString.isEmpty(templateOperate) ? "0" : templateOperate); - return HtmlPageTemplate.merge(CoEConstant.APP_ID, "pal.pl.repository.outputreport.tree.htm", map); - } - - private void createJsonData(JSONArray jsonArray, OutputAppProfile model) { - JSONObject json; - json = new JSONObject(); - json.put("id", model.getId()); - json.put("name", model.getTitle()); - json.put("groupName", model.getGroupName()); - String appId = model.getAppContext().getId(); - json.put("pid", "output_" + appId.substring(appId.lastIndexOf(".") + 1)); - json.put("targetMethodScope", model.getTargetMethodScope()); - json.put("targetMethodType", model.getTargetMethodType()); - json.put("relationMethodScope", model.getRelationMethodScope()); - json.put("lang", model.getLang()); - json.put("optionClass", model.getOptionClass()); - json.put("generClass", model.getGenerClass()); - json.put("icon", "../apps/" + model.getAppContext().getId() + "/img/icon16.png"); - json.put("isDownload", model.isDownload()); - json.put("templates", model.getTemplates()); - json.put("appId", model.getAppContext().getId()); - jsonArray.add(json); - } -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/PptCreateUtil.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/PptCreateUtil.java deleted file mode 100644 index f6a21e72..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/PptCreateUtil.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.awspaas.user.bpa.util; - -import org.apache.poi.sl.usermodel.PictureData; -import org.apache.poi.sl.usermodel.TableCell; -import org.apache.poi.xslf.usermodel.XMLSlideShow; -import org.apache.poi.xslf.usermodel.XSLFPictureData; -import org.apache.poi.xslf.usermodel.XSLFPictureShape; -import org.apache.poi.xslf.usermodel.XSLFSlide; -import org.apache.poi.xslf.usermodel.XSLFSlideLayout; -import org.apache.poi.xslf.usermodel.XSLFTable; -import org.apache.poi.xslf.usermodel.XSLFTableCell; -import org.apache.poi.xslf.usermodel.XSLFTableRow; -import org.apache.poi.xslf.usermodel.XSLFTextBox; -import org.apache.poi.xslf.usermodel.XSLFTextRun; -import javax.servlet.ServletOutputStream; -import java.awt.*; -import java.awt.geom.Rectangle2D; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.List; -import java.util.Objects; - - -/** - * @Author: Yangy - * @Date: 2020/11/4 16:12 - * @Description ppt生成工具类 - */ -public class PptCreateUtil { - /** - * @Author Yangy - * @Description 获取一个ppt实例 - * @Date 16:37 2020/11/4 - * @Param [] - * @return org.apache.poi.xslf.usermodel.XMLSlideShow - **/ - public static XMLSlideShow getPptInstance(){ - // 创建ppt: - XMLSlideShow ppt = new XMLSlideShow(); - //设置幻灯片的大小: - Dimension pageSize = ppt.getPageSize(); - pageSize.setSize(800,700); - return ppt; - } - /** - * @Author Yangy - * @Description 创建幻灯片 - * @Date 16:39 2020/11/4 - * @Param ppt - * @return org.apache.poi.xslf.usermodel.XSLFSlideMaster - **/ - public static XSLFSlide createSlide(XMLSlideShow ppt, XSLFSlideLayout layout){ - //通过布局样式创建幻灯片 - XSLFSlide slide = ppt.createSlide(layout); - //清理掉模板内容 - slide.clear(); - return slide; - } - /** - * @Author Yangy - * @Description 生成一个文本框及内容 - * @Date 10:10 2020/11/5 - * @Param content=内容,fontSize=字大小,fontFamily=字体风格,color=字颜色 - * @return org.apache.poi.xslf.usermodel.XMLSlideShow - **/ - public static void addTextBox(XSLFSlide slide,String content,Double fontSize, - String fontFamily,Color color, - int x,int y,int w,int h){ - XSLFTextBox textBox = slide.createTextBox(); - //设置坐标、宽高 - textBox.setAnchor(new Rectangle2D.Double(x, y, w, h)); - XSLFTextRun projectInfo = textBox.addNewTextParagraph().addNewTextRun(); - projectInfo.setText(content); - projectInfo.setFontSize(fontSize); - projectInfo.setFontFamily(fontFamily); - projectInfo.setFontColor(color); - } - /** - * @Author Yangy - * @Description 添加图片,设置图片坐标、宽高 - * @Date 16:47 2020/11/4 - * @Param slide=幻灯片实例,picBytes=图片字节流,picType=图片类型 - * @return org.apache.poi.xslf.usermodel.XMLSlideShow - **/ - public static void addPicture(XMLSlideShow ppt, XSLFSlide slide, byte [] picBytes, PictureData.PictureType picType, - int x, int y, int w, int h){ - XSLFPictureData idx = ppt.addPicture(picBytes, picType); - XSLFPictureShape pic = slide.createPicture(idx); - //设置当前图片在ppt中的位置,以及图片的宽高 - pic.setAnchor(new java.awt.Rectangle(x, y, w, h)); - } - /** - * @Author Yangy - * @Description 添加表格 - * @Date 16:55 2020/11/4 - * @Param [ppt] - * @return org.apache.poi.xslf.usermodel.XMLSlideShow - **/ - public static void addTable(XSLFSlide slide,List> dataList,int x,int y,int w,int h){ - XSLFTable table = slide.createTable(); - //此处还可以自行添加表格样式参数 - //dataList第一个列表为行数据,内嵌列表为每一行的列数据 - for (int i = 0; i < dataList.size(); i++) { - List row = dataList.get(i); - if (Objects.isNull(row)) continue; - XSLFTableRow row1 = table.addRow(); - for (int j = 0; j < row.size(); j++) { - XSLFTableCell cell = row1.addCell(); - cell.setBorderColor(TableCell.BorderEdge.top,Color.BLACK); - cell.setBorderColor(TableCell.BorderEdge.right,Color.BLACK); - cell.setBorderColor(TableCell.BorderEdge.bottom,Color.BLACK); - cell.setBorderColor(TableCell.BorderEdge.left,Color.BLACK); - cell.setText(row.get(j)); - } - } - //这个设置必须有,否则表格不显示 - Rectangle2D rectangle2D = new Rectangle2D.Double(x,y,w,h); - table.setAnchor(rectangle2D); - } - - /** - * @Author Yangy - * @Description 写入指定路径的ppt文件 - * @Date 16:59 2020/11/4 - * @Param [ppt, fileOutputStream] - * @return void - **/ - public static void pptWirteOut(XMLSlideShow ppt, FileOutputStream fileOutputStream){ - try { - ppt.write(fileOutputStream); - System.out.println("create PPT successfully"); - fileOutputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - /** - * @Author Yangy - * @Description - * @Date 14:22 2020/11/5 - * @Param [ppt, outputStream] - * @return void - **/ - public static void pptWirteOut(XMLSlideShow ppt, ServletOutputStream outputStream){ - try { - ppt.write(outputStream); - System.out.println("download PPT successfully"); - outputStream.close(); - ppt.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/UtilUrls.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/UtilUrls.java deleted file mode 100644 index 173f118d..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/UtilUrls.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.awspaas.user.bpa.util; - -import org.apache.http.HttpEntity; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; - -import java.nio.charset.Charset; - -/** - * @PackageName: com.awspaas.user.apps.yili.integration.util - * @ClassName: UtilUrl - * @author: yujh - * @date: 2022/5/18 21:41 - */ -public class UtilUrls { - - //使用SOAP1.1发送消息 - public static String doPostSoap(String postUrl, String soapXml, String soapAction) { - String retStr = ""; - // 创建HttpClientBuilder - HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); - // HttpClient - CloseableHttpClient closeableHttpClient = httpClientBuilder.build(); - HttpPost httpPost = new HttpPost(postUrl); - // 设置请求和传输超时时间 - RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(999999999) - .setConnectTimeout(999999999).build(); - httpPost.setConfig(requestConfig); - try { - httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8"); - httpPost.setHeader("SOAPAction", soapAction); - StringEntity data = new StringEntity(soapXml, Charset.forName("UTF-8")); - httpPost.setEntity(data); - CloseableHttpResponse response = closeableHttpClient.execute(httpPost); - HttpEntity httpEntity = response.getEntity(); - if (httpEntity != null) { - // 打印响应内容 - retStr = EntityUtils.toString(httpEntity, "UTF-8"); - } - // 释放资源 - closeableHttpClient.close(); - } catch (Exception e) { - e.printStackTrace(); - } - return retStr; - } -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/Utils.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/Utils.java deleted file mode 100644 index a972d4fe..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/Utils.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.awspaas.user.bpa.util; - -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellType; -import org.apache.poi.ss.usermodel.DateUtil; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.util.CellRangeAddress; -import org.apache.poi.xssf.usermodel.*; - -import java.io.*; -import java.util.Iterator; -import java.util.List; - -public class Utils { - - - - - - /** - * #合并多个excel文件 - * @param fileLists excel文件路径 - * @param path 目标文件保存目录 - * @param fileName 目标文件名称 - */ - public static void mergeExcel(List fileLists, String path, String fileName) { - // 创建新的excel工作簿 - XSSFWorkbook newExcelWorkBook = new XSSFWorkbook(); - // 遍历需要合并的excel文件 - for (String excelName : fileLists) { - try (InputStream in = new FileInputStream(excelName)) { - // 创建工作簿 - XSSFWorkbook tmpWorkBook = new XSSFWorkbook(in); - // 获取工作簿中的Sheet个数 - int len = tmpWorkBook.getNumberOfSheets(); - if (len <= 1) { - XSSFSheet tmpSheet = tmpWorkBook.getSheetAt(0); - XSSFSheet newExcelSheet = newExcelWorkBook.createSheet(tmpSheet.getSheetName()); - // 复制sheet内容 - copyExcelSheet(newExcelWorkBook, tmpSheet, newExcelSheet); - } else { - for (int i = 0; i < len; i++) { - XSSFSheet tmpSheet = tmpWorkBook.getSheetAt(i); - XSSFSheet newExcelSheet = newExcelWorkBook.createSheet(tmpSheet.getSheetName()); - // 复制sheet内容 - copyExcelSheet(newExcelWorkBook, tmpSheet, newExcelSheet); - } - } - // 关闭tmpWorkBook工作簿 - tmpWorkBook.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - // 新生成的excel文件 - if (!fileName.endsWith(".xlsx") && !fileName.endsWith(".xls")) { - fileName += ".xlsx"; - } - String excelFileName = path + File.separator + fileName; - // 判断文件是否存在 - File excelFile = new File(excelFileName); - if (excelFile.exists()) { - // 存在则删除 - excelFile.delete(); - } - // 使用输出流写出 - try (FileOutputStream fos = new FileOutputStream(excelFileName)) { - newExcelWorkBook.write(fos); - fos.flush(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - newExcelWorkBook.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - System.out.println("excel文件合并成功,合并后文件路径:" + excelFileName); - } - - /** - * #复制sheet到新的excel文件中 - * @param workbook excel工作簿 - * @param tmpSheet 来源sheet - * @param newExcelSheet 新生成的sheet - */ - public static void copyExcelSheet(XSSFWorkbook workbook, XSSFSheet tmpSheet, XSSFSheet newExcelSheet) { - // 合并单元格 - mergeSheetAllRegion(tmpSheet, newExcelSheet); - // 设置单元格列宽度 - // 获取最后一个单元格位置 - if (tmpSheet.getRow(tmpSheet.getFirstRowNum())==null){ - - }else { - int len = tmpSheet.getRow(tmpSheet.getFirstRowNum()).getLastCellNum(); - for (int i = 0; i < len; i++) { - newExcelSheet.setColumnWidth(i, tmpSheet.getColumnWidth(i)); - } - // 复制每行内容 - Iterator it = tmpSheet.iterator(); - while (it.hasNext()) { - XSSFRow tmpRow = (XSSFRow) it.next(); - // 创建新行 - XSSFRow newExcelRow = newExcelSheet.createRow(tmpRow.getRowNum()); - // 复制行 - copyExcelRow(workbook, tmpRow, newExcelRow); - } - } - } - - /** - * #合并单元格 - * @param tmpSheet 来源sheet - * @param newExcelSheet 目标sheet - */ - private static void mergeSheetAllRegion(XSSFSheet tmpSheet, XSSFSheet newExcelSheet) { - int num = tmpSheet.getNumMergedRegions(); - CellRangeAddress cellRange = null; - for (int i = 0; i < num; i++) { - cellRange = tmpSheet.getMergedRegion(i); - newExcelSheet.addMergedRegion(cellRange); - } - } - - /** - * #复制excel中的行到新的sheet中 - * @param workbook 目标工作簿 - * @param tmpRow 来源excel行 - * @param newExcelRow 目标excel行 - */ - public static void copyExcelRow(XSSFWorkbook workbook, XSSFRow tmpRow, XSSFRow newExcelRow) { - // 设置行高 - newExcelRow.setHeight(tmpRow.getHeight()); - // 获取所有列 - Iterator it = tmpRow.cellIterator(); - while (it.hasNext()) { - XSSFCell tmpCell = (XSSFCell) it.next(); - // 创建单元格 - XSSFCell newExcelCell = newExcelRow.createCell(tmpCell.getColumnIndex()); - // 复制单元格 - copyExcelCell(workbook, tmpCell, newExcelCell); - } - } - - /** - * #复制单元格 - * @param workbook 目标工作簿 - * @param tmpCell 来源excel单元格 - * @param newExcelCell 目标excel单元格 - */ - public static void copyExcelCell(XSSFWorkbook workbook, XSSFCell tmpCell, XSSFCell newExcelCell) { - XSSFCellStyle newExcelStyle = workbook.createCellStyle(); - // 复制单元格样式 - newExcelStyle.cloneStyleFrom(tmpCell.getCellStyle()); - // 单元格样式 - newExcelCell.setCellStyle(newExcelStyle); - if (tmpCell.getCellComment() != null) { - newExcelCell.setCellComment(tmpCell.getCellComment()); - } - // 不同数据类型处理 - CellType tmpCellType = CellType.forInt(tmpCell.getCellType()); - - newExcelCell.setCellType(tmpCellType); - if (tmpCellType == CellType.NUMERIC) { - if (DateUtil.isCellDateFormatted(tmpCell)) { - newExcelCell.setCellValue(tmpCell.getDateCellValue()); - } else { - newExcelCell.setCellValue(tmpCell.getNumericCellValue()); - } - } else if (tmpCellType == CellType.STRING) { - newExcelCell.setCellValue(tmpCell.getRichStringCellValue()); - } else if (tmpCellType == CellType.BLANK) { - } else if (tmpCellType == CellType.BOOLEAN) { - newExcelCell.setCellValue(tmpCell.getBooleanCellValue()); - } else if (tmpCellType == CellType.ERROR) { - newExcelCell.setCellErrorValue(tmpCell.getErrorCellValue()); - } else if (tmpCellType == CellType.FORMULA) { - newExcelCell.setCellFormula(tmpCell.getCellFormula()); - } else { - } - } - -} \ No newline at end of file diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/test.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/test.java deleted file mode 100644 index 91fc121d..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/test.java +++ /dev/null @@ -1,26 +0,0 @@ -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 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; - } - } - } - } -} diff --git a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/webapi/WorkFlowAPI.java b/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/webapi/WorkFlowAPI.java deleted file mode 100644 index 0d452abc..00000000 --- a/com.awspaas.user.bpa/com.awspaas.user.bpa/src/com/awspaas/user/bpa/webapi/WorkFlowAPI.java +++ /dev/null @@ -1,567 +0,0 @@ -package com.awspaas.user.bpa.webapi; - -import com.actionsoft.bpms.bo.engine.BO; -import com.actionsoft.bpms.commons.database.RowMap; -import com.actionsoft.bpms.org.model.UserModel; -import com.actionsoft.bpms.server.UserContext; -import com.actionsoft.bpms.server.bind.annotation.Controller; -import com.actionsoft.bpms.server.bind.annotation.HandlerType; -import com.actionsoft.bpms.server.bind.annotation.Param; -import com.actionsoft.bpms.util.DBSql; -import com.actionsoft.bpms.util.UtilString; -import com.actionsoft.sdk.local.SDK; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.awspaas.user.bpa.util.UtilUrls; -import org.dom4j.Document; -import org.dom4j.DocumentException; -import org.dom4j.DocumentHelper; -import org.dom4j.Element; - -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; - - -@Controller(type = HandlerType.RESTFUL, apiName = "workfolwapi", desc = "伊利新版BPA接口") -@Path("/workfolw") -public class WorkFlowAPI { - - @GET - public String sayHello() { - return "hello,world! - get请求"; - } - - @POST - public String sayHelloPost() { - return "hello,world!- post请求"; - } - - - /** - * 这个是传流程结束的json数据的 - * @return activiti流程信息 - * @throws DocumentException - * @throws ParseException - */ - @Path("/process/endprocess") - @GET - public String getEndProcess( - @Param String starttime, - @Param String endtime) throws DocumentException, ParseException { - JSONArray jsonArray_new = new JSONArray(new LinkedList<>()); - JSONObject results = new JSONObject(new LinkedHashMap<>()); - System.out.println("这里是end_process流程的伊利OA数据"); - - //List bo_eu_oa_process = SDK.getBOAPI().query("BO_EU_MODEL", true).list(); - List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc"); - //List 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()); - List 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); - - 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")); - //jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() - //jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() - jsonObject.put("pageIndex", j); - jsonObject.put("pageSize", 1000); - String xmlStr = "\n" + - " " + - " " + - " " + - " " + - "" + jsonObject + "" + - " " + - " " + - " " + - ""; - - System.out.println("参数===============" + xmlStr); - //System.out.println("参数==============="+xmls); - //HttpClientUtil httpClientUtil = new HttpClientUtil(); - int timeout = 600000; - // HttpURLConnection 发送SOAP请求 - System.out.println("HttpURLConnection 发送SOAP请求"); - - String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); - - - Document document = DocumentHelper.parseText(postSoap); - Element rootElement = document.getRootElement(); - // 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"); - JSONArray jsonArray = JSONArray.parseArray(datas); - if (jsonArray != null && jsonArray.size() != 0) { - for (int i = 0; i < jsonArray.size(); i++) { - // JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId") - JSONObject end_process = new JSONObject(new LinkedHashMap<>()); - end_process.put("processinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId").toString().trim());//流程实例id - end_process.put("processdefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId").toString().trim());//流程定义id - RowMap workflowId = DBSql.getMap("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '" + JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId") + "'"); - if (workflowId.getString("PROCESSVERSION") != null) { - end_process.put("processdefverid", workflowId.getString("VERSION"));//流程版本定义 - } else { - end_process.put("processdefverid", "1"); - } - end_process.put("starttime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间 - end_process.put("endtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate"));//结束时间 - end_process.put("createtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//创建时间 - - - UserModel operatorWorkCode = SDK.getORGAPI().getUser(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString()); - if (operatorWorkCode != null) { - end_process.put("createuser", JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));//创建人 - UserContext userContext = UserContext.fromUID(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString()); - end_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id - end_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id - end_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id - } else { - end_process.put("createuser", "admin");//创建人 - UserContext userContext = UserContext.fromUID("admin"); - end_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id - end_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id - end_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id - } - - end_process.put("controlstate", JSONObject.parseObject(jsonArray.get(i).toString()).get("status")); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Date beginDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate").toString()); - if (UtilString.isNotEmpty(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString())) { - Date endDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString()); - long dates = (endDate.getTime() - beginDate.getTime()) / (1000 * 60); - end_process.put("executecosttime", dates);//开始时间-结束时间如果结束时间为空,则这个时间也为空 - } else { - end_process.put("executecosttime", "");//开始时间-结束时间如果结束时间为空,则这个时间也为空 - } - end_process.put("timedur", ""); - 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")); - } - - } - System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size()); - return jsonArray_new.toString(); - } - - /** - * 2.这里是传开始流程的startprocess的json数据的 - * @return 开始流程 - * @throws DocumentException - * @throws ParseException - */ - - @Path("/process/startprocess") - @GET - public String getStartProcess( - @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 maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc"); - //List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc"); - int last_page = 1; - int size = 2; - - JSONObject jsonObject = new JSONObject(new LinkedHashMap()); - // List 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); - - for (int j = last_page; j < size; j++) { - - int tale = Integer.valueOf(maps.get(0).getString("ID").trim()); - BO bo = new BO(); - UserContext userContexts = UserContext.fromUID("admin"); - 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")); - //jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() - //jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() - jsonObject.put("pageIndex", j); - jsonObject.put("pageSize", 1000); - String xmlStr = "\n" + - " " + - " " + - " " + - " " + - "" + jsonObject + "" + - " " + - " " + - " " + - ""; - - System.out.println("参数===============" + xmlStr); - //System.out.println("参数==============="+xmls); - //HttpClientUtil httpClientUtil = new HttpClientUtil(); - int timeout = 600000; - // HttpURLConnection 发送SOAP请求 - System.out.println("HttpURLConnection 发送SOAP请求"); - - String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); - - - Document document = DocumentHelper.parseText(postSoap); - Element rootElement = document.getRootElement(); - // 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"); - JSONArray jsonArray = JSONArray.parseArray(datas); - if (jsonArray != null && jsonArray.size() != 0) { - for (int i = 0; i < jsonArray.size(); i++) { - // JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId") - JSONObject start_process = new JSONObject(new LinkedHashMap<>()); - start_process.put("processinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId"));//流程实例id - start_process.put("processdefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId"));//流程定义id - RowMap workflowId = DBSql.getMap("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '" + JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId") + "'"); - if (workflowId != null) { - start_process.put("processdefverid", workflowId.getString("PROCESSVERSION"));//流程版本定义 - } else { - start_process.put("processdefverid", "1"); - } - start_process.put("starttime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间 - start_process.put("createtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//创建时间 - UserModel operatorWorkCode = SDK.getORGAPI().getUser(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString()); - if (operatorWorkCode != null) { - start_process.put("createuser", JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));//创建人 - UserContext userContext = UserContext.fromUID(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString()); - start_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id - start_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id - start_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id - } else { - start_process.put("createuser", "admin");//创建人 - UserContext userContext = UserContext.fromUID("admin"); - start_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id - start_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id - start_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id - } - start_process.put("timedur", ""); - start_process.put("warningtimedur", ""); - start_process.put("controlstate", JSONObject.parseObject(jsonArray.get(i).toString()).get("status")); - jsonArray_new.add(start_process); - } - } else { - break; - } - } - 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(); - } - - @Path("/task/startTask") - @GET - public String getStartTask( - @Param String starttime, - @Param String endtime) throws DocumentException { - System.out.println("开始任务数据对应的json数据"); - JSONArray jsonArray_new = new JSONArray(new LinkedList<>()); - JSONObject results = new JSONObject(new LinkedHashMap<>()); - List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc"); - // List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc"); - int last_page = 1; - int size = 2; - - JSONObject jsonObject = new JSONObject(new LinkedHashMap()); - List 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); - 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")); - //jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() - //jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() - jsonObject.put("pageIndex", j); - jsonObject.put("pageSize", 1000); - String xmlStr = "\n" + - " " + - " " + - " " + - " " + - "" + jsonObject + "" + - " " + - " " + - " " + - ""; - - System.out.println("参数===============" + xmlStr); - //System.out.println("参数==============="+xmls); - //HttpClientUtil httpClientUtil = new HttpClientUtil(); - int timeout = 600000; - // HttpURLConnection 发送SOAP请求 - System.out.println("HttpURLConnection 发送SOAP请求"); - - String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); - - - Document document = DocumentHelper.parseText(postSoap); - Element rootElement = document.getRootElement(); - // 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"); - JSONArray jsonArray = JSONArray.parseArray(datas); - if (jsonArray != null && jsonArray.size() != 0) { - for (int i = 0; i < jsonArray.size(); i++) { - // JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId") - JSONObject start_task = new JSONObject(new LinkedHashMap<>()); - start_task.put("taskinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("id"));//流程实例id - start_task.put("processdefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId"));//流程定义id - RowMap workflowId = DBSql.getMap("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '" + JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId") + "'"); - if (workflowId.getString("PROCESSVERSION") != null) { - start_task.put("processdefverid", workflowId.getString("PROCESSVERSION"));//流程版本定义 - } else { - start_task.put("processdefverid", "1"); - } - start_task.put("processinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId")); - start_task.put("state", JSONObject.parseObject(jsonArray.get(i).toString()).get("status")); - start_task.put("begintime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间 - UserModel operatorWorkCode = SDK.getORGAPI().getUser(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString()); - if (operatorWorkCode != null) { - start_task.put("createuser", JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));//创建人 - UserContext userContext = UserContext.fromUID(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString()); - start_task.put("createuserorgid", userContext.getCompanyModel().getId());//公司id - start_task.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id - start_task.put("createuserroleid", userContext.getRoleModel().getId());//角色id - } else { - start_task.put("createuser", "admin");//创建人 - UserContext userContext = UserContext.fromUID("admin"); - start_task.put("createuserorgid", userContext.getCompanyModel().getId());//公司id - start_task.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id - start_task.put("createuserroleid", userContext.getRoleModel().getId());//角色id - } - - start_task.put("activitydefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeid"));//角色id - start_task.put("timedur", ""); - start_task.put("warningtimedur", ""); - start_task.put("createtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate")); - jsonArray_new.add(start_task); - } - } else { - break; - } - } - System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size()); - - return jsonArray_new.toString(); - } - - @Path("/task/endTask") - /** - * structFieldList.add(DataTypes.createStructField("activitydefid", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("executecosttime", DataTypes.LongType, true)); - * structFieldList.add(DataTypes.createStructField("processdefverid", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("processdefid", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("processinstid", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("taskinstid", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("actionname", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("state", DataTypes.IntegerType, true)); - * structFieldList.add(DataTypes.createStructField("timedur", DataTypes.LongType, true)); - * structFieldList.add(DataTypes.createStructField("warningtimedur", DataTypes.LongType, true)); - * structFieldList.add(DataTypes.createStructField("begintime", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("endtime", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("createuser", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("createuserorgid", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("createuserdeptid", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("createuserroleid", DataTypes.StringType, true)); - * structFieldList.add(DataTypes.createStructField("createtime", DataTypes.TimestampType, true)); - */ - @GET - public String getEndTask( - @Param String starttime, - @Param String endtime) throws DocumentException, ParseException { - System.out.println("结束任务开始获取数据"); - JSONArray jsonArray_new = new JSONArray(new LinkedList<>()); - JSONObject results = new JSONObject(new LinkedHashMap<>()); - List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc"); - //List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc"); - int last_page = 1; - int size =2; - - JSONObject jsonObject = new JSONObject(new LinkedHashMap()); - List 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); - 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")); - //jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() - //jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() - jsonObject.put("pageIndex", j); - jsonObject.put("pageSize", 1000); - String xmlStr = "\n" + - " " + - " " + - " " + - " " + - "" + jsonObject + "" + - " " + - " " + - " " + - ""; - - System.out.println("参数===============" + xmlStr); - //System.out.println("参数==============="+xmls); - //HttpClientUtil httpClientUtil = new HttpClientUtil(); - int timeout = 600000; - // HttpURLConnection 发送SOAP请求 - System.out.println("HttpURLConnection 发送SOAP请求"); - - String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); - - - Document document = DocumentHelper.parseText(postSoap); - Element rootElement = document.getRootElement(); - // 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"); - JSONArray jsonArray = JSONArray.parseArray(datas); - if (jsonArray != null && jsonArray.size() != 0) { - for (int i = 0; i < jsonArray.size(); i++) { - // JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId") - JSONObject end_task = new JSONObject(new LinkedHashMap<>()); - end_task.put("taskinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("id"));//流程实例id - end_task.put("processdefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId"));//流程定义id - RowMap workflowId = DBSql.getMap("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '" + JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId") + "'"); - if (workflowId.getString("PROCESSVERSION") != null) { - end_task.put("processdefverid", workflowId.getString("VERSION"));//流程版本定义 - } else { - end_task.put("processdefverid", "1"); - } - end_task.put("processinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId")); - end_task.put("state", JSONObject.parseObject(jsonArray.get(i).toString()).get("status")); - end_task.put("begintime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间 - end_task.put("createuser", JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));//创建人 - - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Date beginDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate").toString()); - if (UtilString.isNotEmpty(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString())) { - Date endDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString()); - long dates = (endDate.getTime() - beginDate.getTime()) / (1000 * 60); - end_task.put("executecosttime", dates);//开始时间-结束时间如果结束时间为空,则这个时间也为空 - } else { - end_task.put("executecosttime", "");//开始时间-结束时间如果结束时间为空,则这个时间也为空 - } - - end_task.put("endtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate")); - - UserModel operatorWorkCode = SDK.getORGAPI().getUser(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString()); - if (operatorWorkCode != null) { - UserContext userContext = UserContext.fromUID(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString()); - end_task.put("createuserorgid", userContext.getCompanyModel().getId());//公司id - end_task.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id - end_task.put("createuserroleid", userContext.getRoleModel().getId());//角色id - } else { - UserContext userContext = UserContext.fromUID("admin"); - end_task.put("createuserorgid", userContext.getCompanyModel().getId());//公司id - end_task.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id - end_task.put("createuserroleid", userContext.getRoleModel().getId());//角色id - } - - end_task.put("activitydefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeid"));//角色id - end_task.put("timedur", ""); - end_task.put("warningtimedur", ""); - end_task.put("createtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate")); - end_task.put("actionname", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateType")); - jsonArray_new.add(end_task); - } - } else { - break; - } - } - System.out.println("task_end结束_jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size()); - return jsonArray_new.toString(); - } - - -} diff --git a/com.awspaas.user.bpa/src/com/awspaas/user/bpa/webapi/WorkFlowAPI.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/webapi/WorkFlowAPI.java index 5018125b..0d452abc 100644 --- a/com.awspaas.user.bpa/src/com/awspaas/user/bpa/webapi/WorkFlowAPI.java +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/webapi/WorkFlowAPI.java @@ -61,8 +61,8 @@ public class WorkFlowAPI { System.out.println("这里是end_process流程的伊利OA数据"); //List bo_eu_oa_process = SDK.getBOAPI().query("BO_EU_MODEL", true).list(); - //List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc"); - List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc"); + List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc"); + //List 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; @@ -173,9 +173,6 @@ public class WorkFlowAPI { 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; } } @@ -200,13 +197,13 @@ public class WorkFlowAPI { long startTime = System.currentTimeMillis(); JSONArray jsonArray_new = new JSONArray(new LinkedList<>()); JSONObject results = new JSONObject(new LinkedHashMap<>()); - //List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc"); - List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc"); + List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc"); + //List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc"); int last_page = 1; int size = 2; JSONObject jsonObject = new JSONObject(new LinkedHashMap()); - List boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list(); + // List 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); @@ -316,8 +313,8 @@ public class WorkFlowAPI { System.out.println("开始任务数据对应的json数据"); JSONArray jsonArray_new = new JSONArray(new LinkedList<>()); JSONObject results = new JSONObject(new LinkedHashMap<>()); - //List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc"); - List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc"); + List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc"); + // List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc"); int last_page = 1; int size = 2; @@ -447,8 +444,8 @@ public class WorkFlowAPI { System.out.println("结束任务开始获取数据"); JSONArray jsonArray_new = new JSONArray(new LinkedList<>()); JSONObject results = new JSONObject(new LinkedHashMap<>()); - // List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc"); - List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc"); + List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc"); + //List maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc"); int last_page = 1; int size =2;