新版BPA应用相关代码提交

This commit is contained in:
Mr-wang 2023-09-26 10:13:06 +08:00
parent 6a7112943d
commit d1f387da69
25 changed files with 9 additions and 8496 deletions

View File

@ -1,29 +0,0 @@
package com.awspaas.user.bpa.at;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.at.AbstExpression;
import com.actionsoft.bpms.commons.at.ExpressionContext;
import com.actionsoft.exception.AWSExpressionException;
import com.actionsoft.sdk.local.SDK;
public class GetOrgPostByName extends AbstExpression {
public GetOrgPostByName(ExpressionContext atContext, String expressionValue) {
super(atContext, expressionValue);
}
@Override
public String execute(String s) throws AWSExpressionException {
String boName = getParameter(s,1);
String zd_name = getParameter(s,2);
String name = getParameter(s,3);
String set_name = getParameter(s,4);
String names = zd_name.concat(" = ");
BO detail = SDK.getBOAPI().query(boName, true).addQuery(names, name).detail();
if (detail!=null){
String set_name1 = detail.getString(set_name);
return set_name1;
}else {
return "";
}
}
}

View File

@ -1,32 +0,0 @@
package com.awspaas.user.bpa.at;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.at.AbstExpression;
import com.actionsoft.bpms.commons.at.ExpressionContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.exception.AWSExpressionException;
import com.actionsoft.sdk.local.SDK;
public class getSJNumsByprocess extends AbstExpression {
public getSJNumsByprocess(ExpressionContext atContext, String expressionValue) {
super(atContext, expressionValue);
}
@Override
public String execute(String s) throws AWSExpressionException {
String bindid = getParameter(s,1);
BO bo_eu_pal_pulbish_success = SDK.getBOAPI().query("BO_EU_PAL_PULBISH_SUCCESS", true).addQuery("BINDID = ", bindid).detail();
if (bo_eu_pal_pulbish_success!=null){
String processid = bo_eu_pal_pulbish_success.getString("PROCESSID");
String num = DBSql.getString("select count(user_id) AS NUMBERS from BO_ACT_DATAID where 1=1 AND PROCESSID = '" + processid + "'");
String read_num = DBSql.getString("select count(user_id) AS NUMBERS from BO_ACT_ALREADY_DATAID where 1=1 AND PROCESSID = '" + processid + "'");
Integer data = Integer.parseInt(num)+Integer.parseInt(read_num);
System.out.println("data>>>>>>>>>>>"+data
);
return String.valueOf(data);
}else {
return "";
}
}
}

View File

@ -1,117 +0,0 @@
package com.awspaas.user.bpa.controller;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.bpa.util.PalUtil;
@Controller
public class GetOpenDataController {
@Mapping("com.awspaas.user.bpa.controller.GetOpenDataController.getHtmlPage")
//./w?sid=@sid&cmd=CLIENT_BPM_WORKLIST_PROCESSINST_CREATE_AJAX_PREPAGE&processGroupId=obj_049cd0b7cd864c078ae35e4a79dc0a76&processDefId=obj_19f3b1d5083841a6a44af73400d5305e
public String getHtmlPage(String sid,String processDefId){
ResponseObject ro = ResponseObject.newOkResponse();
UserContext userContext = UserContext.fromSessionId(sid);
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance(processDefId, userContext.getUID(), "");
//SDK.getProcessAPI().start(processInstance);
TaskInstance taskInst = SDK.getProcessAPI().start(processInstance).fetchActiveTasks().get(0);
String formPage = SDK.getFormAPI().getFormPage(userContext, processInstance, taskInst, 1, 1, null, null);
return formPage;
}
// @Mapping("COE_PAL_OUTPUTREPORT_JSON_DATA")
@Mapping("com.actionsoft.apps.bpa.pal_report_json_data")
public String COEPALOutPutReportJsonData(UserContext me, String language, String templateOperate) {
PalUtil outPutReport = new PalUtil();
return outPutReport.jsonData(me.getSessionId(),language, templateOperate);
}
@Mapping("com.actionsoft.apps.bpa.getSjNumByprocess")
public JSONObject getSjNumByprocess(String sid, String bindid) {
JSONObject result = new JSONObject();
BO bo_eu_pal_pulbish_success = SDK.getBOAPI().query("BO_EU_PAL_PULBISH_SUCCESS", true).addQuery("BINDID = ", bindid).detail();
if (bo_eu_pal_pulbish_success!=null){
String processid = bo_eu_pal_pulbish_success.getString("PROCESSID");
String num = DBSql.getString("select count(user_id) AS NUMBERS from BO_ACT_DATAID where 1=1 AND PROCESSID = '" + processid + "'");
String read_num = DBSql.getString("select count(user_id) AS NUMBERS from BO_ACT_ALREADY_DATAID where 1=1 AND PROCESSID = '" + processid + "'");
Integer data = Integer.parseInt(num)+Integer.parseInt(read_num);
bo_eu_pal_pulbish_success.set("SENDNUMSJ",data);
SDK.getBOAPI().update("BO_EU_PAL_PULBISH_SUCCESS",bo_eu_pal_pulbish_success);
result.put("data",data);
}
return result;
}
@Mapping("com.actionsoft.apps.bpa.IsHidden_Modeling_Guidance")
public String IsHidden_Modeling_Guidance(String sid) {
String property = SDK.getAppAPI().getProperty("com.awspaas.user.apps.app20221008163300", "JM_HIDDEN");
return property;
}
@Mapping("com.awspaas.user.bpa.controller.GetOpenDataController.GetName")
public JSONObject GetName(String sid, String boName, String zd_name, String name, String set_name) {
//String boName = getParameter(s,1);
// String zd_name = getParameter(s,2);
// String name = getParameter(s,3);
// String set_name = getParameter(s,4);
String names = zd_name.concat(" = ");
JSONObject result= new JSONObject();
if (boName.contains("BO_")&&( boName.lastIndexOf("1")!=(boName.length()-1))){
BO detail = SDK.getBOAPI().query(boName, true).addQuery(names, name).detail();
if (detail!=null){
String set_name1 = detail.getString(set_name);
System.out.println("数据>>>>>>>>>"+set_name1);
result.put("data",set_name1);
return result;
}else {
result.put("data","");
return result;
}
}else {
boName= boName.substring(0,boName.lastIndexOf("1"));
String sql = boName+"'" + name + "'";
System.out.println("sql = >>>>>>>>"+sql);
RowMap map = DBSql.getMap(sql);
System.out.println("map>>>>>>>>"+map);
if (map!=null){
String set_name1 = map.getString(set_name);
System.out.println("数据>>>>>>>>>"+set_name1);
result.put("data",set_name1);
return result;
}else {
result.put("data","");
return result;
}
}
}
@Mapping("com.awspaas.user.apps.app.controller.Delete_Pal_RePOSITORY")
public ResponseObject delete_pal(String sid,String plId) {
ResponseObject ro = ResponseObject.newOkResponse();
String sql = "DELETE FROM BO_EU_PAL_REPOSITORY";
int update = DBSql.update(sql);
if(update>0) {
ro.put("result", "ok");
}else {
ro.put("result", "error");
}
return ro;
}
}

View File

