diff --git a/com.actionsoft.apps.coe.pal.approvalhelper/web/com.actionsoft.apps.coe.pal.approvalhelper/main/img/iconfont.ce1b01d3.ce1b01d3.svg b/com.actionsoft.apps.coe.pal.approvalhelper/web/com.actionsoft.apps.coe.pal.approvalhelper/main/img/iconfont.ce1b01d3.ce1b01d3.svg deleted file mode 100644 index c8bbdca4..00000000 --- a/com.actionsoft.apps.coe.pal.approvalhelper/web/com.actionsoft.apps.coe.pal.approvalhelper/main/img/iconfont.ce1b01d3.ce1b01d3.svg +++ /dev/null @@ -1,2447 +0,0 @@ - - - - - -Created by iconfont - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/com.actionsoft.apps.coe.pal.batch/web/com.actionsoft.apps.coe.pal.batch/main/img/iconfont.ce1b01d3.ce1b01d3.svg b/com.actionsoft.apps.coe.pal.batch/web/com.actionsoft.apps.coe.pal.batch/main/img/iconfont.ce1b01d3.ce1b01d3.svg deleted file mode 100644 index c8bbdca4..00000000 --- a/com.actionsoft.apps.coe.pal.batch/web/com.actionsoft.apps.coe.pal.batch/main/img/iconfont.ce1b01d3.ce1b01d3.svg +++ /dev/null @@ -1,2447 +0,0 @@ - - - - - -Created by iconfont - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/main/img/iconfont.ce1b01d3.ce1b01d3.svg b/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/main/img/iconfont.ce1b01d3.ce1b01d3.svg deleted file mode 100644 index c8bbdca4..00000000 --- a/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/main/img/iconfont.ce1b01d3.ce1b01d3.svg +++ /dev/null @@ -1,2447 +0,0 @@ - - - - - -Created by iconfont - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/com.awspaas.user.bpa/src/com/awspaas/user/bpa/aslp/UpdatePptxAndExcelAslp.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/aslp/UpdatePptxAndExcelAslp.java new file mode 100644 index 00000000..35b62e4a --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/aslp/UpdatePptxAndExcelAslp.java @@ -0,0 +1,955 @@ +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.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xslf.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.util.StringUtils; + +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: 'shape_uuid', required: true, desc: '文件内容id'", + "name: 'file_data', required: true, desc: '文件名称'" }) + public ResponseObject call(Map params) { + ResponseObject ro = ResponseObject.newWarnResponse("结果未知"); + 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("f9df56d7-a6b2-442c-9898-822619057493"); + model_old.setShape_uuid("obj_7ebfdb24f36e469cb841988cbda035c8"); + 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, path, fileName); + FileInputStream file = new FileInputStream(new File(dcContext.getFilePath())); + 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"); + strArray[8] = obj2.getString("Contents_and_reasons_for_revision"); + 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(sheet_xd, datas[i], dataStartRow + i); + } + + + // 保存修改后的 Excel 文件 + FileOutputStream outputStream = new FileOutputStream(dcContext.getFilePath()); + workbook.write(outputStream); + workbook.close(); + outputStream.close(); + + System.out.println("封面参数替换完成!"); + + }catch (Exception e){ + + } + }else { + HSSFUtils.mergeExcel(list, path, fileName); + FileInputStream file = new FileInputStream(new File(dcContext.getFilePath())); + 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"); + strArray[8] = obj2.getString("Contents_and_reasons_for_revision"); + 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(sheet_xd, datas[i], dataStartRow + i); + } + + + // 保存修改后的 Excel 文件 + FileOutputStream outputStream = new FileOutputStream(dcContext.getFilePath()); + 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("f9df56d7-a6b2-442c-9898-822619057493"); + model_old.setShape_uuid("obj_7ebfdb24f36e469cb841988cbda035c8"); + 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); + + PALRepositoryModel palRepositoryModel = PALRepositoryCache.getCache().get(pl_uuid); + JSONArray versionHistoryTable = getVersionHistoryTable(palRepositoryModel); + System.out.println("jsonArray>>>>>>>>>>"+versionHistoryTable.toString()); + + String process_name = DBSql.getString("select PLNAME from app_act_coe_pal_repository where ID = '" + pl_uuid + "'"); + 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')"); + + 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); + + } + } + + } + } + SDK.getLogAPI().consoleInfo("asddasdasdas"); + } + + } + q++; + } + + + // 获取PPT的第一页 + + + + // 替换文本框中的参数 + for (XSLFSlide slide : slides) { + for (XSLFShape shape : slide.getShapes()) { + if (shape instanceof XSLFTextShape) { + XSLFTextShape textShape = (XSLFTextShape) shape; + for (XSLFTextParagraph paragraph : textShape.getTextParagraphs()) { + for (XSLFTextRun textRun : paragraph.getTextRuns()) { + String text = textRun.getRawText(); + // 根据需要替换参数 + text = text.replace("{{process_name}}", process_name); + textRun.setText(text); + } + } + } + } + } + XSLFSlide secondslide_last = slides.get(slides.size()-1); + slideShows.setSlideOrder(secondslide_last, 1); + FileOutputStream out = new FileOutputStream(dcContext.getFilePath()); + slideShows.write(out); + slideShows.close(); + out.close(); + SDK.getLogAPI().consoleInfo("移动文件位置替换完成"); + + + + + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + return null; + } + + + 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)) { + cell.setCellValue(cellValue.replace(parameter, replacement)); + } + } + + + /** + * 解决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)) { + cell.setCellValue(cellValue.replace(parameter, replacement)); + } + } + + /** + * 插入数据xlsx的 + * @param sheet + * @param rowData + * @param row + */ + private static void insertData(XSSFSheet sheet, String[] rowData, int row) { + XSSFRow newRow = sheet.createRow(row); + for (int i = 0; i < rowData.length; i++) { + XSSFCell cell = newRow.createCell(i); + cell.setCellValue(rowData[i]); + } + } + + /** + * 插入数据xls的 + * @param sheet + * @param rowData + * @param row + */ + private static void insertData(HSSFSheet sheet, String[] rowData, int row) { + HSSFRow newRow = sheet.createRow(row); + for (int i = 0; i < rowData.length; i++) { + HSSFCell cell = newRow.createCell(i); + cell.setCellValue(rowData[i]); + } + } + + /** + * 替换参数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)) { + cell.setCellValue(cellValue.replace(parameter, replacement)); + } + } + } + } + + } + /** + * 替换参数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)) { + cell.setCellValue(cellValue.replace(parameter, replacement)); + } + } + } + } + + } + + 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/src/com/awspaas/user/bpa/at/GetOrgPostByName.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/at/GetOrgPostByName.java new file mode 100644 index 00000000..9881724f --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/at/GetOrgPostByName.java @@ -0,0 +1,29 @@ +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/src/com/awspaas/user/bpa/at/getSJNumsByprocess.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/at/getSJNumsByprocess.java new file mode 100644 index 00000000..6bc7e911 --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/at/getSJNumsByprocess.java @@ -0,0 +1,32 @@ +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/src/com/awspaas/user/bpa/controller/GetOpenDataController.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/controller/GetOpenDataController.java new file mode 100644 index 00000000..2059f2fd --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/controller/GetOpenDataController.java @@ -0,0 +1,117 @@ +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/src/com/awspaas/user/bpa/controller/UpateFileStateController.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/controller/UpateFileStateController.java new file mode 100644 index 00000000..2975e24a --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/controller/UpateFileStateController.java @@ -0,0 +1,202 @@ +package com.awspaas.user.apps.app.controller; + +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 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; + +/** + * 修改文件状态 + * @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 + "'"; + DBSql.update(sqlt); + /* + 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 + "'"); } } + */ + + PALRepositoryCache.getCache().reload(); + SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>"); + if(Integer.valueOf(state) == 1){ + 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); + PALRepositoryCache.getCache().reload(); + SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>"); + } else if ("3".equals(type)) { + // 重新生成手册 + PALRepositoryModel model = PALRepositoryCache.getCache().get(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); + PALRepositoryCache.getCache().reload(); + 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()); + 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; + } + +} diff --git a/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/CreateVER_ACTIVITYJob.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/CreateVER_ACTIVITYJob.java new file mode 100644 index 00000000..de3a6731 --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/job/CreateVER_ACTIVITYJob.java @@ -0,0 +1,81 @@ +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 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/src/com/awspaas/user/bpa/plugins/Plugins.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/plugins/Plugins.java new file mode 100644 index 00000000..c1a84791 --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/plugins/Plugins.java @@ -0,0 +1,30 @@ +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/src/com/awspaas/user/bpa/test.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/test.java new file mode 100644 index 00000000..87d4006a --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/test.java @@ -0,0 +1,61 @@ +package com.awspaas.user.bpa; + +import com.actionsoft.sdk.local.SDK; +import com.awspaas.user.bpa.util.PptCreateUtil; +import com.spire.presentation.*; +import com.spire.presentation.drawing.IImageData; +import com.spire.xls.Workbook; +import com.spire.xls.Worksheet; +import org.apache.commons.io.IOUtils; +import org.apache.poi.hslf.extractor.PowerPointExtractor; +import org.apache.poi.sl.usermodel.PictureData; +import org.apache.poi.xslf.usermodel.*; +import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph; +import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape; +import org.openxmlformats.schemas.presentationml.x2006.main.CTShape; +import org.openxmlformats.schemas.presentationml.x2006.main.CTSlide; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +public class test { + public static void main(String[] args) throws Exception { + //新建PowerPoint文档 + Presentation ppt = new Presentation(); + + //加载Excel文档,将指定单元格数据保存为图片 + Workbook workbook = new Workbook(); + workbook.loadFromFile("test.xlsx"); + Worksheet sheet = workbook.getWorksheets().get(0); + sheet.saveToImage("image.png",1,1,8,7);//将指定单元格数据范围保存为图片 + + //加载保存的表格图片(作为OLE对象图标) + File file = new File("image.png"); + BufferedImage image = ImageIO.read(file); + IImageData oleImage = ppt.getImages().append(image); + Rectangle rec = new Rectangle(120, 30, image.getWidth()/2, image.getHeight()/2); + + //将Excel数据保存到流 + File oldFile = new File("test.xlsx"); + FileInputStream inputStream = new FileInputStream(oldFile); + byte[] data = new byte[(int)oldFile.length()]; + inputStream.read(data,0,data.length); + + //将Excel文档作为OLE对象插入到幻灯片 + IOleObject oleObject = ppt.getSlides().get(0).getShapes().appendOleObject("excel", data, rec); + oleObject.getSubstituteImagePictureFillFormat().getPicture().setEmbedImage(oleImage); + oleObject.setProgId("Excel.Sheet.12"); + + //保存文档 + ppt.saveToFile("EmbedExcelAsOLE.pptx", FileFormat.PPTX_2013); + inputStream.close(); + } + +} \ No newline at end of file diff --git a/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/HSSFUtils.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/HSSFUtils.java new file mode 100644 index 00000000..6b0bc402 --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/HSSFUtils.java @@ -0,0 +1,188 @@ +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/src/com/awspaas/user/bpa/util/PalUtil.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/PalUtil.java new file mode 100644 index 00000000..d785c764 --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/PalUtil.java @@ -0,0 +1,105 @@ +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/src/com/awspaas/user/bpa/util/PptCreateUtil.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/PptCreateUtil.java new file mode 100644 index 00000000..f6a21e72 --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/PptCreateUtil.java @@ -0,0 +1,154 @@ +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/src/com/awspaas/user/bpa/util/UtilUrls.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/UtilUrls.java new file mode 100644 index 00000000..173f118d --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/UtilUrls.java @@ -0,0 +1,52 @@ +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/src/com/awspaas/user/bpa/util/Utils.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/Utils.java new file mode 100644 index 00000000..a972d4fe --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/util/Utils.java @@ -0,0 +1,184 @@ +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/src/com/awspaas/user/bpa/webapi/WorkFlowAPI.java b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/webapi/WorkFlowAPI.java new file mode 100644 index 00000000..c7da8a20 --- /dev/null +++ b/com.awspaas.user.bpa/src/com/awspaas/user/bpa/webapi/WorkFlowAPI.java @@ -0,0 +1,548 @@ +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 where ID = '124' order by CAST(EXT1 as int) asc"); + int q=0; + for (RowMap bos:maps + ) { + if (q<=maps.size()){ + + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加 + + + int size = Integer.valueOf(soap_page); + + for (int j = 1; j < size; j++) { + + int tale = Integer.valueOf(bos.getString("ID").trim()); + + 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); + } + } else { + break; + } + + } + }else { + break; + } + q++; + } + System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.toString()); + 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("这里是开始流程的接口数据传递"); + 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 ID = '124' order by CAST(EXT1 as int) asc"); + int q = 0; + for (RowMap bos:maps + ) { + if (q<=maps.size()){ + + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加 + + + int size = Integer.valueOf(soap_page); + + for (int j = 1; j < size; j++) { + + int tale = Integer.valueOf(bos.getString("ID").trim()); + BO bo = new BO(); + UserContext userContexts = UserContext.fromUID("admin"); + bo.set("WORKID",bos.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; + } + } + }else { + break; + } + q++; + } + System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.toString()); + 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 where ID = '124' order by CAST(EXT1 as int) asc"); + int q=0; + for (RowMap bos:maps + ) { + if (q<=maps.size()){ + + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加 + + + int size = Integer.valueOf(soap_page); + + for (int j = 1; j < size; j++) { + + int tale = Integer.valueOf(bos.getString("ID").trim()); + + 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; + } + } + }else { + break; + } + q++; + } + System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.toString()); + 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 where ID = '124' order by CAST(EXT1 as int) asc"); + int q=0; + for (RowMap bos:maps + ) { + if (q<=maps.size()){ + + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加 + + int size = Integer.valueOf(soap_page); + + for (int j = 1; j < size; j++) { + + int tale = Integer.valueOf(bos.getString("ID").trim()); + + 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; + } + } + }else { + break; + } + q++; + } + System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.toString()); + return jsonArray_new.toString(); + } + + +}