@ -1,278 +0,0 @@
package com.awspaas.user.bpa.controller;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.sdk.local.api.BOQueryAPI;
import com.alibaba.fastjson.JSONArray;
import com.awspaas.user.apps.yili.reportform.util.RepositoryAttribute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 修改文件状态
* @author lihongyu
*
*/
@Controller
public class UpateFileStateController {
private static Logger logger = LoggerFactory.getLogger(UpateFileStateController.class);
// 修改文件发布状态
@Mapping("com.awspaas.user.apps.app.controller.updatePalFileState_new")
public ResponseObject checkIsSend(UserContext me , String sid, String plIds, String state, String type) {
System.err.println("修改文件状态========>" + plIds + "/" + state + "/" + type);
ResponseObject ro = ResponseObject.newOkResponse();
int count = 0;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String[] plIdList = plIds.split(",");
for (String plId : plIdList){
String date = simpleDateFormat.format(new Date());
if ("1".equals(type)) {
BO bo_eu_pal_repository = SDK.getBOAPI().query("BO_EU_PAL_REPOSITORY").addQuery("PLID = ", plId).detail();
bo_eu_pal_repository.set("ISPUBLISH",state);
SDK.getBOAPI().update("BO_EU_PAL_REPOSITORY",bo_eu_pal_repository);
//修改发布状态
String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISPUBLISH = '" + state + "',MODIFYDATE = TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '" + plId
+ "'";
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '"+state+"',MODIFYDATE = TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '"+plId+"'");
count = DBSql.update(updataSql);
String sqlt = "UPDATE BO_EU_PAL_FILE1 SET FILESTATE = '" + state + "' WHERE FILEID = '" + plId + "'";
int update = DBSql.update(sqlt);
if (update==0){
}
/*
String id = DBSql.getString("SELECT ID FROM APP_ACT_COE_PAL_PUBLISH_LIST WHERE PALREPOSITORYID='" + plId + "'");
* if (UtilString.isNotEmpty(id)) { PALRepositoryModel model =
* PALRepositoryCache.getCache().get(plId); if
* ("control.policy".equals(model.getMethodId()) ||
* "process.flowchart".equals(model.getMethodId()) ||
* "data.form".equals(model.getMethodId()) ||
* "process.epc".equals(model.getMethodId())) { String taskId =
* createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin",
* "", plId); // 刷新预览加载的表 String sqlr =
* "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + taskId + "' WHERE PLID = '"
* + plId + "'"; DBSql.update(sqlr); System.err.println("重新生成手册:" +
* model.getName() + "--->taskId" + taskId);
* DBSql.update("UPDATE BO_ACT_COE_PUBLISH_N SET TASKID='" + taskId +
* "'WHERE PUBLISHFILEID ='" + plId + "'"); count =
* DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId +
* "'WHERE PALREPOSITORYID='" + plId + "'"); } }
*/
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
if (model!=null){
PALRepositoryCache.getCache().put(plId,model);
}
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
if(Integer.valueOf(state) == 1){
UpdateDept(model,plId);
createPermScopeData(plId , me);
SDK.getLogAPI().consoleInfo("修改为发布状态后同步权限数据到权限阅览成功===========>");
}
} else if ("2".equals(type)) {
BO bo_eu_pal_repository = SDK.getBOAPI().query("BO_EU_PAL_REPOSITORY").addQuery("PLID = ", plId).detail();
bo_eu_pal_repository.set("ISAPPROVAL",state);
SDK.getBOAPI().update("BO_EU_PAL_REPOSITORY",bo_eu_pal_repository);
// 修改流程文件的审批状态
String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISAPPROVAL = '" + state + "',MODIFYDATE =TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '" + plId
+ "'";
System.err.println("审批改为设计=======>" + updataSql);
count = DBSql.update(updataSql);
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
if (model!=null){
PALRepositoryCache.getCache().put(plId,model);
}
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
} else if ("3".equals(type)) {
// 重新生成手册
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
String taskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin", "", plId);
System.err.println("======手动生成手册id======"+taskId);
// 刷新预览加载的表
String sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + taskId + "' WHERE PLID = '" + plId + "'";
DBSql.update(sqlr);
String sql1 = "SELECT ID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID = '" + plId + "'";
String sql2 = "SELECT ID FROM BO_ACT_COE_PUBLISH_C WHERE CHANGEDFILEIDNEW = '" + plId + "'";
if (UtilString.isNotEmpty(DBSql.getString(sql1))) {
count = DBSql.update(
"UPDATE BO_ACT_COE_PUBLISH_N SET TASKID='" + taskId + "'WHERE PUBLISHFILEID ='" + plId + "'");
}
if (UtilString.isNotEmpty(DBSql.getString(sql2))) {
count = DBSql.update(
"UPDATE BO_ACT_COE_PUBLISH_C SET TASKID='" + taskId + "'WHERE CHANGEDFILEIDNEW ='" + plId + "'");
}
if (count != 0) {
DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId + "'WHERE PALREPOSITORYID='"
+ plId + "'");
}
System.err.println("重新生成手册成功=====》" + count);
}else if ("4".equals(type)) {
BO bo_eu_pal_repository = SDK.getBOAPI().query("BO_EU_PAL_REPOSITORY").addQuery("PLID = ", plId).detail();
bo_eu_pal_repository.set("ISSTOP",state);
SDK.getBOAPI().update("BO_EU_PAL_REPOSITORY",bo_eu_pal_repository);
// 修改流程文件的停用状态
String updataSql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET ISSTOP = '" + state + "',MODIFYDATE = TO_DATE('"+date+"','YY-MM-DD HH24:MI:SS') WHERE ID = '" + plId
+ "'";
System.err.println("停用改设计=======>" + updataSql);
count = DBSql.update(updataSql);
PALRepositoryModel model = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
if (model!=null){
PALRepositoryCache.getCache().put(plId,model);
}
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
}
}
if (count > 0) {
/*
* TeamPermCache.getCache().reload(); TeamMemberPermCache.getCache().reload();
* PublishHistoryCache.getCache().reload();
* PublishUserGroupCache.getCache().reload();
* PublishUserGroupPermCache.getCache().reload();
* PublishUserGroupRoleCache.getCache().reload();
* PALDesignerFileCache.getCache().reload();
* PALDesignerFileDragModelCache.getCache().reload();
* PALRepositoryRemoveCache.getCache().reload();
* CoeDesignerShapeCache.getCache().reload();
* DesignerShapeRelationCache.getCache().reload();
* PALRepositoryPropertyCache.getCache().reload();
* PALRepositoryAttributeCache.getCache().reload();
* PALRepositoryShapeConfigCache.getCache().reload();
* PALRepositoryShapeAttributeCache.getCache().reload();
* CoeProcessLevelCorrelateCache.getCache().reload();
* CoeDesignerImageCache.getCache().reload();
*/
ro.put("result", "ok");
} else {
ro.put("result", "error");
}
return ro;
}
/**
* 文件修改为发布状态时同步权限数据到权限阅览
*
* @param palId palid
* @param me me
*/
private void createPermScopeData(String palId , UserContext me) {
PALRepositoryModel parentModel = PALRepositoryCache.getCache().get(palId);
String plVersionid = parentModel.getVersionId();
BO oldBo = (BO) ((BOQueryAPI) SDK.getBOAPI().query("BO_ACT_PUBLISH_PERM_SCOPE").addQuery("PALVERSIONID = ", plVersionid)).detail();
if (oldBo == null) {
BO scopeBo = new BO();
scopeBo.set("PALVERSIONID" , plVersionid);
scopeBo.set("PALNAME" , parentModel.getName());
String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '"+palId+"'";
RowMap map = DBSql.getMap(sql);
if (map!=null){
scopeBo.set("ORGPERM" ,map.getString("EXT6"));
}
ProcessInstance processInst = SDK.getProcessAPI().createBOProcessInstance("obj_e076b01bd0d04bc39e5af12e2c8c188c", me.getUID(), "权限阅览");
SDK.getBOAPI().create("BO_ACT_PUBLISH_PERM_SCOPE", scopeBo, processInst, me);
}
}
private String createOutputReport(PALRepositoryModel model, String wsId, String userId, String teamId, String uuid) {
String taskId = "";
if (model.getMethodId().contains("process.")) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
taskId = object.getJSONObject("data").getString("taskId");
}
} else if ("data.form".equals(model.getMethodId())) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
taskId = object.getJSONObject("data").getString("taskId");
}
} else if ("control.policy".equals(model.getMethodId())) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
taskId = object.getJSONObject("data").getString("taskId");
}
}
return taskId;
}
public void UpdateDept(PALRepositoryModel palRepositoryModel,String id){
int count = 0;
int count2 = 0;
try {
Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(id);
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
// 发布部门
String dempId = "";
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
if (null != Issuing_department && !Issuing_department.equals("")) {
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
SDK.getLogAPI().consoleInfo(Issuing_department.toString());
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
for (Object PUBDEPTO : PUBDEPTJA) {
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
dempId += PUBDEPTJO.getString("id")+",";
}
dempId = dempId.substring(0,dempId.length()-1);
count2 += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('"+dempId+"') WHERE ID = '"+id+"'");
}
}
}
} catch (Exception e) {
// TODO: handle exception
}
// String methodId = palRepositoryModel.getMethodId();
String plVersionId = palRepositoryModel.getVersionId();
String sqly = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + plVersionId + "'";
List<RowMap> maps = DBSql.getMaps(sqly);
if (maps.size() > 1) {
String sqlu = "SELECT ID FROM (SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '"
+ plVersionId + "' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2";
String palId = DBSql.getString(sqlu);
if (UtilString.isNotEmpty(palId)) {
if (!id.equals(palId)) {
count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+id+"'");
// continue;
} else {
count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+id+"'");
}
}
}
//刷新状态
if(palRepositoryModel.isStop()) {
count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+id+"'");
}
}
}

View File

@ -1,81 +0,0 @@
package com.awspaas.user.bpa.job;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.HistoryTaskInstance;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.bpa.util.UtilUrls;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.util.List;
public class CreateVER_ACTIVITYJob implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
try {
DBSql.update("delete from APP_ACT_BPAD_P_VER_ACTIVITY");
//jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
//jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser()
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.services.weaver.com.cn\">\n" +
" <soapenv:Header/>\n" +
" <soapenv:Body>\n" +
" <web:getAllWfId/>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
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<jsonArray.size();i++
) {
JSONObject jsonObject = JSON.parseObject(jsonArray.get(i).toString());
if ((jsonObject.get("WORKFLOWNAME").toString().contains("废止")&&!jsonObject.get("WORKFLOWNAME").toString().contains("仅查询"))||jsonObject.get("WORKFLOWNAME").toString().contains("停止")
||jsonObject.get("WORKFLOWNAME").toString().contains("停用")||jsonObject.get("WORKFLOWNAME").toString().contains("(废)")||jsonObject.get("WORKFLOWNAME").toString().contains("作废")){
}else {
//insert into 表名列名1,列名2,列名3.....values(值1,值2,值3.....);
Integer version = 1;
if (UtilString.isNotEmpty(jsonObject.get("VERSION").toString())){
version = Integer.parseInt(jsonObject.get("VERSION").toString());
}
String sql = "insert into APP_ACT_BPAD_P_VER_ACTIVITY(ID,PROCESSVERSION,PROCESSVERNAME,PROCESSVERSIONID,PROCESSGROUPID,EXT1) values('"+jsonObject.get("ID").toString().trim()+"','"+version+"','"+jsonObject.get("WORKFLOWNAME")+"','"+jsonObject.get("ID").toString().trim()+"','"+jsonObject.get("ID").toString().trim()+"','"+i+"')";
DBSql.update(sql);
}
}
}catch (Exception e){
e.printStackTrace();
}
}
}

View File

@ -1,44 +0,0 @@
package com.awspaas.user.bpa.job;
import com.actionsoft.apps.resource.plugin.profile.CachePluginProfile;
import com.actionsoft.bpms.commons.cache.Cache;
import com.actionsoft.bpms.commons.cache.CacheIndex;
import com.actionsoft.bpms.commons.cache.CacheManager;
import com.actionsoft.bpms.commons.cache.ListValueIndex;
import com.actionsoft.bpms.commons.mvc.dao.IDaoQuery;
import java.io.Serializable;
import java.util.List;
public class DimensionCache extends Cache<String, DimensionModel> {
public DimensionCache(CachePluginProfile configuration) {
super(configuration);
registeIndex(DimensionParentIndex.class, (CacheIndex)new DimensionParentIndex());
}
public List<DimensionModel> getDimensionListOfParent(String parentDimensionId) {
List<DimensionModel> list = iteratorToList(getCache().getByIndex(DimensionParentIndex.class, parentDimensionId));
return list;
}
protected void load() {
DimensionDao dimensionDao = new DimensionDao();
IDaoQuery<DimensionModel> iDaoQuery = dimensionDao.query();
List<DimensionModel> dimensionModels = iDaoQuery.list();
for (DimensionModel dimensionModel : dimensionModels)
put(dimensionModel.getId(), (DimensionModel) dimensionModel, false);
}
public static DimensionCache getCache() {
return (DimensionCache)CacheManager.getCache(DimensionCache.class);
}
class DimensionParentIndex extends ListValueIndex<String, DimensionModel> {
public String key(DimensionModel t) {
return t.getParentId();
}
}
}

View File

@ -1,160 +0,0 @@
/* */ package com.awspaas.user.bpa.job;
/* */
/* */ import com.actionsoft.bpms.bo.engine.SQLNullValue;
/* */ import com.actionsoft.bpms.commons.database.RowMapper;
/* */ import com.actionsoft.bpms.commons.mvc.dao.DaoObject;
/* */ import com.actionsoft.bpms.util.DBSql;
/* */ import com.actionsoft.bpms.util.UUIDGener;
/* */ import com.actionsoft.bpms.util.UtilString;
/* */ import com.actionsoft.exception.AWSDataAccessException;
/* */ import com.actionsoft.exception.AWSException;
/* */ import java.io.Serializable;
/* */ import java.sql.Connection;
/* */ import java.sql.ResultSet;
/* */ import java.sql.SQLException;
/* */ import java.util.HashMap;
/* */ import java.util.Iterator;
/* */ import java.util.List;
/* */ import java.util.Map;
/* */
/* */ public class DimensionDao extends DaoObject<DimensionModel> {
/* */ public int insert(Connection conn, DimensionModel model) throws AWSDataAccessException {
/* 40 */ if (UtilString.isEmpty(model.getId()))
/* 41 */ model.setId(UUIDGener.getUUID());
/* 43 */ Map<String, Object> paraMap = new HashMap<>();
/* 44 */ paraMap.put("ID", model.getId());
/* 45 */ paraMap.put("DIMENSIONNAME", model.getDimensionName());
/* 46 */ paraMap.put("CREATEUSER", model.getCreateUser());
/* 47 */ paraMap.put("CREATETIME", model.getCreateTime());
/* 48 */ paraMap.put("HOTSPOTDEFID", model.getHotspotDefId());
/* 49 */ paraMap.put("ISENABLED", Integer.valueOf(model.getIsEnabled()));
/* 50 */ paraMap.put("ISEXAMINE", Integer.valueOf(model.getIsExamine()));
/* 52 */ if (model.getMemo() == null) {
/* 53 */ paraMap.put("MEMO", SQLNullValue.newInstance(12));
/* */ } else {
/* 55 */ paraMap.put("MEMO", model.getMemo());
/* */ }
/* 58 */ paraMap.put("PARENTID", model.getParentId());
/* 59 */ paraMap.put("SHOWTYPE", Integer.valueOf(model.getShowType()));
/* 61 */ if (model.getLastUpdate() == null) {
/* 62 */ paraMap.put("LASTUPDATE", SQLNullValue.newInstance(91));
/* */ } else {
/* 64 */ paraMap.put("LASTUPDATE", model.getLastUpdate());
/* */ }
/* 67 */ paraMap.put("ORDERINDEX", Integer.valueOf(model.getOrderIndex()));
/* 69 */ int result = 0;
/* 70 */ if (conn == null) {
/* 71 */ result = DBSql.update(DBSql.getInsertStatement(entityName(), paraMap), paraMap);
/* */ } else {
/* 73 */ result = DBSql.update(conn, DBSql.getInsertStatement(entityName(), paraMap), paraMap);
/* */ }
/* 75 */ if (result == 1)
/* 76 */ DimensionCache.getCache().put(model.getId(), (DimensionModel) model);
/* 78 */ return result;
/* */ }
/* */
/* */ public int insert(DimensionModel model) throws AWSDataAccessException {
/* 83 */ return insert((Connection)null, model);
/* */ }
/* */
/* */ public int update(Connection conn, DimensionModel model) throws AWSDataAccessException {
/* 96 */ if (UtilString.isEmpty(model.getId()))
/* 97 */ throw new AWSDataAccessException("Method getId() Does Not Allow Empty");
/* 99 */ Map<String, Object> paraMap = new HashMap<>();
/* 100 */ paraMap.put("DIMENSIONNAME", model.getDimensionName());
/* 101 */ paraMap.put("CREATEUSER", model.getCreateUser());
/* 102 */ paraMap.put("CREATETIME", model.getCreateTime());
/* 103 */ paraMap.put("HOTSPOTDEFID", model.getHotspotDefId());
/* 104 */ paraMap.put("ISENABLED", Integer.valueOf(model.getIsEnabled()));
/* 105 */ paraMap.put("ISEXAMINE", Integer.valueOf(model.getIsExamine()));
/* 106 */ paraMap.put("MEMO", model.getMemo());
/* 107 */ paraMap.put("PARENTID", model.getParentId());
/* 108 */ paraMap.put("SHOWTYPE", Integer.valueOf(model.getShowType()));
/* 109 */ if (model.getLastUpdate() == null) {
/* 110 */ paraMap.put("LASTUPDATE", SQLNullValue.newInstance(91));
/* */ } else {
/* 112 */ paraMap.put("LASTUPDATE", model.getLastUpdate());
/* */ }
/* 115 */ paraMap.put("ORDERINDEX", Integer.valueOf(model.getOrderIndex()));
/* 117 */ int result = 0;
/* 118 */ if (conn == null) {
/* 119 */ result = update(model.getId(), paraMap);
/* */ } else {
/* 121 */ result = update(conn, model.getId(), paraMap);
/* */ }
/* 123 */ if (result == 1)
/* 124 */ DimensionCache.getCache().put(model.getId(), (DimensionModel) model);
/* 126 */ return result;
/* */ }
/* */
/* */ public int update(DimensionModel model) throws AWSDataAccessException {
/* 131 */ return update((Connection)null, model);
/* */ }
/* */
/* */ public String entityName() {
/* 136 */ return "APP_ACT_KMS_DIMENSION";
/* */ }
/* */
/* */ public RowMapper<DimensionModel> rowMapper() {
/* 141 */ return new RowMapper<DimensionModel>() {
/* */ public DimensionModel mapRow(ResultSet rs, int rowNum) throws SQLException {
/* 144 */ return DimensionDao.this.record2Model(rs);
/* */ }
/* */ };
/* */ }
/* */
/* */ public DimensionModel record2Model(ResultSet rs) {
/* 150 */ DimensionModel dimensionModel = new DimensionModel();
/* */ try {
/* 152 */ dimensionModel.setId(rs.getString("ID"));
/* 153 */ dimensionModel.setCreateTime(rs.getTimestamp("CREATETIME"));
/* 154 */ dimensionModel.setCreateUser(rs.getString("CREATEUSER"));
/* 155 */ dimensionModel.setDimensionName(rs.getString("DIMENSIONNAME"));
/* 156 */ dimensionModel.setHotspotDefId(rs.getString("HOTSPOTDEFID"));
/* 157 */ dimensionModel.setIsEnabled(rs.getInt("ISENABLED"));
/* 158 */ dimensionModel.setIsExamine(rs.getInt("ISEXAMINE"));
/* 159 */ dimensionModel.setLastUpdate(rs.getTimestamp("LASTUPDATE"));
/* 160 */ dimensionModel.setMemo(rs.getString("MEMO"));
/* 161 */ String parentId = rs.getString("PARENTID");
/* 162 */ dimensionModel.setParentId((parentId == null) ? "" : parentId.trim());
/* 163 */ dimensionModel.setShowType(rs.getInt("SHOWTYPE"));
/* 164 */ dimensionModel.setOrderIndex(rs.getInt("ORDERINDEX"));
/* 165 */ } catch (Exception e) {
/* 166 */ e.printStackTrace();
/* 167 */ throw new AWSException(e);
/* */ }
/* 169 */ return dimensionModel;
/* */ }
/* */
/* */ public int delete(List<String> dimensionIdList) throws AWSDataAccessException {
/* 182 */ StringBuilder sqlWhere = new StringBuilder("(");
/* 183 */ for (int i = 0; i < dimensionIdList.size(); i++)
/* 184 */ sqlWhere.append("'" + (String)dimensionIdList.get(i) + "',");
/* 186 */ String sqlWhere1 = sqlWhere.substring(0, sqlWhere.lastIndexOf(","));
/* 187 */ sqlWhere1 = sqlWhere1 + ")";
/* 188 */ String sql = "DELETE FROM " + entityName() + " WHERE " + pkFieldName() + " IN " + sqlWhere1;
/* 190 */ int result = DBSql.update(sql);
/* 192 */ DimensionCache dimensionCache = DimensionCache.getCache();
/* 193 */ for (String id : dimensionIdList)
/* 194 */ dimensionCache.remove(id);
/* 196 */ return result;
/* */ }
/* */
/* */ public void fillDescendantDimensions(String id, List<String> dimensionIds) {
/* 207 */ Iterator<DimensionModel> iterator = DimensionCache.getCache().iterator();
/* 208 */ while (iterator.hasNext()) {
/* 209 */ DimensionModel dimensionModel = iterator.next();
/* 210 */ if (id.equals(dimensionModel.getParentId())) {
/* 211 */ dimensionIds.add(dimensionModel.getId());
/* 212 */ String id1 = dimensionModel.getId();
/* 213 */ fillDescendantDimensions(id1, dimensionIds);
/* */ }
/* */ }
/* */ }
/* */ }
/* Location: C:\Users\12976\Desktop\com.actionsoft.apps.kms.jar!\com\actionsoft\apps\kms\dao\DimensionDao.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/

View File

@ -1,184 +0,0 @@
package com.awspaas.user.bpa.job;
import com.actionsoft.bpms.commons.mvc.model.IModelBean;
import com.actionsoft.bpms.commons.mvc.model.ModelBean;
import java.sql.Timestamp;
public class DimensionModel extends ModelBean implements IModelBean, Cloneable {
private static final long serialVersionUID = 1L;
public static final String ID = "ID";
public static final String DIMENSIONNAME = "DIMENSIONNAME";
public static final String PARENTID = "PARENTID";
public static final String SHOWTYPE = "SHOWTYPE";
public static final String ISEXAMINE = "ISEXAMINE";
public static final String MEMO = "MEMO";
public static final String CREATEUSER = "CREATEUSER";
public static final String CREATETIME = "CREATETIME";
public static final String LASTUPDATE = "LASTUPDATE";
public static final String HOTSPOTDEFID = "HOTSPOTDEFID";
public static final String ISENABLED = "ISENABLED";
public static final String ORDERINDEX = "ORDERINDEX";
private String id;
private String dimensionName;
private String parentId;
private int showType;
private int isExamine;
private String memo;
private String createUser;
private Timestamp createTime;
private Timestamp lastUpdate;
private String hotspotDefId;
private int isEnabled;
private int orderIndex;
private boolean hasPerm = true;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getDimensionName() {
if (this.dimensionName == null)
/* 55 */ this.dimensionName = "";
/* 57 */ return this.dimensionName;
}
public void setDimensionName(String dimensionName) {
/* 61 */ this.dimensionName = dimensionName;
}
public String getParentId() {
/* 65 */ if (this.parentId == null)
/* 66 */ this.parentId = "";
/* 68 */ return this.parentId;
}
public void setParentId(String parentId) {
/* 72 */ this.parentId = parentId;
}
public int getShowType() {
/* 76 */ return this.showType;
}
public void setShowType(int showType) {
/* 80 */ this.showType = showType;
}
public int getIsExamine() {
/* 84 */ return this.isExamine;
}
public void setIsExamine(int isExamine) {
/* 88 */ this.isExamine = isExamine;
}
public String getMemo() {
/* 92 */ if (this.memo == null)
/* 93 */ this.memo = "";
/* 95 */ return this.memo;
}
public void setMemo(String memo) {
/* 99 */ this.memo = memo;
}
public String getCreateUser() {
/* 103 */ if (this.createUser == null)
/* 104 */ this.createUser = "";
/* 106 */ return this.createUser;
}
public void setCreateUser(String createUser) {
/* 110 */ this.createUser = createUser;
}
public Timestamp getCreateTime() {
/* 114 */ return this.createTime;
}
public void setCreateTime(Timestamp createTime) {
/* 118 */ this.createTime = createTime;
}
public Timestamp getLastUpdate() {
/* 122 */ return this.lastUpdate;
}
public void setLastUpdate(Timestamp lastUpdate) {
/* 126 */ this.lastUpdate = lastUpdate;
}
public String getHotspotDefId() {
/* 130 */ if (this.hotspotDefId == null)
/* 131 */ this.hotspotDefId = "";
/* 133 */ return this.hotspotDefId;
}
public void setHotspotDefId(String hotspotDefId) {
/* 137 */ this.hotspotDefId = hotspotDefId;
}
public int getIsEnabled() {
/* 141 */ return this.isEnabled;
}
public void setIsEnabled(int isEnabled) {
/* 145 */ this.isEnabled = isEnabled;
}
public int getOrderIndex() {
/* 149 */ return this.orderIndex;
}
public void setOrderIndex(int orderIndex) {
/* 153 */ this.orderIndex = orderIndex;
}
public boolean isHasPerm() {
/* 157 */ return this.hasPerm;
}
public void setHasPerm(boolean hasPerm) {
/* 161 */ this.hasPerm = hasPerm;
}
public DimensionModel clone() {
try {
/* 167 */ return (DimensionModel)super.clone();
/* 168 */ } catch (CloneNotSupportedException e) {
/* 169 */ e.printStackTrace();
/* 170 */ return null;
}
}
}

View File

@ -1,155 +0,0 @@
package com.awspaas.user.bpa.job;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.commons.login.constant.LoginConst;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.SSOUtil;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.AppAPI;
import com.alibaba.fastjson.JSONArray;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class KnowMoveOther implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
//UserContext uc = UserContext.fromUID("admin");
String sessionId = new SSOUtil().registerClientSessionNoPassword("admin", LoginConst.DEFAULT_LANG, "localhost", LoginConst.DEVICE_PC);
List<PALRepositoryModel> palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getAllCoeProcessLevelByWsId("7d3ca852-a0bd-42e6-80b1-3dcea6f55083");
if (palRepositoryModels.size()>0){
for (PALRepositoryModel palRepositoryModel:
palRepositoryModels) {
boolean publish = palRepositoryModel.isPublish();
if (publish) {
//in ('org.role','data.form','process.flowchart','process.epc','control.policy','process.evc','control.kpi')
if (palRepositoryModel.getMethodId().equals("org.role") ||
palRepositoryModel.getMethodId().equals("data.form") ||
palRepositoryModel.getMethodId().equals("process.flowchart") ||
palRepositoryModel.getMethodId().equals("process.epc") ||
palRepositoryModel.getMethodId().equals("control.policy") ||
palRepositoryModel.getMethodId().equals("process.evc") ||
palRepositoryModel.getMethodId().equals("control.kpi")) {
String ext4 = palRepositoryModel.getExt4();
if (ext4 != null) {
String pal_sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + palRepositoryModel.getId() + "'";
RowMap map = DBSql.getMap(pal_sql);
if (map != null) {
String parentId = map.getString("PLPARENTID");
System.err.println("parentId>>>>>>>>>>>>>>>>" + parentId);
//PALRepositoryModel palRepositoryModel_parent = PALRepositoryCache.getCache().get(parentId);
String pal_parent_sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + parentId + "'";
RowMap ext41 = DBSql.getMap(pal_parent_sql);
if (ext41 != null) {
String parent_sql = "select DIMENSIONID FROM APP_ACT_KMS_PUBLISH WHERE CARDID = '" + ext4 + "'";
String parent_demensionid = DBSql.getString(parent_sql);
if (parent_demensionid.equals(ext41.getString("EXT4"))) {
} else {
System.out.println("PLname>>>>>>>>>>>>>>"+palRepositoryModel.getName());
//先取消发布知识
execute(sessionId, ext4);
JSONArray dimensionIDArray = new JSONArray(new LinkedList<>());
dimensionIDArray.add(ext41.getString("EXT4"));
JSONArray knwlIDArray = new JSONArray(new LinkedList<>());
knwlIDArray.add(ext4);
publishKnow(dimensionIDArray, knwlIDArray, sessionId);
}
}
}
}else {
String name = palRepositoryModel.getName();
double version = palRepositoryModel.getVersion();
BigDecimal bd = new BigDecimal(version);
String versions = bd.setScale(1, BigDecimal.ROUND_DOWN).toString();
String card_name = name+"V"+versions;
String card_sql = "select * from APP_ACT_KMS_card where cardname = '"+card_name+"'";
RowMap map = DBSql.getMap(card_sql);
if (map!=null){
String id = map.getString("ID");
int update = DBSql.update("update APP_ACT_COE_PAL_REPOSITORY set EXT4 = '" + id + "' where id = '" + palRepositoryModel.getId() + "'");
System.out.println("更新空的EXT4到pal资产库中"+update);
//先取消发布知识
String pal_sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + palRepositoryModel.getId() + "'";
RowMap mapss = DBSql.getMap(pal_sql);
String parentId = mapss.getString("PLPARENTID");
System.err.println("palRepositoryModel.getId()>>>>>>>>>>>>>>>>"+palRepositoryModel.getId()+">>>>>>>>>>>>parentId>>>>>>>>>>>>>>>>" + parentId);
//PALRepositoryModel palRepositoryModel_parent = PALRepositoryCache.getCache().get(parentId);
String pal_parent_sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + parentId + "'";
RowMap ext41 = DBSql.getMap(pal_parent_sql);
System.out.println("PLname>>>>>>>>>>>>>>"+palRepositoryModel.getName());
execute(sessionId, id);
JSONArray dimensionIDArray = new JSONArray(new LinkedList<>());
dimensionIDArray.add(ext41.getString("EXT4"));
JSONArray knwlIDArray = new JSONArray(new LinkedList<>());
knwlIDArray.add(id);
publishKnow(dimensionIDArray, knwlIDArray, sessionId);
}
}
}
}
}
}
}
/**
* 先取消发布知识,然后重新发布知识
* @param sid
* @param knwlId
*/
public void execute(String sid,String knwlId) {
// 调用App
String sourceAppId = "com.awspaas.user.apps.new_performance_indicator_library";
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.kms/CancelPublishKnwl";
// 参数定义列表
Map params = new HashMap<String, Object>();
//sid如果为空则需要传createUser参数,非必填
params.put("sid", sid);
//知识ID,必填
params.put("knwlId", knwlId);
AppAPI appAPI = SDK.getAppAPI();
//取消发布知识全部维度
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
boolean ok = ro.isOk();
System.out.println("取消发布成功>>>>>>>>>>"+ok);
}
/**
* 发布知识
* @return
*/
public void publishKnow(JSONArray dimensionIDArray,JSONArray knwlIDArray,String sid) {
// 调用App
String sourceAppId = "com.awspaas.user.apps.new_performance_indicator_library";
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.kms/PublishKnwl";
// 参数定义列表
Map params = new HashMap<String, Object>();
//要发布到的维度ID的JSON数组字符串,必填
params.put("dimensionIDArray", dimensionIDArray);
//要发布的知识ID的JSON数组字符串,必填
params.put("knwlIDArray", knwlIDArray);
//sid,必填
params.put("sid", sid);
AppAPI appAPI = SDK.getAppAPI();
//发布知识
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
boolean ok = ro.isOk();
System.out.println("移动知识文件>>>>>>>>>"+ro);
}
}

View File

@ -1,30 +0,0 @@
package com.awspaas.user.bpa.job;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.util.DBSql;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.util.List;
public class RemovedimensionJob implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
String dimension_sql = "select * from APP_ACT_KMS_DIMENSION where ID not IN ('obj_6adcee05d6f740868b2ef901dbeb85ee') and ID != 'obj_6adcee05d6f740868b2ef901dbeb85ee'";
List<RowMap> maps = DBSql.getMaps(dimension_sql);
for (RowMap map: maps) {
String id = map.getString("ID");
List<RowMap> maps1 = DBSql.getMaps("select * from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '" + id + "'");
System.out.println("maps1>>>>>>>>>>>>>>>>"+maps1);
if (maps1.size()>0){
}else {
int update = DBSql.update("delete from APP_ACT_KMS_DIMENSION where ID = '" + id + "'");
System.out.println("删除无用的知识维度>>>>>>>>>>>>>>>"+update+"><<<<<<<<<<<<"+map.getString("DIMENSIONNAME"));
//DimensionCache.getCache().reload();
}
}
}
}

View File

@ -1,209 +0,0 @@
package com.awspaas.user.bpa.job;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.cc.RDSAPI;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.bpa.util.UtilUrls;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.sql.Connection;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
public class SaveMoreData implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
String CC_ID = "58372e80-6456-40d7-9822-ec0f4e2cd7a7";
RDSAPI rdsapi;
Connection connection = null;
rdsapi = SDK.getCCAPI().getRDSAPI(CC_ID);
connection = rdsapi.open();
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc");
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
/*if (boss!=null&&boss.size()>0){
String pages = boss.get(0).getString("PAGES");
last_page = Integer.parseInt(pages);
size = last_page+1;
}else {
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
}*/
for (int c= 0;c<maps.size();c++) {
int size = 2;
int last_page = 1;
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
for (int j = last_page; j < size; j++) {
int tale = Integer.valueOf(maps.get(c).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 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.services.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:getFlowListByWfId>" +
" <web:in0>" +
"" + jsonObject + "" +
" </web:in0>" +
" </web:getFlowListByWfId>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
System.out.println("参数===============" + xmlStr);
//System.out.println("参数==============="+xmls);
//HttpClientUtil httpClientUtil = new HttpClientUtil();
int timeout = 600000;
// HttpURLConnection 发送SOAP请求
System.out.println("HttpURLConnection 发送SOAP请求");
String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, "");
Document document = null;
try {
document = DocumentHelper.parseText(postSoap);
} catch (DocumentException e) {
e.printStackTrace();
}
Element rootElement = document.getRootElement();
// System.out.println("rootElement>>>>>>"+rootElement);
Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out");
String resultString = result.getData().toString();
/*
System.out.println("resultString=>>>>>>>>>>"+resultString);
*/
//if (!StringUtils.isEmpty(resultString)){
JSONObject jsonObject1 = JSON.parseObject(resultString);
String datas = jsonObject1.getString("datas");
JSONArray jsonArray = JSONArray.parseArray(datas);
System.out.println("jsonArray>>>>>>>>>>>>>"+jsonArray.size());
if (jsonArray != null && jsonArray.size() != 0) {
for (int i = 0; i < jsonArray.size(); i++) {
// JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId")
JSONObject end_process = new JSONObject(new LinkedHashMap<>());
end_process.put("processinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId").toString().trim());//流程实例id
end_process.put("processdefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId").toString().trim());//流程定义id
RowMap workflowId = DBSql.getMap("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '" + JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId") + "'");
if (workflowId!=null) {
end_process.put("processdefverid", workflowId.getString("PROCESSVERSION"));//流程版本定义
} else {
end_process.put("processdefverid", "1");
}
end_process.put("starttime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间
end_process.put("endtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate"));//结束时间
end_process.put("createtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//创建时间
UserModel operatorWorkCode = SDK.getORGAPI().getUser(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString());
if (operatorWorkCode != null) {
end_process.put("createuser", JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));//创建人
UserContext userContext = UserContext.fromUID(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString());
end_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id
end_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id
end_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id
} else {
end_process.put("createuser", "admin");//创建人
UserContext userContext = UserContext.fromUID("admin");
end_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id
end_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id
end_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id
}
end_process.put("activitydefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeName").toString());//角色id
end_process.put("state", JSONObject.parseObject(jsonArray.get(i).toString()).get("status"));
end_process.put("begintime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间
end_process.put("taskinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("id"));//流程实例id
end_process.put("controlstate", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowType"));
end_process.put("actionname", JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeName"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date beginDate = null;
try {
beginDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate").toString());
} catch (ParseException e) {
e.printStackTrace();
}
if (UtilString.isNotEmpty(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString())) {
Date endDate = null;
try {
endDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString());
if (endDate!=null){
long dates = (endDate.getTime() - beginDate.getTime()) / (1000 * 60);
end_process.put("executecosttime", dates);//开始时间-结束时间如果结束时间为空,则这个时间也为空
}
} catch (ParseException e) {
e.printStackTrace();
}
} else {
end_process.put("executecosttime", "");//开始时间-结束时间如果结束时间为空,则这个时间也为空
}
end_process.put("timedur", "");
end_process.put("warningtimedur", "");
String sql = "insert into aws_bpa (ID,processinstid,processdefid,processdefverid,starttime,endtime," +
"createtime,createuser," +
"createuserorgid,createuserdeptid,createuserroleid," +
"controlstate,executecosttime,timedur,warningtimedur" +
",actionname,activitydefid,begintime,state,taskinstid" +
") values ('%s', '%s', '%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')";
String id = UUIDGener.getUUID();
int update = DBSql.update(connection, String.format(sql, id,
end_process.getString("processinstid"),
end_process.getString("processdefid"),
end_process.getString("processdefverid"),
end_process.getString("starttime"),
end_process.getString("endtime"),
end_process.getString("createtime"),
end_process.getString("createuser"),
end_process.getString("createuserorgid"),
end_process.getString("createuserdeptid"),
end_process.getString("createuserroleid"),
end_process.getString("controlstate"),
end_process.getString("executecosttime"),
end_process.getString("timedur"),
end_process.getString("warningtimedur"),
end_process.getString("operateType"),
end_process.getString("nodeid"),
end_process.getString("operateDate"),
end_process.getString("state"),
end_process.getString("taskinstid")
));
System.out.println("是否插入一条数据>>>>>>>>>>" + update);
}
} else {
break;
}
}
}
}
}

View File

@ -1,108 +0,0 @@
package com.awspaas.user.bpa.job;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.bpa.util.UtilUrls;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.UUID;
public class ThirdJob implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
List<RowMap> 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 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.services.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:getFlowListByWfId>" +
" <web:in0>" +
"" + jsonObject + "" +
" </web:in0>" +
" </web:getFlowListByWfId>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
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);
}
}
}
}
}
}
}
}

View File

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

View File

@ -1,30 +0,0 @@
package com.awspaas.user.bpa.plugins;
import com.actionsoft.apps.listener.PluginListener;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.apps.resource.plugin.profile.ASLPPluginProfile;
import com.actionsoft.apps.resource.plugin.profile.AWSPluginProfile;
import com.actionsoft.apps.resource.plugin.profile.AtFormulaPluginProfile;
import com.actionsoft.apps.resource.plugin.profile.HttpASLP;
import com.awspaas.user.bpa.aslp.UpdatePptxAndExcelAslp;
import com.awspaas.user.bpa.at.GetOrgPostByName;
import com.awspaas.user.bpa.at.getSJNumsByprocess;
import java.util.ArrayList;
import java.util.List;
public class Plugins implements PluginListener {
@Override
public List<AWSPluginProfile> register(AppContext appContext) {
// 存放本应用的全部插件扩展点描述
List<AWSPluginProfile> list = new ArrayList<AWSPluginProfile>();
// 注册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;
}
}

View File

@ -1,188 +0,0 @@
package com.awspaas.user.bpa.util;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.util.CellRangeAddress;
import java.io.*;
import java.util.Iterator;
import java.util.List;
public class HSSFUtils {
/**
* #合并多个excel文件
* @param fileLists excel文件路径
* @param path 目标文件保存目录
* @param fileName 目标文件名称
*/
public static void mergeExcel(List<String> 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<Row> 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<Cell> 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 {
}
}
}

View File

@ -1,105 +0,0 @@
package com.awspaas.user.bpa.util;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager;
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile;
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PalUtil {
public String jsonData(String sid
,String language, String templateOperate) {
// 多语言过滤 暂时没有实现多语言
if (!"cn".equals(language)) {
return "";
}
List<OutputAppProfile> list = OutputAppManager.getList();
JSONArray jsonArray = new JSONArray();
// 加载报告类型
Map<String, OutputAppProfile> appMap = new HashMap<String, OutputAppProfile>();
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<String, OutputAppProfile> 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<String> 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<String, Object> map = new HashMap<String, Object>();
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);
}
}

View File

@ -1,154 +0,0 @@
package com.awspaas.user.bpa.util;
import org.apache.poi.sl.usermodel.PictureData;
import org.apache.poi.sl.usermodel.TableCell;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFPictureData;
import org.apache.poi.xslf.usermodel.XSLFPictureShape;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFSlideLayout;
import org.apache.poi.xslf.usermodel.XSLFTable;
import org.apache.poi.xslf.usermodel.XSLFTableCell;
import org.apache.poi.xslf.usermodel.XSLFTableRow;
import org.apache.poi.xslf.usermodel.XSLFTextBox;
import org.apache.poi.xslf.usermodel.XSLFTextRun;
import javax.servlet.ServletOutputStream;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
/**
* @Author: Yangy
* @Date: 2020/11/4 16:12
* @Description ppt生成工具类
*/
public class PptCreateUtil {
/**
* @Author Yangy
* @Description 获取一个ppt实例
* @Date 16:37 2020/11/4
* @Param []
* @return org.apache.poi.xslf.usermodel.XMLSlideShow
**/
public static XMLSlideShow getPptInstance(){
// 创建ppt:
XMLSlideShow ppt = new XMLSlideShow();
//设置幻灯片的大小
Dimension pageSize = ppt.getPageSize();
pageSize.setSize(800,700);
return ppt;
}
/**
* @Author Yangy
* @Description 创建幻灯片
* @Date 16:39 2020/11/4
* @Param ppt
* @return org.apache.poi.xslf.usermodel.XSLFSlideMaster
**/
public static XSLFSlide createSlide(XMLSlideShow ppt, XSLFSlideLayout layout){
//通过布局样式创建幻灯片
XSLFSlide slide = ppt.createSlide(layout);
//清理掉模板内容
slide.clear();
return slide;
}
/**
* @Author Yangy
* @Description 生成一个文本框及内容
* @Date 10:10 2020/11/5
* @Param content=内容fontSize=字大小fontFamily=字体风格color=字颜色
* @return org.apache.poi.xslf.usermodel.XMLSlideShow
**/
public static void addTextBox(XSLFSlide slide,String content,Double fontSize,
String fontFamily,Color color,
int x,int y,int w,int h){
XSLFTextBox textBox = slide.createTextBox();
//设置坐标宽高
textBox.setAnchor(new Rectangle2D.Double(x, y, w, h));
XSLFTextRun projectInfo = textBox.addNewTextParagraph().addNewTextRun();
projectInfo.setText(content);
projectInfo.setFontSize(fontSize);
projectInfo.setFontFamily(fontFamily);
projectInfo.setFontColor(color);
}
/**
* @Author Yangy
* @Description 添加图片设置图片坐标宽高
* @Date 16:47 2020/11/4
* @Param slide=幻灯片实例picBytes=图片字节流picType=图片类型
* @return org.apache.poi.xslf.usermodel.XMLSlideShow
**/
public static void addPicture(XMLSlideShow ppt, XSLFSlide slide, byte [] picBytes, PictureData.PictureType picType,
int x, int y, int w, int h){
XSLFPictureData idx = ppt.addPicture(picBytes, picType);
XSLFPictureShape pic = slide.createPicture(idx);
//设置当前图片在ppt中的位置以及图片的宽高
pic.setAnchor(new java.awt.Rectangle(x, y, w, h));
}
/**
* @Author Yangy
* @Description 添加表格
* @Date 16:55 2020/11/4
* @Param [ppt]
* @return org.apache.poi.xslf.usermodel.XMLSlideShow
**/
public static void addTable(XSLFSlide slide,List<List<String>> dataList,int x,int y,int w,int h){
XSLFTable table = slide.createTable();
//此处还可以自行添加表格样式参数
//dataList第一个列表为行数据内嵌列表为每一行的列数据
for (int i = 0; i < dataList.size(); i++) {
List<String> 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();
}
}
}

View File

@ -1,52 +0,0 @@
package com.awspaas.user.bpa.util;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import java.nio.charset.Charset;
/**
* @PackageName: com.awspaas.user.apps.yili.integration.util
* @ClassName: UtilUrl
* @author: yujh
* @date: 2022/5/18 21:41
*/
public class UtilUrls {
//使用SOAP1.1发送消息
public static String doPostSoap(String postUrl, String soapXml, String soapAction) {
String retStr = "";
// 创建HttpClientBuilder
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
// HttpClient
CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
HttpPost httpPost = new HttpPost(postUrl);
// 设置请求和传输超时时间
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(999999999)
.setConnectTimeout(999999999).build();
httpPost.setConfig(requestConfig);
try {
httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8");
httpPost.setHeader("SOAPAction", soapAction);
StringEntity data = new StringEntity(soapXml, Charset.forName("UTF-8"));
httpPost.setEntity(data);
CloseableHttpResponse response = closeableHttpClient.execute(httpPost);
HttpEntity httpEntity = response.getEntity();
if (httpEntity != null) {
// 打印响应内容
retStr = EntityUtils.toString(httpEntity, "UTF-8");
}
// 释放资源
closeableHttpClient.close();
} catch (Exception e) {
e.printStackTrace();
}
return retStr;
}
}

View File

@ -1,184 +0,0 @@
package com.awspaas.user.bpa.util;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import java.io.*;
import java.util.Iterator;
import java.util.List;
public class Utils {
/**
* #合并多个excel文件
* @param fileLists excel文件路径
* @param path 目标文件保存目录
* @param fileName 目标文件名称
*/
public static void mergeExcel(List<String> 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<Row> 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<Cell> 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 {
}
}
}

View File

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

View File

@ -1,567 +0,0 @@
package com.awspaas.user.bpa.webapi;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.HandlerType;
import com.actionsoft.bpms.server.bind.annotation.Param;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.bpa.util.UtilUrls;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
@Controller(type = HandlerType.RESTFUL, apiName = "workfolwapi", desc = "伊利新版BPA接口")
@Path("/workfolw")
public class WorkFlowAPI {
@GET
public String sayHello() {
return "hello,world! - get请求";
}
@POST
public String sayHelloPost() {
return "hello,world!- post请求";
}
/**
* 这个是传流程结束的json数据的
* @return activiti流程信息
* @throws DocumentException
* @throws ParseException
*/
@Path("/process/endprocess")
@GET
public String getEndProcess(
@Param String starttime,
@Param String endtime) throws DocumentException, ParseException {
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject results = new JSONObject(new LinkedHashMap<>());
System.out.println("这里是end_process流程的伊利OA数据");
//List<BO> bo_eu_oa_process = SDK.getBOAPI().query("BO_EU_MODEL", true).list();
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc");
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int size = 2;
int last_page = 1;
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
/*if (boss!=null&&boss.size()>0){
String pages = boss.get(0).getString("PAGES");
last_page = Integer.parseInt(pages);
size = last_page+1;
}else {
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
}*/
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
for (int j = last_page; j < size; j++) {
int tale = Integer.valueOf(maps.get(0).getString("ID").trim());
jsonObject.put("workflowId", tale);
// jsonObject.put("workflowId",bo.getString("WORKFLOWID"));
//jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
//jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser()
jsonObject.put("pageIndex", j);
jsonObject.put("pageSize", 1000);
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.services.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:getFlowListByWfId>" +
" <web:in0>" +
"" + jsonObject + "" +
" </web:in0>" +
" </web:getFlowListByWfId>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
System.out.println("参数===============" + xmlStr);
//System.out.println("参数==============="+xmls);
//HttpClientUtil httpClientUtil = new HttpClientUtil();
int timeout = 600000;
// HttpURLConnection 发送SOAP请求
System.out.println("HttpURLConnection 发送SOAP请求");
String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, "");
Document document = DocumentHelper.parseText(postSoap);
Element rootElement = document.getRootElement();
// System.out.println("rootElement>>>>>>"+rootElement);
Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out");
String resultString = result.getData().toString();
/*
System.out.println("resultString=>>>>>>>>>>"+resultString);
*/
//if (!StringUtils.isEmpty(resultString)){
JSONObject jsonObject1 = JSON.parseObject(resultString);
String datas = jsonObject1.getString("datas");
JSONArray jsonArray = JSONArray.parseArray(datas);
if (jsonArray != null && jsonArray.size() != 0) {
for (int i = 0; i < jsonArray.size(); i++) {
// JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId")
JSONObject end_process = new JSONObject(new LinkedHashMap<>());
end_process.put("processinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId").toString().trim());//流程实例id
end_process.put("processdefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId").toString().trim());//流程定义id
RowMap workflowId = DBSql.getMap("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '" + JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId") + "'");
if (workflowId.getString("PROCESSVERSION") != null) {
end_process.put("processdefverid", workflowId.getString("VERSION"));//流程版本定义
} else {
end_process.put("processdefverid", "1");
}
end_process.put("starttime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间
end_process.put("endtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate"));//结束时间
end_process.put("createtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//创建时间
UserModel operatorWorkCode = SDK.getORGAPI().getUser(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString());
if (operatorWorkCode != null) {
end_process.put("createuser", JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));//创建人
UserContext userContext = UserContext.fromUID(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString());
end_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id
end_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id
end_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id
} else {
end_process.put("createuser", "admin");//创建人
UserContext userContext = UserContext.fromUID("admin");
end_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id
end_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id
end_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id
}
end_process.put("controlstate", JSONObject.parseObject(jsonArray.get(i).toString()).get("status"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date beginDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate").toString());
if (UtilString.isNotEmpty(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString())) {
Date endDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString());
long dates = (endDate.getTime() - beginDate.getTime()) / (1000 * 60);
end_process.put("executecosttime", dates);//开始时间-结束时间如果结束时间为空,则这个时间也为空
} else {
end_process.put("executecosttime", "");//开始时间-结束时间如果结束时间为空,则这个时间也为空
}
end_process.put("timedur", "");
end_process.put("warningtimedur", "");
jsonArray_new.add(end_process);
}
BO bo = new BO();
bo.set("WORKFLOWID",maps.get(0).getString("ID").trim());
bo.set("PAGES",size);
SDK.getBOAPI().createDataBO("BO_EU_OTHER_SYSTEM_PAGE",bo,UserContext.fromUID("admin"));
}
}
System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size());
return jsonArray_new.toString();
}
/**
* 2这里是传开始流程的startprocess的json数据的
* @return 开始流程
* @throws DocumentException
* @throws ParseException
*/
@Path("/process/startprocess")
@GET
public String getStartProcess(
@Param String starttime,
@Param String endtime) throws DocumentException, ParseException {
System.out.println("这里是开始流程的接口数据传递");
SDK.getLogAPI().consoleInfo("开始流程的开始时间>>>>>>>>>>>"+System.currentTimeMillis());
long startTime = System.currentTimeMillis();
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject results = new JSONObject(new LinkedHashMap<>());
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc");
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int last_page = 1;
int size = 2;
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
// List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
/* if (boss!=null&&boss.size()>0){
String pages = boss.get(0).getString("PAGES");
last_page = Integer.parseInt(pages);
size = last_page+1;
}else {
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
}*/
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
for (int j = last_page; j < size; j++) {
int tale = Integer.valueOf(maps.get(0).getString("ID").trim());
BO bo = new BO();
UserContext userContexts = UserContext.fromUID("admin");
bo.set("WORKID",maps.get(0).getString("ID"));
SDK.getBOAPI().createDataBO("BO_EU_TEST2",bo,userContexts);
jsonObject.put("workflowId", tale);
// jsonObject.put("workflowId",bo.getString("WORKFLOWID"));
//jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
//jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser()
jsonObject.put("pageIndex", j);
jsonObject.put("pageSize", 1000);
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.services.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:getFlowListByWfId>" +
" <web:in0>" +
"" + jsonObject + "" +
" </web:in0>" +
" </web:getFlowListByWfId>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
System.out.println("参数===============" + xmlStr);
//System.out.println("参数==============="+xmls);
//HttpClientUtil httpClientUtil = new HttpClientUtil();
int timeout = 600000;
// HttpURLConnection 发送SOAP请求
System.out.println("HttpURLConnection 发送SOAP请求");
String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, "");
Document document = DocumentHelper.parseText(postSoap);
Element rootElement = document.getRootElement();
// System.out.println("rootElement>>>>>>"+rootElement);
Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out");
String resultString = result.getData().toString();
/* System.out.println("resultString=>>>>>>>>>>"+resultString);*/
//if (!StringUtils.isEmpty(resultString)){
JSONObject jsonObject1 = JSON.parseObject(resultString);
String datas = jsonObject1.getString("datas");
JSONArray jsonArray = JSONArray.parseArray(datas);
if (jsonArray != null && jsonArray.size() != 0) {
for (int i = 0; i < jsonArray.size(); i++) {
// JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId")
JSONObject start_process = new JSONObject(new LinkedHashMap<>());
start_process.put("processinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId"));//流程实例id
start_process.put("processdefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId"));//流程定义id
RowMap workflowId = DBSql.getMap("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '" + JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId") + "'");
if (workflowId != null) {
start_process.put("processdefverid", workflowId.getString("PROCESSVERSION"));//流程版本定义
} else {
start_process.put("processdefverid", "1");
}
start_process.put("starttime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间
start_process.put("createtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//创建时间
UserModel operatorWorkCode = SDK.getORGAPI().getUser(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString());
if (operatorWorkCode != null) {
start_process.put("createuser", JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));//创建人
UserContext userContext = UserContext.fromUID(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString());
start_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id
start_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id
start_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id
} else {
start_process.put("createuser", "admin");//创建人
UserContext userContext = UserContext.fromUID("admin");
start_process.put("createuserorgid", userContext.getCompanyModel().getId());//公司id
start_process.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id
start_process.put("createuserroleid", userContext.getRoleModel().getId());//角色id
}
start_process.put("timedur", "");
start_process.put("warningtimedur", "");
start_process.put("controlstate", JSONObject.parseObject(jsonArray.get(i).toString()).get("status"));
jsonArray_new.add(start_process);
}
} else {
break;
}
}
System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size());
SDK.getLogAPI().consoleInfo("开始流程的结束时间>>>>>>>>>>>"+System.currentTimeMillis());
long endstime = System.currentTimeMillis();
SDK.getLogAPI().consoleInfo("开始流程所消耗的时间>>>>>>>>"+(endstime-startTime)+"ms");
return jsonArray_new.toString();
}
@Path("/task/startTask")
@GET
public String getStartTask(
@Param String starttime,
@Param String endtime) throws DocumentException {
System.out.println("开始任务数据对应的json数据");
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject results = new JSONObject(new LinkedHashMap<>());
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc");
// List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int last_page = 1;
int size = 2;
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
/* if (boss!=null&&boss.size()>0){
String pages = boss.get(0).getString("PAGES");
last_page = Integer.parseInt(pages);
size = last_page+1;
}else {
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
}*/
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
for (int j = last_page; j < size; j++) {
int tale = Integer.valueOf(maps.get(0).getString("ID").trim());
jsonObject.put("workflowId", tale);
// jsonObject.put("workflowId",bo.getString("WORKFLOWID"));
//jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
//jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser()
jsonObject.put("pageIndex", j);
jsonObject.put("pageSize", 1000);
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.services.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:getFlowListByWfId>" +
" <web:in0>" +
"" + jsonObject + "" +
" </web:in0>" +
" </web:getFlowListByWfId>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
System.out.println("参数===============" + xmlStr);
//System.out.println("参数==============="+xmls);
//HttpClientUtil httpClientUtil = new HttpClientUtil();
int timeout = 600000;
// HttpURLConnection 发送SOAP请求
System.out.println("HttpURLConnection 发送SOAP请求");
String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, "");
Document document = DocumentHelper.parseText(postSoap);
Element rootElement = document.getRootElement();
// System.out.println("rootElement>>>>>>"+rootElement);
Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out");
String resultString = result.getData().toString();
/*System.out.println("resultString=>>>>>>>>>>"+resultString);*/
//if (!StringUtils.isEmpty(resultString)){
JSONObject jsonObject1 = JSON.parseObject(resultString);
String datas = jsonObject1.getString("datas");
JSONArray jsonArray = JSONArray.parseArray(datas);
if (jsonArray != null && jsonArray.size() != 0) {
for (int i = 0; i < jsonArray.size(); i++) {
// JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId")
JSONObject start_task = new JSONObject(new LinkedHashMap<>());
start_task.put("taskinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("id"));//流程实例id
start_task.put("processdefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId"));//流程定义id
RowMap workflowId = DBSql.getMap("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '" + JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId") + "'");
if (workflowId.getString("PROCESSVERSION") != null) {
start_task.put("processdefverid", workflowId.getString("PROCESSVERSION"));//流程版本定义
} else {
start_task.put("processdefverid", "1");
}
start_task.put("processinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId"));
start_task.put("state", JSONObject.parseObject(jsonArray.get(i).toString()).get("status"));
start_task.put("begintime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间
UserModel operatorWorkCode = SDK.getORGAPI().getUser(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString());
if (operatorWorkCode != null) {
start_task.put("createuser", JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));//创建人
UserContext userContext = UserContext.fromUID(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString());
start_task.put("createuserorgid", userContext.getCompanyModel().getId());//公司id
start_task.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id
start_task.put("createuserroleid", userContext.getRoleModel().getId());//角色id
} else {
start_task.put("createuser", "admin");//创建人
UserContext userContext = UserContext.fromUID("admin");
start_task.put("createuserorgid", userContext.getCompanyModel().getId());//公司id
start_task.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id
start_task.put("createuserroleid", userContext.getRoleModel().getId());//角色id
}
start_task.put("activitydefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeid"));//角色id
start_task.put("timedur", "");
start_task.put("warningtimedur", "");
start_task.put("createtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));
jsonArray_new.add(start_task);
}
} else {
break;
}
}
System.out.println("jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size());
return jsonArray_new.toString();
}
@Path("/task/endTask")
/**
* structFieldList.add(DataTypes.createStructField("activitydefid", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("executecosttime", DataTypes.LongType, true));
* structFieldList.add(DataTypes.createStructField("processdefverid", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("processdefid", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("processinstid", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("taskinstid", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("actionname", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("state", DataTypes.IntegerType, true));
* structFieldList.add(DataTypes.createStructField("timedur", DataTypes.LongType, true));
* structFieldList.add(DataTypes.createStructField("warningtimedur", DataTypes.LongType, true));
* structFieldList.add(DataTypes.createStructField("begintime", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("endtime", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("createuser", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("createuserorgid", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("createuserdeptid", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("createuserroleid", DataTypes.StringType, true));
* structFieldList.add(DataTypes.createStructField("createtime", DataTypes.TimestampType, true));
*/
@GET
public String getEndTask(
@Param String starttime,
@Param String endtime) throws DocumentException, ParseException {
System.out.println("结束任务开始获取数据");
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject results = new JSONObject(new LinkedHashMap<>());
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc");
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int last_page = 1;
int size =2;
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
/* if (boss!=null&&boss.size()>0){
String pages = boss.get(0).getString("PAGES");
last_page = Integer.parseInt(pages);
size = last_page+1;
}else {
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
}*/
String soap_page = SDK.getAppAPI().getProperty("com.awspaas.user.apps.performance_indicator_library", "soap_page");//这里是获取配置的SOAP接口传的多少页,如果3500左右不够可以自行往上增加
size = Integer.valueOf(soap_page);
for (int j = last_page; j < size; j++) {
int tale = Integer.valueOf(maps.get(0).getString("ID").trim());
jsonObject.put("workflowId", tale);
// jsonObject.put("workflowId",bo.getString("WORKFLOWID"));
//jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
//jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser()
jsonObject.put("pageIndex", j);
jsonObject.put("pageSize", 1000);
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.services.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:getFlowListByWfId>" +
" <web:in0>" +
"" + jsonObject + "" +
" </web:in0>" +
" </web:getFlowListByWfId>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
System.out.println("参数===============" + xmlStr);
//System.out.println("参数==============="+xmls);
//HttpClientUtil httpClientUtil = new HttpClientUtil();
int timeout = 600000;
// HttpURLConnection 发送SOAP请求
System.out.println("HttpURLConnection 发送SOAP请求");
String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, "");
Document document = DocumentHelper.parseText(postSoap);
Element rootElement = document.getRootElement();
// System.out.println("rootElement>>>>>>"+rootElement);
Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out");
String resultString = result.getData().toString();
// System.out.println("resultString=>>>>>>>>>>"+resultString);
//if (!StringUtils.isEmpty(resultString)){
JSONObject jsonObject1 = JSON.parseObject(resultString);
String datas = jsonObject1.getString("datas");
JSONArray jsonArray = JSONArray.parseArray(datas);
if (jsonArray != null && jsonArray.size() != 0) {
for (int i = 0; i < jsonArray.size(); i++) {
// JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId")
JSONObject end_task = new JSONObject(new LinkedHashMap<>());
end_task.put("taskinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("id"));//流程实例id
end_task.put("processdefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId"));//流程定义id
RowMap workflowId = DBSql.getMap("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '" + JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId") + "'");
if (workflowId.getString("PROCESSVERSION") != null) {
end_task.put("processdefverid", workflowId.getString("VERSION"));//流程版本定义
} else {
end_task.put("processdefverid", "1");
}
end_task.put("processinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId"));
end_task.put("state", JSONObject.parseObject(jsonArray.get(i).toString()).get("status"));
end_task.put("begintime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间
end_task.put("createuser", JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));//创建人
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date beginDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate").toString());
if (UtilString.isNotEmpty(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString())) {
Date endDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString());
long dates = (endDate.getTime() - beginDate.getTime()) / (1000 * 60);
end_task.put("executecosttime", dates);//开始时间-结束时间如果结束时间为空,则这个时间也为空
} else {
end_task.put("executecosttime", "");//开始时间-结束时间如果结束时间为空,则这个时间也为空
}
end_task.put("endtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate"));
UserModel operatorWorkCode = SDK.getORGAPI().getUser(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString());
if (operatorWorkCode != null) {
UserContext userContext = UserContext.fromUID(JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode").toString());
end_task.put("createuserorgid", userContext.getCompanyModel().getId());//公司id
end_task.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id
end_task.put("createuserroleid", userContext.getRoleModel().getId());//角色id
} else {
UserContext userContext = UserContext.fromUID("admin");
end_task.put("createuserorgid", userContext.getCompanyModel().getId());//公司id
end_task.put("createuserdeptid", userContext.getDepartmentModel().getId());//部门id
end_task.put("createuserroleid", userContext.getRoleModel().getId());//角色id
}
end_task.put("activitydefid", JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeid"));//角色id
end_task.put("timedur", "");
end_task.put("warningtimedur", "");
end_task.put("createtime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));
end_task.put("actionname", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateType"));
jsonArray_new.add(end_task);
}
} else {
break;
}
}
System.out.println("task_end结束_jsonArray_new.toString()>>>>>>>>>>>>>"+jsonArray_new.size());
return jsonArray_new.toString();
}
}

View File

@ -61,8 +61,8 @@ public class WorkFlowAPI {
System.out.println("这里是end_process流程的伊利OA数据");
//List<BO> bo_eu_oa_process = SDK.getBOAPI().query("BO_EU_MODEL", true).list();
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc");
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int size = 2;
int last_page = 1;
@ -173,9 +173,6 @@ public class WorkFlowAPI {
bo.set("WORKFLOWID",maps.get(0).getString("ID").trim());
bo.set("PAGES",size);
SDK.getBOAPI().createDataBO("BO_EU_OTHER_SYSTEM_PAGE",bo,UserContext.fromUID("admin"));
} else {
DBSql.update("update APP_ACT_BPAD_P_VER_ACTIVITY set EXT2 = '123' where ID = '"+maps.get(0).getString("ID")+"'");
break;
}
}
@ -200,13 +197,13 @@ public class WorkFlowAPI {
long startTime = System.currentTimeMillis();
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject results = new JSONObject(new LinkedHashMap<>());
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc");
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int last_page = 1;
int size = 2;
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
// List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
/* if (boss!=null&&boss.size()>0){
String pages = boss.get(0).getString("PAGES");
last_page = Integer.parseInt(pages);
@ -316,8 +313,8 @@ public class WorkFlowAPI {
System.out.println("开始任务数据对应的json数据");
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject results = new JSONObject(new LinkedHashMap<>());
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc");
// List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int last_page = 1;
int size = 2;
@ -447,8 +444,8 @@ public class WorkFlowAPI {
System.out.println("结束任务开始获取数据");
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject results = new JSONObject(new LinkedHashMap<>());
// List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where EXT2 IS NULL order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc");
//List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY where ID = '124' order by CAST(EXT1 as int) asc");
int last_page = 1;
int size =2;