流程手册,泳道图生成手册时显示判断节点
制度手册,附件列表过滤掉第一个节点形状上的附件
This commit is contained in:
parent
5acbf4963a
commit
40f34e1e1a
@ -347,11 +347,14 @@ public class Report1Gener {
|
||||
int regulateIndex = 1;// 控制序号
|
||||
for (Map<String, Object> shape : repositoryFileElements) {
|
||||
//过滤导出的图形类型
|
||||
if ("method_approval_node,method_service_node,method_approval_node3,method_service_node4".indexOf((String)shape.get("type")) == -1) {
|
||||
if ("method_approval_node,method_service_node,method_approval_node3,method_service_node4,decision".indexOf((String)shape.get("type")) == -1) {
|
||||
continue;
|
||||
}
|
||||
JSONObject _tr = new JSONObject();
|
||||
OutputWordUtil.setShapeDefaultValue2(repositoryId, _tr); //设置默认值
|
||||
|
||||
|
||||
|
||||
_tr.put(OutputWordUtil.SERIAL_NUMBER, index); //序号
|
||||
_tr.put(OutputWordUtil.REPOSITORY_NAME, specialCharTransfer(repositoryModel.getName().replace("\n", ""))); //流程名称
|
||||
_tr.put(OutputWordUtil.SHAPE_NAME, specialCharTransfer(shape.get("text").toString()).replace("\n", WRAPSTRING)); //步骤名称
|
||||
|
||||
@ -16,6 +16,8 @@ import com.actionsoft.apps.coe.pal.pal.output.util.OutputWordUtil;
|
||||
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.cache.PALRepositoryPropertyCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
|
||||
@ -226,16 +228,19 @@ public class Report1Gener {
|
||||
if (upfileModel.getFileName().contains(".xml")) {
|
||||
if (dcProfile != null) {
|
||||
dcContextpdf = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), upfileModel.getFileName());
|
||||
|
||||
String path = dcContextpdf.getPath(); String fileName =
|
||||
dcContextpdf.getFileName(); //创建实例,加载doc测试文档
|
||||
com.spire.doc.Document docs = new com.spire.doc.Document(); docs.loadFromFile("/"+path+fileName);
|
||||
//保存为xml格式
|
||||
//nas/awsinst/doccenter/com.actionsoft.apps.coe.pal/COE_Upfile/03e55104-3ac6-4298-8a9f-6d1c03cad06b/obj_2ebe57d0f9b84bdeb7cf697945d3c5ab/ 液态奶事业部食品安全委员会运行管理规定.doc
|
||||
String substring = fileName.substring(0, fileName.lastIndexOf(".xml"));
|
||||
docs.saveToFile("/"+path+substring+".xml",FileFormat.Word_ML);
|
||||
dcContextpdf = new DCContext(userContext, dcProfile, CoEConstant.APP_ID,
|
||||
upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), substring+".xml");
|
||||
/*
|
||||
* String path = dcContextpdf.getPath(); String fileName =
|
||||
* dcContextpdf.getFileName(); //创建实例,加载doc测试文档 com.spire.doc.Document docs =
|
||||
* new com.spire.doc.Document(); docs.loadFromFile("/"+path+fileName);
|
||||
* //保存为xml格式
|
||||
* //nas/awsinst/doccenter/com.actionsoft.apps.coe.pal/COE_Upfile/03e55104-3ac6-
|
||||
* 4298-8a9f-6d1c03cad06b/obj_2ebe57d0f9b84bdeb7cf697945d3c5ab/
|
||||
* 液态奶事业部食品安全委员会运行管理规定.doc String substring = fileName.substring(0,
|
||||
* fileName.lastIndexOf(".xml"));
|
||||
* docs.saveToFile("/"+path+substring+".xml",FileFormat.Word_ML); dcContextpdf =
|
||||
* new DCContext(userContext, dcProfile, CoEConstant.APP_ID,
|
||||
* upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), substring+".xml");
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -449,9 +454,23 @@ public class Report1Gener {
|
||||
}
|
||||
|
||||
// 流程附件列表
|
||||
String shpId = "";
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
StringBuffer sqlWhere = new StringBuffer();
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(repositoryModel.getId()).append("'");
|
||||
//制度手册过滤掉第一个节点形状上的附件
|
||||
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(repositoryId, 0);
|
||||
String define = defineModel.getDefinition();
|
||||
JSONObject definition = JSONObject.parseObject(define);
|
||||
JSONObject elements = definition.getJSONObject("elements");
|
||||
for (String key : elements.keySet()) {
|
||||
JSONObject shape1 = elements.getJSONObject(key);
|
||||
if ("regulation,I/O_L4,manual".contains(shape1.getString("name"))) {
|
||||
shpId = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sqlWhere.append(" and PALREPOSITORYID ='").append(repositoryModel.getId()).append("'").append(" and SHAPEID !='").append(shpId).append("'");
|
||||
List<UpfileModel> search = upFileDao.search(sqlWhere.toString());
|
||||
File file = null;
|
||||
//三员管理下,用户密级与文件密级过滤显示
|
||||
@ -473,9 +492,9 @@ public class Report1Gener {
|
||||
if (search != null && search.size() > 0) {
|
||||
// 复制附件
|
||||
for (UpfileModel upfileModel : search) {
|
||||
if (!"f".equals(upfileModel.getType())) {// 文件
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* if (!"f".equals(upfileModel.getType())) {// 文件 continue; }
|
||||
*/
|
||||
// 复制doccenter下的文件
|
||||
DCContext dcContext = null;
|
||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
@ -735,7 +754,7 @@ public class Report1Gener {
|
||||
JSONArray related_files = new JSONArray();
|
||||
try {
|
||||
int count = 0;
|
||||
String sql = "select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '"+repositoryModel.getId()+"' and PROPERTYID = 'relevant_flies'";
|
||||
String sql = "select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '"+repositoryModel.getId()+"' and PROPERTYID = 'related_files'";
|
||||
String relatFileJson = DBSql.getString(sql);
|
||||
if(UtilString.isNotEmpty(relatFileJson)) {
|
||||
JSONObject parseObject = JSONObject.parseObject(relatFileJson);
|
||||
|
||||
@ -1,241 +0,0 @@
|
||||
package com.awspaas.user.apps.integration;
|
||||
|
||||
/**
|
||||
* @author wangchengye
|
||||
* @description
|
||||
* @createtime 2022-07-09 15:54
|
||||
* @updateAndOther
|
||||
*/
|
||||
public class XmlDatasUtil {
|
||||
//外部系统ID
|
||||
private String External_system_ID;
|
||||
//其他系统待办ID
|
||||
private String Other_system_to_do_ID;
|
||||
//流程标题
|
||||
private String Process_title;
|
||||
////pc端的url地址
|
||||
private String pcurl;
|
||||
//s手机端的url地址
|
||||
private String mobileurl;
|
||||
//待办人的登录账号
|
||||
private String To_do_login_account;
|
||||
//待办创建时间
|
||||
private String To_do_creation_time;
|
||||
////待办办结时间
|
||||
private String To_do_completion_time;
|
||||
//待办状态
|
||||
private String To_do_status;
|
||||
//公文类型的待办
|
||||
private String To_do_official_type;
|
||||
//已读类型
|
||||
private String viewtype;
|
||||
//创建日期
|
||||
private String createdate;
|
||||
//待办办结日期
|
||||
private String donedate;
|
||||
//待办接收日期
|
||||
private String receivedate;
|
||||
//待办接收时间
|
||||
private String receivetime;
|
||||
//当前节点是否已经归档
|
||||
private String currentnodetype;
|
||||
//流程编号
|
||||
private String requestcode;
|
||||
//当前节点
|
||||
private String currentnodename;
|
||||
//未操作者
|
||||
private String nooperator;
|
||||
//待办人员工作工号
|
||||
private String workcode;
|
||||
//工作流程编号
|
||||
private String workflowname;
|
||||
//流程创建人员登录账号
|
||||
private String createrhrcode;
|
||||
//流程创建人员工号
|
||||
private String createrworkcode;
|
||||
|
||||
|
||||
public String getExternal_system_ID() {
|
||||
return External_system_ID;
|
||||
}
|
||||
|
||||
public void setExternal_system_ID(String external_system_ID) {
|
||||
External_system_ID = external_system_ID;
|
||||
}
|
||||
|
||||
public String getOther_system_to_do_ID() {
|
||||
return Other_system_to_do_ID;
|
||||
}
|
||||
|
||||
public void setOther_system_to_do_ID(String other_system_to_do_ID) {
|
||||
Other_system_to_do_ID = other_system_to_do_ID;
|
||||
}
|
||||
|
||||
public String getProcess_title() {
|
||||
return Process_title;
|
||||
}
|
||||
|
||||
public void setProcess_title(String process_title) {
|
||||
Process_title = process_title;
|
||||
}
|
||||
|
||||
public String getPcurl() {
|
||||
return pcurl;
|
||||
}
|
||||
|
||||
public void setPcurl(String pcurl) {
|
||||
this.pcurl = pcurl;
|
||||
}
|
||||
|
||||
public String getMobileurl() {
|
||||
return mobileurl;
|
||||
}
|
||||
|
||||
public void setMobileurl(String mobileurl) {
|
||||
this.mobileurl = mobileurl;
|
||||
}
|
||||
|
||||
public String getTo_do_login_account() {
|
||||
return To_do_login_account;
|
||||
}
|
||||
|
||||
public void setTo_do_login_account(String to_do_login_account) {
|
||||
To_do_login_account = to_do_login_account;
|
||||
}
|
||||
|
||||
public String getTo_do_creation_time() {
|
||||
return To_do_creation_time;
|
||||
}
|
||||
|
||||
public void setTo_do_creation_time(String to_do_creation_time) {
|
||||
To_do_creation_time = to_do_creation_time;
|
||||
}
|
||||
|
||||
public String getTo_do_completion_time() {
|
||||
return To_do_completion_time;
|
||||
}
|
||||
|
||||
public void setTo_do_completion_time(String to_do_completion_time) {
|
||||
To_do_completion_time = to_do_completion_time;
|
||||
}
|
||||
|
||||
public String getTo_do_status() {
|
||||
return To_do_status;
|
||||
}
|
||||
|
||||
public void setTo_do_status(String to_do_status) {
|
||||
To_do_status = to_do_status;
|
||||
}
|
||||
|
||||
public String getTo_do_official_type() {
|
||||
return To_do_official_type;
|
||||
}
|
||||
|
||||
public void setTo_do_official_type(String to_do_official_type) {
|
||||
To_do_official_type = to_do_official_type;
|
||||
}
|
||||
|
||||
public String getViewtype() {
|
||||
return viewtype;
|
||||
}
|
||||
|
||||
public void setViewtype(String viewtype) {
|
||||
this.viewtype = viewtype;
|
||||
}
|
||||
|
||||
public String getCreatedate() {
|
||||
return createdate;
|
||||
}
|
||||
|
||||
public void setCreatedate(String createdate) {
|
||||
this.createdate = createdate;
|
||||
}
|
||||
|
||||
public String getDonedate() {
|
||||
return donedate;
|
||||
}
|
||||
|
||||
public void setDonedate(String donedate) {
|
||||
this.donedate = donedate;
|
||||
}
|
||||
|
||||
public String getReceivedate() {
|
||||
return receivedate;
|
||||
}
|
||||
|
||||
public void setReceivedate(String receivedate) {
|
||||
this.receivedate = receivedate;
|
||||
}
|
||||
|
||||
public String getReceivetime() {
|
||||
return receivetime;
|
||||
}
|
||||
|
||||
public void setReceivetime(String receivetime) {
|
||||
this.receivetime = receivetime;
|
||||
}
|
||||
|
||||
public String getCurrentnodetype() {
|
||||
return currentnodetype;
|
||||
}
|
||||
|
||||
public void setCurrentnodetype(String currentnodetype) {
|
||||
this.currentnodetype = currentnodetype;
|
||||
}
|
||||
|
||||
public String getRequestcode() {
|
||||
return requestcode;
|
||||
}
|
||||
|
||||
public void setRequestcode(String requestcode) {
|
||||
this.requestcode = requestcode;
|
||||
}
|
||||
|
||||
public String getCurrentnodename() {
|
||||
return currentnodename;
|
||||
}
|
||||
|
||||
public void setCurrentnodename(String currentnodename) {
|
||||
this.currentnodename = currentnodename;
|
||||
}
|
||||
|
||||
public String getNooperator() {
|
||||
return nooperator;
|
||||
}
|
||||
|
||||
public void setNooperator(String nooperator) {
|
||||
this.nooperator = nooperator;
|
||||
}
|
||||
|
||||
public String getWorkcode() {
|
||||
return workcode;
|
||||
}
|
||||
|
||||
public void setWorkcode(String workcode) {
|
||||
this.workcode = workcode;
|
||||
}
|
||||
|
||||
public String getWorkflowname() {
|
||||
return workflowname;
|
||||
}
|
||||
|
||||
public void setWorkflowname(String workflowname) {
|
||||
this.workflowname = workflowname;
|
||||
}
|
||||
|
||||
public String getCreaterhrcode() {
|
||||
return createrhrcode;
|
||||
}
|
||||
|
||||
public void setCreaterhrcode(String createrhrcode) {
|
||||
this.createrhrcode = createrhrcode;
|
||||
}
|
||||
|
||||
public String getCreaterworkcode() {
|
||||
return createrworkcode;
|
||||
}
|
||||
|
||||
public void setCreaterworkcode(String createrworkcode) {
|
||||
this.createrworkcode = createrworkcode;
|
||||
}
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.controller;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.output.OutputAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
|
||||
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.UUIDGener;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.awspaas.user.apps.integration.event.OutputDCFileProcessor;
|
||||
|
||||
/*
|
||||
* 文件阅览界面下载时创建手册
|
||||
*/
|
||||
@Controller
|
||||
public class CreateFileContorller {
|
||||
@Mapping("com.awspaas.user.apps.integrates.createFileController")
|
||||
public JSONObject createFile(String sid,String taskId,String title) throws Exception {
|
||||
System.out.println("taskid》》》》》》》》》》"+taskId);
|
||||
System.out.println("fileName》》》》》》》》》》"+title);
|
||||
String reportDownloadURL = "";
|
||||
UserContext me = UserContext.fromSessionId(sid);
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
|
||||
JSONObject result = new JSONObject();
|
||||
if (model != null) {
|
||||
//三员管理,步骤横表下载重新生成手册
|
||||
|
||||
String taskName = model.getTaskName();
|
||||
if ("步骤横表".equals(taskName)){
|
||||
// 重新设置生成id,与用户id
|
||||
String uuid = UUIDGener.getUUID();
|
||||
model.setUserId(me.getUID());
|
||||
|
||||
// 重新生成手册文件
|
||||
OutputAPIManager.getInstance().reGennerReport(me,model,uuid);
|
||||
|
||||
// 重新构建手册下载URL
|
||||
taskId = uuid;
|
||||
}
|
||||
|
||||
try {
|
||||
result.put("result","ok");
|
||||
reportDownloadURL = OutputDCFileProcessor.getReportDownloadURL(model.getWsId(), taskId, model.getProfileId(), me, title+model.getTaskName());
|
||||
result.put("url",reportDownloadURL);
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.controller;
|
||||
|
||||
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.htmlframework.HtmlPageTemplate;
|
||||
import com.actionsoft.bpms.server.RequestParams;
|
||||
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.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.FormAPI;
|
||||
import com.actionsoft.sdk.local.api.ProcessExecuteQuery;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@Controller
|
||||
public class GetSomeIndexController {
|
||||
@Mapping(value = "com.awspaas.user.apps.integration.controller.GetSomeIndexController.toIndex")
|
||||
public String toIndex(){
|
||||
return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration","domainprocess.html",new LinkedHashMap<>());
|
||||
}
|
||||
|
||||
@Mapping(value = "com.awspaas.user.apps.integration.controller.GetSomeIndexController.getProcessCenter")
|
||||
public String getProcessCenter(UserContext me, RequestParams params){
|
||||
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_fb1c7a54b98b412187388c8bab407362", me.getUID(), me.getUserName() + "发起流程发布流程");
|
||||
//ProcessExecuteQuery start = SDK.getProcessAPI().start(processInstance);
|
||||
//String startTaskInstId = processInstance.getStartTaskInstId();
|
||||
TaskInstance taskInstance = (TaskInstance) SDK.getProcessAPI().start(processInstance).fetchActiveTasks().get(0);
|
||||
String url = SDK.getPortalAPI().getPortalUrl() + "/r/w?sid=" + me.getSessionId()
|
||||
+ "&cmd=CLIENT_BPM_FORM_MAIN_PAGE_OPEN&processInstId=" + processInstance.getId() + "&taskInstId="
|
||||
+ taskInstance.getId() + "&openState=1&reloadedFile=1";
|
||||
return SDK.getFormAPI().getFormPage(me,processInstance.getId(),taskInstance.getId(),taskInstance.getState(),1,"","","",true);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,191 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.controller;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.def.ProcessDefinition;
|
||||
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.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.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.awspaas.user.apps.integration.XmlDatasUtil;
|
||||
import com.awspaas.user.apps.integration.util.HttpClientUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
public class SendOAProcessController {
|
||||
@Mapping("com.awspaas.user.apps.integration.controller.SendOAProcessController.SendProcessByOA")
|
||||
public JSONObject SendProcessByOA(String sid,String taskInstId,String processInstId,String isSave) throws IOException, DocumentException {
|
||||
JSONObject result = new JSONObject(new LinkedHashMap<>());
|
||||
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId);
|
||||
TaskInstance instanceById1 = SDK.getTaskAPI().getInstanceById(taskInstId);
|
||||
XmlDatasUtil xmlDatasUtil = new XmlDatasUtil();
|
||||
xmlDatasUtil.setExternal_system_ID("LCZD");
|
||||
xmlDatasUtil.setOther_system_to_do_ID(instanceById1.getId());
|
||||
ProcessDefinition processDefinition = SDK.getRepositoryAPI().getProcessDefinition(instanceById.getProcessDefId());
|
||||
String processName = processDefinition.getName();
|
||||
xmlDatasUtil.setProcess_title(" 您有一条草稿流程保存成功【"+processName+"】");
|
||||
|
||||
|
||||
|
||||
|
||||
//http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
if (portalUrl.equals("http://10.114.11.135:8088/portal")){
|
||||
portalUrl = "https://bpm.yili.com:8088/portal/";
|
||||
}
|
||||
xmlDatasUtil.setPcurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+instanceById.getId()+"&taskInstId="+instanceById1.getId());
|
||||
xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+instanceById1.getTarget()+"&processInstId="+instanceById.getId()+"&taskInstId="+instanceById1.getId());
|
||||
String target = instanceById1.getTarget();
|
||||
if (target.length()==8&&"00".equals(target.substring(0,2))){
|
||||
target = target.substring(2);
|
||||
}
|
||||
System.out.println("当前账户======》》》》"+target);
|
||||
BO bo_eu_oa_reson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=" , target).detail();
|
||||
System.out.println("bo>>>>>>>>>>"+bo_eu_oa_reson);
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒
|
||||
String str = df.format(instanceById1.getBeginTime());
|
||||
String substring = str.substring(str.indexOf(" "), str.length());
|
||||
xmlDatasUtil.setTo_do_creation_time(substring);
|
||||
xmlDatasUtil.setTo_do_completion_time(substring);
|
||||
|
||||
//if (taskInstance.getState()==1){
|
||||
xmlDatasUtil.setTo_do_status("0");
|
||||
//}
|
||||
xmlDatasUtil.setTo_do_official_type("0");
|
||||
// if (taskInstance.getReadState()==0){
|
||||
// xmlDatasUtil.setViewtype("0");
|
||||
// }else if (taskInstance.getReadState()==1){
|
||||
xmlDatasUtil.setViewtype("0");
|
||||
//
|
||||
|
||||
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
|
||||
xmlDatasUtil.setDonedate(str.substring(0, str.indexOf(" ")));
|
||||
/*String der ="";
|
||||
if (taskInstance.getReadTime()!=null){
|
||||
der = df.format(taskInstance.getReadTime());
|
||||
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
|
||||
}else {
|
||||
der = df.format(taskInstance.getBeginTime());
|
||||
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
|
||||
}*/
|
||||
xmlDatasUtil.setReceivedate(str.substring(0, str.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(substring);
|
||||
|
||||
xmlDatasUtil.setCurrentnodetype("0");
|
||||
xmlDatasUtil.setRequestcode(instanceById.getId());
|
||||
xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(instanceById.getProcessDefId(),instanceById1.getActivityDefId()).getName());
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = instanceById.getAppId();
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//流程实例id,必填
|
||||
params.put("processInstId", instanceById.getId());
|
||||
//,必填
|
||||
params.put("sid", sid);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//流程节点数据
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
String username = "";
|
||||
String userid = "";
|
||||
/*if (ro.isOk()){
|
||||
List list = new ArrayList();
|
||||
Object processBudgetModelList = ro.get("processBudgetModelList");
|
||||
JSONArray array = JSON.parseArray(String.valueOf(processBudgetModelList));
|
||||
|
||||
if (!array.isEmpty()){
|
||||
for(int i=0;i<array.size();i++){
|
||||
JSONObject jsonObject = JSONObject.parseObject(array.get(i).toString());
|
||||
String executor = jsonObject.get("executor").toString();
|
||||
String userid2 = jsonObject.get("userid2").toString();
|
||||
//String userid2 = jsonArray.getJSONObject(i).getString("userid2");
|
||||
username+=executor+" ";
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setNooperator(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
|
||||
xmlDatasUtil.setWorkcode("");
|
||||
xmlDatasUtil.setWorkflowname(instanceById.getTitle());
|
||||
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
xmlDatasUtil.setCreaterworkcode("");
|
||||
|
||||
|
||||
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
BO bo_eu_oa_mobileurl = SDK.getBOAPI().query("BO_EU_OA_MOBILEURL", true).addQuery("TODOID=", instanceById1.getId()).detail();
|
||||
if (bo_eu_oa_mobileurl==null){
|
||||
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
|
||||
|
||||
BO bo = new BO();
|
||||
bo.set("OUTSYSID",xmlDatasUtil.getExternal_system_ID());
|
||||
bo.set("TODOID",xmlDatasUtil.getOther_system_to_do_ID());
|
||||
bo.set("CONTENT",xmlDatasUtil.getProcess_title());
|
||||
bo.set("PCURL",xmlDatasUtil.getPcurl());
|
||||
bo.set("MOBILEURL",xmlDatasUtil.getMobileurl());
|
||||
bo.set("HRCODE",xmlDatasUtil.getTo_do_login_account());
|
||||
bo.set("STATUS",xmlDatasUtil.getTo_do_status());
|
||||
bo.set("WFTYPE",xmlDatasUtil.getTo_do_official_type());
|
||||
bo.set("VIEWTYPE",xmlDatasUtil.getViewtype());
|
||||
bo.set("CREATEDATES",xmlDatasUtil.getCreatedate());
|
||||
bo.set("NEWCREATETIME",xmlDatasUtil.getTo_do_creation_time());
|
||||
bo.set("DONEDATE",xmlDatasUtil.getDonedate());
|
||||
bo.set("NEWDONETIME",xmlDatasUtil.getTo_do_status());
|
||||
bo.set("RECEIVEDATE",xmlDatasUtil.getReceivedate());
|
||||
bo.set("RECEIVETIME",xmlDatasUtil.getReceivetime());
|
||||
bo.set("CURRENTNODETYPE",xmlDatasUtil.getCurrentnodetype());
|
||||
bo.set("REQUESTCODE",xmlDatasUtil.getRequestcode());
|
||||
bo.set("CURRENTNODENAME",xmlDatasUtil.getCurrentnodename());
|
||||
bo.set("NOOPERATOR",xmlDatasUtil.getNooperator());
|
||||
bo.set("CREATERHRCODE",xmlDatasUtil.getCreaterhrcode());
|
||||
bo.set("WORKFLOWNAME",xmlDatasUtil.getWorkflowname());
|
||||
bo.set("OA_RESULT",s);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
bo.set("OA_DATE",sdf.format(new Date()));
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL",bo,UserContext.fromUID(instanceById1.getTarget()));
|
||||
|
||||
if (s.contains("success")){
|
||||
result.put("result","ok");
|
||||
}else {
|
||||
result.put("result","error");
|
||||
System.out.println("发送待办任务失败,请联系管理员查看是否出现错误");
|
||||
TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(taskInstId);
|
||||
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", taskInstance.getTarget()+ "失败更新待办");
|
||||
BO bo_faid = new BO();
|
||||
bo_faid.set("CHANGED","1");
|
||||
bo_faid.set("TASK_ID",taskInstId);
|
||||
bo_faid.set("PROCESS_ID",processInstId);
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext);
|
||||
SDK.getProcessAPI().start(processInstance);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.controller;
|
||||
|
||||
import com.actionsoft.bpms.server.bind.annotation.Controller;
|
||||
import com.actionsoft.bpms.server.bind.annotation.Mapping;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class getCookieController {
|
||||
@Mapping("")
|
||||
public String getCookieTourl(String cookie){
|
||||
JSONObject result = JSONObject.parseObject(cookie);
|
||||
String yili_userid = result.getString("yili_userid");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.controller;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
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.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
public class testcontroller {
|
||||
|
||||
|
||||
}
|
||||
@ -1,472 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.output.constant.OutputConst;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
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.server.fs.DCContext;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.exception.AWSException;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import javax.swing.tree.RowMapper;
|
||||
import java.sql.Connection;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 创建已发布的知识
|
||||
*/
|
||||
public class CreateDataKnow implements IJob {
|
||||
|
||||
|
||||
private static String APPID = "com.awspaas.user.apps.yili.integration";
|
||||
|
||||
|
||||
private static String USERID = "admin";
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
SSOUtil ssoUtil = new SSOUtil();
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
String sid = ssoUtil.registerClientSessionNoPassword(USERID, "cn", portalUrl, "pc");
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
System.out.println("创建知识准备开始===============");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
System.out.println("开始时间是>>>>>>>>>>"+sdf.format(new Date()));
|
||||
String sql = "select * from APP_ACT_COE_PAL_REPOSITORY " +
|
||||
"where PLCATEGORY = 'process'and PLMETHODID !='process.framework' " +
|
||||
"and ISPUBLISH = '1' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')";
|
||||
|
||||
List<RowMap> rowMapList = DBSql.getMaps(sql);
|
||||
for (RowMap rowmap:rowMapList
|
||||
) {
|
||||
String card_sql = "SELECT * FROM APP_ACT_KMS_CARD WHERE CARDNAME like '"+rowmap.getString("PLNAME")+"%'";
|
||||
RowMap map = DBSql.getMap(card_sql);
|
||||
if (map!=null){
|
||||
String sql_pal = "SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE EXT4 = '"+map.getString("ID")+"'";
|
||||
RowMap rowMap = DBSql.getMap(sql_pal);
|
||||
if (rowMap!=null){
|
||||
System.out.println("该知识已经存在于PAL资产库中的EXT4中,并且已经在知识中");
|
||||
}else{
|
||||
String level = "";
|
||||
if (rowMap!=null){
|
||||
|
||||
|
||||
if (rowmap.getString("PLVER").contains(".00")){
|
||||
String[] plvers = rowmap.getString("PLVER").split(".");
|
||||
plvers[1] = plvers[1].replaceAll("0","");
|
||||
level = plvers[0]+plvers[1];
|
||||
}else {
|
||||
level = rowmap.getString("PLVER");
|
||||
}
|
||||
}
|
||||
CreateKnow(rowmap.getString("PLMETHODID"),rowmap.getString("PLNAME")+"V"+level,rowmap.getString("PLNAME"),rowmap.getString("PLVER"),true,true,"2099-12-31","1",USERID,"",sid);
|
||||
/*Map names = new LinkedHashMap<>();
|
||||
|
||||
String plname = rowmap.getString("PLNAME");
|
||||
for (int i=0;i<4;i++) {
|
||||
String sql_de = sql+" and PLNAME = '"+plname+"'";
|
||||
RowMap map1 = DBSql.getMap(sql_de);
|
||||
if (map1!=null){
|
||||
names.put(i,map1.getString("PLNAME"));
|
||||
plname = map1.getString("PLNAME");
|
||||
}else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i=names.size() - 1; i >= 0; i--) {
|
||||
String sql_de = sql+" and PLNAME = '"+names.get(i)+"'";
|
||||
RowMap map1 = DBSql.getMap(sql_de);
|
||||
String sql_decre = "select * from APP_ACT_KMS_DIMENSION where DIMENSIONNAME = '"+names.get(i)+"'";
|
||||
RowMap map2 = DBSql.getMap(sql_decre);
|
||||
if (map2==null){
|
||||
|
||||
createDimension(map1.getString("ID"),false,true,"1","","",names.get(i).toString(),sid);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}else {
|
||||
String level = "";
|
||||
if (rowmap!=null){
|
||||
if (rowmap.getString("PLVER").contains(".00")){
|
||||
String[] plvers = rowmap.getString("PLVER").split(".");
|
||||
plvers[1] = plvers[1].replaceAll("0","");
|
||||
level = plvers[0]+plvers[1];
|
||||
}else {
|
||||
level = rowmap.getString("PLVER");
|
||||
}
|
||||
}
|
||||
CreateKnow(rowmap.getString("PLMETHODID"),rowmap.getString("PLNAME")+"V"+level,rowmap.getString("PLNAME"),rowmap.getString("PLVER"),true,true,"2099-12-31","1",USERID,"",sid);
|
||||
/*Map names = new LinkedHashMap<>();
|
||||
|
||||
|
||||
String plname = rowmap.getString("PLNAME");
|
||||
String plparentid = rowmap.getString("PLPARENTID");
|
||||
for (int i=0;i<4;i++) {
|
||||
String slq = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+plparentid+"'";
|
||||
RowMap map3 = DBSql.getMap(slq);
|
||||
if (map3!=null){
|
||||
names.put(i,map3.getString("PLNAME"));
|
||||
plname = map3.getString("PLNAME");
|
||||
plparentid = map3.getString("PLPARENTID");
|
||||
}else if (plparentid.equals("process")){
|
||||
names.put(i,"流程制度");
|
||||
}else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i=names.size() - 1; i >= 0; i--) {
|
||||
if (names.get(i).equals("流程制度")){
|
||||
String sql_decre = "select * from APP_ACT_KMS_DIMENSION where DIMENSIONNAME = '"+names.get(i)+"'";
|
||||
RowMap map2 = DBSql.getMap(sql_decre);
|
||||
if (map2==null){
|
||||
|
||||
createDimension("",false,true,"1","","",names.get(i).toString(),sid);
|
||||
}
|
||||
}else {
|
||||
String sql_de = "select * from APP_ACT_COE_PAL_REPOSITORY " +
|
||||
"where PLCATEGORY = 'process'and PLMETHODID ='process.framework' " +
|
||||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')"+" and PLNAME = '"+names.get(i)+"'";
|
||||
RowMap map1 = DBSql.getMap(sql_de);
|
||||
String sql_decre = "select * from APP_ACT_KMS_DIMENSION where DIMENSIONNAME = '"+names.get(i)+"'";
|
||||
RowMap map2 = DBSql.getMap(sql_decre);
|
||||
if (map2==null){
|
||||
|
||||
createDimension(map1.getString("ID"),false,true,"1","","",names.get(i).toString(),sid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateKnow(String securityLevel,String knwlName,String plname,String PLVER, boolean isComment,boolean isRate,String validDate,String onlineLevel,String createUser,String cardContext,String sid) {
|
||||
// 调用App
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/CreateKnwl";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//保密级别, 0: 普通 1:秘密 2:机密,必填
|
||||
params.put("securityLevel", 0);
|
||||
//知识名称,必填
|
||||
params.put("knwlName", knwlName);
|
||||
//是否可以评论,必填
|
||||
params.put("isComment", isComment);
|
||||
//是否可以评分,必填
|
||||
params.put("isRate", isRate);
|
||||
//有效期:yyyy-MM-dd,非必填
|
||||
params.put("validDate", validDate);
|
||||
//只读控制,1:在线阅读和下载 0:在线阅读,必填
|
||||
params.put("onlineLevel", 1);
|
||||
//知识创建人,某些特殊场景下,sid和createUser代表的用户并不一样,如果此参数为null,则使用sid代表的用户,非必填
|
||||
|
||||
params.put("createUser", createUser);
|
||||
//知识内容,非必填
|
||||
params.put("cardContext", cardContext);
|
||||
//sid,必填
|
||||
params.put("sid", sid);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//创建知识
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
if (ro.isOk()){
|
||||
String cardId = ((LinkedHashMap) ro.getData()).get("cardId").toString();
|
||||
|
||||
String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '"+cardId+"' WHERE " +
|
||||
" PLCATEGORY = 'process'and PLMETHODID !='process.framework' " +
|
||||
" and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
" ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and ISPUBLISH = '1' and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
" 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
" '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
" '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
" '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
" '42c09260-c1d3-44b7-ac3d-f8280e04c294') and PLMETHODID = '"+securityLevel+"' and PLNAME = '"+plname+"' AND PLVER = '"+PLVER+"'";
|
||||
int update = DBSql.update(update_sql);
|
||||
System.out.println("更新名称为:"+plname+"版本为:"+PLVER +"的知识对应的资产库的EXT4的影响行数为"+update);
|
||||
creadteFile(userContext,cardId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void creadteFile(UserContext userContext, String cardId){
|
||||
/**
|
||||
* 这个主要是负责对流程手册进行相关的文件的生成
|
||||
*/
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/CreateFile";
|
||||
|
||||
if (StringUtils.isNotEmpty(cardId)){
|
||||
String sql_ext4 = "select * from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '"+cardId+"'";
|
||||
RowMap map = DBSql.getMap(sql_ext4);
|
||||
RowMap rowMap = DBSql.getMap("select * from (select * from BO_ACT_COE_PUBLISH_N where PUBLISHFILEID = '"+map.getString("ID")+"' order by CREATEDATE desc) where rownum = 1");
|
||||
if (rowMap!=null){
|
||||
|
||||
if (StringUtils.isNotEmpty(rowMap.getString("TASKID"))) {
|
||||
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(rowMap.getString("TASKID"));
|
||||
if (model != null) {
|
||||
System.out.println(",pdel============" + model);
|
||||
System.out.println("123313123123123==========" + model.getProfileId());
|
||||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||||
System.out.println("dajadfas======" + appProfile);
|
||||
if (appProfile == null) {
|
||||
throw new AWSException("Not Find OutputAppProfile! profileId=" + model.getProfileId());
|
||||
}
|
||||
DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT);
|
||||
if (dcProfile == null)
|
||||
throw new AWSException("Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT);
|
||||
String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + rowMap.getString("PUBLISHFILEID") + "'";
|
||||
String lever = DBSql.getString( sql_lever);
|
||||
//lever = lever.substring(0,3);
|
||||
if(lever.length()==5&&lever.substring(4).equals("0")){
|
||||
lever.substring(0,3);
|
||||
}else if (lever.length()==1){
|
||||
lever=lever+".0";
|
||||
}
|
||||
DCContext dcContext = new DCContext(userContext, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), rowMap.getString("TASKID"), rowMap.getString("PUBLISHFILENAME") + "_" + lever + ".doc");
|
||||
//UtilFile file = new UtilFile(dcContext.getPath());
|
||||
|
||||
|
||||
Map params = new HashMap<String, Object>();
|
||||
//知识ID,必填
|
||||
params.put("cardId", cardId);
|
||||
//sid,必填
|
||||
params.put("sid", userContext.getSessionId());
|
||||
|
||||
params.put("dc", dcContext);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//创建文件
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
System.out.println("流程手册的存入=================" + ro);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
String sql_A = "SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY where ID = '"+map.getString("ID")+"' AND PLMETHODID != 'process.framework' AND PLMETHODID IN (select distinct PLMETHODID from APP_ACT_COE_PAL_REPOSITORY)";
|
||||
List<RowMap> rows = DBSql.getMaps(sql_A);
|
||||
|
||||
for (RowMap bo:rows
|
||||
) {
|
||||
|
||||
/**
|
||||
* 这个是模型中的附件获取的并插入的数据信息,需要做修改
|
||||
*/
|
||||
// 调用App
|
||||
|
||||
// 参数定义列表
|
||||
Map paramss = new HashMap<String, Object>();
|
||||
//知识ID,必填
|
||||
paramss.put("cardId", cardId);
|
||||
//sid,必填
|
||||
paramss.put("sid", userContext.getSessionId());
|
||||
|
||||
UpfileWeb upfileWeb = new UpfileWeb(userContext);
|
||||
|
||||
|
||||
|
||||
String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where PLMETHODID != 'process.framework' AND ID= '"+map.getString("ID")+"'" +
|
||||
")";
|
||||
List<RowMap> maps = DBSql.getMaps(sql_upfile);
|
||||
for (RowMap row : maps) {
|
||||
System.out.println("附件的名称>>>>>>>>>>"+row.getString("FILENAME"));
|
||||
if (!row.getString("FILENAME").contains(".xml")){
|
||||
try {
|
||||
|
||||
|
||||
UpfileModel upfileModel = new UpfileModel();
|
||||
upfileModel.setType(row.getString("FILETYPE"));
|
||||
upfileModel.setFileName(row.getString("FILENAME"));
|
||||
upfileModel.setPl_uuid(row.getString("PALREPOSITORYID"));
|
||||
upfileModel.setShape_uuid(row.getString("SHAPEID"));
|
||||
DCContext dcContexts = upfileWeb.getDCContext(upfileModel);
|
||||
paramss.put("dc", dcContexts);
|
||||
AppAPI appAPIs = SDK.getAppAPI();
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, paramss);
|
||||
System.out.println("流程模型附件的生成============="+ros);
|
||||
}catch (Exception e){
|
||||
System.out.println("附件无法上传>>>>>>>>"+row.getString("FILENAME"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//DCContext对象,必填
|
||||
|
||||
//创建文件
|
||||
}
|
||||
PublishKnow(userContext,cardId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void PublishKnow(UserContext userContext,String id){
|
||||
|
||||
String sql = "select EXT4 from APP_ACT_COE_PAL_REPOSITORY where id in (select PLPARENTID from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '"+id +"')";
|
||||
List<RowMap> maps = DBSql.getMaps(sql);
|
||||
String ids = "";
|
||||
for (RowMap rowmap:maps
|
||||
) {
|
||||
ids+=rowmap.getString("EXT4")+",";
|
||||
}
|
||||
String[] deptSplit_id = ids.split(",");
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
for (String id_names:deptSplit_id
|
||||
) {
|
||||
jsonArray.add(id_names);
|
||||
}
|
||||
//jsonObject.put(deptSplit_id);
|
||||
id+=",";
|
||||
String[] deptSplit_das = id.split(",");
|
||||
JSONArray jsonArray_das = new JSONArray();
|
||||
for (String das:deptSplit_das
|
||||
) {
|
||||
jsonArray_das.add(das);
|
||||
}
|
||||
//jsonObject.put(deptSplit_id);
|
||||
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/PublishKnwl";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//要发布到的维度ID的JSON数组字符串,必填
|
||||
params.put("dimensionIDArray", jsonArray.toString());
|
||||
//要发布的知识ID的JSON数组字符串,必填
|
||||
params.put("knwlIDArray", jsonArray_das.toString());
|
||||
//标签的JSON数组字符串,非必填
|
||||
|
||||
//sid,必填
|
||||
params.put("sid", userContext.getSessionId());
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//发布知识
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
|
||||
System.out.println("知识发布============"+ro);
|
||||
|
||||
String sql_ext4 = "select PERMTYPE,ORGPERM from BO_ACT_PUBLISH_PERM_SCOPE where PALVERSIONID = (select PLVERSIONID from APP_ACT_COE_PAL_REPOSITORY where ISPUBLISH = '1' AND EXT4 = '"+id.substring(0,id.length()-1)+"')";
|
||||
RowMap rowMap = DBSql.getMap(sql_ext4);
|
||||
System.out.println("rowMap>>>>>>>>"+rowMap);
|
||||
System.out.println("sqls>>>>>>>>"+sql_ext4);
|
||||
JSONArray jsonArray1 = new JSONArray(new LinkedList<>());
|
||||
if (rowMap==null){
|
||||
List<RowMap> select_id_from_orgdepartment = DBSql.getMaps("select ID from ORGDEPARTMENT");
|
||||
for (RowMap depaid:
|
||||
select_id_from_orgdepartment) {
|
||||
String id_depart = depaid.getString("ID");
|
||||
JSONObject jsonObjecta = new JSONObject();
|
||||
jsonObjecta.put("assignmentType","department");
|
||||
jsonObjecta.put("assignmentId",id_depart);
|
||||
jsonArray1.add(jsonObjecta);
|
||||
}
|
||||
}else {
|
||||
String permtype = rowMap.getString("PERMTYPE");
|
||||
if (permtype.equals("1")) {
|
||||
List<RowMap> select_id_from_orgdepartment = DBSql.getMaps("select ID from ORGDEPARTMENT");
|
||||
for (RowMap depaid :
|
||||
select_id_from_orgdepartment) {
|
||||
String depaid_id = depaid.getString("ID");
|
||||
JSONObject jsonObjecta = new JSONObject();
|
||||
jsonObjecta.put("assignmentType", "department");
|
||||
jsonObjecta.put("assignmentId", depaid_id);
|
||||
jsonArray1.add(jsonObjecta);
|
||||
}
|
||||
} else {
|
||||
String org_depart = rowMap.getString("ORGPERM");
|
||||
String deoa = "";
|
||||
if (org_depart.contains(",")) {
|
||||
String[] ds = org_depart.split(",");
|
||||
for (String depaid :
|
||||
ds) {
|
||||
JSONObject jsonObjecta = new JSONObject();
|
||||
jsonObjecta.put("assignmentType", "department");
|
||||
jsonObjecta.put("assignmentId", depaid);
|
||||
jsonArray1.add(jsonObjecta);
|
||||
}
|
||||
} else {
|
||||
deoa = org_depart;
|
||||
JSONObject jsonObjecta = new JSONObject();
|
||||
jsonObjecta.put("assignmentType", "department");
|
||||
jsonObjecta.put("assignmentId", deoa);
|
||||
jsonArray1.add(jsonObjecta);
|
||||
}
|
||||
}
|
||||
}
|
||||
AddKnwlAC(jsonArray1,userContext.getSessionId(),id.substring(0,id.length()-1));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean AddKnwlAC(JSONArray jsonArray, String sid, String knwlId) {
|
||||
// 调用App
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/AddKnwlAC";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//[{"assignmentType":"department","assignmentId":"62196ff9-a26d-4be5-9480-3ef680886f63"},{"assignmentType":"user","assignmentId":"user1"}],必填
|
||||
params.put("acList", jsonArray);
|
||||
//sid,如果为空,则需要传createUser参数,非必填
|
||||
params.put("sid", sid);
|
||||
//知识ID,必填
|
||||
params.put("knwlId", knwlId);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//给知识授权
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
System.out.println("授权>>>>>>>>>>>>"+ro);
|
||||
return ro.isOk();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.bpms.dw.exec.event.ideimport.DataWindowAfterImport;
|
||||
import com.actionsoft.bpms.dw.exec.imp.model.ImportModel;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DataWindowImportAfterEvent extends DataWindowAfterImport {
|
||||
@Override
|
||||
public void excute(UserContext userContext, String s, String s1, List<ImportModel> list, String s2, Map<String, Object> map) {
|
||||
System.out.println("daa" +
|
||||
"" +
|
||||
"");
|
||||
}
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import bsh.StringUtil;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FinshKnowAfterEvent extends ExecuteListener {
|
||||
@Override
|
||||
public void execute(ProcessExecutionContext processExecutionContext) throws Exception {
|
||||
List<BO> bo_act_coe_publish_c = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID = ", processExecutionContext.getProcessInstance().getId()).list();
|
||||
List<BO> bo_act_coe_publish_n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID = ", processExecutionContext.getProcessInstance().getId()).list();
|
||||
List<BO> bo_act_coe_publish_s = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).list();
|
||||
|
||||
for (BO bo :
|
||||
bo_act_coe_publish_n) {
|
||||
String sql = "SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '"+bo.getString("PUBLISHFILEID")+"'";
|
||||
RowMap rowMap = DBSql.getMap(sql);
|
||||
String ext4 = rowMap.getString("EXT4");
|
||||
if (StringUtils.isNotEmpty(ext4)){
|
||||
String sql_card = "SELECT * FROM APP_ACT_KMS_CARD WHERE ID = '"+ext4+"'";
|
||||
RowMap map = DBSql.getMap(sql_card);
|
||||
if (ext4.equals(map.getString("ID"))){
|
||||
if (map.getString("CARDNAME").equals(rowMap.getString("PLNAME"))){
|
||||
|
||||
}else {
|
||||
String update_sql_name = "UPDATE APP_ACT_KMS_CARD SET CARDNAME = '"+rowMap.getString("PLNAME")+"' WHERE ID = '"+map.getString("ID")+"'";
|
||||
int update_sql_name_nums = DBSql.update(update_sql_name);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,123 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.log.CoEOpLogAPI;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.OutputAPIManager;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.fs.AbstFileProcessor;
|
||||
import com.actionsoft.bpms.server.fs.DCContext;
|
||||
import com.actionsoft.bpms.server.fs.FileProcessorListener;
|
||||
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
|
||||
import com.actionsoft.bpms.server.fs.dc.DCUtil;
|
||||
import com.actionsoft.bpms.util.UtilFile;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class OutputDCFileProcessor extends AbstFileProcessor implements FileProcessorListener {
|
||||
public OutputDCFileProcessor() {
|
||||
}
|
||||
|
||||
public static String getReportDownloadURL(String wsId, String id, String profileId, UserContext _uc, String taskName) throws Exception {
|
||||
UtilFile file = OutputAPIManager.getInstance().getFilePath(wsId, id, profileId);
|
||||
if (file.exists()) {
|
||||
DCContext dcContext = null;
|
||||
DCUtil.getInstance();
|
||||
dcContext = DCUtil.createTempFileContext("com.actionsoft.apps.coe.pal.output.pr", "output", id, "zip");
|
||||
dcContext.setFileName(taskName + ".zip");
|
||||
File ff = new File(dcContext.getFilePath());
|
||||
UtilFile.zipCompressExcludeName(file.getPath(), ff, "log,**/config.txt");
|
||||
dcContext.setSession(_uc);
|
||||
if (SDK.getAppAPI().getPropertyBooleanValue("com.actionsoft.apps.coe.pal", "IS_RECORD_OP_LOG", false)) {
|
||||
CoEOpLogAPI.auditOkOp(_uc, "PAL应用中心", "download", "下载报告手册文档");
|
||||
}
|
||||
|
||||
return dcContext.getDownloadURL();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String doPreviewReport(String wsId, String id, String profileId, UserContext _uc) throws Exception {
|
||||
UtilFile file = OutputAPIManager.getInstance().getFilePath(wsId, id, profileId);
|
||||
ResponseObject result = ResponseObject.newOkResponse();
|
||||
if (file.exists()) {
|
||||
File[] fileList = file.listFiles();
|
||||
if (fileList.length > 0) {
|
||||
File docFile = null;
|
||||
File[] var8 = fileList;
|
||||
int var9 = fileList.length;
|
||||
|
||||
for(int var10 = 0; var10 < var9; ++var10) {
|
||||
File file2 = var8[var10];
|
||||
if (file2.isFile() && "doc".equals(file2.getName().substring(file2.getName().lastIndexOf(".") + 1))) {
|
||||
docFile = file2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (docFile == null) {
|
||||
return ResponseObject.newErrResponse("没有找到文件").toString();
|
||||
}
|
||||
|
||||
if (SDK.getAppAPI().isActive("com.actionsoft.apps.addons.onlinedoc")) {
|
||||
String sourceAppId = "com.actionsoft.apps.coe.pal.output.pr";
|
||||
String filename = docFile.getName();
|
||||
DCContext sourceDc = new DCContext(_uc, DCProfileManager.getDCProfile(sourceAppId, "output"), sourceAppId, wsId, id, filename);
|
||||
Map<String, Object> aslpParams = new HashMap();
|
||||
aslpParams.put("sid", _uc.getSessionId());
|
||||
aslpParams.put("fileNameOriginal", filename);
|
||||
aslpParams.put("sourceDc", sourceDc);
|
||||
aslpParams.put("isShowDefaultToolbar", "false");
|
||||
aslpParams.put("isEncrypt", true);
|
||||
aslpParams.put("isCopy", "true");
|
||||
aslpParams.put("isPrint", "false");
|
||||
aslpParams.put("isDownload", "false");
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
ResponseObject responseObject = appAPI.callASLP(appAPI.getAppContext(sourceAppId), "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview", aslpParams);
|
||||
if (responseObject != null) {
|
||||
if (responseObject.isOk()) {
|
||||
String url = responseObject.get("url").toString();
|
||||
result.put("url", url);
|
||||
result.put("filename", filename);
|
||||
if (SDK.getAppAPI().getPropertyBooleanValue("com.actionsoft.apps.coe.pal", "IS_RECORD_OP_LOG", false)) {
|
||||
CoEOpLogAPI.auditOkOp(_uc, "PAL应用中心", "access", "访问报告手册文档");
|
||||
}
|
||||
} else {
|
||||
result = ResponseObject.newErrResponse("文档转换服务不可用,请联系管理员");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = ResponseObject.newErrResponse("文档转换服务不可用,请联系管理员");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = ResponseObject.newErrResponse("没有可预览文件");
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String getReportLogDownloadURL(String wsId, String id, String profileId, UserContext _uc, String taskName) throws Exception {
|
||||
UtilFile file = OutputAPIManager.getInstance().getFilePath(wsId, id, profileId);
|
||||
if (file.exists()) {
|
||||
DCContext dcContext = null;
|
||||
DCUtil.getInstance();
|
||||
dcContext = DCUtil.createTempFileContext("com.actionsoft.apps.coe.pal.output.pr", "output", id, "zip");
|
||||
dcContext.setFileName("log.zip");
|
||||
File ff = new File(dcContext.getFilePath());
|
||||
UtilFile.zipCompress(file.getPath(), ff, "log");
|
||||
dcContext.setSession(_uc);
|
||||
if (SDK.getAppAPI().getPropertyBooleanValue("com.actionsoft.apps.coe.pal", "IS_RECORD_OP_LOG", false)) {
|
||||
CoEOpLogAPI.auditOkOp(_uc, "PAL应用中心", "download", "下载报告手册文档日志");
|
||||
}
|
||||
|
||||
return dcContext.getDownloadURL();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,546 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener;
|
||||
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.login.constant.LoginConst;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.org.cache.UserCache;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.bpms.server.SSOUtil;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.awspaas.user.apps.integration.XmlDatasUtil;
|
||||
import com.awspaas.user.apps.integration.oa.OaPendComponent;
|
||||
import com.awspaas.user.apps.integration.util.HttpClientUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class ProcessAfterData extends InterruptListener {
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "0.0.1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProvider() {
|
||||
return "ActionSoft";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "OA审批数据失败之后需要做的操作";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(ProcessExecutionContext processExecutionContext) throws Exception {
|
||||
OaPendComponent component = new OaPendComponent();
|
||||
BO bo_eu_faid_data = SDK.getBOAPI().query("BO_EU_FAID_DATA", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail();
|
||||
if (bo_eu_faid_data!=null){
|
||||
String changed = bo_eu_faid_data.getString("CHANGED");
|
||||
if (changed.equals("1")){
|
||||
ProcessInstance processed = SDK.getProcessAPI().getInstanceById(bo_eu_faid_data.getString("PROCESS_ID"));
|
||||
TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(bo_eu_faid_data.getString("TASK_ID"));
|
||||
if (processed!=null&&taskInstance!=null){
|
||||
System.out.println("这是发送待办调用发送待办数据发送问题");
|
||||
boolean b = sendOAPRocess(bo_eu_faid_data, processExecutionContext, taskInstance, processed);
|
||||
return b;
|
||||
}
|
||||
}else if (changed.equals("2")){
|
||||
ProcessInstance processed = SDK.getProcessAPI().getInstanceById(bo_eu_faid_data.getString("PROCESS_ID"));
|
||||
TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(bo_eu_faid_data.getString("TASK_ID"));
|
||||
if (processed!=null&&taskInstance!=null){
|
||||
System.out.println("这是更新调用发送待办数据发送问题");
|
||||
boolean b = updatePending(bo_eu_faid_data, processExecutionContext, taskInstance, processed);
|
||||
return b;
|
||||
}
|
||||
}else if (changed.equals("3")){
|
||||
ProcessInstance processed = SDK.getProcessAPI().getInstanceById(bo_eu_faid_data.getString("PROCESS_ID"));
|
||||
TaskInstance instanceById = SDK.getTaskAPI().getInstanceById(processed.getStartTaskInstId());
|
||||
if (processed!=null&&instanceById!=null){
|
||||
System.out.println("这是删除调用发送待办数据发送问题");
|
||||
boolean b = updateendPending(bo_eu_faid_data, processExecutionContext, instanceById, processed);
|
||||
return b;
|
||||
}
|
||||
}else if (changed.equals("4")){
|
||||
ProcessInstance processed = SDK.getProcessAPI().getInstanceById(bo_eu_faid_data.getString("PROCESS_ID"));
|
||||
TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(bo_eu_faid_data.getString("TASK_ID"));
|
||||
System.out.println("这是结束调用发送待办数据发送问题");
|
||||
boolean b = updateendPending(bo_eu_faid_data, processExecutionContext, taskInstance, processed);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean sendOAPRocess(BO bo ,ProcessExecutionContext processExecutionContext,TaskInstance taskInstance, ProcessInstance processInstance) throws IOException, DocumentException {
|
||||
boolean flag = false;
|
||||
XmlDatasUtil xmlDatasUtil = new XmlDatasUtil();
|
||||
xmlDatasUtil.setExternal_system_ID("LCZD");
|
||||
xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId());
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstance.getId()).detail();
|
||||
if (bo_act_coe_publish!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理");
|
||||
}else {
|
||||
BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", processInstance.getId()).detail();
|
||||
if (bo_eu_1664184390101!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_LMDOOGTE")+"】,点击进行处理");
|
||||
}else {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+processInstance.getTitle()+"】,点击进行处理");
|
||||
}
|
||||
}
|
||||
|
||||
//http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
if (portalUrl.equals("http://10.114.11.135:8088/portal")){
|
||||
portalUrl = "https://bpm.yili.com:8088/portal/";
|
||||
}
|
||||
xmlDatasUtil.setPcurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState());
|
||||
xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+taskInstance.getTarget()+"&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState());
|
||||
String target = taskInstance.getTarget();
|
||||
System.out.println("当前账户======》》》》"+target);
|
||||
BO bo_eu_oa_reson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=" , target).detail();
|
||||
System.out.println("bo>>>>>>>>>>"+bo_eu_oa_reson);
|
||||
if (bo_eu_oa_reson!=null){
|
||||
|
||||
xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒
|
||||
String str = df.format(taskInstance.getBeginTime());
|
||||
String substring = str.substring(str.indexOf(" "), str.length());
|
||||
xmlDatasUtil.setTo_do_creation_time(substring);
|
||||
xmlDatasUtil.setTo_do_completion_time(substring);
|
||||
//if (taskInstance.getState()==1){
|
||||
xmlDatasUtil.setTo_do_status("0");
|
||||
//}
|
||||
xmlDatasUtil.setTo_do_official_type("0");
|
||||
// if (taskInstance.getReadState()==0){
|
||||
// xmlDatasUtil.setViewtype("0");
|
||||
// }else if (taskInstance.getReadState()==1){
|
||||
xmlDatasUtil.setViewtype("0");
|
||||
// }
|
||||
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
|
||||
xmlDatasUtil.setDonedate(str.substring(0, str.indexOf(" ")));
|
||||
/*String der ="";
|
||||
if (taskInstance.getReadTime()!=null){
|
||||
der = df.format(taskInstance.getReadTime());
|
||||
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
|
||||
}else {
|
||||
der = df.format(taskInstance.getBeginTime());
|
||||
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
|
||||
}*/
|
||||
xmlDatasUtil.setReceivedate(str.substring(0, str.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(substring);
|
||||
|
||||
xmlDatasUtil.setCurrentnodetype("0");
|
||||
xmlDatasUtil.setRequestcode(processInstance.getId());
|
||||
xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(processInstance.getProcessDefId(),taskInstance.getActivityDefId()).getName());
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = processInstance.getAppId();
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//流程实例id,必填
|
||||
params.put("processInstId", processInstance.getId());
|
||||
//,必填
|
||||
params.put("sid", UserContext.fromUID(processInstance.getCreateUser()).getSessionId());
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//流程节点数据
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
String username = "";
|
||||
String userid = "";
|
||||
if (ro.isOk()){
|
||||
List list = new ArrayList();
|
||||
Object processBudgetModelList = ro.get("processBudgetModelList");
|
||||
JSONArray array = JSON.parseArray(String.valueOf(processBudgetModelList));
|
||||
|
||||
if (!array.isEmpty()){
|
||||
for(int i=0;i<array.size();i++){
|
||||
JSONObject jsonObject = JSONObject.parseObject(array.get(i).toString());
|
||||
String executor = jsonObject.get("executor").toString();
|
||||
String userid2 = jsonObject.get("userid2").toString();
|
||||
//String userid2 = jsonArray.getJSONObject(i).getString("userid2");
|
||||
username+=executor+" ";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setNooperator(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
|
||||
xmlDatasUtil.setWorkcode("");
|
||||
xmlDatasUtil.setWorkflowname(processInstance.getTitle());
|
||||
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
xmlDatasUtil.setCreaterworkcode("");
|
||||
|
||||
|
||||
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
|
||||
System.out.println("状态码============》》》》》》》》》》》"+s);
|
||||
|
||||
Document document = null;
|
||||
try {
|
||||
document = DocumentHelper.parseText(s);
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>"+rootElement);
|
||||
/*Element result = rootElement.element("Body").element("InsertTodoCominfoResponse ").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("result");
|
||||
String status = jsonObject1.getString("message");
|
||||
|
||||
if (datas.equals("success")){
|
||||
System.out.println("发送待办任务完成,请去OA系统上查看是否传输完成");
|
||||
flag = true;
|
||||
}else {
|
||||
System.out.println("发送待办任务失败,请联系管理员查看是否出现错误");
|
||||
System.out.println("错误提示>>>>>>>>>>>>"+status);
|
||||
flag = false;
|
||||
}*/
|
||||
bo.set("OA_RESULT",rootElement);
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
bo.set("OA_DATE",simpleDateFormat.format(new Date()));
|
||||
SDK.getBOAPI().update("BO_EU_FAID_DATA",bo);
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新待办状态
|
||||
* @param taskInstance
|
||||
*/
|
||||
public boolean updatePending(BO bo ,ProcessExecutionContext processExecutionContext,TaskInstance taskInstance, ProcessInstance processInstance) throws IOException, DocumentException {
|
||||
boolean flag = false;
|
||||
XmlDatasUtil xmlDatasUtil = new XmlDatasUtil();
|
||||
xmlDatasUtil.setExternal_system_ID("LCZD");
|
||||
|
||||
xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId());
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstance.getId()).detail();
|
||||
if (bo_act_coe_publish!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理");
|
||||
}else {
|
||||
BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", processInstance.getId()).detail();
|
||||
if (bo_eu_1664184390101!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_LMDOOGTE")+"】,点击进行处理");
|
||||
}else {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+processInstance.getTitle()+"】,点击进行处理");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
if (portalUrl.equals("http://10.114.11.135:8088/portal")){
|
||||
portalUrl = "https://bpm.yili.com:8088/portal/";
|
||||
}
|
||||
xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState());
|
||||
xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+taskInstance.getTarget()+"&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState());
|
||||
|
||||
String target = taskInstance.getTarget();
|
||||
|
||||
System.out.println("当前账户======》》》》"+target);
|
||||
BO bo_eu_oa_reson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=" , target).detail();
|
||||
System.out.println("bo>>>>>>>>>>>>>>"+bo_eu_oa_reson);
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒
|
||||
String str = df.format(taskInstance.getBeginTime());
|
||||
String substring = str.substring(str.indexOf(" "), str.length());
|
||||
xmlDatasUtil.setTo_do_creation_time(substring);
|
||||
xmlDatasUtil.setTo_do_completion_time(df.format(taskInstance.getBeginTime()).substring(df.format(taskInstance.getBeginTime()).indexOf(" "), df.format(taskInstance.getBeginTime()).length()));
|
||||
|
||||
xmlDatasUtil.setTo_do_status("1");
|
||||
|
||||
xmlDatasUtil.setTo_do_official_type("0");
|
||||
|
||||
xmlDatasUtil.setViewtype("-2");
|
||||
|
||||
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
|
||||
xmlDatasUtil.setDonedate(df.format(taskInstance.getBeginTime()).substring(0, df.format(taskInstance.getBeginTime()).indexOf(" ")));
|
||||
String der = "";
|
||||
if (taskInstance.getReadTime()==null){
|
||||
der= df.format(new Date());
|
||||
}else {
|
||||
der= df.format(taskInstance.getReadTime());
|
||||
}
|
||||
|
||||
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
|
||||
|
||||
xmlDatasUtil.setCurrentnodetype("0");
|
||||
|
||||
|
||||
xmlDatasUtil.setRequestcode(processInstance.getId());
|
||||
xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(processInstance.getProcessDefId(),taskInstance.getActivityDefId()).getName());
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = processInstance.getAppId();
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//流程实例id,必填
|
||||
params.put("processInstId", processInstance.getId());
|
||||
//,必填
|
||||
if (processInstance.getCreateUser()!=null){
|
||||
params.put("sid", UserContext.fromUID(processInstance.getCreateUser()).getSessionId());
|
||||
}else {
|
||||
String sessionId = new SSOUtil().registerClientSessionNoPassword(taskInstance.getTarget(), LoginConst.DEFAULT_LANG, "127.0.0.1", LoginConst.DEVICE_PC);
|
||||
params.put("sid", sessionId);
|
||||
}
|
||||
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//流程节点数据
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
String username = "";
|
||||
String userid = "";
|
||||
if (ro.isOk()){
|
||||
String data = ro.getData().toString();
|
||||
JSONObject jsonObject = JSONObject.parseObject(data);
|
||||
JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("processBudgetModelList"));
|
||||
if (!jsonArray.isEmpty()){
|
||||
for(int i=0;i<jsonArray.size();i++){
|
||||
String filename = jsonArray.getJSONObject(i).getString("executor");
|
||||
String userid2 = jsonArray.getJSONObject(i).getString("userid2");
|
||||
username+=filename+" ";
|
||||
userid+=userid2+" ";
|
||||
}
|
||||
}
|
||||
}
|
||||
xmlDatasUtil.setNooperator(username);
|
||||
xmlDatasUtil.setWorkcode("");
|
||||
if (processInstance.getTitle()!=null){
|
||||
xmlDatasUtil.setWorkflowname(processInstance.getTitle());
|
||||
}else {
|
||||
xmlDatasUtil.setWorkflowname("流程发布");
|
||||
}
|
||||
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
xmlDatasUtil.setCreaterworkcode("");
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
|
||||
System.out.println("已办查看是否修改");
|
||||
UserModel targetUserModel = UserCache.getModel(taskInstance.getTarget());
|
||||
Document document = null;
|
||||
try {
|
||||
document = DocumentHelper.parseText(s);
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>"+rootElement);
|
||||
/*Element result = rootElement.element("Body").element("InsertTodoCominfoResponse ").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("result");
|
||||
String status = jsonObject1.getString("message");
|
||||
|
||||
if (datas.equals("success")){
|
||||
System.out.println("发送待办任务完成,请去OA系统上查看是否传输完成");
|
||||
flag = true;
|
||||
}else {
|
||||
System.out.println("发送待办任务失败,请联系管理员查看是否出现错误");
|
||||
System.out.println("错误提示>>>>>>>>>>>>"+status);
|
||||
flag = false;
|
||||
}*/
|
||||
bo.set("OA_RESULT",rootElement);
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
bo.set("OA_DATE",simpleDateFormat.format(new Date()));
|
||||
SDK.getBOAPI().update("BO_EU_FAID_DATA",bo);
|
||||
return flag;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新待办状态
|
||||
* @param taskInstance
|
||||
*/
|
||||
public boolean updateendPending(BO bo ,ProcessExecutionContext processExecutionContext,TaskInstance taskInstance, ProcessInstance processInstance) throws IOException, DocumentException {
|
||||
boolean flag = false;
|
||||
XmlDatasUtil xmlDatasUtil = new XmlDatasUtil();
|
||||
xmlDatasUtil.setExternal_system_ID("LCZD");
|
||||
|
||||
xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId());
|
||||
if (processInstance!=null){
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstance.getId()).detail();
|
||||
if (bo_act_coe_publish!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理");
|
||||
}else {
|
||||
BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", processInstance.getId()).detail();
|
||||
if (bo_eu_1664184390101!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_LMDOOGTE")+"】,点击进行处理");
|
||||
}else {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+processInstance.getTitle()+"】,点击进行处理");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条流程发布流程已作废,点击进行处理");
|
||||
}
|
||||
|
||||
//http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
if (portalUrl.equals("http://10.114.11.135:8088/portal")){
|
||||
portalUrl = "https://bpm.yili.com:8088/portal/";
|
||||
}
|
||||
xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState());
|
||||
xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+taskInstance.getTarget()+"&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState());
|
||||
|
||||
String target = taskInstance.getTarget();
|
||||
|
||||
System.out.println("当前账户======》》》》"+target);
|
||||
BO bo_eu_oa_reson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=" , target).detail();
|
||||
System.out.println("bo>>>>>>>>>>>>>>"+bo_eu_oa_reson);
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒
|
||||
String str = df.format(taskInstance.getBeginTime());
|
||||
String substring = str.substring(str.indexOf(" "), str.length());
|
||||
xmlDatasUtil.setTo_do_creation_time(substring);
|
||||
xmlDatasUtil.setTo_do_completion_time(df.format(taskInstance.getBeginTime()).substring(df.format(taskInstance.getBeginTime()).indexOf(" "), df.format(taskInstance.getBeginTime()).length()));
|
||||
|
||||
xmlDatasUtil.setTo_do_status("1");
|
||||
|
||||
xmlDatasUtil.setTo_do_official_type("0");
|
||||
|
||||
xmlDatasUtil.setViewtype("-2");
|
||||
|
||||
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
|
||||
xmlDatasUtil.setDonedate(df.format(taskInstance.getBeginTime()).substring(0, df.format(taskInstance.getBeginTime()).indexOf(" ")));
|
||||
String der = "";
|
||||
if (taskInstance.getReadTime()==null){
|
||||
der= df.format(new Date());
|
||||
}else {
|
||||
der= df.format(taskInstance.getReadTime());
|
||||
}
|
||||
|
||||
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
|
||||
|
||||
xmlDatasUtil.setCurrentnodetype("1");
|
||||
|
||||
|
||||
xmlDatasUtil.setRequestcode(processInstance.getId());
|
||||
xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(processInstance.getProcessDefId(),taskInstance.getActivityDefId()).getName());
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = processInstance.getAppId();
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//流程实例id,必填
|
||||
params.put("processInstId", processInstance.getId());
|
||||
//,必填
|
||||
if (processInstance.getCreateUser()!=null){
|
||||
params.put("sid", UserContext.fromUID(processInstance.getCreateUser()).getSessionId());
|
||||
}else {
|
||||
String sessionId = new SSOUtil().registerClientSessionNoPassword(taskInstance.getTarget(), LoginConst.DEFAULT_LANG, "127.0.0.1", LoginConst.DEVICE_PC);
|
||||
params.put("sid", sessionId);
|
||||
}
|
||||
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//流程节点数据
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
String username = "";
|
||||
String userid = "";
|
||||
if (ro.isOk()){
|
||||
String data = ro.getData().toString();
|
||||
JSONObject jsonObject = JSONObject.parseObject(data);
|
||||
JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("processBudgetModelList"));
|
||||
if (!jsonArray.isEmpty()){
|
||||
for(int i=0;i<jsonArray.size();i++){
|
||||
String filename = jsonArray.getJSONObject(i).getString("executor");
|
||||
String userid2 = jsonArray.getJSONObject(i).getString("userid2");
|
||||
username+=filename+" ";
|
||||
userid+=userid2+" ";
|
||||
}
|
||||
}
|
||||
}
|
||||
xmlDatasUtil.setNooperator(username);
|
||||
xmlDatasUtil.setWorkcode("");
|
||||
if (processInstance.getTitle()!=null){
|
||||
xmlDatasUtil.setWorkflowname(processInstance.getTitle());
|
||||
}else {
|
||||
xmlDatasUtil.setWorkflowname("流程发布");
|
||||
}
|
||||
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
xmlDatasUtil.setCreaterworkcode("");
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
|
||||
System.out.println("已办查看是否修改");
|
||||
UserModel targetUserModel = UserCache.getModel(taskInstance.getTarget());
|
||||
Document document = null;
|
||||
try {
|
||||
document = DocumentHelper.parseText(s);
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>"+rootElement);
|
||||
/*Element result = rootElement.element("Body").element("InsertTodoCominfoResponse ").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("result");
|
||||
String status = jsonObject1.getString("message");
|
||||
|
||||
if (datas.equals("success")){
|
||||
System.out.println("发送待办任务完成,请去OA系统上查看是否传输完成");
|
||||
flag = true;
|
||||
}else {
|
||||
System.out.println("发送待办任务失败,请联系管理员查看是否出现错误");
|
||||
System.out.println("错误提示>>>>>>>>>>>>"+status);
|
||||
flag = false;
|
||||
}*/
|
||||
bo.set("OA_RESULT",rootElement);
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
bo.set("OA_DATE",simpleDateFormat.format(new Date()));
|
||||
SDK.getBOAPI().update("BO_EU_FAID_DATA",bo);
|
||||
return flag;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,27 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.ProcessExecuteQuery;
|
||||
|
||||
public class TaskCreatedAfterEvent extends ExecuteListener {
|
||||
public TaskCreatedAfterEvent() {
|
||||
super.setDescription("自动审批");
|
||||
super.setProvider("actionsoft");
|
||||
super.setVersion("1.0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ProcessExecutionContext processExecutionContext) throws Exception {
|
||||
TaskInstance taskInstance = processExecutionContext.getTaskInstance();
|
||||
if (taskInstance.getState() != 2) {
|
||||
String taskInstanceId = processExecutionContext.getTaskInstance().getId();
|
||||
SDK.getTaskAPI().setComment(taskInstanceId, "同意", "同意");
|
||||
String target = SDK.getTaskAPI().getTaskInstance(taskInstanceId).getTarget();
|
||||
// String target = processExecutionContext.getTaskInstance().getTarget();
|
||||
ProcessExecuteQuery processExecuteQuery = SDK.getTaskAPI().completeTask(taskInstanceId, null, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,376 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListenerInterface;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @PackageName: com.awspaas.user.apps.yili.event
|
||||
* @ClassName: TestEvent
|
||||
* @author: yujh
|
||||
* @date: 2022/5/30 20:20
|
||||
*/
|
||||
public class TestEvent extends ExecuteListener implements ExecuteListenerInterface {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "0.0.1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProvider() {
|
||||
return "ActionSoft";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "这个主要是做部门/岗位/职级进行并集,交集测试";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ProcessExecutionContext processExecutionContext) throws Exception {
|
||||
BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_EU_WCY_TEST", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail();
|
||||
String uid = "";
|
||||
String new_uid = "";
|
||||
if(bo_act_coe_publish1!=null) {
|
||||
String da = bo_act_coe_publish1.getString("SEND_SCOP");
|
||||
|
||||
if (da.equals("1")) {
|
||||
List<RowMap> select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER WHERE CLOSED = '0'and userno is not null");
|
||||
for (RowMap row : select_userid_from_orguser
|
||||
) {
|
||||
DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID"));
|
||||
if(departmentModel.getId().equals("e79281b1-2f81-4895-b30e-9f96e9ad0e2c")||departmentModel.getId().equals("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")){
|
||||
|
||||
}else {
|
||||
uid += row.getString("USERID") + ",";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List posts_list = new ArrayList();
|
||||
List<String> org_list = new ArrayList();
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_ORG"))){
|
||||
String strs[] = bo_act_coe_publish1.getString("SEND_SCOPE_ORG").split(",");
|
||||
org_list= Arrays.asList(strs);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_POST"))) {
|
||||
String posts[] = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
posts_list = Arrays.asList(posts);
|
||||
}
|
||||
List ranks_list = new ArrayList();
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL"))) {
|
||||
String ranks[] = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
ranks_list = Arrays.asList(ranks);
|
||||
}
|
||||
|
||||
System.out.println("部门id》》》》》》》》》》》》》"+org_list );
|
||||
System.out.println("posts_list》》》》》》》》》》》》》"+posts_list);
|
||||
System.out.println("ranks_list》》》》》》》》》》》》》"+ranks_list);
|
||||
System.out.println("部门数量》》》》》》》》》》》》》"+org_list.size() );
|
||||
System.out.println("岗位数量》》》》》》》》》》》》》"+posts_list.size());
|
||||
System.out.println("职级数量》》》》》》》》》》》》》"+ranks_list.size());
|
||||
if (org_list.size()!=0 && org_list!=null) {
|
||||
for (String depaartid : org_list
|
||||
) {
|
||||
System.out.println("departid>>>>>>>>>>>>>" + depaartid);
|
||||
DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentById(depaartid);
|
||||
boolean existSubModelOfCache = departmentModel.isExistSubModelOfCache();
|
||||
System.out.println("是否含有下级?????????????" + existSubModelOfCache);
|
||||
//判断选中的是否有下级部门
|
||||
if (existSubModelOfCache) {
|
||||
List<RowMap> maps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + depaartid + "'");
|
||||
for (RowMap row : maps
|
||||
) {
|
||||
String id = row.getString("ID");
|
||||
DepartmentModel model = SDK.getORGAPI().getDepartmentById(id);
|
||||
|
||||
if (model.isExistSubModelOfCache()) {
|
||||
//有下级部门的选中有下级部门
|
||||
List<RowMap> rowMapList = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + id + "'");
|
||||
for (RowMap wo :
|
||||
rowMapList) {
|
||||
String ids = wo.getString("ID");
|
||||
DepartmentModel model1 = SDK.getORGAPI().getDepartmentById(ids);
|
||||
if (model1.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapLists = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + ids + "'");
|
||||
for (RowMap wsa :
|
||||
rowMapLists) {
|
||||
String wsaString = wsa.getString("ID");
|
||||
DepartmentModel model2 = SDK.getORGAPI().getDepartmentById(wsaString);
|
||||
if (model2.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList1 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + wsaString + "'");
|
||||
for (RowMap rows :
|
||||
rowMapList1) {
|
||||
String rowsString = rows.getString("ID");
|
||||
DepartmentModel model3 = SDK.getORGAPI().getDepartmentById(rowsString);
|
||||
if (model3.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList2 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString + "'");
|
||||
for (RowMap ormap :
|
||||
rowMapList2) {
|
||||
String rowsString1 = ormap.getString("ID");
|
||||
DepartmentModel model4 = SDK.getORGAPI().getDepartmentById(rowsString1);
|
||||
if (model4.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMaps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString1 + "'");
|
||||
for (RowMap owmapr :
|
||||
rowMaps) {
|
||||
String row_id = owmapr.getString("ID");
|
||||
DepartmentModel model5 = SDK.getORGAPI().getDepartmentById(row_id);
|
||||
if (model5.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList3 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + row_id + "'");
|
||||
for (RowMap owzmap :
|
||||
rowMapList3) {
|
||||
String idsa = owzmap.getString("ID");
|
||||
DepartmentModel model6 = SDK.getORGAPI().getDepartmentById(idsa);
|
||||
if (model6.isExistSubModelOfCache()) {
|
||||
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(idsa);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (!user.isClosed()){
|
||||
System.out.println("userclose>>>>>>>>>>"+user.isClosed());
|
||||
|
||||
if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(row_id);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (!user.isClosed()) {
|
||||
System.out.println("userclose>>>>>>>>>>"+user.isClosed());
|
||||
|
||||
if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString1);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (!user.isClosed()){
|
||||
System.out.println("userclose>>>>>>>>>>"+user.isClosed());
|
||||
|
||||
if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (!user.isClosed()) {
|
||||
System.out.println("userclose>>>>>>>>>>"+user.isClosed());
|
||||
|
||||
if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(wsaString);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (!user.isClosed()) {
|
||||
System.out.println("userclose>>>>>>>>>>"+user.isClosed());
|
||||
if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(ids);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (!user.isClosed()) {
|
||||
System.out.println("userclose>>>>>>>>>>"+user.isClosed());
|
||||
|
||||
if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(id);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (!user.isClosed()) {
|
||||
System.out.println("userclose>>>>>>>>>>"+user.isClosed());
|
||||
|
||||
if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//选中的没有下级部门
|
||||
List<UserModel> allUsersByDepartment = SDK.getORGAPI().getAllUsersByDepartment(depaartid);
|
||||
for (UserModel user : allUsersByDepartment
|
||||
) {
|
||||
if (!user.isClosed()) {
|
||||
System.out.println("userclose>>>>>>>>>>"+user.isClosed());
|
||||
|
||||
System.out.println("user.getExt2())???????????" + user.getExt2());
|
||||
System.out.println("posts_list》》》》》》》》》das" + (posts_list.size() != 0));
|
||||
System.out.println("123123》》》》》》》》》》" + (ranks_list.size() != 0));
|
||||
if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String posts="";
|
||||
if (posts_list.size() !=0 &&ranks_list.size()==0) {
|
||||
String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
if (post.length==1){
|
||||
// DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN ");
|
||||
posts = "'"+post[0]+"'";
|
||||
}else {
|
||||
posts = "'"+ StringUtils.join(post, "','")+"'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ") and userno is not null");
|
||||
for (RowMap map:maps
|
||||
) {
|
||||
uid+=map.getString("USERID")+",";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (org_list.size()==0||org_list==null){
|
||||
String posts="";
|
||||
String levels = "";
|
||||
if (posts_list.size() !=0 &&ranks_list.size()==0) {
|
||||
String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
if (post.length==1){
|
||||
// DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN ");
|
||||
posts = "'"+post[0]+"'";
|
||||
}else {
|
||||
posts = "'"+ StringUtils.join(post, "','")+"'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where CLOSED = '0' and userno is not null and POSITION_NO in(" + posts + ")");
|
||||
for (RowMap map:maps
|
||||
) {
|
||||
uid+=map.getString("USERID")+",";
|
||||
}
|
||||
}else if (posts_list.size() ==0 &&ranks_list.size()!=0){
|
||||
String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
|
||||
if (level.length==1){
|
||||
levels = "'"+level[0]+"'";
|
||||
}else {
|
||||
levels = "'"+ StringUtils.join(level, "','")+"'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where CLOSED = '0' and userno is not null and EXT2 in (" + levels + ")");
|
||||
for (RowMap map:maps
|
||||
) {
|
||||
uid+=map.getString("USERID")+",";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
System.out.println("userid》》》》》》》》》》》》》》》》》》》"+uid);
|
||||
if (StringUtils.isNotEmpty(uid
|
||||
)) {
|
||||
uid = uid.substring(0, uid.length() - 1);
|
||||
String[] split = uid.split(",");
|
||||
|
||||
List<String> list = new ArrayList(Arrays.asList(split));
|
||||
|
||||
HashSet h = new HashSet(list);
|
||||
list.clear();
|
||||
list.addAll(h);
|
||||
for (String userid:list
|
||||
) {
|
||||
new_uid+=userid+",";
|
||||
// System.out.println("当前账户======》》》》"+userid);
|
||||
// BO boEuOaReson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", userid).detail();
|
||||
// if (boEuOaReson!=null){
|
||||
BO bo = new BO();
|
||||
bo.set("USER_CODE",userid);
|
||||
bo.set("USER_NAME",SDK.getORGAPI().getUser(userid).getUserName());
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().createDataBO("BO_EU_YEUWS",bo,userContext);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("账户人员信息>>>>>>>>>>>>>"+new_uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,84 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
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 org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 更新流程架构中同步到知识维度的数据
|
||||
*/
|
||||
public class UpdateDimensionJob implements IJob {
|
||||
|
||||
|
||||
|
||||
private static String APPID = "com.awspaas.user.apps.yili.integration";
|
||||
|
||||
|
||||
private static String USERID = "admin";
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
SSOUtil ssoUtil = new SSOUtil();
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
String sid = ssoUtil.registerClientSessionNoPassword(USERID, "cn", portalUrl, "pc");
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
String sql = "select * from APP_ACT_KMS_DIMENSION where ID not in ('obj_e055a421f23547579a75130d27ab3b34','obj_5020f54928c842b58107c3354e450070')";
|
||||
List<RowMap> maps = DBSql.getMaps(sql);
|
||||
for (RowMap row :
|
||||
maps) {
|
||||
String sql_Pal = "select * from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '"+row.getString("ID")+"'";
|
||||
RowMap map = DBSql.getMap(sql_Pal);
|
||||
if (map!=null){
|
||||
if (row.getString("DIMENSIONNAME").equals(map.getString("PLNAME"))){
|
||||
|
||||
}else{
|
||||
String parent_ext4 = "select EXT4 from APP_ACT_COE_PAL_REPOSITORY where id = '"+map.getString("PLPARENTID")+"'";
|
||||
String ext4 = DBSql.getString("EXT4");
|
||||
updateDimension(row.getString("ID"),map.getString("PLNAME"),ext4,sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateDimension(String dimensionId,String dimensionName,String parentId,String sid) {
|
||||
// 调用App
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/updateDimension";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//发布是否需要审批,默认false,非必填
|
||||
params.put("isExamine", false);
|
||||
//维度ID,必填
|
||||
params.put("dimensionId", dimensionId);
|
||||
//是否启用,默认启用,非必填
|
||||
params.put("isEnabled", true);
|
||||
//维度类型,1:允许发布知识 2:不允许发布知识,非必填
|
||||
params.put("showType", 1);
|
||||
//维度描述,非必填
|
||||
params.put("memo", "");
|
||||
//维度名称,非必填
|
||||
params.put("dimensionName", dimensionName);
|
||||
//父维度Id:""表示根维度,非必填
|
||||
params.put("parentId", parentId);
|
||||
//sid,必填
|
||||
params.put("sid", sid);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//修改维度
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
}
|
||||
}
|
||||
@ -1,165 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
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 org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 创建维度
|
||||
*/
|
||||
public class createDimensionJob implements IJob {
|
||||
|
||||
|
||||
private static String APPID = "com.awspaas.user.apps.yili.integration";
|
||||
private static String USERID = "admin";
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
SSOUtil ssoUtil = new SSOUtil();
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
String sid = ssoUtil.registerClientSessionNoPassword(USERID, "cn", portalUrl, "pc");
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = 'process' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc";
|
||||
List<RowMap> maps = DBSql.getMaps(sql);
|
||||
for (RowMap rowmap: maps
|
||||
) {
|
||||
|
||||
String sql_decre = "select * from APP_ACT_KMS_DIMENSION where DIMENSIONNAME = '"+rowmap.getString("PLNAME")+"'";
|
||||
RowMap map2 = DBSql.getMap(sql_decre);
|
||||
if (map2==null){
|
||||
|
||||
createDimension(rowmap.getString("PLPARENTID"),false,true,"1","","",rowmap.getString("PLNAME").toString(),sid);
|
||||
}
|
||||
|
||||
String sql_parent = "select * from APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = '"+rowmap.getString("ID")+"' order by PLORDERINDEX asc";
|
||||
List<RowMap> maps1 = DBSql.getMaps(sql_parent);
|
||||
for (RowMap rowMap:
|
||||
maps1) {
|
||||
|
||||
String cime = "select * from APP_ACT_KMS_DIMENSION where DIMENSIONNAME = '"+rowMap.getString("PLNAME")+"'";
|
||||
RowMap map = DBSql.getMap(cime);
|
||||
if (map==null){
|
||||
|
||||
createDimension(rowMap.getString("PLPARENTID"),false,true,"1","","",rowMap.getString("PLNAME").toString(),sid);
|
||||
}
|
||||
|
||||
String sql_parent1 = "select * from APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = '"+rowMap.getString("ID")+"' order by PLORDERINDEX asc";
|
||||
List<RowMap> maps11 = DBSql.getMaps(sql_parent1);
|
||||
for (RowMap rowMap1:
|
||||
maps11) {
|
||||
|
||||
String cle = "select * from APP_ACT_KMS_DIMENSION where DIMENSIONNAME = '"+rowMap1.getString("PLNAME")+"'";
|
||||
RowMap mapss = DBSql.getMap(cle);
|
||||
if (mapss==null){
|
||||
|
||||
createDimension(rowMap1.getString("PLPARENTID"),false,true,"1","","",rowMap1.getString("PLNAME").toString(),sid);
|
||||
}
|
||||
|
||||
String sql_parent11 = "select * from APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = '"+rowMap1.getString("ID")+"' order by PLORDERINDEX asc";
|
||||
List<RowMap> maps111 = DBSql.getMaps(sql_parent11);
|
||||
for (RowMap rowMap2:
|
||||
maps111) {
|
||||
|
||||
String cles = "select * from APP_ACT_KMS_DIMENSION where DIMENSIONNAME = '"+rowMap2.getString("PLNAME")+"'";
|
||||
RowMap mapkjs = DBSql.getMap(cles);
|
||||
if (mapkjs==null){
|
||||
|
||||
createDimension(rowMap2.getString("PLPARENTID"),false,true,"1","","",rowMap2.getString("PLNAME").toString(),sid);
|
||||
}
|
||||
|
||||
String sql_parent111 = "select * from APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = '"+rowMap2.getString("ID")+"' order by PLORDERINDEX asc";
|
||||
List<RowMap> maps1111 = DBSql.getMaps(sql_parent111);
|
||||
|
||||
for (RowMap rowMap3:
|
||||
maps1111) {
|
||||
String oqka = "select * from APP_ACT_KMS_DIMENSION where DIMENSIONNAME = '"+rowMap3.getString("PLNAME")+"'";
|
||||
RowMap ssaq = DBSql.getMap(oqka);
|
||||
if (ssaq==null){
|
||||
|
||||
createDimension(rowMap3.getString("PLPARENTID"),false,true,"1","","",rowMap3.getString("PLNAME").toString(),sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public void createDimension(String id,boolean isExamine,boolean isEnabled,String showType,String memo,String createUser,String dimensionName,String sid) {
|
||||
// 调用App
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/createDimension";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//发布是否需要审批,默认false,必填
|
||||
params.put("isExamine", isExamine);
|
||||
//是否启用,默认启用,必填
|
||||
params.put("isEnabled", isEnabled);
|
||||
//维度类型,1:允许发布知识 2:不允许发布知识,必填
|
||||
params.put("showType", showType);
|
||||
//维度描述,非必填
|
||||
params.put("memo", memo);
|
||||
//维度名称,必填
|
||||
params.put("dimensionName", dimensionName);
|
||||
//父维度Id:""表示根维度,必填
|
||||
|
||||
String sql = "select EXT4 from APP_ACT_COE_PAL_REPOSITORY where id ='"+id+"'";
|
||||
String string = DBSql.getString(sql);
|
||||
if (id.equals("process")){
|
||||
|
||||
if (SDK.getPortalAPI().getPortalUrl().equals("https://bpm.yili.com:8088/portal")){
|
||||
string = "obj_5020f54928c842b58107c3354e450070";
|
||||
}else if (SDK.getPortalAPI().getPortalUrl().equals("http://10.60.143.183:8088/portal")){
|
||||
string = "obj_e055a421f23547579a75130d27ab3b34";
|
||||
}else{
|
||||
string = "obj_6dcfbc5d374645d5b97c8ec51ea3a234";
|
||||
}
|
||||
}
|
||||
params.put("parentId", string);
|
||||
//sid,必填
|
||||
params.put("sid", sid);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//创建维度
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
|
||||
if (!dimensionName.equals("流程制度")){
|
||||
if (ro.isOk()){
|
||||
|
||||
|
||||
String cardId = ((LinkedHashMap) ro.getData()).get("dimensionId").toString();
|
||||
String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '"+cardId+"' WHERE " +
|
||||
" PLCATEGORY = 'process'and PLMETHODID ='process.framework' " +
|
||||
" and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
" ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
" 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
" '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
" '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
" '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
" '42c09260-c1d3-44b7-ac3d-f8280e04c294') and PLNAME = '"+dimensionName+"'";
|
||||
int update = DBSql.update(update_sql);
|
||||
System.out.println("更新名称为:"+dimensionName+"的维度对应的资产库的EXT4的影响行数为"+update);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
|
||||
public class getEHSQDataEvent extends ExecuteListener {
|
||||
@Override
|
||||
public void execute(ProcessExecutionContext processExecutionContext) throws Exception {
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
|
||||
public class gettilePro extends ExecuteListener {
|
||||
@Override
|
||||
public void execute(ProcessExecutionContext processExecutionContext) throws Exception {
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail();
|
||||
BO bo_act_coe_publishs = SDK.getBOAPI().query("BO_EU_TEST", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail();
|
||||
}
|
||||
}
|
||||
@ -1,395 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.event;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public class tetdt extends ExecuteListener {
|
||||
@Override
|
||||
public void execute(ProcessExecutionContext processExecutionContext) throws Exception {
|
||||
BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail();
|
||||
String uid = "";
|
||||
String new_uid = "";
|
||||
if(bo_act_coe_publish1!=null) {
|
||||
String da = bo_act_coe_publish1.getString("SEND_SCOP");
|
||||
|
||||
if (da.equals("1")) {
|
||||
List<RowMap> select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER WHERE CLOSED = '0'");
|
||||
for (RowMap row : select_userid_from_orguser
|
||||
) {
|
||||
DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID"));
|
||||
if(departmentModel.getId().equals("e79281b1-2f81-4895-b30e-9f96e9ad0e2c")||departmentModel.getId().equals("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")){
|
||||
|
||||
}else {
|
||||
uid += row.getString("USERID") + ",";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List posts_list = new ArrayList();
|
||||
List<String> org_list = new ArrayList();
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_ORG"))){
|
||||
String strs[] = bo_act_coe_publish1.getString("SEND_SCOPE_ORG").split(",");
|
||||
org_list= Arrays.asList(strs);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_POST"))) {
|
||||
String posts[] = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
posts_list = Arrays.asList(posts);
|
||||
}
|
||||
List ranks_list = new ArrayList();
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL"))) {
|
||||
String ranks[] = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
ranks_list = Arrays.asList(ranks);
|
||||
}
|
||||
|
||||
System.out.println("部门id》》》》》》》》》》》》》"+org_list );
|
||||
System.out.println("posts_list》》》》》》》》》》》》》"+posts_list);
|
||||
System.out.println("ranks_list》》》》》》》》》》》》》"+ranks_list);
|
||||
if (org_list.size()!=0 && org_list!=null) {
|
||||
for (String depaartid : org_list
|
||||
) {
|
||||
System.out.println("departid>>>>>>>>>>>>>" + depaartid);
|
||||
DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentById(depaartid);
|
||||
boolean existSubModelOfCache = departmentModel.isExistSubModelOfCache();
|
||||
System.out.println("是否含有下级?????????????" + existSubModelOfCache);
|
||||
//判断选中的是否有下级部门
|
||||
if (existSubModelOfCache) {
|
||||
List<RowMap> maps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + depaartid + "'");
|
||||
for (RowMap row : maps
|
||||
) {
|
||||
String id = row.getString("ID");
|
||||
DepartmentModel model = SDK.getORGAPI().getDepartmentById(id);
|
||||
|
||||
if (model.isExistSubModelOfCache()) {
|
||||
//有下级部门的选中有下级部门
|
||||
List<RowMap> rowMapList = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + id + "'");
|
||||
for (RowMap wo :
|
||||
rowMapList) {
|
||||
String ids = wo.getString("ID");
|
||||
DepartmentModel model1 = SDK.getORGAPI().getDepartmentById(ids);
|
||||
if (model1.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapLists = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + ids + "'");
|
||||
for (RowMap wsa :
|
||||
rowMapLists) {
|
||||
String wsaString = wsa.getString("ID");
|
||||
DepartmentModel model2 = SDK.getORGAPI().getDepartmentById(wsaString);
|
||||
if (model2.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList1 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + wsaString + "'");
|
||||
for (RowMap rows :
|
||||
rowMapList1) {
|
||||
String rowsString = rows.getString("ID");
|
||||
DepartmentModel model3 = SDK.getORGAPI().getDepartmentById(rowsString);
|
||||
if (model3.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList2 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString + "'");
|
||||
for (RowMap ormap :
|
||||
rowMapList2) {
|
||||
String rowsString1 = ormap.getString("ID");
|
||||
DepartmentModel model4 = SDK.getORGAPI().getDepartmentById(rowsString1);
|
||||
if (model4.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMaps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString1 + "'");
|
||||
for (RowMap owmapr :
|
||||
rowMaps) {
|
||||
String row_id = owmapr.getString("ID");
|
||||
DepartmentModel model5 = SDK.getORGAPI().getDepartmentById(row_id);
|
||||
if (model5.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList3 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + row_id + "'");
|
||||
for (RowMap owzmap :
|
||||
rowMapList3) {
|
||||
String idsa = owzmap.getString("ID");
|
||||
DepartmentModel model6 = SDK.getORGAPI().getDepartmentById(idsa);
|
||||
if (model6.isExistSubModelOfCache()) {
|
||||
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(idsa);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(row_id);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString1);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(wsaString);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(ids);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(id);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//选中的没有下级部门
|
||||
List<UserModel> allUsersByDepartment = SDK.getORGAPI().getAllUsersByDepartment(depaartid);
|
||||
for (UserModel user : allUsersByDepartment
|
||||
) {
|
||||
System.out.println("user.getExt2())???????????" + user.getExt2());
|
||||
System.out.println("posts_list》》》》》》》》》das" + (posts_list.size() != 0));
|
||||
System.out.println("123123》》》》》》》》》》" + (ranks_list.size() != 0));
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (org_list.size()==0||org_list==null){
|
||||
String posts="";
|
||||
String levels = "";
|
||||
if (posts_list.size() !=0 &&ranks_list.size()!=0){
|
||||
String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
if (post.length==1){
|
||||
// DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN ");
|
||||
posts = "'"+post[0]+"'";
|
||||
}else {
|
||||
posts = "'"+ StringUtils.join(post, "','")+"'";
|
||||
}
|
||||
if (level.length==1){
|
||||
levels = "'"+level[0]+"'";
|
||||
}else {
|
||||
levels = "'"+ StringUtils.join(level, "','")+"'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ") and EXT2 in (" + levels + ")");
|
||||
for (RowMap map:maps
|
||||
) {
|
||||
uid+=map.getString("USERID")+",";
|
||||
}
|
||||
} else if (posts_list.size() !=0 &&ranks_list.size()==0) {
|
||||
String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
if (post.length==1){
|
||||
// DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN ");
|
||||
posts = "'"+post[0]+"'";
|
||||
}else {
|
||||
posts = "'"+ StringUtils.join(post, "','")+"'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ")");
|
||||
for (RowMap map:maps
|
||||
) {
|
||||
uid+=map.getString("USERID")+",";
|
||||
}
|
||||
}else if (posts_list.size() ==0 &&ranks_list.size()!=0){
|
||||
String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
|
||||
if (level.length==1){
|
||||
levels = "'"+level[0]+"'";
|
||||
}else {
|
||||
levels = "'"+ StringUtils.join(level, "','")+"'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where EXT2 in (" + levels + ")");
|
||||
for (RowMap map:maps
|
||||
) {
|
||||
uid+=map.getString("USERID")+",";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
System.out.println("userid》》》》》》》》》》》》》》》》》》》"+uid);
|
||||
if (StringUtils.isNotEmpty(uid
|
||||
)) {
|
||||
uid = uid.substring(0, uid.length() - 1);
|
||||
String[] split = uid.split(",");
|
||||
|
||||
List<String> list = new ArrayList(Arrays.asList(split));
|
||||
|
||||
HashSet h = new HashSet(list);
|
||||
list.clear();
|
||||
list.addAll(h);
|
||||
for (String userid:list
|
||||
) {
|
||||
|
||||
System.out.println("当前账户======》》》》"+userid);
|
||||
// BO boEuOaReson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", userid).detail();
|
||||
// if (boEuOaReson!=null){
|
||||
new_uid+=userid+",";
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,427 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
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 com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class AddKnowACJob implements IJob {
|
||||
|
||||
private static String APPID = "com.awspaas.user.apps.yili.integration";
|
||||
|
||||
|
||||
private static String USERID = "admin";
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
|
||||
String jobParameter = SDK.getJobAPI().getJobParameter(jobExecutionContext);
|
||||
|
||||
SSOUtil ssoUtil = new SSOUtil();
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
String sid = ssoUtil.registerClientSessionNoPassword(USERID, "cn", portalUrl, "pc");
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
|
||||
List<BO> bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).list();
|
||||
for (BO bo : bo_act_coe_publish
|
||||
) {
|
||||
String uid = "";
|
||||
String new_uid = "";
|
||||
if (bo != null) {
|
||||
String da = bo.getString("SEND_SCOP");
|
||||
|
||||
if (da.equals("1")) {
|
||||
List<RowMap> select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER");
|
||||
for (RowMap row : select_userid_from_orguser
|
||||
) {
|
||||
uid += row.getString("USERID") + ",";
|
||||
}
|
||||
} else {
|
||||
List posts_list = new ArrayList();
|
||||
String strs[] = bo.getString("SEND_SCOPE_ORG").split(",");
|
||||
if (StringUtils.isNotEmpty(bo.getString("SEND_SCOPE_POST"))) {
|
||||
String posts[] = bo.getString("SEND_SCOPE_POST").split(",");
|
||||
posts_list = Arrays.asList(posts);
|
||||
}
|
||||
List ranks_list = new ArrayList();
|
||||
if (StringUtils.isNotEmpty(bo.getString("SEND_SCOPE_LEVEL"))) {
|
||||
String ranks[] = bo.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
ranks_list = Arrays.asList(ranks);
|
||||
}
|
||||
|
||||
for (String depaartid : strs
|
||||
) {
|
||||
DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentById(depaartid);
|
||||
boolean existSubModelOfCache = departmentModel.isExistSubModelOfCache();
|
||||
//判断选中的是否有下级部门
|
||||
if (existSubModelOfCache) {
|
||||
List<RowMap> maps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + depaartid + "'");
|
||||
for (RowMap row : maps
|
||||
) {
|
||||
String id = row.getString("ID");
|
||||
DepartmentModel model = SDK.getORGAPI().getDepartmentById(id);
|
||||
|
||||
if (model.isExistSubModelOfCache()) {
|
||||
//有下级部门的选中有下级部门
|
||||
List<RowMap> rowMapList = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + id + "'");
|
||||
for (RowMap wo :
|
||||
rowMapList) {
|
||||
String ids = wo.getString("ID");
|
||||
DepartmentModel model1 = SDK.getORGAPI().getDepartmentById(ids);
|
||||
if (model1.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapLists = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + ids + "'");
|
||||
for (RowMap wsa :
|
||||
rowMapLists) {
|
||||
String wsaString = wsa.getString("ID");
|
||||
DepartmentModel model2 = SDK.getORGAPI().getDepartmentById(wsaString);
|
||||
if (model2.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList1 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + wsaString + "'");
|
||||
for (RowMap rows :
|
||||
rowMapList1) {
|
||||
String rowsString = rows.getString("ID");
|
||||
DepartmentModel model3 = SDK.getORGAPI().getDepartmentById(rowsString);
|
||||
if (model3.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList2 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString + "'");
|
||||
for (RowMap ormap :
|
||||
rowMapList2) {
|
||||
String rowsString1 = ormap.getString("ID");
|
||||
DepartmentModel model4 = SDK.getORGAPI().getDepartmentById(rowsString1);
|
||||
if (model4.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMaps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString1 + "'");
|
||||
for (RowMap owmapr :
|
||||
rowMaps) {
|
||||
String row_id = owmapr.getString("ID");
|
||||
DepartmentModel model5 = SDK.getORGAPI().getDepartmentById(row_id);
|
||||
if (model5.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList3 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + row_id + "'");
|
||||
for (RowMap owzmap :
|
||||
rowMapList3) {
|
||||
String idsa = owzmap.getString("ID");
|
||||
DepartmentModel model6 = SDK.getORGAPI().getDepartmentById(idsa);
|
||||
if (model6.isExistSubModelOfCache()) {
|
||||
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(idsa);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list != null && ranks_list != null) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list != null && ranks_list == null) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list == null && ranks_list != null) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(row_id);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list != null && ranks_list != null) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list != null && ranks_list == null) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list == null && ranks_list != null) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString1);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list != null && ranks_list != null) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list != null && ranks_list == null) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list == null && ranks_list != null) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list != null && ranks_list != null) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list != null && ranks_list == null) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list == null && ranks_list != null) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(wsaString);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list != null && ranks_list != null) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list != null && ranks_list == null) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list == null && ranks_list != null) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(ids);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list != null && ranks_list != null) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list != null && ranks_list == null) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list == null && ranks_list != null) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(id);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list != null && ranks_list != null) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list != null && ranks_list == null) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list == null && ranks_list != null) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//选中的没有下级部门
|
||||
List<UserModel> allUsersByDepartment = SDK.getORGAPI().getAllUsersByDepartment(depaartid);
|
||||
for (UserModel user : allUsersByDepartment
|
||||
) {
|
||||
if (posts_list != null && ranks_list != null) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list != null && ranks_list == null) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list == null && ranks_list != null) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(uid
|
||||
)) {
|
||||
uid = uid.substring(0, uid.length() - 1);
|
||||
String[] split = uid.split(",");
|
||||
|
||||
List<String> list = new ArrayList(Arrays.asList(split));
|
||||
|
||||
HashSet h = new HashSet(list);
|
||||
list.clear();
|
||||
list.addAll(h);
|
||||
for (String userid : list
|
||||
) {
|
||||
new_uid += userid + ",";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(new_uid
|
||||
)) {
|
||||
new_uid = new_uid.substring(0, new_uid.length() - 1);
|
||||
}
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
|
||||
if (bo.getString("SEND_SCOP").equals("0")) {
|
||||
String departId = bo.getString("SEND_SCOPE_ORG");
|
||||
if (StringUtils.isNotEmpty(departId) && StringUtils.isEmpty(bo.getString("SEND_SCOPE_LEVEL")) && StringUtils.isEmpty(bo.getString("SEND_SCOPE_POST"))) {
|
||||
String strs[] = departId.split(",");
|
||||
for (String departmentid : strs
|
||||
) {
|
||||
JSONObject jsonObjecta = new JSONObject();
|
||||
jsonObjecta.put("assignmentType", "department");
|
||||
jsonObjecta.put("assignmentId", departmentid);
|
||||
jsonArray.add(jsonObjecta);
|
||||
}
|
||||
} else {
|
||||
String[] split = uid.split(",");
|
||||
|
||||
List<String> list = new ArrayList(Arrays.asList(split));
|
||||
|
||||
HashSet h = new HashSet(list);
|
||||
list.clear();
|
||||
list.addAll(h);
|
||||
|
||||
for (String user_id : list
|
||||
) {
|
||||
JSONObject jsonObjecta = new JSONObject();
|
||||
jsonObjecta.put("assignmentType", "user");
|
||||
jsonObjecta.put("assignmentId", user_id);
|
||||
jsonArray.add(jsonObjecta);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<BO> list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", bo.getString("BINDID")).list();
|
||||
|
||||
for (BO bo_N:
|
||||
list) {
|
||||
String pr_id = bo_N.getString("PUBLISHFILEID");
|
||||
RowMap map = DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + pr_id + "'");
|
||||
if (map!=null){
|
||||
String ext4 = map.getString("EXT4");
|
||||
if (StringUtils.isNotEmpty(ext4)){
|
||||
AddKnwlAC(jsonArray,userContext.getSessionId(),ext4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<BO> boList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", bo.getString("BINDID")).list();
|
||||
|
||||
for (BO bo_N:
|
||||
boList) {
|
||||
String pr_id = bo_N.getString("CHANGEDFILEIDNEW");
|
||||
RowMap map = DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + pr_id + "'");
|
||||
if (map!=null){
|
||||
String ext4 = map.getString("EXT4");
|
||||
if (StringUtils.isNotEmpty(ext4)){
|
||||
AddKnwlAC(jsonArray,userContext.getSessionId(),ext4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean AddKnwlAC(JSONArray jsonArray, String sid, String knwlId) {
|
||||
// 调用App
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/AddKnwlAC";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//[{"assignmentType":"department","assignmentId":"62196ff9-a26d-4be5-9480-3ef680886f63"},{"assignmentType":"user","assignmentId":"user1"}],必填
|
||||
params.put("acList", jsonArray);
|
||||
//sid,如果为空,则需要传createUser参数,非必填
|
||||
params.put("sid", sid);
|
||||
//知识ID,必填
|
||||
params.put("knwlId", knwlId);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//给知识授权
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
return ro.isOk();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,590 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.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.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.apps.integration.util.JDBCUtil;
|
||||
import com.awspaas.user.apps.integration.util.UtilUrl;
|
||||
import jodd.util.StringUtil;
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
|
||||
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.RequestEntity;
|
||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
/**
|
||||
* 伊利OA系统与流程审批节点操作数据查询接口集成
|
||||
*/
|
||||
public class CreateWorkflowServiceJob implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
System.out.println("portal======>>>>" + portalUrl);
|
||||
/*if (portalUrl.equals("http://10.114.11.135:8088/portal")){
|
||||
portalUrl = "http://bpm.yili.com:8088/portal/";
|
||||
}*/
|
||||
JDBCUtil jdbcUtil = new JDBCUtil();
|
||||
Connection open = DBSql.open();
|
||||
List<BO> bos = SDK.getBOAPI().query("BO_EU_OA_WORKFLOW_DATA", true).list();
|
||||
for (BO bo : bos
|
||||
) {
|
||||
|
||||
|
||||
try {
|
||||
int tale = Integer.parseInt(bo.getString("WORKFLOWID"));
|
||||
String workflowname = bo.getString("WORKFLOWNAME");
|
||||
//ProcessExecutionContext processExecutionContext,String fileCreateName,String fileName,String fileurl,String readingScope_org,String isFullCompany,String fileCreateDate,String relationProcessinstId,String readingScope_post,String readingScope_level,String fileid
|
||||
|
||||
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
|
||||
jsonObject.put("workflowId", tale);
|
||||
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", 1);
|
||||
jsonObject.put("pageSize", 10);
|
||||
|
||||
|
||||
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:getFormDataByWfId>" +
|
||||
" <web:in0>" +
|
||||
"" + jsonObject + "" +
|
||||
" </web:in0>" +
|
||||
" </web:getFormDataByWfId>" +
|
||||
" </soapenv:Body>" +
|
||||
"</soapenv:Envelope>";
|
||||
|
||||
|
||||
/* String xmls = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
|
||||
" <soapenv:Header/> <soapenv:Body> <web:service> <web:in0><![CDATA[ {\"action\":\"read\",\"title\":\"asdadasdadasda\",\"dept\":\"00000010\",\"user\":\"00345531\",\"date\":\"2022-07-13\",\"remark\":\"分发本部门人员查看\",\"status\":\"0\",\"pcurl\":\"http://10.119.254.49:33018/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId=cf8ec45e-8209-4437-a8dd-a2ea278771ae\",\"mobileurl\":\"http://10.119.254.49:33018/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId=cf8ec45e-8209-4437-a8dd-a2ea278771ae\",\"userList\":\"00345531\"} ]]> </web:in0> </web:service> </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 = UtilUrl.doPostSoap("http://10.105.1.59:80/services/WorkflowService", xmlStr, "");
|
||||
|
||||
/*// HttpClient发送SOAP请求
|
||||
System.out.println("HttpClient 发送SOAP请求");
|
||||
HttpClient client = new HttpClient();
|
||||
PostMethod postMethod = new PostMethod("http://10.119.22.207:80/services/WorkflowService");
|
||||
// 设置连接超时
|
||||
client.getHttpConnectionManager().getParams().setConnectionTimeout(timeout);
|
||||
// 设置读取时间超时
|
||||
client.getHttpConnectionManager().getParams().setSoTimeout(timeout);
|
||||
// 然后把Soap请求数据添加到PostMethod中
|
||||
RequestEntity requestEntity = new StringRequestEntity(xmlStr, "text/xml", "UTF-8");
|
||||
// 设置请求体
|
||||
postMethod.setRequestEntity(requestEntity);
|
||||
int status = client.executeMethod(postMethod);
|
||||
// 打印请求状态码
|
||||
System.out.println("status:" + status);
|
||||
// 获取响应体输入流
|
||||
String responseBodyAsString = postMethod.getResponseBodyAsString();
|
||||
|
||||
|
||||
System.out.println("responseBodyAsString==========>>>>>>>"+responseBodyAsString);
|
||||
|
||||
System.out.println("result=========>>>>>>>"+responseBodyAsString);*/
|
||||
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>" + rootElement);
|
||||
Element result = rootElement.element("Body").element("getFormDataByWfIdResponse").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
System.out.println("resultString=>>>>>>>>>>" + resultString);
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("datas");
|
||||
JSONArray resultArray = JSONObject.parseArray(datas);
|
||||
System.out.println("个数》》》》》》》》" + resultArray.size());
|
||||
StringBuffer allKey = getAllKey(resultArray.getJSONObject(0));
|
||||
System.out.println("所有的字段名称信息输出》》》》》》》》》》》》" + allKey
|
||||
);
|
||||
String strs[] = allKey.toString().split(",");
|
||||
String sql = "create table T" + tale + "(";
|
||||
for (String name : strs
|
||||
) {
|
||||
String field = getPYIndexStr(name,true);
|
||||
|
||||
if (field.contains("(")){
|
||||
field =field.replaceAll("[(]","L");
|
||||
}
|
||||
if (field.contains(")")){
|
||||
field =field.replaceAll("[)]","R");
|
||||
}
|
||||
if (isStartWithNumber(field)){
|
||||
field = "A"+field;
|
||||
}
|
||||
|
||||
|
||||
System.out.println("flename=>>>>>>>"+name+">>>>fileid》》》》》"+field);
|
||||
|
||||
sql += field + " " + "nvarchar2(2000),";
|
||||
}
|
||||
sql = sql.substring(0, sql.length() - 1) + ")";
|
||||
System.out.println("sql>>>>>>>>>>>>>>" + sql);
|
||||
RowMap map = DBSql.getMap("select * from user_tables t where table_name= upper('T" + tale + "')");
|
||||
System.out.println("rowMap>>>>>>>>" + map);
|
||||
if (map == null) {
|
||||
int update = DBSql.update(sql
|
||||
);
|
||||
|
||||
for (String name : strs
|
||||
) {
|
||||
String field = getPYIndexStr(name,true);
|
||||
//sql += field + " " + "nvarchar2(2000),";
|
||||
if (field.contains("(")){
|
||||
field =field.replaceAll("[(]","L");
|
||||
}
|
||||
if (field.contains(")")){
|
||||
field =field.replaceAll("[)]","R");
|
||||
}
|
||||
if (isStartWithNumber(field)){
|
||||
field = "A"+field;
|
||||
}
|
||||
System.out.println("flename=>>>>>>>"+name+">>>>fileid》》》》》"+field);
|
||||
jdbcUtil.comment("T"+tale,field,name);
|
||||
}
|
||||
|
||||
System.out.println("是否已经插入数据" + update);
|
||||
}
|
||||
|
||||
|
||||
// DBSql.update("create index AWS_IN_63A5A52E2FA2 on T"+tale+" (BINDID);");
|
||||
String substring = allKey.substring(0, allKey.length() - 1);
|
||||
String insetr = "insert into T" + tale + "(" + substring + ") values(";
|
||||
//for (int i =0;i<resultArray.size();i++){
|
||||
|
||||
|
||||
for (int i = 0; i < resultArray.size(); i++) {
|
||||
String data = "";
|
||||
JSONObject jsonObject2 = resultArray.getJSONObject(i);
|
||||
for (String field : strs
|
||||
) {
|
||||
if (jsonObject2.get(field).toString().contains("'")) {
|
||||
String basic_data = jsonObject2.get(field).toString().replaceAll("'", "'||CHR(39)||'");
|
||||
if (basic_data.length() > 2000) {
|
||||
DBSql.update("alter table T" + tale + " add " + field + "_temp clob");
|
||||
DBSql.update("update T" + tale + " set " + field + "_temp = " + field + "");
|
||||
DBSql.update("alter table T" + tale + " drop column " + field + "");
|
||||
DBSql.update("alter table T" + tale + " rename column " + field + "_temp to " + field + "");
|
||||
}
|
||||
data += "'" + basic_data + "',";
|
||||
} else {
|
||||
if (jsonObject2.get(field).toString().length() > 2000) {
|
||||
DBSql.update("alter table T" + tale + " add " + field + "_temp clob");
|
||||
DBSql.update("update T" + tale + " set " + field + "_temp = " + field + "");
|
||||
DBSql.update("alter table T" + tale + " drop column " + field + "");
|
||||
DBSql.update("alter table T" + tale + " rename column " + field + "_temp to " + field + "");
|
||||
}
|
||||
data += "'" + jsonObject2.get(field).toString() + "',";
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println("最后数据=====》》》》》" + data);
|
||||
data = data.substring(0, data.length() - 1);
|
||||
String sqsl = insetr + data + ")";
|
||||
System.out.println("sqsl>>>>>>>>>>>>" + sqsl);
|
||||
int update = DBSql.update(sqsl);
|
||||
System.out.println("插入数据影响行数》》》》》》》》》》》" + update);
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
open.close();
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
}
|
||||
System.out.println("同步插入OA表单数据同步完成");
|
||||
}
|
||||
}
|
||||
|
||||
public String getPYIndexStr(String strChinese, boolean bUpCase){
|
||||
|
||||
try{
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
String chinese = "";
|
||||
|
||||
byte b[] = strChinese.getBytes("GBK");//把中文转化成byte数组
|
||||
|
||||
for(int i = 0; i < b.length; i++){
|
||||
|
||||
if((b[i] & 255) > 128){
|
||||
|
||||
int char1 = b[i++] & 255;
|
||||
|
||||
char1 <<= 8;//左移运算符用“<<”表示,是将运算符左边的对象,向左移动运算符右边指定的位数,并且在低位补零。其实,向左移n位,就相当于乘上2的n次方
|
||||
|
||||
int chart = char1 + (b[i] & 255);
|
||||
|
||||
buffer.append(getPYIndexChar((char)chart, bUpCase));
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
char c = (char)b[i];
|
||||
|
||||
//确定指定字符是否是汉字、大写字母、数字
|
||||
if(!Character.isJavaIdentifierPart(c) || (c >= 'A' && c <= 'Z') || Character.isDigit(c)){
|
||||
|
||||
buffer.append(c);
|
||||
|
||||
}if (c >= 'a' && c <= 'z'){
|
||||
|
||||
buffer.append((char) (c - 'a' + 'A'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (buffer.toString().contains("-")){
|
||||
chinese = buffer.toString().replaceAll("-","_");
|
||||
}else if (buffer.toString().contains(" ")){
|
||||
chinese = buffer.toString().replaceAll(" ","_");
|
||||
}else {
|
||||
chinese = buffer.toString();
|
||||
}
|
||||
|
||||
if (chinese.contains("\\(")){
|
||||
chinese = buffer.toString().replaceAll("\\(","L");
|
||||
}
|
||||
|
||||
if (chinese.contains(")")){
|
||||
chinese = buffer.toString().replaceAll("[)]","R");
|
||||
}
|
||||
|
||||
return chinese;
|
||||
|
||||
}catch(Exception e){
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static char getPYIndexChar(char strChinese, boolean bUpCase){
|
||||
|
||||
int charGBK = strChinese;
|
||||
|
||||
char result;
|
||||
|
||||
if(charGBK >= 45217 && charGBK <= 45252){
|
||||
|
||||
result = 'A';
|
||||
|
||||
}else if(charGBK >= 45253 && charGBK <= 45760){
|
||||
|
||||
result = 'B';
|
||||
|
||||
}else if(charGBK >= 45761 && charGBK <= 46317){
|
||||
|
||||
result = 'C';
|
||||
|
||||
}else if(charGBK >= 46318 && charGBK <= 46825){
|
||||
|
||||
result = 'D';
|
||||
|
||||
} else if(charGBK >= 46826 && charGBK <= 47009){
|
||||
|
||||
result = 'E';
|
||||
|
||||
}else if(charGBK >= 47010 && charGBK <= 47296){
|
||||
|
||||
result = 'F';
|
||||
|
||||
}else if(charGBK >= 47297 && charGBK <= 47613){
|
||||
|
||||
result = 'G';
|
||||
|
||||
}else if(charGBK >= 47614 && charGBK <= 48118){
|
||||
|
||||
result = 'H';
|
||||
|
||||
}else if(charGBK >= 48119 && charGBK <= 49061){
|
||||
|
||||
result = 'J';
|
||||
|
||||
} else if(charGBK >= 49062 && charGBK <= 49323){
|
||||
|
||||
result = 'K';
|
||||
|
||||
}else if(charGBK >= 49324 && charGBK <= 49895){
|
||||
|
||||
result = 'L';
|
||||
|
||||
}else if(charGBK >= 49896 && charGBK <= 50370){
|
||||
|
||||
result = 'M';
|
||||
|
||||
}else if(charGBK >= 50371 && charGBK <= 50613){
|
||||
|
||||
result = 'N';
|
||||
|
||||
}else if(charGBK >= 50614 && charGBK <= 50621){
|
||||
|
||||
result = 'O';
|
||||
|
||||
}else if(charGBK >= 50622 && charGBK <= 50905){
|
||||
|
||||
result = 'P';
|
||||
|
||||
}else if(charGBK >= 50906 && charGBK <= 51386){
|
||||
|
||||
result = 'Q';
|
||||
|
||||
}else if(charGBK >= 51387 && charGBK <= 51445){
|
||||
|
||||
result = 'R';
|
||||
|
||||
}else if(charGBK >= 51446 && charGBK <= 52217){
|
||||
|
||||
result = 'S';
|
||||
|
||||
}else if(charGBK >= 52218 && charGBK <= 52697){
|
||||
|
||||
result = 'T';
|
||||
|
||||
}else if(charGBK >= 52698 && charGBK <= 52979){
|
||||
|
||||
result = 'W';
|
||||
|
||||
}else if(charGBK >= 52980 && charGBK <= 53688){
|
||||
|
||||
result = 'X';
|
||||
|
||||
}else if(charGBK >= 53689 && charGBK <= 54480){
|
||||
|
||||
result = 'Y';
|
||||
|
||||
}else if(charGBK >= 54481 && charGBK <= 55289){
|
||||
|
||||
result = 'Z';
|
||||
|
||||
}else{
|
||||
|
||||
result = (char)(65 + (new Random()).nextInt(25));
|
||||
|
||||
}
|
||||
|
||||
if(!bUpCase){
|
||||
result = Character.toLowerCase(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
//根据JSONArray获取所有的key
|
||||
public static StringBuffer getAllKey(JSONArray json1) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
if (json1 != null ) {
|
||||
Iterator i1 = json1.iterator();
|
||||
while (i1.hasNext()) {
|
||||
Object key = i1.next();
|
||||
if (key instanceof JSONObject) {
|
||||
JSONObject innerObject = (JSONObject) key;
|
||||
stringBuffer.append(getAllKey(innerObject));
|
||||
} else if (key instanceof JSONArray) {
|
||||
JSONArray innerObject = (JSONArray) key;
|
||||
stringBuffer.append(getAllKey(innerObject));
|
||||
}else{
|
||||
}
|
||||
}
|
||||
}
|
||||
return stringBuffer;
|
||||
}
|
||||
//根据jsonobject获取所有的key
|
||||
public static StringBuffer getAllKey(JSONObject jsonObject) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
Iterator<String> keys = jsonObject.keySet().iterator();// jsonObject.keys();
|
||||
while (keys.hasNext()) {
|
||||
String key = keys.next();
|
||||
stringBuffer.append(key.toString()).append(",");
|
||||
if (jsonObject.get(key) instanceof JSONObject) {
|
||||
JSONObject innerObject = (JSONObject) jsonObject.get(key);
|
||||
stringBuffer.append(getAllKey(innerObject));
|
||||
} else if (jsonObject.get(key) instanceof JSONArray) {
|
||||
JSONArray innerObject = (JSONArray) jsonObject.get(key);
|
||||
stringBuffer.append(getAllKey(innerObject));
|
||||
}
|
||||
}
|
||||
return stringBuffer;
|
||||
}
|
||||
|
||||
//递归获取jsonObject的所有value
|
||||
private StringBuffer mStringBuffer = new StringBuffer();
|
||||
public String getAllContentFromJson(Object cObject) {
|
||||
|
||||
if(cObject instanceof JSONObject) {
|
||||
JSONObject jsonObject = (JSONObject) cObject;
|
||||
for (Map.Entry<String, Object> entry: jsonObject.entrySet()) {
|
||||
Object o = entry.getValue();
|
||||
if(o instanceof Integer){
|
||||
mStringBuffer.append("'"+entry.getValue()+"',");
|
||||
}else if(o instanceof Double){
|
||||
mStringBuffer.append("'"+entry.getValue()+"',");
|
||||
}else if(o instanceof Float){
|
||||
mStringBuffer.append("'"+entry.getValue()+"',");
|
||||
}else if(o instanceof Byte){
|
||||
mStringBuffer.append("'"+entry.getValue()+"',");
|
||||
}else if(o instanceof Long){
|
||||
mStringBuffer.append("'"+entry.getValue()+"',");
|
||||
}else if(o instanceof String) {
|
||||
Object object = null;
|
||||
try{
|
||||
object=JSONObject.parseObject((String)o);
|
||||
getAllContentFromJson(object);
|
||||
}catch (Exception e){
|
||||
mStringBuffer.append("'"+entry.getValue()+"',");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
getAllContentFromJson(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cObject instanceof JSONArray) {
|
||||
JSONArray jsonArray = (JSONArray) cObject;
|
||||
for(int i = 0; i < jsonArray.size(); i ++) {
|
||||
getAllContentFromJson(jsonArray.get(i));
|
||||
}
|
||||
}
|
||||
return mStringBuffer.toString();
|
||||
}
|
||||
|
||||
public static String replaceStr(String sourceStr) {
|
||||
if (StringUtil.isBlank(sourceStr)) {
|
||||
return "";
|
||||
}
|
||||
String substring = sourceStr.substring(1, sourceStr.length() - 1);
|
||||
if (substring.contains("'")) {
|
||||
String replaceStr = substring.replace("'", "''");
|
||||
return "'" + replaceStr + "'";
|
||||
}
|
||||
return sourceStr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 将汉字转换为全拼
|
||||
public static String getPingYin(String src) {
|
||||
|
||||
char[] t1 = null;
|
||||
t1 = src.toCharArray();
|
||||
String[] t2 = new String[t1.length];
|
||||
HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat();
|
||||
t3.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
||||
t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
||||
t3.setVCharType(HanyuPinyinVCharType.WITH_V);
|
||||
String t4 = "";
|
||||
int t0 = t1.length;
|
||||
try {
|
||||
for (int i = 0; i < t0; i++) {
|
||||
// 判断是否为汉字字符
|
||||
if (java.lang.Character.toString(t1[i]).matches(
|
||||
"[\\u4E00-\\u9FA5]+")) {
|
||||
t2 = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3);
|
||||
t4 += t2[0];
|
||||
} else
|
||||
t4 += java.lang.Character.toString(t1[i]);
|
||||
}
|
||||
// System.out.println(t4);
|
||||
return t4;
|
||||
} catch (BadHanyuPinyinOutputFormatCombination e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
return t4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 返回中文的首字母
|
||||
public static String getPinYinHeadChar(String str) {
|
||||
String temp = "";
|
||||
String demo = "";
|
||||
String convert = "";
|
||||
for (int j = 0; j < str.length(); j++) {
|
||||
char word = str.charAt(j);
|
||||
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
|
||||
if (pinyinArray != null) {
|
||||
convert += pinyinArray[0].charAt(0);
|
||||
} else {
|
||||
convert += word;
|
||||
}
|
||||
}
|
||||
for(int i=0;i<convert.length();i++){//convert目前为小写首字母,下面是将小写首字母转化为大写
|
||||
if(convert.charAt(i)>='a' && convert.charAt(i)<='z'){
|
||||
temp=convert.substring(i,i+1).toUpperCase();
|
||||
demo += temp;
|
||||
}
|
||||
}
|
||||
return demo;
|
||||
}
|
||||
|
||||
// 将字符串转移为ASCII码
|
||||
public static String getCnASCII(String cnStr) {
|
||||
StringBuffer strBuf = new StringBuffer();
|
||||
byte[] bGBK = cnStr.getBytes();
|
||||
for (int i = 0; i < bGBK.length; i++) {
|
||||
// System.out.println(Integer.toHexString(bGBK[i]&0xff));
|
||||
strBuf.append(Integer.toHexString(bGBK[i] & 0xff));
|
||||
}
|
||||
return strBuf.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//判断字符串是不是以数字开头
|
||||
public static boolean isStartWithNumber(String str) {
|
||||
Pattern pattern = Pattern.compile("[0-9]*");
|
||||
Matcher isNum = pattern.matcher(str.charAt(0)+"");
|
||||
if (!isNum.matches()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
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.apps.integration.util.UtilUrl;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* 伊利oa审批数据获取
|
||||
*/
|
||||
public class CreategetFlowListALLByWfidJob implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
try {
|
||||
|
||||
DBSql.update("delete from BO_EU_OA_PROCESS");
|
||||
//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 = UtilUrl.doPostSoap("http://10.105.1.59: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("(废)")){
|
||||
|
||||
}else {
|
||||
BO bo = new BO();
|
||||
bo.set("WORKFLOWID",jsonObject.get("ID"));
|
||||
bo.set("ISVALID",jsonObject.get("ISVALID"));
|
||||
bo.set("VERSION",jsonObject.get("VERSION"));
|
||||
bo.set("WORKFLOWNAME",jsonObject.get("WORKFLOWNAME"));
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_PROCESS",bo,userContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,120 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
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.apps.integration.util.UtilUrl;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 伊利oa审批数据获取
|
||||
*/
|
||||
public class CreategetFlowListByWfidJob implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
|
||||
|
||||
//List<BO> bo_eu_oa_process = SDK.getBOAPI().query("BO_EU_OA_PROCESS", true).list();
|
||||
// for (BO bo:
|
||||
// bo_eu_oa_process) {
|
||||
|
||||
|
||||
try{
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
|
||||
List<BO> bo_eu_oa_process = SDK.getBOAPI().query("BO_EU_OA_PROCESS", true).list();
|
||||
for (BO bos:bo_eu_oa_process
|
||||
) {
|
||||
int tale = Integer.valueOf(bos.getString("WORKFLOWID"));
|
||||
|
||||
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",1);
|
||||
jsonObject.put("pageSize",3000);
|
||||
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 = UtilUrl.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);
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("datas");
|
||||
JSONArray jsonArray = JSONArray.parseArray(datas);
|
||||
|
||||
System.out.println("jsonArrayData》》》》》》》》》》》》"+jsonArray);
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
for (int i=0;i<jsonArray.size();i++){
|
||||
|
||||
BO detail = SDK.getBOAPI().query("BO_EU_PROCESS_NEW", true).addQuery("WORKFLOWID=", JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId")).addQuery("REQUESTID=", JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId")).detail();
|
||||
if (detail==null){
|
||||
BO bo = new BO();
|
||||
bo.set("OPERATORWORKCODE",JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));
|
||||
bo.set("REQUESTID",JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId"));
|
||||
bo.set("WORKFLOWID",JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId"));
|
||||
bo.set("WORKFLOWNAME",JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowName"));
|
||||
bo.set("OPERATEDATE",JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));
|
||||
bo.set("RECEIVEDATE",JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate"));
|
||||
SDK.getBOAPI().createDataBO("BO_EU_PROCESS_NEW",bo,userContext);
|
||||
}
|
||||
BO bo = new BO();
|
||||
bo.set("TASKID",JSONObject.parseObject(jsonArray.get(i).toString()).get("id"));
|
||||
bo.set("NODENAME",JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeName"));
|
||||
bo.set("NODEID",JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeid"));
|
||||
bo.set("OPERATEDATE",JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));
|
||||
bo.set("OPERATETYPE",JSONObject.parseObject(jsonArray.get(i).toString()).get("operateType"));
|
||||
bo.set("OPERATOR",JSONObject.parseObject(jsonArray.get(i).toString()).get("operator"));
|
||||
bo.set("OPERATORWORKCODE",JSONObject.parseObject(jsonArray.get(i).toString()).get("operatorWorkCode"));
|
||||
bo.set("RECEIVEDATE",JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate"));
|
||||
bo.set("REQUESTID",JSONObject.parseObject(jsonArray.get(i).toString()).get("requestId"));
|
||||
bo.set("REQUESTNAME",JSONObject.parseObject(jsonArray.get(i).toString()).get("requestName"));
|
||||
bo.set("STATUS",JSONObject.parseObject(jsonArray.get(i).toString()).get("status"));
|
||||
bo.set("WORKFLOWID",JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowId"));
|
||||
bo.set("WORKFLOWNAME",JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowName"));
|
||||
bo.set("WORKFLOWTYPE_OA",JSONObject.parseObject(jsonArray.get(i).toString()).get("workflowType"));
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_PROCESS_TASK",bo,userContext);
|
||||
}
|
||||
}
|
||||
} catch (DocumentException documentException) {
|
||||
documentException.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
//}
|
||||
System.out.println("保存OA流程数据完成");
|
||||
}
|
||||
}
|
||||
@ -1,407 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.output.OutputAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.constant.OutputConst;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.server.SSOUtil;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.fs.DCContext;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.bpms.util.UtilFile;
|
||||
import com.actionsoft.exception.AWSException;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class InsertKnowlJob implements Job {
|
||||
private static String APPID = "com.awspaas.user.apps.yili.integration";
|
||||
|
||||
|
||||
private static String USERID = "admin";
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
Connection open = DBSql.open();
|
||||
try {
|
||||
|
||||
|
||||
String jobParameter = SDK.getJobAPI().getJobParameter(jobExecutionContext);
|
||||
|
||||
SSOUtil ssoUtil = new SSOUtil();
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
String sid = ssoUtil.registerClientSessionNoPassword(USERID, "cn", portalUrl, "pc");
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
System.out.println("创建维度准备开始===============");
|
||||
String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID not in (select PLPARENTID from APP_ACT_COE_PAL_REPOSITORY) and PLCATEGORY ='process'";
|
||||
|
||||
List<RowMap> list = DBSql.getMaps(open, sql);
|
||||
for (RowMap bo : list
|
||||
) {
|
||||
String repository_sql = "select PLNAME from APP_ACT_COE_PAL_REPOSITORY where ID IN (select PLPARENTID from APP_ACT_COE_PAL_REPOSITORY where PLMETHODID like '%process%' AND PLNAME ='" + bo.getString("PLNAME") + "')";
|
||||
String PLNAME = DBSql.getString(open, repository_sql);
|
||||
System.out.println("repository_sql>>>>>>>>>>>>>>>>>>>" + repository_sql);
|
||||
if (StringUtils.isEmpty(PLNAME)) {
|
||||
PLNAME = bo.getString("PLNAME");
|
||||
}
|
||||
String add_name = PLNAME + ",";
|
||||
|
||||
Map names = new LinkedHashMap<>();
|
||||
names.put(0, bo.getString("PLNAME"));
|
||||
names.put(1, PLNAME);
|
||||
for (int i = 2; i < 5; i++) {
|
||||
String repository_sqls = "select PLNAME from APP_ACT_COE_PAL_REPOSITORY where ID IN (select PLPARENTID from APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process' AND PLNAME ='" + PLNAME + "')";//and PLMETHODID !='process.framework'
|
||||
String parent_name = DBSql.getString(open, repository_sqls);
|
||||
if (names.containsValue(parent_name)) {
|
||||
break;
|
||||
}
|
||||
String util_space = "select PLCATEGORY from APP_ACT_COE_PAL_REPOSITORY where PLPARENTID in ('process') and PLNAME = '" + PLNAME + "'";
|
||||
String fisrt_name = DBSql.getString(open, util_space);
|
||||
if (names.containsValue(fisrt_name)) {
|
||||
break;
|
||||
}
|
||||
if (fisrt_name.equals("process")) {
|
||||
names.put(i, "流程制度");
|
||||
} else if (fisrt_name.equals("org")) {
|
||||
names.put(i, "组织");
|
||||
} else if (fisrt_name.equals("data")) {
|
||||
names.put(i, "数据");
|
||||
} else if (fisrt_name.equals("itsystem")) {
|
||||
names.put(i, "IT系统");
|
||||
} else if (fisrt_name.equals("control")) {
|
||||
names.put(i, "控制");
|
||||
}
|
||||
if (StringUtils.isEmpty(parent_name)) {
|
||||
break;
|
||||
}
|
||||
PLNAME = parent_name;
|
||||
names.put(i, PLNAME);
|
||||
add_name = PLNAME + ",";
|
||||
}
|
||||
add_name = names.get(0) + ",";
|
||||
System.out.println("add_name=============="
|
||||
+ add_name);
|
||||
String dimensionId = "";
|
||||
String de_name = "";
|
||||
System.out.println("names==========" + names);
|
||||
for (int i = names.size() - 1; i >= 0; i--) {
|
||||
System.out.println("name" + i + "=================?>>>>>>>>>>" + names.get(i));
|
||||
String dimensionId_sql = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='" + names.get(i) + "'";
|
||||
dimensionId = DBSql.getString(open, dimensionId_sql);
|
||||
String sql_Frameworks = "select PLNAME from APP_ACT_COE_PAL_REPOSITORY where PLMETHODID != 'process.framework' and PLNAME = '" + names.get(i) + "'";//
|
||||
String framework = DBSql.getString(open, sql_Frameworks);//&& StringUtils.isEmpty(framework)
|
||||
|
||||
if (StringUtils.isNotEmpty(dimensionId) ) {
|
||||
|
||||
} else {
|
||||
System.out.println("进入知识");
|
||||
String sql_Framework = "select PLNAME from APP_ACT_COE_PAL_REPOSITORY where PLMETHODID like '%process.%' AND PLMETHODID != 'process.framework' and PLNAME = '" + names.get(i) + "'";//PLMETHODID = 'process.framework' and
|
||||
String frameworks = DBSql.getString(open, sql_Framework);//&& StringUtils.isEmpty(framework)
|
||||
if (bo.getString("PLNAME").equals(names.get(i))) {
|
||||
String card_sql = "select ID from APP_ACT_KMS_CARD where CARDNAME ='" + names.get(i) + "'";
|
||||
String card = DBSql.getString(open, card_sql);
|
||||
if (StringUtils.isNotEmpty(card)) {
|
||||
// creadteFile(userContext, open, bo.getString("PLNAME"), add_name);
|
||||
|
||||
} else {
|
||||
|
||||
// aslp服务地址
|
||||
String aslps_create = "aslp://com.actionsoft.apps.kms/CreateKnwl";
|
||||
// 参数定义列表
|
||||
Map params_create = new HashMap<String, Object>();
|
||||
//保密级别, 0: 普通 1:秘密 2:机密,必填
|
||||
params_create.put("securityLevel", 0);
|
||||
//知识名称,必填
|
||||
params_create.put("knwlName", names.get(i));
|
||||
//是否可以评论,必填
|
||||
params_create.put("isComment", true);
|
||||
//是否可以评分,必填
|
||||
params_create.put("isRate", true);
|
||||
//有效期:yyyy-MM-dd,非必填
|
||||
params_create.put("validDate", "2099-12-31");
|
||||
//只读控制,1:在线阅读和下载 0:在线阅读,必填
|
||||
params_create.put("onlineLevel", 1);
|
||||
//知识创建人,某些特殊场景下,sid和createUser代表的用户并不一样,如果此参数为null,则使用sid代表的用户,非必填
|
||||
params_create.put("createUser", "admin");
|
||||
//知识内容,非必填
|
||||
params_create.put("cardContext", "");
|
||||
//sid,必填
|
||||
params_create.put("sid", userContext.getSessionId());
|
||||
AppAPI appAPI_create = SDK.getAppAPI();
|
||||
//创建知识
|
||||
ResponseObject ro_create = appAPI_create.callASLP(appAPI_create.getAppContext(APPID), aslps_create, params_create);
|
||||
System.out.println("ro_create================" + ro_create);
|
||||
// creadteFile(userContext, open, names.get(i).toString(), add_name);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if (StringUtils.isEmpty(dimensionId)){
|
||||
// 调用App
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslps_de = "aslp://com.actionsoft.apps.kms/createDimension";
|
||||
// 参数定义列表
|
||||
Map paramss = new HashMap<String, Object>();
|
||||
//发布是否需要审批,默认false,必填
|
||||
paramss.put("isExamine", false);
|
||||
//是否启用,默认启用,必填
|
||||
paramss.put("isEnabled", true);
|
||||
//维度类型,1:允许发布知识 2:不允许发布知识,必填
|
||||
paramss.put("showType", 1);
|
||||
//维度描述,非必填
|
||||
paramss.put("memo", "");
|
||||
//创建人,非必填
|
||||
paramss.put("createUser", "admin");
|
||||
//维度名称,必填
|
||||
paramss.put("dimensionName", names.get(i));
|
||||
|
||||
String dimensionId_sql_i = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='" + names.get(i + 1) + "'";
|
||||
de_name = DBSql.getString(open, dimensionId_sql_i);
|
||||
//父维度Id:""表示根维度,必填
|
||||
paramss.put("parentId", de_name);
|
||||
//sid,必填
|
||||
paramss.put("sid", userContext.getSessionId());
|
||||
AppAPI appAPIs = SDK.getAppAPI();
|
||||
//创建维度
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslps_de, paramss);
|
||||
|
||||
System.out.println("ros==================" + ros);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("定时器执行完毕");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
open.close();
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void creadteFile(UserContext userContext, Connection open, String name, String add_name){
|
||||
/**
|
||||
* 这个主要是负责对流程手册进行相关的文件的生成
|
||||
*/
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/CreateFile";
|
||||
|
||||
String sql = "SELECT ID FROM APP_ACT_KMS_CARD WHERE CARDNAME = '"+name+"'";
|
||||
String id = DBSql.getString(open,sql);
|
||||
if (StringUtils.isNotEmpty(id)){
|
||||
BO bos = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N",true).addQuery("PUBLISHFILENAME = ",name).detail();
|
||||
if (bos!=null){
|
||||
|
||||
|
||||
if (StringUtils.isNotEmpty(bos.getString("TASKID"))) {
|
||||
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(bos.getString("TASKID"));
|
||||
if (model != null) {
|
||||
System.out.println(",pdel============" + model);
|
||||
System.out.println("123313123123123==========" + model.getProfileId());
|
||||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||||
System.out.println("dajadfas======" + appProfile);
|
||||
if (appProfile == null) {
|
||||
throw new AWSException("Not Find OutputAppProfile! profileId=" + model.getProfileId());
|
||||
}
|
||||
DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT);
|
||||
if (dcProfile == null)
|
||||
throw new AWSException("Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT);
|
||||
String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME = '" + bos.getString("PUBLISHFILENAME") + "'";
|
||||
String lever = DBSql.getString(open, sql_lever);
|
||||
//lever = lever.substring(0,3);
|
||||
DCContext dcContext = new DCContext(userContext, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bos.getString("TASKID"), bos.getString("PUBLISHFILENAME") + "_" + lever + ".doc");
|
||||
//UtilFile file = new UtilFile(dcContext.getPath());
|
||||
|
||||
|
||||
Map params = new HashMap<String, Object>();
|
||||
//知识ID,必填
|
||||
params.put("cardId", id);
|
||||
//sid,必填
|
||||
params.put("sid", userContext.getSessionId());
|
||||
|
||||
params.put("dc", dcContext);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//创建文件
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
System.out.println("流程手册的存入=================" + ro);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
String sql_A = "SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY where PLNAME = '"+name+"' AND PLMETHODID != 'process.framework' AND PLMETHODID IN (select distinct PLMETHODID from APP_ACT_COE_PAL_REPOSITORY)";
|
||||
List<RowMap> rows = DBSql.getMaps(open,sql_A);
|
||||
|
||||
for (RowMap bo:rows
|
||||
) {
|
||||
|
||||
/**
|
||||
* 这个是模型中的附件获取的并插入的数据信息,需要做修改
|
||||
*/
|
||||
// 调用App
|
||||
|
||||
// 参数定义列表
|
||||
Map paramss = new HashMap<String, Object>();
|
||||
//知识ID,必填
|
||||
paramss.put("cardId", id);
|
||||
//sid,必填
|
||||
paramss.put("sid", userContext.getSessionId());
|
||||
|
||||
UpfileWeb upfileWeb = new UpfileWeb(userContext);
|
||||
|
||||
|
||||
|
||||
String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where PLMETHODID != 'process.framework' AND PLNAME= '"+bo.getString("PLNAME")+"'" +
|
||||
")";
|
||||
List<RowMap> maps = DBSql.getMaps(open,sql_upfile);
|
||||
for (RowMap row : maps) {
|
||||
UpfileModel upfileModel = new UpfileModel();
|
||||
upfileModel.setType(row.getString("FILETYPE"));
|
||||
upfileModel.setFileName(row.getString("FILENAME"));
|
||||
upfileModel.setPl_uuid(row.getString("PALREPOSITORYID"));
|
||||
upfileModel.setShape_uuid(row.getString("SHAPEID"));
|
||||
DCContext dcContexts = upfileWeb.getDCContext(upfileModel);
|
||||
paramss.put("dc", dcContexts);
|
||||
AppAPI appAPIs = SDK.getAppAPI();
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, paramss);
|
||||
System.out.println("流程模型附件的生成============="+ros);
|
||||
}
|
||||
|
||||
//DCContext对象,必填
|
||||
|
||||
//创建文件
|
||||
}
|
||||
// PublishKnow(userContext,open,add_name,id);
|
||||
}
|
||||
}
|
||||
|
||||
public void PublishKnow(UserContext userContext,Connection open,String add_name,String id){
|
||||
System.out.println("add_name================="+add_name);
|
||||
String result = add_name.substring(0,add_name.length()-1);
|
||||
String[] deptSplit = result.split(",");
|
||||
|
||||
if(deptSplit.length==1){
|
||||
result = "'"+deptSplit[0]+"'";
|
||||
}
|
||||
result ="'"+ StringUtils.join(deptSplit, "','")+"'";
|
||||
System.out.println(">>>>>NO =" + result);
|
||||
|
||||
String sql = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME IN ("+result+") ";
|
||||
List<RowMap> maps = DBSql.getMaps(open, sql);
|
||||
if (maps.size()==0){
|
||||
String sql_DIMENSIONNAME = "SELECT PLPARENTID FROM APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process' and PLNAME IN ("+result+") ";
|
||||
String maps_first = DBSql.getString(open, sql_DIMENSIONNAME);
|
||||
|
||||
if (maps_first.equals("itsystem")){
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='IT系统' ";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
}else if (maps_first.equals("control")){
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='控制' ";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
}else if (maps_first.equals("process")){
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='流程制度' ";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
}else if (maps_first.equals("org")){
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='组织' ";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
}else if (maps_first.equals("data")){
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='数据' ";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
}else {
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME =(SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY where ID ='"+maps_first+"')";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
}
|
||||
}
|
||||
String ids = "";
|
||||
if (maps.size()!=0){
|
||||
|
||||
for (RowMap rowmap:maps
|
||||
) {
|
||||
ids+=rowmap.getString("ID")+",";
|
||||
}
|
||||
ids = ids.substring(0,ids.length()-1);
|
||||
|
||||
}else {
|
||||
for (RowMap rowmap:maps
|
||||
) {
|
||||
ids+=rowmap.getString("ID")+",";
|
||||
}
|
||||
ids = ids.substring(0,ids.length()-1);
|
||||
}
|
||||
|
||||
String[] deptSplit_id = ids.split(",");
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
for (String id_names:deptSplit_id
|
||||
) {
|
||||
jsonArray.add(id_names);
|
||||
}
|
||||
//jsonObject.put(deptSplit_id);
|
||||
id+=",";
|
||||
String[] deptSplit_das = id.split(",");
|
||||
JSONArray jsonArray_das = new JSONArray();
|
||||
for (String das:deptSplit_das
|
||||
) {
|
||||
jsonArray_das.add(das);
|
||||
}
|
||||
//jsonObject.put(deptSplit_id);
|
||||
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/PublishKnwl";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//要发布到的维度ID的JSON数组字符串,必填
|
||||
params.put("dimensionIDArray", jsonArray.toString());
|
||||
//要发布的知识ID的JSON数组字符串,必填
|
||||
params.put("knwlIDArray", jsonArray_das.toString());
|
||||
//标签的JSON数组字符串,非必填
|
||||
|
||||
//sid,必填
|
||||
params.put("sid", userContext.getSessionId());
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//发布知识
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
|
||||
System.out.println("知识发布============"+ro);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,572 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
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.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
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.apps.integration.util.UtilUrl;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
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.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class SendReadBycontract implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
String jobParameter = SDK.getJobAPI().getJobParameter(jobExecutionContext);
|
||||
String taskid = jobParameter.split(",")[1];
|
||||
String processid = jobParameter.split(",")[0];
|
||||
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processid);
|
||||
TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(taskid);
|
||||
String wsId = "";
|
||||
JSONArray filed = new JSONArray(new LinkedList<>());
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
System.out.println("portal======>>>>"+portalUrl);
|
||||
/*if (portalUrl.equals("http://10.114.11.135:8088/portal")){
|
||||
portalUrl = "http://bpm.yili.com:8088/portal/";
|
||||
}*/
|
||||
try {
|
||||
|
||||
|
||||
String url = portalUrl + "/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId();
|
||||
String mobileurl = "https://bpm.yili.com:8088/portal" + "/r/or?cmd=com.yili_process_page_phone&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId();
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Timestamp endTime = instanceById.getStartTime();
|
||||
BO boActCoePublish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", instanceById.getId()).detail();
|
||||
|
||||
|
||||
//ProcessExecutionContext processExecutionContext,String fileCreateName,String fileName,String fileurl,String readingScope_org,String isFullCompany,String fileCreateDate,String relationProcessinstId,String readingScope_post,String readingScope_level,String fileid
|
||||
String not_url = "/w?cmd=com.yili_process_page&processInstId=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId();
|
||||
|
||||
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
|
||||
jsonObject.put("action", "read");
|
||||
jsonObject.put("title", " " +
|
||||
"" + boActCoePublish.getString("PROCESS_TITLE") + "");
|
||||
System.out.println("部门庄户》》》》》》》" + SDK.getORGAPI().getDepartmentByUser(taskInstance.getTarget()).getNo());
|
||||
jsonObject.put("dept", SDK.getORGAPI().getDepartmentByUser(taskInstance.getTarget()).getNo());//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
|
||||
String target = taskInstance.getTarget();
|
||||
target = taskInstance.getTarget();
|
||||
|
||||
System.out.println("当前账户======》》》》" + target);
|
||||
|
||||
jsonObject.put("user", target);
|
||||
|
||||
// jsonObject.put("user",);//processExecutionContext.getProcessInstance().getCreateUser()
|
||||
jsonObject.put("date", sdf.format(endTime));
|
||||
jsonObject.put("remark", boActCoePublish.getString("PROCESS_TITLE"));
|
||||
jsonObject.put("status", "0");
|
||||
jsonObject.put("dataid", instanceById.getId());
|
||||
jsonObject.put("pcurl", url);
|
||||
jsonObject.put("mobileurl", mobileurl);
|
||||
//list.add(1,"00352394");
|
||||
//list.add(2,"00352394");
|
||||
BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", instanceById.getId()).detail();
|
||||
String uid = "";
|
||||
String new_uid = "";
|
||||
if (bo_act_coe_publish1 != null) {
|
||||
String da = bo_act_coe_publish1.getString("SEND_SCOP");
|
||||
|
||||
if (da.equals("1")) {
|
||||
List<RowMap> select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER WHERE CLOSED = '0'");
|
||||
|
||||
for (RowMap row : select_userid_from_orguser
|
||||
) {
|
||||
BO boList = SDK.getBOAPI().query("BO_ACT_DATAID",true).addQuery("PROCESSID=",processid).addQuery("USER_ID=",row.getString("USERID")).detail();
|
||||
if (boList==null){
|
||||
DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID"));
|
||||
if(departmentModel.getId().equals("e79281b1-2f81-4895-b30e-9f96e9ad0e2c")||departmentModel.getId().equals("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")){
|
||||
|
||||
}else {
|
||||
uid += row.getString("USERID") + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List posts_list = new ArrayList();
|
||||
List<String> org_list = new ArrayList();
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_ORG"))) {
|
||||
String strs[] = bo_act_coe_publish1.getString("SEND_SCOPE_ORG").split(",");
|
||||
org_list = Arrays.asList(strs);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_POST"))) {
|
||||
String posts[] = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
posts_list = Arrays.asList(posts);
|
||||
}
|
||||
List ranks_list = new ArrayList();
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL"))) {
|
||||
String ranks[] = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
ranks_list = Arrays.asList(ranks);
|
||||
}
|
||||
|
||||
System.out.println("部门id》》》》》》》》》》》》》" + org_list);
|
||||
System.out.println("posts_list》》》》》》》》》》》》》" + posts_list);
|
||||
System.out.println("ranks_list》》》》》》》》》》》》》" + ranks_list);
|
||||
if (org_list.size() != 0 && org_list != null) {
|
||||
for (String depaartid : org_list
|
||||
) {
|
||||
System.out.println("departid>>>>>>>>>>>>>" + depaartid);
|
||||
DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentById(depaartid);
|
||||
boolean existSubModelOfCache = departmentModel.isExistSubModelOfCache();
|
||||
System.out.println("是否含有下级?????????????" + existSubModelOfCache);
|
||||
//判断选中的是否有下级部门
|
||||
if (existSubModelOfCache) {
|
||||
List<RowMap> maps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + depaartid + "'");
|
||||
for (RowMap row : maps
|
||||
) {
|
||||
String id = row.getString("ID");
|
||||
DepartmentModel model = SDK.getORGAPI().getDepartmentById(id);
|
||||
|
||||
if (model.isExistSubModelOfCache()) {
|
||||
//有下级部门的选中有下级部门
|
||||
List<RowMap> rowMapList = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + id + "'");
|
||||
for (RowMap wo :
|
||||
rowMapList) {
|
||||
String ids = wo.getString("ID");
|
||||
DepartmentModel model1 = SDK.getORGAPI().getDepartmentById(ids);
|
||||
if (model1.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapLists = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + ids + "'");
|
||||
for (RowMap wsa :
|
||||
rowMapLists) {
|
||||
String wsaString = wsa.getString("ID");
|
||||
DepartmentModel model2 = SDK.getORGAPI().getDepartmentById(wsaString);
|
||||
if (model2.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList1 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + wsaString + "'");
|
||||
for (RowMap rows :
|
||||
rowMapList1) {
|
||||
String rowsString = rows.getString("ID");
|
||||
DepartmentModel model3 = SDK.getORGAPI().getDepartmentById(rowsString);
|
||||
if (model3.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList2 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString + "'");
|
||||
for (RowMap ormap :
|
||||
rowMapList2) {
|
||||
String rowsString1 = ormap.getString("ID");
|
||||
DepartmentModel model4 = SDK.getORGAPI().getDepartmentById(rowsString1);
|
||||
if (model4.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMaps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString1 + "'");
|
||||
for (RowMap owmapr :
|
||||
rowMaps) {
|
||||
String row_id = owmapr.getString("ID");
|
||||
DepartmentModel model5 = SDK.getORGAPI().getDepartmentById(row_id);
|
||||
if (model5.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList3 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + row_id + "'");
|
||||
for (RowMap owzmap :
|
||||
rowMapList3) {
|
||||
String idsa = owzmap.getString("ID");
|
||||
DepartmentModel model6 = SDK.getORGAPI().getDepartmentById(idsa);
|
||||
if (model6.isExistSubModelOfCache()) {
|
||||
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(idsa);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(row_id);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString1);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(wsaString);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(ids);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(id);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//选中的没有下级部门
|
||||
List<UserModel> allUsersByDepartment = SDK.getORGAPI().getAllUsersByDepartment(depaartid);
|
||||
for (UserModel user : allUsersByDepartment
|
||||
) {
|
||||
System.out.println("user.getExt2())???????????" + user.getExt2());
|
||||
System.out.println("posts_list》》》》》》》》》das" + (posts_list.size() != 0));
|
||||
System.out.println("123123》》》》》》》》》》" + (ranks_list.size() != 0));
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (org_list.size() == 0 || org_list == null) {
|
||||
String posts = "";
|
||||
String levels = "";
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
if (post.length == 1) {
|
||||
// DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN ");
|
||||
posts = "'" + post[0] + "'";
|
||||
} else {
|
||||
posts = "'" + StringUtils.join(post, "','") + "'";
|
||||
}
|
||||
if (level.length == 1) {
|
||||
levels = "'" + level[0] + "'";
|
||||
} else {
|
||||
levels = "'" + StringUtils.join(level, "','") + "'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ") and EXT2 in (" + levels + ")");
|
||||
for (RowMap map : maps
|
||||
) {
|
||||
uid += map.getString("USERID") + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
if (post.length == 1) {
|
||||
// DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN ");
|
||||
posts = "'" + post[0] + "'";
|
||||
} else {
|
||||
posts = "'" + StringUtils.join(post, "','") + "'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ")");
|
||||
for (RowMap map : maps
|
||||
) {
|
||||
uid += map.getString("USERID") + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
|
||||
if (level.length == 1) {
|
||||
levels = "'" + level[0] + "'";
|
||||
} else {
|
||||
levels = "'" + StringUtils.join(level, "','") + "'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where EXT2 in (" + levels + ")");
|
||||
for (RowMap map : maps
|
||||
) {
|
||||
uid += map.getString("USERID") + ",";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
System.out.println("userid》》》》》》》》》》》》》》》》》》》" + uid);
|
||||
if (StringUtils.isNotEmpty(uid
|
||||
)) {
|
||||
uid = uid.substring(0, uid.length() - 1);
|
||||
String[] split = uid.split(",");
|
||||
|
||||
List<String> list = new ArrayList(Arrays.asList(split));
|
||||
|
||||
HashSet h = new HashSet(list);
|
||||
list.clear();
|
||||
list.addAll(h);
|
||||
for (String userid : list
|
||||
) {
|
||||
|
||||
System.out.println("当前账户======》》》》" + userid);
|
||||
// BO boEuOaReson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", userid).detail();
|
||||
// if (boEuOaReson!=null){
|
||||
new_uid += userid + ",";
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(new_uid
|
||||
)) {
|
||||
new_uid = new_uid.substring(0, new_uid.length() - 1);
|
||||
}
|
||||
|
||||
System.out.println("new_userid ==========>>>>>>>>>"+new_uid);
|
||||
String[] users = new_uid.split(",");
|
||||
int length = 300;
|
||||
int ys = users.length%length;
|
||||
if (ys==0) {
|
||||
int size = users.length/length;
|
||||
int flag = 0;
|
||||
|
||||
List<String[]> list = new LinkedList();
|
||||
|
||||
for (int i=0;i<size;i++){
|
||||
String[] results;
|
||||
results = Arrays.copyOfRange(users, flag, flag+300);
|
||||
list.add(results);
|
||||
flag = flag+300;
|
||||
}
|
||||
|
||||
// 创建线程来实现为每300人为一个的线程跑待阅
|
||||
ExecutorService service = Executors.newFixedThreadPool(4);
|
||||
service.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (String[] resrt:list
|
||||
) {
|
||||
try {
|
||||
SendOARead(jsonObject,instanceById,resrt);
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
int size = users.length/length;
|
||||
int flag = 0;
|
||||
List<String[]> list = new LinkedList();
|
||||
for (int i=0;i<size;i++){
|
||||
String[] results;
|
||||
results = Arrays.copyOfRange(users, flag, flag+300);
|
||||
list.add(results);
|
||||
flag = flag+300;
|
||||
}
|
||||
String[] redata;
|
||||
redata = Arrays.copyOfRange(users, flag, flag+ys);
|
||||
list.add(redata);
|
||||
// 创建线程来实现为每300人为一个的线程跑待阅
|
||||
ExecutorService service = Executors.newFixedThreadPool(4);
|
||||
service.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (String[] resrt:list
|
||||
) {
|
||||
try {
|
||||
SendOARead(jsonObject,instanceById,resrt);
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void SendOARead(JSONObject jsonObject,ProcessInstance instanceById,String[] results) throws DocumentException {
|
||||
String userId = "";
|
||||
userId = StringUtils.join(results, ",");
|
||||
jsonObject.put("userList",userId);
|
||||
|
||||
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
|
||||
" <soapenv:Header/>" +
|
||||
" <soapenv:Body>" +
|
||||
" <web:service>" +
|
||||
" <web:in0>" +
|
||||
"<![CDATA["+jsonObject+"]]>"+
|
||||
" </web:in0>" +
|
||||
" </web:service>" +
|
||||
" </soapenv:Body>" +
|
||||
"</soapenv:Envelope>";
|
||||
System.out.println("xmlStr>>>>>>>>"+xmlStr);
|
||||
String postSoap = UtilUrl.doPostSoap("http://10.105.1.59:80/services/service_lcglpt", xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>"+rootElement);
|
||||
Element result = rootElement.element("Body").element("serviceResponse").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("data");
|
||||
String status = jsonObject1.getString("status");
|
||||
System.out.println("状态是什么》》》》》》》》》》》"+status);
|
||||
JSONArray resultArray = JSONObject.parseArray(datas);
|
||||
for (int j=0;j<resultArray.size();j++) {
|
||||
JSONObject jsonObject2 = resultArray.getJSONObject(j);
|
||||
String user = jsonObject2.get("user").toString();
|
||||
String dataid = jsonObject2.get("dataid").toString();
|
||||
BO bo = new BO();
|
||||
bo.set("PROCESSID",instanceById.getId());
|
||||
bo.set("USER_ID",user);
|
||||
bo.set("DATAID",dataid);
|
||||
SDK.getBOAPI().create("BO_ACT_DATAID",bo,instanceById.getId(),instanceById.getCreateUser());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,633 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
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.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
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.apps.integration.util.UtilUrl;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class TestSendOARead implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
String jobParameter = SDK.getJobAPI().getJobParameter(jobExecutionContext);
|
||||
String taskid = jobParameter.split(",")[1];
|
||||
String processid = jobParameter.split(",")[0];
|
||||
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processid);
|
||||
TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(taskid);
|
||||
String wsId = "";
|
||||
JSONArray filed = new JSONArray(new LinkedList<>());
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
System.out.println("portal======>>>>"+portalUrl);
|
||||
/*if (portalUrl.equals("http://10.114.11.135:8088/portal")){
|
||||
portalUrl = "http://bpm.yili.com:8088/portal/";
|
||||
}*/
|
||||
try {
|
||||
|
||||
|
||||
String url = portalUrl + "/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId();
|
||||
String mobileurl = "https://bpm.yili.com:8088/portal" + "/r/or?cmd=com.yili_process_page_phone&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId();
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Timestamp endTime = instanceById.getStartTime();
|
||||
BO boActCoePublish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", instanceById.getId()).detail();
|
||||
|
||||
|
||||
//ProcessExecutionContext processExecutionContext,String fileCreateName,String fileName,String fileurl,String readingScope_org,String isFullCompany,String fileCreateDate,String relationProcessinstId,String readingScope_post,String readingScope_level,String fileid
|
||||
String not_url = "/w?cmd=com.yili_process_page&processInstId=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId();
|
||||
|
||||
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
|
||||
jsonObject.put("action", "read");
|
||||
jsonObject.put("title", " " +
|
||||
"" + boActCoePublish.getString("PROCESS_TITLE") + "");
|
||||
System.out.println("部门庄户》》》》》》》" + SDK.getORGAPI().getDepartmentByUser(taskInstance.getTarget()).getNo());
|
||||
jsonObject.put("dept", SDK.getORGAPI().getDepartmentByUser(taskInstance.getTarget()).getNo());//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
|
||||
String target = taskInstance.getTarget();
|
||||
target = taskInstance.getTarget();
|
||||
|
||||
System.out.println("当前账户======》》》》" + target);
|
||||
|
||||
jsonObject.put("user", target);
|
||||
|
||||
// jsonObject.put("user",);//processExecutionContext.getProcessInstance().getCreateUser()
|
||||
jsonObject.put("date", sdf.format(endTime));
|
||||
jsonObject.put("remark", boActCoePublish.getString("PROCESS_TITLE"));
|
||||
jsonObject.put("status", "0");
|
||||
jsonObject.put("dataid", instanceById.getId());
|
||||
jsonObject.put("pcurl", url);
|
||||
jsonObject.put("mobileurl", mobileurl);
|
||||
//list.add(1,"00352394");
|
||||
//list.add(2,"00352394");
|
||||
/* BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", instanceById.getId()).detail();
|
||||
String uid = "";
|
||||
String new_uid = "";
|
||||
if (bo_act_coe_publish1 != null) {
|
||||
String da = bo_act_coe_publish1.getString("SEND_SCOP");
|
||||
|
||||
if (da.equals("1")) {
|
||||
List<RowMap> select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER WHERE CLOSED = '0'");
|
||||
|
||||
for (RowMap row : select_userid_from_orguser
|
||||
) {
|
||||
BO boList = SDK.getBOAPI().query("BO_ACT_DATAID",true).addQuery("PROCESSID=",processid).addQuery("USER_ID=",row.getString("USERID")).detail();
|
||||
if (boList==null){
|
||||
DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID"));
|
||||
if(departmentModel.getId().equals("e79281b1-2f81-4895-b30e-9f96e9ad0e2c")||departmentModel.getId().equals("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")){
|
||||
|
||||
}else {
|
||||
uid += row.getString("USERID") + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List posts_list = new ArrayList();
|
||||
List<String> org_list = new ArrayList();
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_ORG"))) {
|
||||
String strs[] = bo_act_coe_publish1.getString("SEND_SCOPE_ORG").split(",");
|
||||
org_list = Arrays.asList(strs);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_POST"))) {
|
||||
String posts[] = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
posts_list = Arrays.asList(posts);
|
||||
}
|
||||
List ranks_list = new ArrayList();
|
||||
if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL"))) {
|
||||
String ranks[] = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
ranks_list = Arrays.asList(ranks);
|
||||
}
|
||||
|
||||
System.out.println("部门id》》》》》》》》》》》》》" + org_list);
|
||||
System.out.println("posts_list》》》》》》》》》》》》》" + posts_list);
|
||||
System.out.println("ranks_list》》》》》》》》》》》》》" + ranks_list);
|
||||
if (org_list.size() != 0 && org_list != null) {
|
||||
for (String depaartid : org_list
|
||||
) {
|
||||
System.out.println("departid>>>>>>>>>>>>>" + depaartid);
|
||||
DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentById(depaartid);
|
||||
boolean existSubModelOfCache = departmentModel.isExistSubModelOfCache();
|
||||
System.out.println("是否含有下级?????????????" + existSubModelOfCache);
|
||||
//判断选中的是否有下级部门
|
||||
if (existSubModelOfCache) {
|
||||
List<RowMap> maps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + depaartid + "'");
|
||||
for (RowMap row : maps
|
||||
) {
|
||||
String id = row.getString("ID");
|
||||
DepartmentModel model = SDK.getORGAPI().getDepartmentById(id);
|
||||
|
||||
if (model.isExistSubModelOfCache()) {
|
||||
//有下级部门的选中有下级部门
|
||||
List<RowMap> rowMapList = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + id + "'");
|
||||
for (RowMap wo :
|
||||
rowMapList) {
|
||||
String ids = wo.getString("ID");
|
||||
DepartmentModel model1 = SDK.getORGAPI().getDepartmentById(ids);
|
||||
if (model1.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapLists = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + ids + "'");
|
||||
for (RowMap wsa :
|
||||
rowMapLists) {
|
||||
String wsaString = wsa.getString("ID");
|
||||
DepartmentModel model2 = SDK.getORGAPI().getDepartmentById(wsaString);
|
||||
if (model2.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList1 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + wsaString + "'");
|
||||
for (RowMap rows :
|
||||
rowMapList1) {
|
||||
String rowsString = rows.getString("ID");
|
||||
DepartmentModel model3 = SDK.getORGAPI().getDepartmentById(rowsString);
|
||||
if (model3.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList2 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString + "'");
|
||||
for (RowMap ormap :
|
||||
rowMapList2) {
|
||||
String rowsString1 = ormap.getString("ID");
|
||||
DepartmentModel model4 = SDK.getORGAPI().getDepartmentById(rowsString1);
|
||||
if (model4.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMaps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString1 + "'");
|
||||
for (RowMap owmapr :
|
||||
rowMaps) {
|
||||
String row_id = owmapr.getString("ID");
|
||||
DepartmentModel model5 = SDK.getORGAPI().getDepartmentById(row_id);
|
||||
if (model5.isExistSubModelOfCache()) {
|
||||
List<RowMap> rowMapList3 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + row_id + "'");
|
||||
for (RowMap owzmap :
|
||||
rowMapList3) {
|
||||
String idsa = owzmap.getString("ID");
|
||||
DepartmentModel model6 = SDK.getORGAPI().getDepartmentById(idsa);
|
||||
if (model6.isExistSubModelOfCache()) {
|
||||
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(idsa);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(row_id);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString1);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(wsaString);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(ids);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<UserModel> allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(id);
|
||||
for (UserModel user : allUsersByDepartments
|
||||
) {
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//选中的没有下级部门
|
||||
List<UserModel> allUsersByDepartment = SDK.getORGAPI().getAllUsersByDepartment(depaartid);
|
||||
for (UserModel user : allUsersByDepartment
|
||||
) {
|
||||
System.out.println("user.getExt2())???????????" + user.getExt2());
|
||||
System.out.println("posts_list》》》》》》》》》das" + (posts_list.size() != 0));
|
||||
System.out.println("123123》》》》》》》》》》" + (ranks_list.size() != 0));
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
if (posts_list.contains(user.getPositionNo())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
if (ranks_list.contains(user.getExt2())) {
|
||||
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
} else {
|
||||
uid += user.getUID() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (org_list.size() == 0 || org_list == null) {
|
||||
String posts = "";
|
||||
String levels = "";
|
||||
if (posts_list.size() != 0 && ranks_list.size() != 0) {
|
||||
String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
if (post.length == 1) {
|
||||
// DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN ");
|
||||
posts = "'" + post[0] + "'";
|
||||
} else {
|
||||
posts = "'" + StringUtils.join(post, "','") + "'";
|
||||
}
|
||||
if (level.length == 1) {
|
||||
levels = "'" + level[0] + "'";
|
||||
} else {
|
||||
levels = "'" + StringUtils.join(level, "','") + "'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ") and EXT2 in (" + levels + ")");
|
||||
for (RowMap map : maps
|
||||
) {
|
||||
uid += map.getString("USERID") + ",";
|
||||
}
|
||||
} else if (posts_list.size() != 0 && ranks_list.size() == 0) {
|
||||
String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(",");
|
||||
if (post.length == 1) {
|
||||
// DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN ");
|
||||
posts = "'" + post[0] + "'";
|
||||
} else {
|
||||
posts = "'" + StringUtils.join(post, "','") + "'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ")");
|
||||
for (RowMap map : maps
|
||||
) {
|
||||
uid += map.getString("USERID") + ",";
|
||||
}
|
||||
} else if (posts_list.size() == 0 && ranks_list.size() != 0) {
|
||||
String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(",");
|
||||
|
||||
if (level.length == 1) {
|
||||
levels = "'" + level[0] + "'";
|
||||
} else {
|
||||
levels = "'" + StringUtils.join(level, "','") + "'";
|
||||
}
|
||||
List<RowMap> maps = DBSql.getMaps("select USERID from ORGUSER where EXT2 in (" + levels + ")");
|
||||
for (RowMap map : maps
|
||||
) {
|
||||
uid += map.getString("USERID") + ",";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
System.out.println("userid》》》》》》》》》》》》》》》》》》》" + uid);
|
||||
if (StringUtils.isNotEmpty(uid
|
||||
)) {
|
||||
uid = uid.substring(0, uid.length() - 1);
|
||||
String[] split = uid.split(",");
|
||||
|
||||
List<String> list = new ArrayList(Arrays.asList(split));
|
||||
|
||||
HashSet h = new HashSet(list);
|
||||
list.clear();
|
||||
list.addAll(h);
|
||||
for (String userid : list
|
||||
) {
|
||||
|
||||
System.out.println("当前账户======》》》》" + userid);
|
||||
// BO boEuOaReson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", userid).detail();
|
||||
// if (boEuOaReson!=null){
|
||||
new_uid += userid + ",";
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(new_uid
|
||||
)) {
|
||||
new_uid = new_uid.substring(0, new_uid.length() - 1);
|
||||
}*/
|
||||
|
||||
/*System.out.println("new_userid ==========>>>>>>>>>"+new_uid);
|
||||
String[] users = new_uid.split(",");
|
||||
int length = 300;
|
||||
int ys = users.length%length;
|
||||
if (ys==0) {
|
||||
int size = users.length/length;
|
||||
int flag = 0;
|
||||
for (int i=0;i<size;i++){
|
||||
String[] results;
|
||||
results = Arrays.copyOfRange(users, flag, flag+300);
|
||||
flag = flag+300;
|
||||
String userId = "";
|
||||
userId = StringUtils.join(results, ",");
|
||||
jsonObject.put("userList",userId);
|
||||
|
||||
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
|
||||
" <soapenv:Header/>" +
|
||||
" <soapenv:Body>" +
|
||||
" <web:service>" +
|
||||
" <web:in0>" +
|
||||
"<![CDATA["+jsonObject+"]]>"+
|
||||
" </web:in0>" +
|
||||
" </web:service>" +
|
||||
" </soapenv:Body>" +
|
||||
"</soapenv:Envelope>";
|
||||
System.out.println("xmlStr>>>>>>>>"+xmlStr);
|
||||
String postSoap = UtilUrl.doPostSoap("http://10.105.1.59:80/services/service_lcglpt", xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>"+rootElement);
|
||||
Element result = rootElement.element("Body").element("serviceResponse").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("data");
|
||||
String status = jsonObject1.getString("status");
|
||||
System.out.println("状态是什么》》》》》》》》》》》"+status);
|
||||
JSONArray resultArray = JSONObject.parseArray(datas);
|
||||
for (int j=0;j<resultArray.size();j++) {
|
||||
JSONObject jsonObject2 = resultArray.getJSONObject(j);
|
||||
String user = jsonObject2.get("user").toString();
|
||||
String dataid = jsonObject2.get("dataid").toString();
|
||||
BO bo = new BO();
|
||||
bo.set("PROCESSID",instanceById.getId());
|
||||
bo.set("USER_ID",user);
|
||||
bo.set("DATAID",dataid);
|
||||
SDK.getBOAPI().create("BO_ACT_DATAID",bo,instanceById.getId(),target);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
int size = users.length/length;
|
||||
int flag = 0;
|
||||
for (int i=0;i<size;i++){
|
||||
String[] results;
|
||||
results = Arrays.copyOfRange(users, flag, flag+300);
|
||||
flag = flag+300;
|
||||
String userId = "";
|
||||
userId = StringUtils.join(results, ",");
|
||||
jsonObject.put("userList",userId);
|
||||
|
||||
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
|
||||
" <soapenv:Header/>" +
|
||||
" <soapenv:Body>" +
|
||||
" <web:service>" +
|
||||
" <web:in0>" +
|
||||
"<![CDATA["+jsonObject+"]]>"+
|
||||
" </web:in0>" +
|
||||
" </web:service>" +
|
||||
" </soapenv:Body>" +
|
||||
"</soapenv:Envelope>";
|
||||
System.out.println("xmlStr>>>>>>>>"+xmlStr);
|
||||
String postSoap = UtilUrl.doPostSoap("http://10.105.1.59:80/services/service_lcglpt", xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>"+rootElement);
|
||||
Element result = rootElement.element("Body").element("serviceResponse").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("data");
|
||||
String status = jsonObject1.getString("status");
|
||||
System.out.println("状态是什么》》》》》》》》》》》"+status);
|
||||
JSONArray resultArray = JSONObject.parseArray(datas);
|
||||
for (int j=0;j<resultArray.size();j++) {
|
||||
JSONObject jsonObject2 = resultArray.getJSONObject(j);
|
||||
String user = jsonObject2.get("user").toString();
|
||||
String dataid = jsonObject2.get("dataid").toString();
|
||||
BO bo = new BO();
|
||||
bo.set("PROCESSID",instanceById.getId());
|
||||
bo.set("USER_ID",user);
|
||||
bo.set("DATAID",dataid);
|
||||
SDK.getBOAPI().create("BO_ACT_DATAID",bo,instanceById.getId(),target);
|
||||
}
|
||||
}
|
||||
users = Arrays.copyOfRange(users, flag, flag+ys);
|
||||
String userId = "";
|
||||
userId = StringUtils.join(users, ",");
|
||||
jsonObject.put("userList",userId);
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
|
||||
" <soapenv:Header/>" +
|
||||
" <soapenv:Body>" +
|
||||
" <web:service>" +
|
||||
" <web:in0>" +
|
||||
"<![CDATA["+jsonObject+"]]>"+
|
||||
" </web:in0>" +
|
||||
" </web:service>" +
|
||||
" </soapenv:Body>" +
|
||||
"</soapenv:Envelope>";
|
||||
System.out.println("xmlStr>>>>>>>>"+xmlStr);
|
||||
String postSoap = UtilUrl.doPostSoap("http://10.105.1.59:80/services/service_lcglpt", xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>"+rootElement);
|
||||
Element result = rootElement.element("Body").element("serviceResponse").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("data");
|
||||
String status = jsonObject1.getString("status");
|
||||
System.out.println("状态是什么》》》》》》》》》》》"+status);
|
||||
JSONArray resultArray = JSONObject.parseArray(datas);
|
||||
for (int j=0;j<resultArray.size();j++) {
|
||||
JSONObject jsonObject2 = resultArray.getJSONObject(j);
|
||||
String user = jsonObject2.get("user").toString();
|
||||
String dataid = jsonObject2.get("dataid").toString();
|
||||
BO bo = new BO();
|
||||
bo.set("PROCESSID",instanceById.getId());
|
||||
bo.set("USER_ID",user);
|
||||
bo.set("DATAID",dataid);
|
||||
SDK.getBOAPI().create("BO_ACT_DATAID",bo,instanceById.getId(),target);
|
||||
}
|
||||
|
||||
}*/
|
||||
jsonObject.put("userList","10056870");
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
|
||||
" <soapenv:Header/>" +
|
||||
" <soapenv:Body>" +
|
||||
" <web:service>" +
|
||||
" <web:in0>" +
|
||||
"<![CDATA["+jsonObject+"]]>"+
|
||||
" </web:in0>" +
|
||||
" </web:service>" +
|
||||
" </soapenv:Body>" +
|
||||
"</soapenv:Envelope>";
|
||||
System.out.println("xmlStr>>>>>>>>"+xmlStr);
|
||||
String postSoap = UtilUrl.doPostSoap("http://10.105.1.59:80/services/service_lcglpt", xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
System.out.println("rootElement>>>>>>"+rootElement);
|
||||
Element result = rootElement.element("Body").element("serviceResponse").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("data");
|
||||
String status = jsonObject1.getString("status");
|
||||
System.out.println("状态是什么》》》》》》》》》》》"+status);
|
||||
JSONArray resultArray = JSONObject.parseArray(datas);
|
||||
for (int j=0;j<resultArray.size();j++) {
|
||||
JSONObject jsonObject2 = resultArray.getJSONObject(j);
|
||||
String user = jsonObject2.get("user").toString();
|
||||
String dataid = jsonObject2.get("dataid").toString();
|
||||
BO bo = new BO();
|
||||
bo.set("PROCESSID",instanceById.getId());
|
||||
bo.set("USER_ID",user);
|
||||
bo.set("DATAID",dataid);
|
||||
SDK.getBOAPI().create("BO_ACT_DATAID",bo,instanceById.getId(),target);
|
||||
}
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
public class TestdeleteJob implements IJob {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
|
||||
|
||||
DBSql.update("update APP_ACT_BPA_PROCESS set DATAPROFILE = 'local'");
|
||||
|
||||
DBSql.update("update APP_ACT_BPA_PROCESS set CATEGORYPID = '10f882f7-ae01-4430-b54d-e504246bf0e3' where CATEGORYPID = '0' and CATEGORY !='本地' ");
|
||||
|
||||
|
||||
// DBSql.update("delete from APP_ACT_BPA_PROCESS where CATEGORY in ('task任务','obj_0889e9236deb827ea50aa13d2ac2fef3','obj_bc0f34c006a5d76e31f95bbbaec255dd')");
|
||||
}
|
||||
}
|
||||
@ -1,461 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.output.constant.OutputConst;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.server.SSOUtil;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.fs.DCContext;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.exception.AWSException;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @PackageName: com.awspaas.user.apps.yili.integration.job
|
||||
* @ClassName: UpdateKnowJob
|
||||
* @author: wangcy
|
||||
* @date: 2022/8/10 14:41
|
||||
*/
|
||||
public class UpdateKnowJob implements Job {
|
||||
|
||||
private static String APPID = "com.awspaas.user.apps.yili.integration";
|
||||
|
||||
|
||||
private static String USERID = "admin";
|
||||
|
||||
@Override
|
||||
|
||||
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
Connection open = DBSql.open();
|
||||
try {
|
||||
|
||||
|
||||
String jobParameter = SDK.getJobAPI().getJobParameter(jobExecutionContext);
|
||||
|
||||
SSOUtil ssoUtil = new SSOUtil();
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
String sid = ssoUtil.registerClientSessionNoPassword(USERID, "cn", portalUrl, "pc");
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
System.out.println("创建维度准备开始===============");
|
||||
String sql = "select * from APP_ACT_COE_PAL_REPOSITORY " +
|
||||
"where PLCATEGORY = 'process'and PLMETHODID !='process.framework' " +
|
||||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')";
|
||||
|
||||
|
||||
List<RowMap> list = DBSql.getMaps(open, sql);
|
||||
for (RowMap bo : list
|
||||
) {
|
||||
String repository_sql = " select PLNAME from APP_ACT_COE_PAL_REPOSITORY " +
|
||||
"where PLCATEGORY = 'process'and PLMETHODID ='process.framework' " +
|
||||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')" + " and PLNAME ='" + bo.getString("PLNAME") + "'";
|
||||
String PLNAME = DBSql.getString(open, repository_sql);
|
||||
System.out.println("repository_sql>>>>>>>>>>>>>>>>>>>" + repository_sql);
|
||||
if (StringUtils.isEmpty(PLNAME)) {
|
||||
PLNAME = bo.getString("EXT4");
|
||||
}
|
||||
String add_name = PLNAME + ",";
|
||||
|
||||
Map names = new LinkedHashMap<>();
|
||||
names.put(0, bo.getString("EXT4"));
|
||||
names.put(1, PLNAME);
|
||||
for (int i = 2; i < 5; i++) {
|
||||
String repository_sqls = " select EXT4 from APP_ACT_COE_PAL_REPOSITORY " +
|
||||
"where PLCATEGORY = 'process'and PLMETHODID ='process.framework' " +
|
||||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')"+" and EXT4 ='" + PLNAME + "'";//and PLMETHODID !='process.framework'
|
||||
String parent_name = DBSql.getString(open, repository_sqls);
|
||||
if (names.containsValue(parent_name)) {
|
||||
break;
|
||||
}
|
||||
String util_space = "select PLCATEGORY from APP_ACT_COE_PAL_REPOSITORY where PLPARENTID in ('process') and PLNAME = '" + PLNAME + "'";
|
||||
String fisrt_name = DBSql.getString(open, util_space);
|
||||
if (names.containsValue(fisrt_name)) {
|
||||
break;
|
||||
}
|
||||
if (fisrt_name.equals("process")) {
|
||||
names.put(i, "obj_5020f54928c842b58107c3354e450070");
|
||||
}
|
||||
if (StringUtils.isEmpty(parent_name)) {
|
||||
break;
|
||||
}
|
||||
PLNAME = parent_name;
|
||||
names.put(i, PLNAME);
|
||||
add_name = PLNAME + ",";
|
||||
}
|
||||
add_name = names.get(0) + ",";
|
||||
System.out.println("add_name=============="
|
||||
+ add_name);
|
||||
String dimensionId = "";
|
||||
String de_name = "";
|
||||
System.out.println("names==========" + names);
|
||||
for (int i = names.size() - 1; i >= 0; i--) {
|
||||
System.out.println("name" + i + "=================?>>>>>>>>>>" + names.get(i));
|
||||
String dimensionId_sql = "SELECT ID FROM APP_ACT_KMS_DIMENSION where ID ='" + names.get(i) + "'";
|
||||
dimensionId = DBSql.getString(open, dimensionId_sql);
|
||||
String sql_Frameworks = " select EXT4 from APP_ACT_COE_PAL_REPOSITORY " +
|
||||
"where PLCATEGORY = 'process'and PLMETHODID ='process.framework' " +
|
||||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')"+" and EXT4 = '" + names.get(i) + "'";//
|
||||
String framework = DBSql.getString(open, sql_Frameworks);//&& StringUtils.isEmpty(framework)
|
||||
|
||||
if (StringUtils.isNotEmpty(dimensionId) || StringUtils.isEmpty(framework)) {
|
||||
|
||||
} else {
|
||||
System.out.println("进入知识");
|
||||
String sql_Framework = " select EXT4 from APP_ACT_COE_PAL_REPOSITORY " +
|
||||
"where PLCATEGORY = 'process'and PLMETHODID !='process.framework' " +
|
||||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')"+"and EXT4 = '" + names.get(i) + "'";//PLMETHODID = 'process.framework' and
|
||||
String frameworks = DBSql.getString(open, sql_Framework);//&& StringUtils.isEmpty(framework)
|
||||
if (bo.getString("EXT4").equals(names.get(i))) {
|
||||
String card_sql = "select ID from APP_ACT_KMS_CARD where ID ='" + names.get(i) + "'";
|
||||
String card = DBSql.getString(open, card_sql);
|
||||
String card_sql_name = "select CARDNAME from APP_ACT_KMS_CARD where ID ='" + names.get(i) + "'";
|
||||
String card_name = DBSql.getString(open, card_sql_name);
|
||||
if (StringUtils.isNotEmpty(card)) {
|
||||
creadteFile(userContext, open, bo.getString("PLNAME"), add_name);
|
||||
|
||||
} else {
|
||||
|
||||
// aslp服务地址
|
||||
String aslps_create = "aslp://com.actionsoft.apps.kms/CreateKnwl";
|
||||
// 参数定义列表
|
||||
Map params_create = new HashMap<String, Object>();
|
||||
//保密级别, 0: 普通 1:秘密 2:机密,必填
|
||||
params_create.put("securityLevel", 0);
|
||||
//知识名称,必填
|
||||
params_create.put("knwlName", card_name);
|
||||
//是否可以评论,必填
|
||||
params_create.put("isComment", true);
|
||||
//是否可以评分,必填
|
||||
params_create.put("isRate", true);
|
||||
//有效期:yyyy-MM-dd,非必填
|
||||
params_create.put("validDate", "2099-12-31");
|
||||
//只读控制,1:在线阅读和下载 0:在线阅读,必填
|
||||
params_create.put("onlineLevel", 1);
|
||||
//知识创建人,某些特殊场景下,sid和createUser代表的用户并不一样,如果此参数为null,则使用sid代表的用户,非必填
|
||||
params_create.put("createUser", "admin");
|
||||
//知识内容,非必填
|
||||
params_create.put("cardContext", "");
|
||||
//sid,必填
|
||||
params_create.put("sid", userContext.getSessionId());
|
||||
AppAPI appAPI_create = SDK.getAppAPI();
|
||||
//创建知识
|
||||
ResponseObject ro_create = appAPI_create.callASLP(appAPI_create.getAppContext(APPID), aslps_create, params_create);
|
||||
System.out.println("ro_create================" + ro_create);
|
||||
creadteFile(userContext, open, names.get(i).toString(), add_name);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if (StringUtils.isNotEmpty(dimensionId)) {
|
||||
// 调用App
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslps_de = "aslp://com.actionsoft.apps.kms/createDimension";
|
||||
// 参数定义列表
|
||||
Map paramss = new HashMap<String, Object>();
|
||||
//发布是否需要审批,默认false,必填
|
||||
paramss.put("isExamine", false);
|
||||
//是否启用,默认启用,必填
|
||||
paramss.put("isEnabled", true);
|
||||
//维度类型,1:允许发布知识 2:不允许发布知识,必填
|
||||
paramss.put("showType", 1);
|
||||
//维度描述,非必填
|
||||
paramss.put("memo", "");
|
||||
//创建人,非必填
|
||||
paramss.put("createUser", "admin");
|
||||
|
||||
String sql_fa = " select PLNAME from APP_ACT_COE_PAL_REPOSITORY " +
|
||||
"where PLCATEGORY = 'process'and PLMETHODID ='process.framework' " +
|
||||
"and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
",'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
"'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
"'36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
"'98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
"'79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
"'42c09260-c1d3-44b7-ac3d-f8280e04c294')"+" and EXT4 = '" + names.get(i) + "'";
|
||||
String plname = DBSql.getString(open, sql_fa);
|
||||
//维度名称,必填
|
||||
paramss.put("dimensionName", plname);
|
||||
|
||||
String dimensionId_sql_i = "SELECT ID FROM APP_ACT_KMS_DIMENSION where ID ='" + names.get(i + 1) + "'";
|
||||
de_name = DBSql.getString(open, dimensionId_sql_i);
|
||||
//父维度Id:""表示根维度,必填
|
||||
paramss.put("parentId", de_name);
|
||||
//sid,必填
|
||||
paramss.put("sid", userContext.getSessionId());
|
||||
AppAPI appAPIs = SDK.getAppAPI();
|
||||
//创建维度
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslps_de, paramss);
|
||||
|
||||
System.out.println("ros==================" + ros);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("定时器执行完毕");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
open.close();
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void creadteFile(UserContext userContext, Connection open, String name, String add_name) {
|
||||
/**
|
||||
* 这个主要是负责对流程手册进行相关的文件的生成
|
||||
*/
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/CreateFile";
|
||||
|
||||
String sql = "SELECT CARDNAME FROM APP_ACT_KMS_CARD WHERE ID = '" + name + "'";
|
||||
String id = DBSql.getString(open, sql);
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
BO bos = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("PUBLISHFILENAME = ", name).detail();
|
||||
if (bos != null) {
|
||||
|
||||
|
||||
if (StringUtils.isNotEmpty(bos.getString("TASKID"))) {
|
||||
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(bos.getString("TASKID"));
|
||||
if (model != null) {
|
||||
System.out.println(",pdel============" + model);
|
||||
System.out.println("123313123123123==========" + model.getProfileId());
|
||||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||||
System.out.println("dajadfas======" + appProfile);
|
||||
if (appProfile == null) {
|
||||
throw new AWSException("Not Find OutputAppProfile! profileId=" + model.getProfileId());
|
||||
}
|
||||
DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT);
|
||||
if (dcProfile == null)
|
||||
throw new AWSException("Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT);
|
||||
String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME = '" + bos.getString("PUBLISHFILENAME") + "'";
|
||||
String lever = DBSql.getString(open, sql_lever);
|
||||
//lever = lever.substring(0,3);
|
||||
DCContext dcContext = new DCContext(userContext, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bos.getString("TASKID"), bos.getString("PUBLISHFILENAME") + "_" + lever + ".doc");
|
||||
//UtilFile file = new UtilFile(dcContext.getPath());
|
||||
|
||||
|
||||
Map params = new HashMap<String, Object>();
|
||||
//知识ID,必填
|
||||
params.put("cardId", id);
|
||||
//sid,必填
|
||||
params.put("sid", userContext.getSessionId());
|
||||
|
||||
params.put("dc", dcContext);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//创建文件
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
System.out.println("流程手册的存入=================" + ro);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
String sql_A = "SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY where PLNAME = '" + name + "' AND PLMETHODID != 'process.framework' AND PLMETHODID IN (select distinct PLMETHODID from APP_ACT_COE_PAL_REPOSITORY)";
|
||||
List<RowMap> rows = DBSql.getMaps(open, sql_A);
|
||||
|
||||
for (RowMap bo : rows
|
||||
) {
|
||||
|
||||
/**
|
||||
* 这个是模型中的附件获取的并插入的数据信息,需要做修改
|
||||
*/
|
||||
// 调用App
|
||||
|
||||
// 参数定义列表
|
||||
Map paramss = new HashMap<String, Object>();
|
||||
//知识ID,必填
|
||||
paramss.put("cardId", id);
|
||||
//sid,必填
|
||||
paramss.put("sid", userContext.getSessionId());
|
||||
|
||||
UpfileWeb upfileWeb = new UpfileWeb(userContext);
|
||||
|
||||
|
||||
String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where PLMETHODID != 'process.framework' AND PLNAME= '" + bo.getString("PLNAME") + "'" +
|
||||
")";
|
||||
List<RowMap> maps = DBSql.getMaps(open, sql_upfile);
|
||||
for (RowMap row : maps) {
|
||||
UpfileModel upfileModel = new UpfileModel();
|
||||
upfileModel.setType(row.getString("FILETYPE"));
|
||||
upfileModel.setFileName(row.getString("FILENAME"));
|
||||
upfileModel.setPl_uuid(row.getString("PALREPOSITORYID"));
|
||||
upfileModel.setShape_uuid(row.getString("SHAPEID"));
|
||||
DCContext dcContexts = upfileWeb.getDCContext(upfileModel);
|
||||
paramss.put("dc", dcContexts);
|
||||
AppAPI appAPIs = SDK.getAppAPI();
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, paramss);
|
||||
System.out.println("流程模型附件的生成=============" + ros);
|
||||
}
|
||||
|
||||
//DCContext对象,必填
|
||||
|
||||
//创建文件
|
||||
}
|
||||
PublishKnow(userContext, open, add_name, id);
|
||||
}
|
||||
}
|
||||
|
||||
public void PublishKnow(UserContext userContext, Connection open, String add_name, String id) {
|
||||
System.out.println("add_name=================" + add_name);
|
||||
/*String result = add_name.substring(0, add_name.length() - 1);
|
||||
String[] deptSplit = result.split(",");
|
||||
|
||||
if (deptSplit.length == 1) {
|
||||
result = "'" + deptSplit[0] + "'";
|
||||
}
|
||||
result = "'" + StringUtils.join(deptSplit, "','") + "'";
|
||||
System.out.println(">>>>>NO =" + result);
|
||||
|
||||
String sql = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME IN (" + result + ") ";
|
||||
List<RowMap> maps = DBSql.getMaps(open, sql);
|
||||
if (maps.size() == 0) {
|
||||
String sql_DIMENSIONNAME = "SELECT PLPARENTID FROM APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process' and PLNAME IN (" + result + ") ";
|
||||
String maps_first = DBSql.getString(open, sql_DIMENSIONNAME);
|
||||
|
||||
if (maps_first.equals("itsystem")) {
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='IT系统' ";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
} else if (maps_first.equals("control")) {
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='控制' ";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
} else if (maps_first.equals("process")) {
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='流程制度' ";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
} else if (maps_first.equals("org")) {
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='组织' ";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
} else if (maps_first.equals("data")) {
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME ='数据' ";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
} else {
|
||||
String sql_id = "SELECT ID FROM APP_ACT_KMS_DIMENSION where DIMENSIONNAME =(SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY where ID ='" + maps_first + "')";
|
||||
maps = DBSql.getMaps(open, sql_id);
|
||||
}
|
||||
}
|
||||
String ids = "";
|
||||
if (maps.size() != 0) {
|
||||
|
||||
for (RowMap rowmap : maps
|
||||
) {
|
||||
ids += rowmap.getString("ID") + ",";
|
||||
}
|
||||
ids = ids.substring(0, ids.length() - 1);
|
||||
|
||||
} else {
|
||||
for (RowMap rowmap : maps
|
||||
) {
|
||||
ids += rowmap.getString("ID") + ",";
|
||||
}
|
||||
ids = ids.substring(0, ids.length() - 1);
|
||||
}*/
|
||||
|
||||
String[] deptSplit_id = add_name.split(",");
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
for (String id_names : deptSplit_id
|
||||
) {
|
||||
jsonArray.add(id_names);
|
||||
}
|
||||
//jsonObject.put(deptSplit_id);
|
||||
id += ",";
|
||||
String[] deptSplit_das = id.split(",");
|
||||
JSONArray jsonArray_das = new JSONArray();
|
||||
for (String das : deptSplit_das
|
||||
) {
|
||||
jsonArray_das.add(das);
|
||||
}
|
||||
//jsonObject.put(deptSplit_id);
|
||||
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = APPID;
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/PublishKnwl";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//要发布到的维度ID的JSON数组字符串,必填
|
||||
params.put("dimensionIDArray", jsonArray.toString());
|
||||
//要发布的知识ID的JSON数组字符串,必填
|
||||
params.put("knwlIDArray", jsonArray_das.toString());
|
||||
//标签的JSON数组字符串,非必填
|
||||
|
||||
//sid,必填
|
||||
params.put("sid", userContext.getSessionId());
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//发布知识
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
|
||||
System.out.println("知识发布============" + ro);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.awspaas.user.apps.integration.util.UtilUrl;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
public class UpdateOA implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:com=\"com.synctooa.webservices\">" +
|
||||
" <soapenv:Header/>" +
|
||||
" <soapenv:Body>" +
|
||||
" <com:InsertTodoCominfo>" +
|
||||
" <com:in0>" +
|
||||
"<![CDATA[ " +
|
||||
"<?xml version='1.0' encoding='UTF-8'?>" +
|
||||
"<root>" +
|
||||
" <Todo>" +
|
||||
" <outsysid>LCZD</outsysid>" +
|
||||
" <todoid>922fdd65-104c-4a17-8b52-5e07824b72d3</todoid>" +
|
||||
" <content> 您有一条待办流程【关于发布《无菌/保温试验不合格处理流程》的通知】,点击进行处理</content>" +
|
||||
" <pcurl>https://bpm.yili.com:8088/portal/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId=6ae0dea1-f311-4311-b386-42ae1397e191&taskInstId=922fdd65-104c-4a17-8b52-5e07824b72d3</pcurl>" +
|
||||
" <mobileurl>https://bpm.yili.com:8088/portal/r/or?cmd=com.yili_form_page_open&oauthName=WechatOauthLogin&casaccount=00102699&processInstId=6ae0dea1-f311-4311-b386-42ae1397e191&taskInstId=922fdd65-104c-4a17-8b52-5e07824b72d3</mobileurl>" +
|
||||
" <hrcode>wly</hrcode>" +
|
||||
" <createtime> 18:32:33</createtime>" +
|
||||
" <donetime> 18:32:33</donetime>" +
|
||||
" <status>1</status>" +
|
||||
" <wftype>0</wftype>" +
|
||||
" <viewtype>-2</viewtype>" +
|
||||
" <createdate>2022-09-05</createdate>" +
|
||||
" <donedate>2022-09-05</donedate>" +
|
||||
" <receivedate>2022-09-05</receivedate>" +
|
||||
" <receivetime> 18:32:33</receivetime>" +
|
||||
" <currentnodetype>0</currentnodetype>" +
|
||||
" <requestcode>6ae0dea1-f311-4311-b386-42ae1397e191</requestcode>" +
|
||||
" <currentnodename>内部审核</currentnodename>" +
|
||||
" <nooperator>wly</nooperator>" +
|
||||
" <workcode></workcode>" +
|
||||
" <workflowname>关于发布《无菌/保温试验不合格处理流程》的通知-李强-2022-09-05 10:40:40</workflowname>" +
|
||||
" <createrhrcode>wly</createrhrcode>" +
|
||||
" <createrworkcode></createrworkcode>" +
|
||||
" </Todo>" +
|
||||
"</root>" +
|
||||
"]]>" +
|
||||
"</com:in0>" +
|
||||
" </com:InsertTodoCominfo>" +
|
||||
" </soapenv:Body>" +
|
||||
"</soapenv:Envelope>";
|
||||
String postSoap = UtilUrl.doPostSoap("http://10.105.1.59/services/yili", xmlStr, "");
|
||||
System.out.println("是否更新为已办:::::::::"+postSoap);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.awspaas.user.apps.integration.XmlDatasUtil;
|
||||
import com.awspaas.user.apps.integration.util.HttpClientUtils;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class UpdateOADAIBANJob implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
List<BO> bo_eu_oa_mobileurl = SDK.getBOAPI().query("BO_EU_UPDATE_OA", true).list();
|
||||
for (BO bo:bo_eu_oa_mobileurl
|
||||
) {
|
||||
XmlDatasUtil xmlDatasUtil = new XmlDatasUtil();
|
||||
xmlDatasUtil.setExternal_system_ID("LCZD");
|
||||
|
||||
xmlDatasUtil.setOther_system_to_do_ID(bo.getString("TODOID"));
|
||||
xmlDatasUtil.setProcess_title(bo.getString("CONTENT"));
|
||||
//http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin
|
||||
|
||||
xmlDatasUtil.setPcurl(bo.getString("PCURL").replaceAll("&","&"));
|
||||
xmlDatasUtil.setMobileurl(bo.getString("MOBILEURL").replaceAll("&","&"));
|
||||
|
||||
xmlDatasUtil.setTo_do_login_account(bo.getString("HRCODE"));
|
||||
xmlDatasUtil.setTo_do_creation_time(bo.getString("NEWCREATETIME"));
|
||||
xmlDatasUtil.setTo_do_completion_time(bo.getString("NEWDONETIME"));
|
||||
|
||||
xmlDatasUtil.setTo_do_status("1");
|
||||
|
||||
xmlDatasUtil.setTo_do_official_type("0");
|
||||
|
||||
xmlDatasUtil.setViewtype("-2");
|
||||
|
||||
xmlDatasUtil.setCreatedate(bo.getString("CREATEDATES"));
|
||||
xmlDatasUtil.setDonedate(bo.getString("DONEDATE"));
|
||||
|
||||
xmlDatasUtil.setReceivedate(bo.getString("RECEIVEDATE"));
|
||||
xmlDatasUtil.setReceivetime(bo.getString("RECEIVETIME"));
|
||||
xmlDatasUtil.setCurrentnodetype("0");
|
||||
|
||||
xmlDatasUtil.setRequestcode(bo.getString("REQUESTCODE"));
|
||||
xmlDatasUtil.setCurrentnodename(bo.getString("CURRENTNODENAME"));
|
||||
|
||||
|
||||
xmlDatasUtil.setNooperator(bo.getString("NOOPERATOR"));
|
||||
xmlDatasUtil.setWorkcode("");
|
||||
xmlDatasUtil.setWorkflowname(bo.getString("WORKFLOWNAME"));
|
||||
|
||||
xmlDatasUtil.setCreaterhrcode(bo.getString("CREATERHRCODE"));
|
||||
|
||||
xmlDatasUtil.setCreaterworkcode("");
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
try {
|
||||
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
|
||||
System.out.println("更新成功数据》》》》》》"+s);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.output.constant.OutputConst;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
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.fs.DCContext;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.exception.AWSException;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @PackageName: com.awspaas.user.apps.yili.integration.job
|
||||
* @ClassName: UpdatePalRepositoryExt4
|
||||
* @author: wangcy
|
||||
* @date: 2022/8/10 13:42
|
||||
*/
|
||||
public class UpdatePalRepositoryExt4 implements Job {
|
||||
|
||||
private static String APPID = "com.awspaas.user.apps.yili.integration";
|
||||
|
||||
|
||||
private static String USERID = "admin";
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
String sql ="select ID,DIMENSIONNAME from APP_ACT_KMS_DIMENSION where DIMENSIONNAME " +
|
||||
" in (select PLNAME from APP_ACT_COE_PAL_REPOSITORY where " +
|
||||
"PLMETHODID = 'process.framework'and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试','8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试'))";
|
||||
List<RowMap> rowMapList = DBSql.getMaps(sql);
|
||||
for (RowMap rowmap:rowMapList
|
||||
) {
|
||||
String dimensionname = rowmap.getString("DIMENSIONNAME");
|
||||
String Id = rowmap.getString("ID");
|
||||
String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 ="+Id+" WHERE PLMETHODID = 'process.framework'and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试','8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') AND PLNAME = '"+dimensionname+"'";
|
||||
int update = DBSql.update(update_sql);
|
||||
System.out.println(dimensionname+">>>>>>>>>>>>>>>>"+update);
|
||||
}
|
||||
|
||||
String know_sql = "select ID,cardname from APP_ACT_KMS_CARD where cardname in (select PLNAME from APP_ACT_COE_PAL_REPOSITORY " +
|
||||
" where PLCATEGORY = 'process'and PLMETHODID !='process.framework' " +
|
||||
" and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
" ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
" 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
" '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
" '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
" '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
" '42c09260-c1d3-44b7-ac3d-f8280e04c294'))";
|
||||
List<RowMap> rowMapList_know = DBSql.getMaps(know_sql);
|
||||
for (RowMap rowmap:rowMapList_know
|
||||
) {
|
||||
String dimensionname = rowmap.getString("cardname");
|
||||
String Id = rowmap.getString("ID");
|
||||
String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 ="+Id+" WHERE PLMETHODID != 'process.framework'and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试','8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') AND PLNAME = '"+dimensionname+"'";
|
||||
int update = DBSql.update(update_sql);
|
||||
System.out.println(dimensionname+">>>>APP_ACT_KMS_CARD"+">>>>>>>>>>>>>>>>"+update);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
public class createBoJob implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
DBSql.update("update APP_ACT_COE_PAL_REPOSITORY set EXT4 = '' where ID in ('4e84f39c-0487-4014-9917-d02649ae145f')");
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
/**
|
||||
* 清空表数据,知识发布的相关知识
|
||||
*/
|
||||
public class deleteKnowJob implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
//APP_ACT_KMS_CARD
|
||||
// APP_ACT_KMS_PUBLISH
|
||||
//APP_ACT_KMS_DIMENSION
|
||||
//APP_ACT_KMS_FILE
|
||||
String sql_delete = "delete from APP_ACT_KMS_CARD";
|
||||
DBSql.update(sql_delete);
|
||||
String sql_da = "delete from APP_ACT_KMS_PUBLISH";
|
||||
DBSql.update(sql_da);
|
||||
String sql_das = "delete from APP_ACT_KMS_DIMENSION where DIMENSIONNAME !='流程制度' ";
|
||||
DBSql.update(sql_das);
|
||||
String sql_dass = "delete from APP_ACT_KMS_FILE";
|
||||
DBSql.update(sql_dass);
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
public class deleteTestBO implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
/*DBSql.update(
|
||||
"drop table T561486"
|
||||
);*/
|
||||
DBSql.update("delete from APP_ACT_BPA_EXTEND_PROFILE where PROFILEID = '6a4f14f7-9557-40d4-96c0-7d53d7b959a8' ");
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
/**
|
||||
* 存储OA流程数据
|
||||
*/
|
||||
public class getAllOA implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.job;
|
||||
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
public class updateKnowByExt4Empty implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
String sql = "update APP_ACT_COE_PAL_REPOSITORY set EXT4 = '' where ID in (select ID from APP_ACT_COE_PAL_REPOSITORY" +
|
||||
" where PLCATEGORY = 'process'and PLMETHODID !='process.framework'" +
|
||||
" and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" +
|
||||
" ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" +
|
||||
" and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," +
|
||||
" 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," +
|
||||
" '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," +
|
||||
" '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," +
|
||||
" '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
|
||||
" '42c09260-c1d3-44b7-ac3d-f8280e04c294'))";
|
||||
int update = DBSql.update(sql);
|
||||
String sqls = "update APP_ACT_COE_PAL_REPOSITORY set EXT4 = '' ";
|
||||
int updates = DBSql.update(sqls);
|
||||
}
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.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 javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class updatepalpropjob implements IJob {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
DBSql.update("delete from APP_ACT_BPA_EXTEND_PROFILE where PROFILEID = '134b2275-85ec-461a-bafc-0fe5e7acb626'");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,82 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oa;
|
||||
import com.awspaas.user.apps.integration.util.HttpClientUtils;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
|
||||
import com.actionsoft.bpms.util.ThreadMgr;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @author LiHongYu
|
||||
*/
|
||||
public class OaDeleteComponent {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(OaDeleteComponent.class);
|
||||
private String uri = SDK.getAppAPI().getProperty("com.hy.apps.integrated", "uri");
|
||||
private String userName = SDK.getAppAPI().getProperty("com.hy.apps.integrated", "restUserName");
|
||||
private String password = SDK.getAppAPI().getProperty("com.hy.apps.integrated", "restUserPwd");
|
||||
|
||||
private static class PostPendTask implements Runnable {
|
||||
int type;
|
||||
String url;
|
||||
String taskId;
|
||||
Object content;
|
||||
|
||||
public PostPendTask(String taskId ,int type, String url, Object content) {
|
||||
this.type = type;
|
||||
this.url = url;
|
||||
this.content = content;
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
String params = JSONObject.toJSONString(content);
|
||||
try {
|
||||
//httpClientUtil.setPostRequestBody(params,"application/json","UTF-8");
|
||||
int httpStatus = 1;
|
||||
//String result = httpClientUtil.getResponseBodyAsString("utf-8");
|
||||
|
||||
|
||||
if (httpStatus != HttpStatus.SC_OK){
|
||||
OaPendComponentLose opl = new OaPendComponentLose();
|
||||
TaskInstance instanceById = SDK.getTaskAPI().getInstanceById(taskId);
|
||||
if(instanceById!=null) {
|
||||
opl.careateProcess(type,taskId,instanceById.getTarget());
|
||||
}else {
|
||||
opl.careateProcess(type,taskId,"");
|
||||
}
|
||||
//logger.info("调用删除推送接口====>type:" + type + "taskId: " + taskId + ",url:" + url + ",失败!","已发起手动推送待办流程!");
|
||||
}else{
|
||||
//logger.info("调用OA删除任务接口====>type:"+type+",taskId:"+taskId+",url:"+url+",返回结果:");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//logger.info("调用OA删除任务接口====>type:"+type+"taskId:"+taskId+",url:"+url+",失败!网络异常!",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除任务
|
||||
* @param taskInstanceId DD
|
||||
*/
|
||||
public void deleteOaPending(String taskInstanceId){
|
||||
String token = "";
|
||||
OaPending pend = new OaPending();
|
||||
pend.setTaskId(taskInstanceId);
|
||||
pend.setRegisterCode("3011");
|
||||
pend.setClassify("BPM");
|
||||
pend.setToken(token);
|
||||
ThreadMgr.execute(new PostPendTask(taskInstanceId,3,uri + "/seeyon/rest/thirdPartyCommitted/deleteCommitted?token=" + token,pend));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,167 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oa;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by kkdo FanGaowei (justfgwlzx@163.com).
|
||||
* Description:
|
||||
* <pre>
|
||||
* thirdpartyMessageId 第三方消息主键(保证唯一) 必填
|
||||
* thirdpartyRegisterCode 为第三方配置的系统注册编码 必填
|
||||
* messageContent 消息内容 必填
|
||||
* thirdpartySenderId 第三方消息发起人主键(保证唯一) 非必填
|
||||
* thirdpartyReceiverId 第三方消息接收人主键(保证唯一) 必填
|
||||
* creation_date 消息创建时间(格式:yyyy-MM-dd HH:mm:ss) 必填
|
||||
* messageType 0:PC;1:移动URL接入应用;2:本地H5应用;3:本地原生应用;4:PC&移动URL接入应用;5:PC&本地H5应用;6:PC&本地原生应用 必填
|
||||
* downloadUrl 原生应用下载地址(仅3和6类型可选) 非必填
|
||||
* messageURL PC端穿透链接 非必填
|
||||
* messageH5URL 移动端穿透链接 非必填
|
||||
* appParam 原生应用穿透命令,穿透命令需要按这个顺序:iphone|ipad|android|wp 非必填</pre>
|
||||
* 2017年10月9日 下午8:21:39
|
||||
*/
|
||||
|
||||
public class OaMessage {
|
||||
private String thirdpartyMessageId;
|
||||
private String thirdpartyRegisterCode;
|
||||
private String messageContent;
|
||||
private String thirdpartySenderId;
|
||||
private String thirdpartyReceiverId;
|
||||
private String thirdpartySenderName;
|
||||
private String thirdpartyReceiverName;
|
||||
private Date creationDate;
|
||||
private int messageType;
|
||||
private String downloadUrl;
|
||||
private String messageURL;
|
||||
private String messageH5URL;
|
||||
private String appParam;
|
||||
private String noneBindingSender;
|
||||
private String noneBindingReceiver;
|
||||
|
||||
public OaMessage() {}
|
||||
|
||||
public String getNoneBindingSender() {
|
||||
return noneBindingSender;
|
||||
}
|
||||
|
||||
public void setNoneBindingSender(String noneBindingSender) {
|
||||
this.noneBindingSender = noneBindingSender;
|
||||
}
|
||||
|
||||
public String getNoneBindingReceiver() {
|
||||
return noneBindingReceiver;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void setNoneBindingReceiver(String noneBindingReceiver) {
|
||||
this.noneBindingReceiver = noneBindingReceiver;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getThirdpartySenderName() {
|
||||
return thirdpartySenderName;
|
||||
}
|
||||
|
||||
public void setThirdpartySenderName(String thirdpartySenderName) {
|
||||
this.thirdpartySenderName = thirdpartySenderName;
|
||||
}
|
||||
|
||||
public String getThirdpartyReceiverName() {
|
||||
return thirdpartyReceiverName;
|
||||
}
|
||||
|
||||
public void setThirdpartyReceiverName(String thirdpartyReceiverName) {
|
||||
this.thirdpartyReceiverName = thirdpartyReceiverName;
|
||||
}
|
||||
|
||||
public String getThirdpartyMessageId() {
|
||||
return thirdpartyMessageId;
|
||||
}
|
||||
|
||||
public void setThirdpartyMessageId(String thirdpartyMessageId) {
|
||||
this.thirdpartyMessageId = thirdpartyMessageId;
|
||||
}
|
||||
|
||||
public String getThirdpartyRegisterCode() {
|
||||
return thirdpartyRegisterCode;
|
||||
}
|
||||
|
||||
public void setThirdpartyRegisterCode(String thirdpartyRegisterCode) {
|
||||
this.thirdpartyRegisterCode = thirdpartyRegisterCode;
|
||||
}
|
||||
|
||||
public String getMessageContent() {
|
||||
return messageContent;
|
||||
}
|
||||
|
||||
public void setMessageContent(String messageContent) {
|
||||
this.messageContent = messageContent;
|
||||
}
|
||||
|
||||
public String getThirdpartySenderId() {
|
||||
return thirdpartySenderId;
|
||||
}
|
||||
|
||||
public void setThirdpartySenderId(String thirdpartySenderId) {
|
||||
this.thirdpartySenderId = thirdpartySenderId;
|
||||
}
|
||||
|
||||
public String getThirdpartyReceiverId() {
|
||||
return thirdpartyReceiverId;
|
||||
}
|
||||
|
||||
public void setThirdpartyReceiverId(String thirdpartyReceiverId) {
|
||||
this.thirdpartyReceiverId = thirdpartyReceiverId;
|
||||
}
|
||||
|
||||
public Date getCreationDate() {
|
||||
return creationDate;
|
||||
}
|
||||
|
||||
public void setCreationDate(Date creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
}
|
||||
|
||||
public int getMessageType() {
|
||||
return messageType;
|
||||
}
|
||||
|
||||
public void setMessageType(int messageType) {
|
||||
this.messageType = messageType;
|
||||
}
|
||||
|
||||
public String getDownloadUrl() {
|
||||
return downloadUrl;
|
||||
}
|
||||
|
||||
public void setDownloadUrl(String downloadUrl) {
|
||||
this.downloadUrl = downloadUrl;
|
||||
}
|
||||
|
||||
public String getMessageURL() {
|
||||
return messageURL;
|
||||
}
|
||||
|
||||
public void setMessageURL(String messageURL) {
|
||||
this.messageURL = messageURL;
|
||||
}
|
||||
|
||||
public String getMessageH5URL() {
|
||||
return messageH5URL;
|
||||
}
|
||||
|
||||
public void setMessageH5URL(String messageH5URL) {
|
||||
this.messageH5URL = messageH5URL;
|
||||
}
|
||||
|
||||
public String getAppParam() {
|
||||
return appParam;
|
||||
}
|
||||
|
||||
public void setAppParam(String appParam) {
|
||||
this.appParam = appParam;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,619 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oa;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.ProcessAPIManager;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.context.TaskBehaviorContextImpl;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.TaskCommentModel;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
||||
import com.actionsoft.bpms.commons.login.constant.LoginConst;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.server.SSOUtil;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.awspaas.user.apps.integration.XmlDatasUtil;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.xpath.DefaultXPath;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
|
||||
import com.actionsoft.bpms.org.cache.UserCache;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.exception.BPMNError;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.NotificationAPI;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.awspaas.user.apps.integration.util.HttpClientUtils;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.soap.*;
|
||||
|
||||
/**
|
||||
* @author lihyyu
|
||||
*/
|
||||
public class OaPendComponent {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(OaPendComponent.class);
|
||||
|
||||
private NotificationAPI notificationAPI = SDK.getNotificationAPI();
|
||||
|
||||
private String uri = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "uri");
|
||||
private String userName = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "restUserName");
|
||||
private String password = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "restUserPwd");
|
||||
private String[] GO_BACK = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "GO_BACK").split("\\|");
|
||||
|
||||
|
||||
private static class PostPendTask implements Runnable {
|
||||
int type;
|
||||
String url;
|
||||
String taskId;
|
||||
Object content;
|
||||
|
||||
public PostPendTask(String taskId, int type, String url, Object content) {
|
||||
this.type = type;
|
||||
this.url = url;
|
||||
this.taskId = taskId;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("createTime", new Timestamp(new Date().getTime()));
|
||||
map.put("calledCount", 1);
|
||||
if (content instanceof OaPending) {
|
||||
OaPending pend = (OaPending) this.content;
|
||||
map.put("paramId", pend.getTaskId());
|
||||
map.put("receiver", pend.getNoneBindingReceiver());
|
||||
} else if (content instanceof OaMessage) {
|
||||
OaMessage msg = (OaMessage) this.content;
|
||||
map.put("paramId", msg.getThirdpartyMessageId());
|
||||
map.put("receiver", msg.getNoneBindingReceiver());
|
||||
}
|
||||
String ty= "";
|
||||
if (type == 0) {
|
||||
ty = "推送";
|
||||
map.put("method", "sendPending");
|
||||
} else if (type == 1) {
|
||||
ty = "消息";
|
||||
map.put("method", "sendMsg");
|
||||
} else if (type == 2) {
|
||||
ty = "更新";
|
||||
map.put("method", "updatePending");
|
||||
} else {
|
||||
throw new BPMNError("类型未定义!");
|
||||
}
|
||||
|
||||
String params = JSONObject.toJSONString(content);
|
||||
map.put("params", params);
|
||||
if (params.contains("subState")) {
|
||||
|
||||
} else {
|
||||
}
|
||||
// httpClientUtil.setPostRequestBody(params,"application/json","UTF-8");
|
||||
int httpStatus = 1;
|
||||
if (httpStatus != HttpStatus.SC_OK) {
|
||||
if(type==0||type==2) {
|
||||
OaPendComponentLose opl = new OaPendComponentLose();
|
||||
int careateProcess = opl.careateProcess(type,taskId, SDK.getTaskAPI().getInstanceById(taskId).getTarget());
|
||||
if (careateProcess > 0) {
|
||||
if (type == 0) {
|
||||
logger.info("调用OA推送接口====>type:" + type + "taskId: " + taskId + ",url:" + url + ",失败!",
|
||||
"已发起手动推送待办流程!");
|
||||
}else if(type == 2){
|
||||
logger.info("调用OA更新接口====>type:" + type + "taskId: " + taskId + ",url:" + url + ",失败!",
|
||||
"已发起手动更新待办流程!");
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
logger.info("调用OA待办消息接口====>type:" + type + ",url:" + url + ",失败!" + "taskId: " + taskId);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
logger.info("调用OA待办"+ty+"接口====>taskId: " + taskId + "返回结果:");
|
||||
}
|
||||
|
||||
map.put("httpStatus", httpStatus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送待办
|
||||
*
|
||||
* @param taskInstance DD
|
||||
*/
|
||||
public void sendOaPending(TaskInstance taskInstance, ProcessExecutionContext pec) throws IOException {
|
||||
|
||||
XmlDatasUtil xmlDatasUtil = new XmlDatasUtil();
|
||||
xmlDatasUtil.setExternal_system_ID("LCZD");
|
||||
xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId());
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail();
|
||||
if (!pec.getProcessInstance().getParentTaskInstId().equals("00000000-0000-0000-0000-000000000000")){
|
||||
if (bo_act_coe_publish!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理");
|
||||
}else {
|
||||
BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail();
|
||||
if (bo_eu_1664184390101!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理");
|
||||
}else {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessDef().name+"】,点击进行处理");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条草稿流程保存成功【"+pec.getProcessInstance().getTitle()+"】");
|
||||
}
|
||||
|
||||
|
||||
//http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
if (portalUrl.equals("http://10.114.11.135:8088/portal")){
|
||||
portalUrl = "https://bpm.yili.com:8088/portal/";
|
||||
}
|
||||
xmlDatasUtil.setPcurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState());
|
||||
xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+taskInstance.getTarget()+"&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState());
|
||||
String target = taskInstance.getTarget();
|
||||
|
||||
System.out.println("当前账户======》》》》"+target);
|
||||
BO bo_eu_oa_reson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=" , target).detail();
|
||||
System.out.println("bo>>>>>>>>>>"+bo_eu_oa_reson);
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒
|
||||
String str = df.format(taskInstance.getBeginTime());
|
||||
String substring = str.substring(str.indexOf(" "), str.length());
|
||||
xmlDatasUtil.setTo_do_creation_time(substring);
|
||||
xmlDatasUtil.setTo_do_completion_time(substring);
|
||||
//if (taskInstance.getState()==1){
|
||||
xmlDatasUtil.setTo_do_status("0");
|
||||
//}
|
||||
xmlDatasUtil.setTo_do_official_type("0");
|
||||
// if (taskInstance.getReadState()==0){
|
||||
// xmlDatasUtil.setViewtype("0");
|
||||
// }else if (taskInstance.getReadState()==1){
|
||||
xmlDatasUtil.setViewtype("0");
|
||||
// }
|
||||
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
|
||||
xmlDatasUtil.setDonedate(str.substring(0, str.indexOf(" ")));
|
||||
/*String der ="";
|
||||
if (taskInstance.getReadTime()!=null){
|
||||
der = df.format(taskInstance.getReadTime());
|
||||
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
|
||||
}else {
|
||||
der = df.format(taskInstance.getBeginTime());
|
||||
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
|
||||
}*/
|
||||
xmlDatasUtil.setReceivedate(str.substring(0, str.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(substring);
|
||||
|
||||
xmlDatasUtil.setCurrentnodetype("0");
|
||||
xmlDatasUtil.setRequestcode(pec.getProcessInstance().getId());
|
||||
xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(pec.getProcessInstance().getProcessDefId(),taskInstance.getActivityDefId()).getName());
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = pec.getProcessInstance().getAppId();
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//流程实例id,必填
|
||||
params.put("processInstId", pec.getProcessInstance().getId());
|
||||
//,必填
|
||||
params.put("sid", pec.getUserContext().getSessionId());
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//流程节点数据
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
String username = "";
|
||||
String userid = "";
|
||||
if (ro.isOk()){
|
||||
List list = new ArrayList();
|
||||
Object processBudgetModelList = ro.get("processBudgetModelList");
|
||||
JSONArray array = JSON.parseArray(String.valueOf(processBudgetModelList));
|
||||
|
||||
if (!array.isEmpty()){
|
||||
for(int i=0;i<array.size();i++){
|
||||
JSONObject jsonObject = JSONObject.parseObject(array.get(i).toString());
|
||||
String executor = jsonObject.get("executor").toString();
|
||||
String userid2 = jsonObject.get("userid2").toString();
|
||||
//String userid2 = jsonArray.getJSONObject(i).getString("userid2");
|
||||
username+=executor+" ";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setNooperator(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
|
||||
xmlDatasUtil.setWorkcode("");
|
||||
xmlDatasUtil.setWorkflowname(pec.getProcessInstance().getTitle());
|
||||
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
xmlDatasUtil.setCreaterworkcode("");
|
||||
|
||||
|
||||
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
|
||||
System.out.println("状态码============》》》》》》》》》》》"+s);
|
||||
|
||||
BO bo = new BO();
|
||||
bo.set("OUTSYSID",xmlDatasUtil.getExternal_system_ID());
|
||||
bo.set("TODOID",xmlDatasUtil.getOther_system_to_do_ID());
|
||||
bo.set("CONTENT",xmlDatasUtil.getProcess_title());
|
||||
bo.set("PCURL",xmlDatasUtil.getPcurl());
|
||||
bo.set("MOBILEURL",xmlDatasUtil.getMobileurl());
|
||||
bo.set("HRCODE",xmlDatasUtil.getTo_do_login_account());
|
||||
bo.set("STATUS",xmlDatasUtil.getTo_do_status());
|
||||
bo.set("WFTYPE",xmlDatasUtil.getTo_do_official_type());
|
||||
bo.set("VIEWTYPE",xmlDatasUtil.getViewtype());
|
||||
bo.set("CREATEDATES",xmlDatasUtil.getCreatedate());
|
||||
bo.set("NEWCREATETIME",xmlDatasUtil.getTo_do_creation_time());
|
||||
bo.set("DONEDATE",xmlDatasUtil.getDonedate());
|
||||
bo.set("NEWDONETIME",xmlDatasUtil.getTo_do_status());
|
||||
bo.set("RECEIVEDATE",xmlDatasUtil.getReceivedate());
|
||||
bo.set("RECEIVETIME",xmlDatasUtil.getReceivetime());
|
||||
bo.set("CURRENTNODETYPE",xmlDatasUtil.getCurrentnodetype());
|
||||
bo.set("REQUESTCODE",xmlDatasUtil.getRequestcode());
|
||||
bo.set("CURRENTNODENAME",xmlDatasUtil.getCurrentnodename());
|
||||
bo.set("NOOPERATOR",xmlDatasUtil.getNooperator());
|
||||
bo.set("CREATERHRCODE",xmlDatasUtil.getCreaterhrcode());
|
||||
bo.set("WORKFLOWNAME",xmlDatasUtil.getWorkflowname());
|
||||
bo.set("OA_RESULT",s);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
bo.set("OA_DATE",sdf.format(new Date()));
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL",bo,UserContext.fromUID(taskInstance.getTarget()));
|
||||
if (s.contains("success")){
|
||||
System.out.println("发送待办任务完成,请去OA系统上查看是否传输完成");
|
||||
}else {
|
||||
System.out.println("发送待办任务失败,请联系管理员查看是否出现错误");
|
||||
System.out.println("错误提示>>>>>>>>>>>>"+s);
|
||||
BO bo_eu_faid_data = SDK.getBOAPI().query("BO_EU_FAID_DATA", true).addQuery("TASK_ID=", taskInstance.getId()).detail();
|
||||
if (bo_eu_faid_data==null){
|
||||
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", pec.getUserContext().getUserName() + "失败更新待办");
|
||||
BO bo_faid = new BO();
|
||||
bo_faid.set("CHANGED","1");
|
||||
bo_faid.set("TASK_ID",taskInstance.getId());
|
||||
bo_faid.set("PROCESS_ID",pec.getProcessInstance().getId());
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext);
|
||||
SDK.getProcessAPI().start(processInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构造待办打开链接
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String buildTaskUrl(TaskInstance taskInstance, ProcessExecutionContext pec) {
|
||||
// portal 地址
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
// String portalUrl = "http://localhost:8088/portal";
|
||||
// 执行人账a户
|
||||
String target = taskInstance.getTarget();
|
||||
|
||||
// 流程实例id
|
||||
String bindId = pec.getProcessInstance().getId();
|
||||
// 任务实例id
|
||||
String taskId = taskInstance.getId();
|
||||
StringBuilder stringBuilder = new StringBuilder(portalUrl);
|
||||
try {
|
||||
// final String[] encodeRsa = encodeRsa(target);
|
||||
stringBuilder.append("/r/or?cmd=com.yili_form_page_open&processInstId=").append(bindId)
|
||||
.append("&taskInstId=").append(taskId).append("&uid=").append(target)
|
||||
.append("&oauthName=oauthLogin");
|
||||
return stringBuilder.toString();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新待办状态
|
||||
* @param taskInstance
|
||||
* @param pec
|
||||
*/
|
||||
public void updatePending(TaskInstance taskInstance, ProcessExecutionContext pec) throws IOException, SOAPException, DocumentException {
|
||||
XmlDatasUtil xmlDatasUtil = new XmlDatasUtil();
|
||||
xmlDatasUtil.setExternal_system_ID("LCZD");
|
||||
|
||||
xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId());
|
||||
System.out.println("pec.getProcessInstance()>>>>>>>>"+pec.getProcessInstance());
|
||||
if(pec.getProcessInstance()!=null){
|
||||
String actionName = getActionName(taskInstance);
|
||||
if (actionName.equals("传阅")){
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail();
|
||||
if (bo_act_coe_publish!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条传阅流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理");
|
||||
}else {
|
||||
BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail();
|
||||
if (bo_eu_1664184390101!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条传阅流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理");
|
||||
}else {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条传阅流程【"+pec.getProcessDef().name+"】,点击进行处理");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail();
|
||||
if (bo_act_coe_publish!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理");
|
||||
}else {
|
||||
BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail();
|
||||
if (bo_eu_1664184390101!=null){
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理");
|
||||
}else {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessDef().name+"】,点击进行处理");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条发布流程被作废,点击进行处理");
|
||||
}
|
||||
|
||||
//http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
if (portalUrl.equals("http://10.114.11.135:8088/portal")){
|
||||
portalUrl = "https://bpm.yili.com:8088/portal/";
|
||||
}
|
||||
if (pec.getProcessInstance()!=null){
|
||||
xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState());
|
||||
xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState());
|
||||
}else {
|
||||
xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=CLIENT_BPM_FORM_TRACK_OPEN&oauthName=oauthLogin&processInstId="+taskInstance.getProcessInstId()+"&sourceApp=prm");
|
||||
xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=CLIENT_BPM_FORM_TRACK_OPEN&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId="+taskInstance.getProcessInstId()+"&sourceApp=prm");
|
||||
}
|
||||
|
||||
String target = taskInstance.getTarget();
|
||||
|
||||
System.out.println("当前账户======》》》》"+target);
|
||||
BO bo_eu_oa_reson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=" , target).detail();
|
||||
System.out.println("bo>>>>>>>>>>>>>>"+bo_eu_oa_reson);
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID"));
|
||||
}
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒
|
||||
if (taskInstance.getBeginTime()!=null){
|
||||
String str = df.format(taskInstance.getBeginTime());
|
||||
String substring = str.substring(str.indexOf(" "), str.length());
|
||||
xmlDatasUtil.setTo_do_creation_time(substring);
|
||||
xmlDatasUtil.setTo_do_completion_time(df.format(taskInstance.getBeginTime()).substring(df.format(taskInstance.getBeginTime()).indexOf(" "), df.format(taskInstance.getBeginTime()).length()));
|
||||
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
|
||||
xmlDatasUtil.setDonedate(df.format(taskInstance.getBeginTime()).substring(0, df.format(taskInstance.getBeginTime()).indexOf(" ")));
|
||||
}else {
|
||||
String str = df.format(new Date());
|
||||
String substring = str.substring(str.indexOf(" "), str.length());
|
||||
xmlDatasUtil.setTo_do_creation_time(substring);
|
||||
xmlDatasUtil.setTo_do_completion_time(df.format(new Date()).substring(df.format(new Date()).indexOf(" "), df.format(new Date()).length()));
|
||||
xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" ")));
|
||||
xmlDatasUtil.setDonedate(df.format(new Date()).substring(0, df.format(new Date()).indexOf(" ")));
|
||||
}
|
||||
|
||||
xmlDatasUtil.setTo_do_status("1");
|
||||
|
||||
xmlDatasUtil.setTo_do_official_type("0");
|
||||
|
||||
xmlDatasUtil.setViewtype("-2");
|
||||
|
||||
|
||||
String der = "";
|
||||
if (taskInstance.getReadTime()==null){
|
||||
der= df.format(new Date());
|
||||
}else {
|
||||
der= df.format(taskInstance.getReadTime());
|
||||
}
|
||||
|
||||
xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" ")));
|
||||
xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length()));
|
||||
if (taskInstance!=null){
|
||||
String actionName = getActionName(taskInstance);
|
||||
if (actionName.equals("确认发布")||equalsAction(GO_BACK, actionName)){
|
||||
xmlDatasUtil.setCurrentnodetype("1");
|
||||
}else{
|
||||
xmlDatasUtil.setCurrentnodetype("0");
|
||||
}
|
||||
}else {
|
||||
xmlDatasUtil.setCurrentnodetype("0");
|
||||
}
|
||||
|
||||
|
||||
if (pec.getProcessInstance()!=null) {
|
||||
xmlDatasUtil.setRequestcode(pec.getProcessInstance().getId());
|
||||
xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(pec.getProcessInstance().getProcessDefId(),taskInstance.getActivityDefId()).getName());
|
||||
// 调用App
|
||||
String sourceAppId = pec.getProcessInstance().getAppId();
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//流程实例id,必填
|
||||
params.put("processInstId", pec.getProcessInstance().getId());
|
||||
//,必填
|
||||
if (pec.getUserContext()!=null){
|
||||
params.put("sid", pec.getUserContext().getSessionId());
|
||||
}else {
|
||||
String sessionId = new SSOUtil().registerClientSessionNoPassword(pec.getTaskInstance().getTarget(), LoginConst.DEFAULT_LANG, "127.0.0.1", LoginConst.DEVICE_PC);
|
||||
params.put("sid", sessionId);
|
||||
}
|
||||
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//流程节点数据
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
String username = "";
|
||||
String userid = "";
|
||||
if (ro.isOk()){
|
||||
String data = ro.getData().toString();
|
||||
JSONObject jsonObject = JSONObject.parseObject(data);
|
||||
JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("processBudgetModelList"));
|
||||
if (!jsonArray.isEmpty()){
|
||||
for(int i=0;i<jsonArray.size();i++){
|
||||
String filename = jsonArray.getJSONObject(i).getString("executor");
|
||||
String userid2 = jsonArray.getJSONObject(i).getString("userid2");
|
||||
username+=filename+" ";
|
||||
userid+=userid2+" ";
|
||||
}
|
||||
}
|
||||
}
|
||||
xmlDatasUtil.setNooperator(username);
|
||||
}else {
|
||||
xmlDatasUtil.setRequestcode("");
|
||||
}
|
||||
|
||||
|
||||
|
||||
xmlDatasUtil.setWorkcode("");
|
||||
if (pec.getProcessDef()!=null){
|
||||
xmlDatasUtil.setWorkflowname(pec.getProcessDef().getName());
|
||||
}else {
|
||||
xmlDatasUtil.setWorkflowname("流程发布");
|
||||
}
|
||||
|
||||
if (bo_eu_oa_reson!=null){
|
||||
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
xmlDatasUtil.setCreaterworkcode("");
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
|
||||
|
||||
System.out.println("已办查看是否修改");
|
||||
|
||||
|
||||
|
||||
BO bo = new BO();
|
||||
bo.set("OUTSYSID",xmlDatasUtil.getExternal_system_ID());
|
||||
bo.set("TODOID",xmlDatasUtil.getOther_system_to_do_ID());
|
||||
bo.set("CONTENT",xmlDatasUtil.getProcess_title());
|
||||
bo.set("PCURL",xmlDatasUtil.getPcurl());
|
||||
bo.set("MOBILEURL",xmlDatasUtil.getMobileurl());
|
||||
bo.set("HRCODE",xmlDatasUtil.getTo_do_login_account());
|
||||
bo.set("STATUS",xmlDatasUtil.getTo_do_status());
|
||||
bo.set("WFTYPE",xmlDatasUtil.getTo_do_official_type());
|
||||
bo.set("VIEWTYPE",xmlDatasUtil.getViewtype());
|
||||
bo.set("CREATEDATES",xmlDatasUtil.getCreatedate());
|
||||
bo.set("NEWCREATETIME",xmlDatasUtil.getTo_do_creation_time());
|
||||
bo.set("DONEDATE",xmlDatasUtil.getDonedate());
|
||||
bo.set("NEWDONETIME",xmlDatasUtil.getTo_do_status());
|
||||
bo.set("RECEIVEDATE",xmlDatasUtil.getReceivedate());
|
||||
bo.set("RECEIVETIME",xmlDatasUtil.getReceivetime());
|
||||
bo.set("CURRENTNODETYPE",xmlDatasUtil.getCurrentnodetype());
|
||||
bo.set("REQUESTCODE",xmlDatasUtil.getRequestcode());
|
||||
bo.set("CURRENTNODENAME",xmlDatasUtil.getCurrentnodename());
|
||||
bo.set("NOOPERATOR",xmlDatasUtil.getNooperator());
|
||||
bo.set("CREATERHRCODE",xmlDatasUtil.getCreaterhrcode());
|
||||
bo.set("WORKFLOWNAME",xmlDatasUtil.getWorkflowname());
|
||||
bo.set("OA_RESULT",s);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
bo.set("OA_DATE",sdf.format(new Date()));
|
||||
if (taskInstance!=null&&StringUtils.isNotEmpty(taskInstance.getTarget())){
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL",bo,UserContext.fromUID(taskInstance.getTarget()));
|
||||
}else {
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL",bo,UserContext.fromUID("admin"));
|
||||
}
|
||||
|
||||
if (s.contains("success")){
|
||||
System.out.println("发送待办任务完成,请去OA系统上查看是否传输完成");
|
||||
}else {
|
||||
System.out.println("发送待办任务失败,请联系管理员查看是否出现错误");
|
||||
System.out.println("错误提示>>>>>>>>>>>>"+s);
|
||||
BO bo_eu_faid_data = SDK.getBOAPI().query("BO_EU_FAID_DATA").addQuery("TASK_ID=", taskInstance.getId()).detail();
|
||||
if (bo_eu_faid_data==null){
|
||||
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", "admin" + "失败更新待办");
|
||||
BO bo_faid = new BO();
|
||||
bo_faid.set("CHANGED","2");
|
||||
bo_faid.set("TASK_ID",taskInstance.getId());
|
||||
if (pec.getProcessInstance()!=null){
|
||||
bo_faid.set("PROCESS_ID",pec.getProcessInstance().getId());
|
||||
}
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext);
|
||||
SDK.getProcessAPI().start(processInstance);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void readOa(String taskId) throws Exception {
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
String s = httpClientUtil.readOa("http://10.105.1.59/services/yili", taskId);
|
||||
System.out.println("是否更新成已读了》》》》》》》》》》"+s);
|
||||
}
|
||||
|
||||
private String getActionName(TaskInstance taskInstance) {
|
||||
if (null == taskInstance) {
|
||||
return "";
|
||||
}
|
||||
String actionName = "";
|
||||
Iterator<TaskCommentModel> iterator = null;
|
||||
if (StringUtils.isNotEmpty(taskInstance.getProcessInstId())){
|
||||
iterator= ProcessAPIManager.getInstance()
|
||||
.getComments(taskInstance.getProcessInstId()).iterator();
|
||||
|
||||
|
||||
TaskCommentModel next;
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
if ((next = iterator.next()).getTaskInstId().equals(taskInstance.getId())) {
|
||||
actionName = next.getActionName();
|
||||
}
|
||||
}
|
||||
}
|
||||
return actionName;
|
||||
}
|
||||
|
||||
private boolean equalsAction(String[] actions, String actionName) {
|
||||
for (int i = 0, n = actions.length; i < n; i++) {
|
||||
if (actions[i].equals(actionName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private String gettaskname(TaskInstance taskInstance) {
|
||||
if (null == taskInstance) {
|
||||
return "";
|
||||
}
|
||||
final Iterator<TaskCommentModel> iterator = ProcessAPIManager.getInstance()
|
||||
.getComments(taskInstance.getProcessInstId()).iterator();
|
||||
TaskCommentModel next;
|
||||
String actionName = "";
|
||||
while (iterator.hasNext()) {
|
||||
if ((next = iterator.next()).getTaskInstId().equals(taskInstance.getId())) {
|
||||
actionName = next.getActionName();
|
||||
}
|
||||
}
|
||||
return actionName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oa;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
|
||||
/**
|
||||
* 待办推送/更新失败发起手动推送流程
|
||||
*/
|
||||
public class OaPendComponentLose {
|
||||
|
||||
public int careateProcess(int type,String taskId,String target) {
|
||||
String ty = "";
|
||||
if(type==0) {
|
||||
ty="推送";
|
||||
}else if(type==2) {
|
||||
ty="更新";
|
||||
}else if(type==3) {
|
||||
ty="删除";
|
||||
}
|
||||
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
String userName = SDK.getORGAPI().getUser(target).getUserName();
|
||||
SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
ProcessInstance processInst = SDK.getProcessAPI().createProcessInstance("obj_a1fb5f704992495982da2a876e5e1146","admin",formatter.format(date)+"收到来自【"+userName+"】的手动待办"+ty+"任务");
|
||||
SDK.getProcessAPI().start(processInst).fetchActiveTasks().get(0);
|
||||
BO bo = new BO();
|
||||
bo.set("TASKID", taskId);
|
||||
bo.set("TAR", SDK.getORGAPI().getUser(target).getUserName());
|
||||
bo.set("TYPE",ty);
|
||||
bo.set("TASKTITLE",SDK.getTaskAPI().getInstanceById(taskId).getTitle());
|
||||
int create = SDK.getBOAPI().create("BO_HY_SYNC_LOSE", bo, processInst, UserContext.fromUID("admin"));
|
||||
return create ;
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,233 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oa;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class OaPending {
|
||||
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 第三方待办标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 调用类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 第三方待发已发已办发送人姓名
|
||||
*/
|
||||
|
||||
private String sendName;
|
||||
/**
|
||||
* 第三方待办发送人姓名
|
||||
*/
|
||||
private String senderName;
|
||||
|
||||
/**
|
||||
* 第三方待办发送人ID,在OA中不重要,显示发送人姓名即可,不需要转化
|
||||
*/
|
||||
private String thirdSenderId;
|
||||
/**
|
||||
* 第三方待办接收人员ID,需要对于人员绑定表中的ID,在OA中非常重要,可以保存下此ID,并做转化
|
||||
*/
|
||||
private String thirdReceiverId;
|
||||
/**
|
||||
* 正文类型:非必填项
|
||||
*/
|
||||
private String contentType;
|
||||
/**
|
||||
* 正文内容:非必填项
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 待办PC端连接地址
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* 待办移动端H5连接地址
|
||||
*/
|
||||
private String h5Url;
|
||||
/**
|
||||
* 移动端app打开参数
|
||||
*/
|
||||
private String appParam;
|
||||
/**
|
||||
* 第三方待办ID
|
||||
*/
|
||||
private String taskId;
|
||||
/**
|
||||
* 业务类型,非必填
|
||||
*/
|
||||
private String classify;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
protected String creationDate;
|
||||
/**
|
||||
* 状态:0:未办理;1:已办理
|
||||
*/
|
||||
private String state;
|
||||
/**
|
||||
* 子状态:0/1/2/3同意已办/不同意已办/取消/驳回
|
||||
*/
|
||||
private String subState;
|
||||
/**
|
||||
* 注册应用ID
|
||||
*/
|
||||
private Long registerId;
|
||||
|
||||
private String noneBindingSender;
|
||||
|
||||
private String noneBindingReceiver;
|
||||
|
||||
/**
|
||||
* 注册系统编码
|
||||
*/
|
||||
private String registerCode;
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
public String getSendName() {
|
||||
return sendName;
|
||||
}
|
||||
|
||||
public void setSendName(String sendName) {
|
||||
this.sendName = sendName;
|
||||
}
|
||||
|
||||
public Long getRegisterId() {
|
||||
return registerId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getNoneBindingSender() {
|
||||
return noneBindingSender;
|
||||
}
|
||||
|
||||
|
||||
public void setNoneBindingSender(String noneBindingSender) {
|
||||
this.noneBindingSender = noneBindingSender;
|
||||
}
|
||||
|
||||
|
||||
public String getNoneBindingReceiver() {
|
||||
return noneBindingReceiver;
|
||||
}
|
||||
|
||||
|
||||
public void setNoneBindingReceiver(String noneBindingReceiver) {
|
||||
this.noneBindingReceiver = noneBindingReceiver;
|
||||
}
|
||||
|
||||
public void setRegisterId(Long registerId) {
|
||||
this.registerId = registerId;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getSenderName() {
|
||||
return senderName;
|
||||
}
|
||||
public void setSenderName(String senderName) {
|
||||
this.senderName = senderName;
|
||||
}
|
||||
public String getThirdSenderId() {
|
||||
return thirdSenderId;
|
||||
}
|
||||
public void setThirdSenderId(String thirdSenderId) {
|
||||
this.thirdSenderId = thirdSenderId;
|
||||
}
|
||||
public String getThirdReceiverId() {
|
||||
return thirdReceiverId;
|
||||
}
|
||||
public void setThirdReceiverId(String thirdReceiverId) {
|
||||
this.thirdReceiverId = thirdReceiverId;
|
||||
}
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
public String getH5Url() {
|
||||
return h5Url;
|
||||
}
|
||||
public void setH5Url(String h5Url) {
|
||||
this.h5Url = h5Url;
|
||||
}
|
||||
public String getAppParam() {
|
||||
return appParam;
|
||||
}
|
||||
public void setAppParam(String appParam) {
|
||||
this.appParam = appParam;
|
||||
}
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
public String getCreationDate() {
|
||||
return creationDate;
|
||||
}
|
||||
public void setCreationDate(String creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
}
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
public String getSubState() {
|
||||
return subState;
|
||||
}
|
||||
public void setSubState(String subState) {
|
||||
this.subState = subState;
|
||||
}
|
||||
|
||||
public String getRegisterCode() {
|
||||
return registerCode;
|
||||
}
|
||||
public void setRegisterCode(String registerCode) {
|
||||
this.registerCode = registerCode;
|
||||
}
|
||||
public String getClassify() {
|
||||
return classify;
|
||||
}
|
||||
public void setClassify(String classify) {
|
||||
this.classify = classify;
|
||||
}
|
||||
}
|
||||
@ -1,302 +0,0 @@
|
||||
|
||||
package com.awspaas.user.apps.integration.oa;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.awspaas.user.apps.integration.util.HttpClientUtils;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.def.ProcessDefinition;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
|
||||
import com.actionsoft.bpms.org.cache.UserCache;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.bpms.util.ThreadMgr;
|
||||
import com.actionsoft.exception.BPMNError;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.NotificationAPI;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
|
||||
/**
|
||||
* @author DengPeng 待发
|
||||
*/
|
||||
public class OaReadyComponent {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(OaReadyComponent.class);
|
||||
|
||||
private NotificationAPI notificationAPI = SDK.getNotificationAPI();
|
||||
|
||||
private String uri = SDK.getAppAPI().getProperty("com.hy.apps.integrated", "uri");
|
||||
private String userName = SDK.getAppAPI().getProperty("com.hy.apps.integrated", "restUserName");
|
||||
private String password = SDK.getAppAPI().getProperty("com.hy.apps.integrated", "restUserPwd");
|
||||
|
||||
private static class PostPendTask implements Runnable{
|
||||
int type;
|
||||
String url;
|
||||
String taskId;
|
||||
Object content;
|
||||
|
||||
public PostPendTask(String taskId,int type, String url, Object content) {
|
||||
this.type = type;
|
||||
this.url = url;
|
||||
this.taskId = taskId;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
|
||||
map.put("createTime",new Timestamp(new Date().getTime()));
|
||||
System.out.println(new Timestamp(new Date().getTime()));
|
||||
map.put("calledCount",1);
|
||||
if (content instanceof OaPending){
|
||||
OaPending pend = (OaPending) this.content;
|
||||
map.put("paramId",pend.getTaskId());
|
||||
map.put("receiver",pend.getNoneBindingReceiver());
|
||||
|
||||
}else if (content instanceof OaMessage){
|
||||
OaMessage msg = (OaMessage) this.content;
|
||||
map.put("paramId",msg.getThirdpartyMessageId());
|
||||
map.put("receiver",msg.getNoneBindingReceiver());
|
||||
}
|
||||
String ty = "";
|
||||
if (type == 0){
|
||||
ty = "推送";
|
||||
map.put("method","sendPending");
|
||||
}else if (type == 1){
|
||||
map.put("method","sendMsg");
|
||||
}else if (type == 2){
|
||||
ty = "新增";
|
||||
map.put("method","updatePending");
|
||||
}else {
|
||||
throw new BPMNError("类型未定义!");
|
||||
}
|
||||
|
||||
String params = JSONObject.toJSONString(content);
|
||||
if(params.contains("subState")) {
|
||||
// httpClientUtil.setPostRequestBody("["+params+"]","application/json","UTF-8");
|
||||
}else {
|
||||
//httpClientUtil.setPostRequestBody(params,"application/json","UTF-8");
|
||||
}
|
||||
map.put("params",params);
|
||||
int httpStatus = 1;
|
||||
String result = httpClientUtil.toString();
|
||||
if (httpStatus != HttpStatus.SC_OK){
|
||||
logger.info("调用OA待发"+ty+"接口====>type:"+type+",url:"+url+",失败!"+"taskId: "+taskId);
|
||||
}else{
|
||||
logger.info("调用OA待发"+ty+"接口====>taskId: "+taskId+",返回结果:"+result);
|
||||
}
|
||||
|
||||
map.put("httpStatus",httpStatus);
|
||||
map.put("result",result);
|
||||
|
||||
try{
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
map.put("success",jsonObject.getString("success"));
|
||||
}catch (Exception e){
|
||||
map.put("success","error");
|
||||
}
|
||||
// RowMap oldRecord = DBSql.getMap("SELECT id FROM app_hy_integrated_call_oa_recording WHERE paramId=? and method=?", map.get("paramId"),map.get("method"));
|
||||
//if (!CollectionUtils.isEmpty(oldRecord)){
|
||||
// map.put("id",oldRecord.getLong("ID"));
|
||||
// DBSql.update("UPDATE app_hy_integrated_call_oa_recording SET params=:params,receiver=:receiver,httpStatus=:httpStatus,result=:result,success=:success,calledCount=calledCount+1,lastCallTime=NOW() WHERE id=:id",map);
|
||||
// }else{
|
||||
// DBSql.update(DBSql.getInsertStatement("app_hy_integrated_call_oa_recording", map), map);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送待发
|
||||
* @param taskInstance DD
|
||||
*/
|
||||
public void sendOaPending(TaskInstance taskInstance, ProcessExecutionContext pec){
|
||||
String token = "";
|
||||
OaPending pend = new OaPending();
|
||||
pend.setTaskId(taskInstance.getId());
|
||||
ProcessInstance processInstance = pec.getProcessInstance();
|
||||
pend.setTitle(processInstance.getTitle());
|
||||
ProcessDefinition processDef = pec.getProcessDef();
|
||||
String appId = processDef.getAppId();
|
||||
if("com.hy.apps.swgl".equals(appId)||"com.hy.apps.rmm".equals(appId)||"com.hy.apps.mms".equals(appId)) {
|
||||
pend.setRegisterCode("3001");
|
||||
pend.setClassify("明源");
|
||||
}else {
|
||||
pend.setRegisterCode("3011");
|
||||
pend.setClassify("BPM");
|
||||
}
|
||||
|
||||
pend.setSendName(SDK.getORGAPI().getUser(processInstance.getCreateUser()).getUserName());
|
||||
UserModel targetUserModel = UserCache.getModel(taskInstance.getTarget());
|
||||
if (null == targetUserModel || StringUtils.isBlank(targetUserModel.getExt5())){
|
||||
String msg = "账号对应的OA账号为空!待发不能推送,请补充完善账号信息!BPM账号:"+taskInstance.getTarget();
|
||||
logger.error(msg);
|
||||
|
||||
//给 杨波 推消息
|
||||
notificationAPI.sendSystemMessage("admin", msg,"error");
|
||||
return;
|
||||
}
|
||||
pend.setCreationDate(taskInstance.getBeginTime().toString());
|
||||
pend.setNoneBindingReceiver(targetUserModel.getExt5());
|
||||
pend.setState("10");
|
||||
pend.setType("add");
|
||||
|
||||
String taskUrl = buildTaskUrl(taskInstance,pec);
|
||||
if (null == taskUrl){
|
||||
return;
|
||||
}
|
||||
pend.setUrl(taskUrl);
|
||||
pend.setH5Url(taskUrl);
|
||||
|
||||
ThreadMgr.execute(new PostPendTask(taskInstance.getId(),0,uri + "/seeyon/rest/thirdPartyCommittedWillDone/addSingleWillDone?token=" + token,pend));
|
||||
OaMessage msg = buildMsg(taskInstance, pec, taskUrl);
|
||||
if (null != msg){
|
||||
//ThreadMgr.execute(new PostPendTask(1,uri + "/seeyon/rest/thirdpartyMessage/receive/singleMessage?token=" + token,msg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendOaPending(OaPending pend){
|
||||
String token = "";
|
||||
pend.setToken(token);
|
||||
pend.setRegisterCode("3011");
|
||||
pend.setState("0");
|
||||
pend.setSubState("0");
|
||||
ThreadMgr.execute(new PostPendTask("",0,uri + "/seeyon/rest/thirdPartyCommittedWillDone/addSingleWillDone?token=" + token,pend));
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造待发打开链接
|
||||
* @return
|
||||
*/
|
||||
private String buildTaskUrl(TaskInstance taskInstance, ProcessExecutionContext pec){
|
||||
//portal 地址
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
// String portalUrl = "http://localhost:8088/portal";
|
||||
//执行人账a户
|
||||
String target = taskInstance.getTarget();
|
||||
//流程实例id
|
||||
String bindId =pec.getProcessInstance().getId();
|
||||
//任务实例id
|
||||
String taskId =taskInstance.getId();
|
||||
StringBuilder stringBuilder = new StringBuilder(portalUrl);
|
||||
try {
|
||||
stringBuilder.append("/r/or?cmd=com.hy_client_bpm_form_main_page_open&processInstId=").append(bindId).append("&taskInstId=").append(taskId).append("&uid=").append(target)
|
||||
.append("&oauthName=oauthLogin");
|
||||
|
||||
//append(URLEncoder.encode(encodeRsa[0],"UTF-8"))
|
||||
return stringBuilder.toString();
|
||||
} catch (Exception e) {
|
||||
logger.error("构造ticket失败!",e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新待发状态
|
||||
*/
|
||||
public void updatePending(String taskInstanceId,String state,String subState) {
|
||||
String token = "";
|
||||
OaPending pend = new OaPending();
|
||||
pend.setTaskId(taskInstanceId);
|
||||
pend.setState(state);
|
||||
pend.setSubState(subState);
|
||||
pend.setToken(token);
|
||||
TaskInstance taskInstance = SDK.getTaskAPI().getTaskInstance(taskInstanceId);
|
||||
ProcessDefinition processDefinition = SDK.getRepositoryAPI().getProcessDefinition(taskInstance.getProcessDefId());
|
||||
String appId = processDefinition.getAppId();
|
||||
if("com.hy.apps.swgl".equals(appId)||"com.hy.apps.rmm".equals(appId)||"com.hy.apps.mms".equals(appId)) {
|
||||
pend.setRegisterCode("3001");
|
||||
}else {
|
||||
pend.setRegisterCode("3011");
|
||||
}
|
||||
ThreadMgr.execute(new PostPendTask(taskInstanceId,2,uri + "/seeyon/rest/thirdPartyCommitted/updateState?token=" + token,pend));
|
||||
}
|
||||
|
||||
public void updatePending(OaPending pend,boolean async) {
|
||||
String token = "";
|
||||
pend.setRegisterCode("3011");
|
||||
pend.setToken(token);
|
||||
if (async){
|
||||
ThreadMgr.execute(new PostPendTask("",2,uri + "/seeyon/rest/thirdPartyCommitted/updateState?token=" + token,pend));
|
||||
}else {
|
||||
PostPendTask postPendTask = new PostPendTask("",1, uri + "/seeyon/rest/thirdPartyCommitted/updateState?token=" + token, pend);
|
||||
postPendTask.run();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updatePending(OaPending pend) {
|
||||
updatePending(pend,true);
|
||||
}
|
||||
|
||||
|
||||
public void sendMessage(TaskInstance taskInstance, ProcessExecutionContext pec){
|
||||
String taskUrl = buildTaskUrl(taskInstance, pec);
|
||||
if (null == taskUrl){
|
||||
return;
|
||||
}
|
||||
OaMessage oaMessage = buildMsg(taskInstance, pec, taskUrl);
|
||||
if (null != oaMessage){
|
||||
String token = "";
|
||||
ThreadMgr.execute(new PostPendTask(taskInstance.getId(),1,uri + "/seeyon/rest/thirdpartyMessage/receive/singleMessage?token=" + token,oaMessage));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendMessage(OaMessage msg){
|
||||
msg.setThirdpartyRegisterCode("3011");
|
||||
String token = "";
|
||||
ThreadMgr.execute(new PostPendTask("",1,uri + "/seeyon/rest/thirdpartyMessage/receive/singleMessage?token=" + token,msg));
|
||||
}
|
||||
|
||||
private OaMessage buildMsg(TaskInstance taskInstance, ProcessExecutionContext pec, String msgUrl){
|
||||
ProcessInstance processInstance = pec.getProcessInstance();
|
||||
OaMessage msg = new OaMessage();
|
||||
ProcessDefinition processDef = pec.getProcessDef();
|
||||
String appId = processDef.getAppId();
|
||||
|
||||
if("com.hy.apps.swgl".equals(appId)||"com.hy.apps.rmm".equals(appId)||"com.hy.apps.mms".equals(appId)) {
|
||||
msg.setThirdpartyRegisterCode("3001");
|
||||
}else {
|
||||
msg.setThirdpartyRegisterCode("3011");
|
||||
}
|
||||
msg.setThirdpartyMessageId(taskInstance.getId()+System.currentTimeMillis());
|
||||
msg.setMessageContent("收到待发事项:"+processInstance.getTitle());
|
||||
msg.setThirdpartyReceiverId(taskInstance.getTarget());
|
||||
msg.setThirdpartySenderId(processInstance.getCreateUser());
|
||||
|
||||
UserModel targetUserModel = UserCache.getModel(taskInstance.getTarget());
|
||||
if (null == targetUserModel || StringUtils.isBlank(targetUserModel.getExt5())){
|
||||
String content = "账号对应的OA账号为空!待发不能推送,请补充完善账号信息!BPM账号:"+taskInstance.getTarget();
|
||||
logger.error(content);
|
||||
|
||||
//给 杨波 推消息
|
||||
notificationAPI.sendSystemMessage("admin",content,"error");
|
||||
return null;
|
||||
}
|
||||
|
||||
msg.setNoneBindingReceiver(targetUserModel.getExt5());
|
||||
msg.setNoneBindingSender("group-admin");
|
||||
msg.setCreationDate(new Date());
|
||||
// 0:PC;1:移动URL接入应用;2:本地H5应用;3: 本地原生应用;4:PC&移动URL接入应用;5:PC&本地H5应用;6:PC&本地原生应用
|
||||
msg.setMessageType(0);
|
||||
msg.setMessageURL(msgUrl);
|
||||
msg.setMessageH5URL(msgUrl);
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,121 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oa;
|
||||
/*
|
||||
* package com.hy.apps.integrated.oa;
|
||||
*
|
||||
* import java.sql.Date; import java.sql.PreparedStatement; import
|
||||
* java.util.List;
|
||||
*
|
||||
* import org.slf4j.Logger; import org.slf4j.LoggerFactory;
|
||||
*
|
||||
* import com.actionsoft.bpms.commons.database.BatchPreparedStatementSetter;
|
||||
* import com.actionsoft.bpms.commons.database.RowMap; import
|
||||
* com.actionsoft.bpms.commons.pagination.impl.OraclePagination; import
|
||||
* com.actionsoft.bpms.util.UUIDGener; import com.actionsoft.sdk.local.SDK;
|
||||
* import com.actionsoft.sdk.local.api.NotificationAPI; import
|
||||
* com.actionsoft.sdk.local.api.internal.cc.RDSAPIImpl;
|
||||
*
|
||||
* public class PendingCheck {
|
||||
*
|
||||
* private static Logger logger = LoggerFactory.getLogger(PendingCheck.class);
|
||||
*
|
||||
* private String ehr_cc_id =
|
||||
* SDK.getAppAPI().getProperty("com.hy.apps.integrated", "ehr_cc_id"); private
|
||||
* String oa_cc_id = SDK.getAppAPI().getProperty("com.hy.apps.integrated",
|
||||
* "oa_cc_id");
|
||||
*
|
||||
*//**
|
||||
* 将OA EHR 待办抓取到 EHR系统
|
||||
*
|
||||
* @param updateFlag
|
||||
*/
|
||||
/*
|
||||
* public void getOAPendingToEhr(boolean updateFlag){ RDSAPIImpl ehrRdsApi =
|
||||
* (RDSAPIImpl) SDK.getCCAPI().getRDSAPI(ehr_cc_id); // //删除历史的待办数据
|
||||
* ehrRdsApi.update("DELETE FROM daiban_tmp"); RDSAPIImpl rdsApi = (RDSAPIImpl)
|
||||
* SDK.getCCAPI().getRDSAPI(oa_cc_id); int anInt = rdsApi.
|
||||
* getInt("SELECT COUNT(0) FROM THIRDPARTY_PENDING p WHERE STATE=0 AND REGISTER_ID='775681212246869729'"
|
||||
* ); int index = 0; int pageSize = 200; while (index <= anInt){ String
|
||||
* limitString = (new OraclePagination()).getLimitString("SELECT TASK_ID " +
|
||||
* "FROM THIRDPARTY_PENDING p WHERE STATE=0 AND REGISTER_ID='775681212246869729'"
|
||||
* , index, pageSize);
|
||||
*
|
||||
* index = index +pageSize; List<RowMap> maps = rdsApi.getMaps(limitString);
|
||||
* BatchPreparedStatementSetter setter=new BatchPreparedStatementSetter() {
|
||||
* public int getBatchSize() { return maps.size(); } public void
|
||||
* setValues(PreparedStatement ps, int i) { try { RowMap rowMap = maps.get(i);
|
||||
* ps.setString(1, rowMap.getString("TASK_ID")); } catch (Exception e) {
|
||||
* e.printStackTrace(); } } };
|
||||
* ehrRdsApi.batch("INSERT INTO daiban_tmp (TASK_ID) VALUES (?)",setter); }
|
||||
* //获取EHR已完成的,OA 未消除的待办 List<RowMap> taskMaps = ehrRdsApi.
|
||||
* getMaps("SELECT t.TASK_ID FROM daiban_tmp t INNER JOIN we_task wt ON wt.TASK_ID = t.TASK_ID AND wt.CURRENT_STATE='COMPLETED'"
|
||||
* ); RDSAPIImpl oaRdsApi = (RDSAPIImpl) SDK.getCCAPI().getRDSAPI(oa_cc_id);
|
||||
* //删除历史的待办数据 oaRdsApi.update("DELETE FROM BO_HY_INTEGRATED_EHR_TASK");
|
||||
*
|
||||
* BatchPreparedStatementSetter setter=new BatchPreparedStatementSetter() {
|
||||
* public int getBatchSize() { return taskMaps.size(); } public void
|
||||
* setValues(PreparedStatement ps, int i) { try { RowMap rowMap =
|
||||
* taskMaps.get(i); ps.setString(1, UUIDGener.getUUID()); ps.setString(2,
|
||||
* rowMap.getString("TASK_ID")); } catch (Exception e) { e.printStackTrace(); }
|
||||
* } }; oaRdsApi.
|
||||
* batch("INSERT INTO \"BO_HY_INTEGRATED_EHR_TASK\" (\"ID\", \"TASK_ID\") VALUES (?,?)"
|
||||
* ,setter);
|
||||
*
|
||||
* logger.info("获取并插入EHR总待办条数:"+oaRdsApi.
|
||||
* getInt("SELECT COUNT(0) FROM BO_HY_INTEGRATED_EHR_TASK")); if (updateFlag){
|
||||
* int update = oaRdsApi.
|
||||
* update("UPDATE THIRDPARTY_PENDING TP SET TP.UPDATE_DATE=SYSDATE WHERE EXISTS (SELECT 1 FROM BO_HY_INTEGRATED_EHR_TASK et WHERE et.TASK_ID = TP.TASK_ID ) AND TP.STATE=0"
|
||||
* ); logger.info("更新OA待办为已办条数:"+update); }else{ int count =
|
||||
* oaRdsApi.getInt(" SELECT COUNT(0) FROM BO_HY_INTEGRATED_EHR_TASK "); if
|
||||
* (count>0){ NotificationAPI notificationAPI = SDK.getNotificationAPI();
|
||||
* notificationAPI.sendSystemMessage("18512383665",
|
||||
* "发现OA有未更新的EHR待办:"+count+"条","warning"); }
|
||||
* logger.info("参数未false,不更新OA待办数据。可更新条数:"+count); } }
|
||||
*
|
||||
*
|
||||
*//**
|
||||
* 导EHR 待办进 OA数据库
|
||||
*//*
|
||||
* @Deprecated public void getEHRPending(boolean updateFlag){ RDSAPIImpl
|
||||
* oaRdsApi = (RDSAPIImpl) SDK.getCCAPI().getRDSAPI(oa_cc_id); //删除历史的待办数据
|
||||
* oaRdsApi.update("DELETE FROM BO_HY_INTEGRATED_EHR_TASK"); RDSAPIImpl
|
||||
* ehrRdsApi = (RDSAPIImpl) SDK.getCCAPI().getRDSAPI(ehr_cc_id); int anInt =
|
||||
* ehrRdsApi.getInt("SELECT COUNT(0) \n" +
|
||||
* "FROM we_task wt INNER JOIN we_process wp ON wt.business_key=wp.business_key WHERE wt.CURRENT_STATE IN ('WAITING','ACCEPTED')\n"
|
||||
* + "AND wp.current_state = 'running' AND wt.PRIORITY>1 "); int index = 0; int
|
||||
* pageSize = 500; while (index <= anInt){ String limitString =
|
||||
* "SELECT wt.TASK_ID,wt.ACTIVITY_NAME,wt.current_state,wt.TITLE,wt.PARTICIPANT_NAME,CREATE_TIME \n"
|
||||
* +
|
||||
* "FROM we_task wt INNER JOIN we_process wp ON wt.business_key=wp.business_key WHERE wt.CURRENT_STATE IN ('WAITING','ACCEPTED')\n"
|
||||
* + "AND wp.current_state = 'running' AND wt.PRIORITY>1 limit "+index+","+
|
||||
* pageSize; index = index +pageSize; List<RowMap> maps =
|
||||
* ehrRdsApi.getMaps(limitString); BatchPreparedStatementSetter setter=new
|
||||
* BatchPreparedStatementSetter() { public int getBatchSize() { return
|
||||
* maps.size(); } public void setValues(PreparedStatement ps, int i) { try {
|
||||
* RowMap rowMap = maps.get(i); ps.setString(1, UUIDGener.getUUID());
|
||||
* ps.setString(2, rowMap.getString("TASK_ID")); ps.setString(3,
|
||||
* rowMap.getString("ACTIVITY_NAME")); ps.setString(4,
|
||||
* rowMap.getString("CURRENT_STATE")); ps.setString(5,
|
||||
* rowMap.getString("TITLE")); ps.setString(6,
|
||||
* rowMap.getString("PARTICIPANT_NAME")); ps.setDate(7, new
|
||||
* Date(rowMap.getDate("CREATE_TIME").getTime())); } catch (Exception e) {
|
||||
* e.printStackTrace(); } } }; oaRdsApi.
|
||||
* batch("INSERT INTO \"BO_HY_INTEGRATED_EHR_TASK\" (\"ID\", \"TASK_ID\", \"ACTIVITY_NAME\", \"CURRENT_STATE\", \"TITLE\", \"PARTICIPANT_NAME\", \"CREATE_TIME\") VALUES (?,?, ?,?,?,?,?)"
|
||||
* ,setter); } logger.info("获取并插入EHR总待办条数:"+oaRdsApi.
|
||||
* getInt("SELECT COUNT(0) FROM BO_HY_INTEGRATED_EHR_TASK")); if (updateFlag){
|
||||
* //TODO 更新待办 有问题。 // int update = oaRdsApi.
|
||||
* update("UPDATE THIRDPARTY_PENDING TP SET TP.STATE=1 WHERE EXISTS (\n" + //
|
||||
* "\tSELECT 1 FROM (\n" + //
|
||||
* "\t\tSELECT p.TASK_ID FROM THIRDPARTY_PENDING p \n" + //
|
||||
* "\t\tLEFT JOIN BO_HY_INTEGRATED_EHR_TASK t ON p.TASK_ID = t.TASK_ID\n" + //
|
||||
* "\t\tWHERE STATE=0 AND REGISTER_ID='775681212246869729' AND t.TASK_ID IS NULL\n"
|
||||
* + // "\t) y WHERE y.TASK_ID = TP.TASK_ID ) \n" + // "AND TP.STATE=0"); //
|
||||
* logger.info("更新OA待办为已办条数:"+update); }else{ int count =
|
||||
* oaRdsApi.getInt(" SELECT \"COUNT\"(0) FROM THIRDPARTY_PENDING p \n" +
|
||||
* " LEFT JOIN BO_HY_INTEGRATED_EHR_TASK t ON p.TASK_ID = t.TASK_ID\n" +
|
||||
* " WHERE STATE=0 AND REGISTER_ID='775681212246869729' AND t.TASK_ID IS NULL");
|
||||
* logger.info("参数未false,不更新OA待办数据。可更新条数:"+count); }
|
||||
*
|
||||
* }
|
||||
*
|
||||
* }
|
||||
*/
|
||||
@ -1,422 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oa;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.dom4j.DocumentException;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import com.actionsoft.bpms.bpmn.constant.ProcessRuntimeConst;
|
||||
import com.actionsoft.bpms.bpmn.constant.PublicEventConst;
|
||||
import com.actionsoft.bpms.bpmn.engine.ProcessAPIManager;
|
||||
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
|
||||
import com.actionsoft.bpms.bpmn.engine.listener.ProcessPubicListener;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.def.ProcessDefinition;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.TaskCommentModel;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.HistoryTaskInstance;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
||||
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
|
||||
import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.LogAPI;
|
||||
import com.actionsoft.sdk.local.api.Logger;
|
||||
import com.actionsoft.sdk.local.api.TaskAPI;
|
||||
|
||||
import javax.xml.soap.SOAPException;
|
||||
|
||||
/**
|
||||
* @author lihongyu
|
||||
*
|
||||
*/
|
||||
public class TaskListener extends ProcessPubicListener {
|
||||
|
||||
private Logger logger = LogAPI.getLogger(TaskListener.class);
|
||||
|
||||
private String rootScopeId = "00000000-0000-0000-0000-000000000000";
|
||||
private String sendEnable = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "sendEnable");
|
||||
private String notPushReadyTask = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "notPushReadyTask");
|
||||
private String[] AGREE = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "AGREE").split("\\|");
|
||||
private String[] GO_BACK = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "GO_BACK").split("\\|");
|
||||
private String[] DESI_BACK = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "DESI_BACK").split("\\|");
|
||||
private String[] TE_SHI_TE_BAN = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "TE_SHI_TE_BAN")
|
||||
.split("\\|");
|
||||
private String[] TERMINATION = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "TERMINATION").split("\\|");
|
||||
private String[] ABOLITION = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "ABOLITION").split("\\|");
|
||||
private String[] TRANSFER = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "TRANSFER").split("\\|");
|
||||
private String[] GET_BACK = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "GET_BACK").split("\\|");
|
||||
private String[] GET_BACKCC = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "GET_BACKCC").split("\\|");
|
||||
private String[] GET_BACKD = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "GET_BACK").split("\\|");
|
||||
private TaskAPI taskAPI = SDK.getTaskAPI();
|
||||
private static Set<String> strings = new HashSet<>();
|
||||
private final String close = "2";
|
||||
// 通知类型 9 系统通知任务【不影响流程推进】 2 只读传阅任务【不影响流程推进】
|
||||
private Integer noticeState = 9;
|
||||
private Integer tranReadState = 2;
|
||||
|
||||
/**
|
||||
* 所有人工任务相关行为发生时被触发(见PublicEventConst常量) ProcessPubicListener
|
||||
*
|
||||
* @param eventName 事件名称,见PublicEventConst常量
|
||||
* @param taskInstance 任务实例对象
|
||||
* @param pec 流程引擎提供给监听器的上下文对象
|
||||
* @see PublicEventConst
|
||||
*/
|
||||
@Override
|
||||
public void call(String eventName, TaskInstance taskInstance, ProcessExecutionContext pec) {
|
||||
|
||||
System.out.println("eventName>>>>>>>>>>"+eventName);
|
||||
/**
|
||||
* 手动作废 增加 开始节点作废删除更新OA待办问题
|
||||
* 后台管理员删除流程 process_before_delete 时候删除 更新OA为已办
|
||||
*/
|
||||
//System.out.println("11111111111111");
|
||||
if (close.equals(sendEnable)) {
|
||||
return;
|
||||
}
|
||||
OaPendComponent component = new OaPendComponent();
|
||||
if (pec!=null){
|
||||
if (pec.getProcessInstance()!=null){
|
||||
if (eventName.equals("PROCESS_BEFORE_DELETE")&&UtilString.isNotEmpty(pec.getProcessInstance().getParentTaskInstId())){
|
||||
try {
|
||||
/**
|
||||
* 这是发起人作废的时候,作废的流程实例,需要更新OA数据
|
||||
*/
|
||||
String irt = pec.getProcessInstance().getStartTaskInstId();
|
||||
TaskInstance instanceById = SDK.getTaskAPI().getInstanceById(irt);
|
||||
component.updatePending(instanceById,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (taskInstance == null) {
|
||||
return;
|
||||
}
|
||||
String actionName = "";
|
||||
if (!UtilString.isEmpty(taskInstance.getId())) {
|
||||
actionName = getActionName(taskInstance);
|
||||
|
||||
}
|
||||
|
||||
System.out.println("按钮名称是>>>>>>>>>>>"+actionName);
|
||||
|
||||
if (UtilString.isEmpty(taskInstance.getId()) && PublicEventConst.TASK_DELETE.equals(eventName)) {
|
||||
|
||||
Map<String, Object> parameters2 = pec.getParameters();
|
||||
final Object taskLists = parameters2.get("taskList");
|
||||
if (null != taskLists) {
|
||||
List<HistoryTaskInstance> list = (List<HistoryTaskInstance>) taskLists;
|
||||
list.forEach(h -> {
|
||||
logger.info("调用OA删除任务接口:taskInstanceId:" + h.getId());
|
||||
try {
|
||||
component.readOa(h.getId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//OaDeleteComponent(h.getId());
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
} else if (PublicEventConst.TASK_DELETE.equals(eventName) || taskInstance.getControlState() == "delete") {
|
||||
if (actionName == ""||actionName.equals("收回沟通任务")||(actionName.equals("传阅")&& PublicEventConst.TASK_READ.equals(eventName))||actionName.equals("激活")) {
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//OaDeleteComponent(taskInstance.getId());
|
||||
}
|
||||
}
|
||||
String appId = "";
|
||||
if(PublicEventConst.TASK_CREATE.equals(eventName)) {
|
||||
ProcessDefinition processDef = pec.getProcessDef();
|
||||
if(null!=processDef) {
|
||||
appId = processDef.getAppId();
|
||||
try {
|
||||
//component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PublicEventConst.TASK_COMPLETE.equals(eventName)){
|
||||
ProcessDefinition processDef = pec.getProcessDef();
|
||||
if(null!=processDef) {
|
||||
appId = processDef.getAppId();
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PublicEventConst.TASK_CREATE.equals(eventName) && (!taskInstance.getParentTaskInstId().equals(rootScopeId)||notPushReadyTask.contains(appId))) {
|
||||
if (StringUtils.isEmpty(taskInstance.getTarget())) {
|
||||
return;
|
||||
}
|
||||
if (taskInstance.getState() == noticeState) {
|
||||
try {
|
||||
component.sendOaPending(taskInstance, pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据配置表修改任务标题 by yujh start
|
||||
// TaskUtil taskUtil =new TaskUtil();
|
||||
// String newTitle = taskUtil.updateTaskTitleByBase(pec.getUserContext(), taskInstance.getId(), taskInstance.getActivityDefId(), taskInstance.getTitle());
|
||||
// taskInstance = SDK.getTaskAPI().getTaskInstance(taskInstance.getId());
|
||||
// 根据配置表修改任务标题 by yujh end
|
||||
|
||||
try {
|
||||
component.sendOaPending(taskInstance, pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("创建OA待办,taskInstanceId:" + taskInstance.getId());
|
||||
|
||||
} else if (PublicEventConst.TASK_READ.equals(eventName)) {
|
||||
if (taskInstance.getState() == tranReadState) {
|
||||
|
||||
logger.info("更新知会待办,taskInstanceId:" + taskInstance.getId());
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else if (PublicEventConst.TASK_COMPLETE.equals(eventName)) {
|
||||
if (!taskInstance.getParentTaskInstId().equals(rootScopeId)||notPushReadyTask.contains(appId)) {
|
||||
// final String actionName = getActionName(taskInstance);
|
||||
if (equalsAction(AGREE, actionName)) {
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("更新OA待办:" + "同意");
|
||||
} else if (equalsAction(GO_BACK, actionName)) {
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("更新OA待办:" + "回退");
|
||||
} else if (equalsAction(DESI_BACK, actionName)) {
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("更新OA待办:" + "指定回退");
|
||||
} else if (equalsAction(TE_SHI_TE_BAN, actionName)) {
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("更新OA待办:" + "特事特办");
|
||||
} else if (equalsAction(TERMINATION, actionName)) {
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("更新OA待办:" + "终止");
|
||||
} else if (equalsAction(TRANSFER, actionName)) {
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("更新OA待办:" + "转办");
|
||||
} else {
|
||||
try {
|
||||
component.readOa(taskInstance.getId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("更新OA待办:未定义的操作:" + actionName + ",按同意已办处理");
|
||||
}
|
||||
}
|
||||
|
||||
} else if (PublicEventConst.TASK_TRANSFER.equals(eventName)) {
|
||||
|
||||
// 移交任务 需要更新之前那个人的待办为已办,然后添加当前人的待办
|
||||
} else if (PublicEventConst.TASK_DELEGATE.equals(eventName)) {
|
||||
|
||||
final TaskCommentModel comment = getCommentCreateUserId(taskInstance.getProcessInstId(),
|
||||
taskInstance.getId());
|
||||
if (null != comment) {
|
||||
logger.info("任务转办");
|
||||
taskAPI.createUserTaskInstance(pec.getProcessInstance().getId(), taskInstance.getId(),
|
||||
comment.getCreateUser(), taskInstance.getActivityDefId(), taskInstance.getTarget(),
|
||||
"转办:" + pec.getProcessInstance().getTitle());
|
||||
taskAPI.completeTask(taskInstance.getId(), comment.getCreateUser(), false);
|
||||
}
|
||||
|
||||
} else if (UtilString.isNotEmpty(taskInstance.getId())
|
||||
&& !taskInstance.getParentTaskInstId().equals(rootScopeId)) {
|
||||
// 撤销流程
|
||||
if (UtilString.isEmpty(taskInstance.getId())) {
|
||||
Map<String, Object> parameters = pec.getParameters();
|
||||
if (!CollectionUtils.isEmpty(parameters)) {
|
||||
// 这个list即是撤销时全部删除的任务实例
|
||||
final Object taskList = parameters.get("taskList");
|
||||
if (null != taskList) {
|
||||
List<HistoryTaskInstance> list = (List<HistoryTaskInstance>) taskList;
|
||||
// OaPendComponent component = new OaPendComponent();
|
||||
list.forEach(h -> {
|
||||
if (!h.getParentTaskInstId().equals(rootScopeId)) {
|
||||
if (ProcessRuntimeConst.INST_STATE_ACTIVE.equals(h.getControlState())
|
||||
&& noticeState != h.getState()) {
|
||||
logger.info("更新OA待办:取消,taskInstanceId:" + h.getId());
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (UtilString.isNotEmpty(taskInstance.getId())) {
|
||||
// final String actionName = getActionName(taskInstance);
|
||||
if (equalsAction(TE_SHI_TE_BAN, actionName) || equalsAction(TRANSFER, actionName)) {
|
||||
return;
|
||||
}
|
||||
if (equalsAction(ABOLITION, actionName)) {
|
||||
/*
|
||||
* logger.info("更新OA待办:作废,taskInstanceId:" + taskInstance.getId());
|
||||
* OaPendComponent component = new OaPendComponent();
|
||||
* component.updatePending(taskInstance.getId(), "1", "2");
|
||||
*
|
||||
*/
|
||||
logger.info("调用OA删除任务接口:taskInstanceId:" + taskInstance.getId());
|
||||
try {
|
||||
component.readOa(taskInstance.getId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (equalsAction(GET_BACK, actionName) || equalsAction(GET_BACKD, actionName)||equalsAction(GET_BACKCC, actionName)) {
|
||||
logger.info("更新OA待办:收回,taskInstanceId:" + taskInstance.getParentTaskInstId());
|
||||
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* if (null == pec.getUserContext() ||
|
||||
* taskInstance.getTarget().equals(pec.getUserContext().getUID())) { return; }
|
||||
*/
|
||||
if (strings.contains(taskInstance.getId())) {
|
||||
strings.remove(taskInstance.getId());
|
||||
return;
|
||||
} else {
|
||||
strings.add(taskInstance.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (PublicEventConst.PROCESS_COMPLETE.equals(eventName)) {
|
||||
try {
|
||||
component.updatePending(taskInstance,pec);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SOAPException e) {
|
||||
e.printStackTrace();
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (PublicEventConst.TASK_CANCEL.equals(eventName)) {
|
||||
logger.info("调用OA删除任务接口:taskInstanceId:" + taskInstance.getId());
|
||||
try {
|
||||
component.readOa(taskInstance.getId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OaDeleteComponent(String taskId) {
|
||||
OaDeleteComponent component = new OaDeleteComponent();
|
||||
component.deleteOaPending(taskId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某个审批步骤的 数据
|
||||
*
|
||||
* @param processInstId
|
||||
* @param taskInstanceId
|
||||
* @return
|
||||
*/
|
||||
private TaskCommentModel getCommentCreateUserId(String processInstId, String taskInstanceId) {
|
||||
final Iterator<TaskCommentModel> iterator = ProcessAPIManager.getInstance().getComments(processInstId)
|
||||
.iterator();
|
||||
TaskCommentModel next;
|
||||
while (iterator.hasNext()) {
|
||||
if ((next = iterator.next()).getTaskInstId().equals(taskInstanceId)) {
|
||||
return next;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean equalsAction(String[] actions, String actionName) {
|
||||
for (int i = 0, n = actions.length; i < n; i++) {
|
||||
if (actions[i].equals(actionName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getActionName(TaskInstance taskInstance) {
|
||||
if (null == taskInstance) {
|
||||
return "";
|
||||
}
|
||||
final Iterator<TaskCommentModel> iterator = ProcessAPIManager.getInstance()
|
||||
.getComments(taskInstance.getProcessInstId()).iterator();
|
||||
TaskCommentModel next;
|
||||
String actionName = "";
|
||||
while (iterator.hasNext()) {
|
||||
if ((next = iterator.next()).getTaskInstId().equals(taskInstance.getId())) {
|
||||
actionName = next.getActionName();
|
||||
}
|
||||
}
|
||||
return actionName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "0.0.2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProvider() {
|
||||
return "伊利集团信息管理部";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "流程待办推送";
|
||||
}
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oauth;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.HashMap;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
|
||||
public class App {
|
||||
// Basic testClient:qwertyuio0987654rfg :: Basic ???
|
||||
static String clientId = "prcmgr";
|
||||
static String clientSecret = "Mvo634yOQwYAfMfB";
|
||||
|
||||
// http://cs.idm.yili.com:7777/ms_oauth/oauth2/endpoints/oauthservice/tokens?redirect_uri=http://192.168.88.100:8080/ecs-console/&grant_type=authorization_code&code=
|
||||
// 获取授权Token接口(authorization_code模式)
|
||||
public String getTokens(String redirect_uri, String code) {
|
||||
String tokenJson = "";
|
||||
|
||||
|
||||
String url = "https://idm.yili.com:7777/ms_oauth/oauth2/endpoints/oauthservice/tokens?" + "redirect_uri="
|
||||
+ redirect_uri + "&grant_type=authorization_code&code=" + code;
|
||||
|
||||
String authoStr = geAuthorization(clientId, clientSecret);
|
||||
HashMap<String, String> HeaderMap = new HashMap();
|
||||
//HeaderMap.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
HeaderMap.put("grant_type","authorization_code");
|
||||
HeaderMap.put("Authorization", authoStr);
|
||||
//HeaderMap.put("accept", "*/*");
|
||||
//HeaderMap.put("connection", "Keep-Alive");
|
||||
System.out.println("url地址为=============="+url);
|
||||
System.out.println("参数为=============="+HeaderMap);
|
||||
// do request
|
||||
|
||||
|
||||
tokenJson = HttpJavaUtil.doPost(url, "", HeaderMap);
|
||||
System.out.println(tokenJson);
|
||||
return tokenJson;
|
||||
|
||||
}
|
||||
|
||||
public String getUserInfo(String token) {
|
||||
String userInfoJson = "";
|
||||
String url = "https://idm.yili.com:7777/ms_oauth/resources/userprofile/me";
|
||||
|
||||
String authoStr = token;
|
||||
HashMap<String, String> HeaderMap = new HashMap();
|
||||
HeaderMap.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
HeaderMap.put("Authorization", authoStr);
|
||||
HeaderMap.put("accept", "*/*");
|
||||
HeaderMap.put("connection", "Keep-Alive");
|
||||
|
||||
// do request get
|
||||
userInfoJson = HttpJavaUtil.doGet(url, HeaderMap);
|
||||
System.out.println(userInfoJson);
|
||||
return userInfoJson;
|
||||
}
|
||||
|
||||
public String geAuthorization(String clientId, String clientSecret) {
|
||||
try {
|
||||
byte[] key = (clientId + ":" + clientSecret).getBytes("utf-8");
|
||||
String cc = new String(Base64.encodeBase64(key), "utf-8");
|
||||
// String cc = new String(java.util.Base64.getEncoder().encode(key), "utf-8");
|
||||
return "Basic " + cc;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,336 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oauth;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.security.cert.X509Certificate;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
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;
|
||||
|
||||
public class HttpJavaUtil {
|
||||
|
||||
public static final String DEF_CHATSET = "UTF-8";
|
||||
public static final int DEF_CONN_TIMEOUT = 30000; // 是建立连接的超时时间
|
||||
public static final int DEF_READ_TIMEOUT = 30000; // 是传递数据的超时时间
|
||||
|
||||
public static String doGet(String httpUrl, Map<String, String> HeaderMap) {
|
||||
HttpURLConnection connection = null;
|
||||
InputStream is = null;
|
||||
BufferedReader br = null;
|
||||
String result = null;// 返回结果字符串
|
||||
System.out.println(httpUrl);
|
||||
try {
|
||||
// 创建远程url连接对象
|
||||
URL url = new URL(httpUrl);
|
||||
try {
|
||||
// trustAllHttpsCertificates();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("【异常】doGet-https-->" + e.getMessage());
|
||||
}
|
||||
trustAllHttpsCertificates();
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
// 设置header
|
||||
for (String key : HeaderMap.keySet()) {
|
||||
connection.setRequestProperty(key, HeaderMap.get(key).toString());
|
||||
}
|
||||
|
||||
// 设置连接方式:get
|
||||
connection.setRequestMethod("GET");
|
||||
// 设置连接主机服务器的超时时间:15000毫秒
|
||||
connection.setConnectTimeout(15000);
|
||||
// 设置读取远程返回的数据时间:60000毫秒
|
||||
connection.setReadTimeout(60000);
|
||||
// 发送请求
|
||||
connection.connect();
|
||||
// 通过connection连接,获取输入流
|
||||
if (connection.getResponseCode() == 200) {
|
||||
is = connection.getInputStream();
|
||||
// 封装输入流is,并指定字符集
|
||||
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
// 存放数据
|
||||
StringBuffer sbf = new StringBuffer();
|
||||
String tempX = "";
|
||||
while ((tempX = br.readLine()) != null) {
|
||||
sbf.append(tempX);
|
||||
sbf.append("\r\n");
|
||||
}
|
||||
result = sbf.toString();
|
||||
System.out.println(result);
|
||||
} else {
|
||||
String line;
|
||||
String message = "";
|
||||
br = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
|
||||
StringBuffer buff = new StringBuffer();
|
||||
while ((line = br.readLine()) != null) {
|
||||
buff.append(line + "\n");
|
||||
message += line;
|
||||
}
|
||||
message = buff.toString();
|
||||
System.out.println(message);
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
// 关闭资源
|
||||
if (null != br) {
|
||||
try {
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != is) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
connection.disconnect();// 关闭远程连接
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String doPost(String httpUrl, String BodyParam, Map<String, String> HeaderMap) {
|
||||
HttpURLConnection connection = null;
|
||||
InputStream is = null;
|
||||
OutputStream os = null;
|
||||
BufferedReader br = null;
|
||||
String result = null;
|
||||
try {
|
||||
URL url = new URL(httpUrl);
|
||||
try {
|
||||
// trustAllHttpsCertificates();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("【异常】doPost-https-->" + e.getMessage());
|
||||
}
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
// 设置header
|
||||
for (String key : HeaderMap.keySet()) {
|
||||
connection.setRequestProperty(key, HeaderMap.get(key).toString());
|
||||
}
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setConnectTimeout(15000);
|
||||
connection.setReadTimeout(60000);
|
||||
connection.setDoOutput(true);
|
||||
connection.setDoInput(true);
|
||||
|
||||
os = connection.getOutputStream();
|
||||
os.write(BodyParam.getBytes());
|
||||
int resCode = connection.getResponseCode();
|
||||
|
||||
is = connection.getInputStream();
|
||||
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
StringBuffer sbf = new StringBuffer();
|
||||
String temp = null;
|
||||
while ((temp = br.readLine()) != null) {
|
||||
sbf.append(temp);
|
||||
sbf.append("\r\n");
|
||||
}
|
||||
result = sbf.toString();
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (null != br) {
|
||||
try {
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != os) {
|
||||
try {
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != is) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
connection.disconnect();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//使用SOAP1.1发送消息
|
||||
public static String doPostSoap(String postUrl, String soapXml, Map<String, String> HeaderMap) {
|
||||
String retStr = "";
|
||||
// 创建HttpClientBuilder
|
||||
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
||||
// HttpClient
|
||||
CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
|
||||
HttpPost httpPost = new HttpPost(postUrl);
|
||||
// 设置请求和传输超时时间
|
||||
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(6000)
|
||||
.setConnectTimeout(6000).build();
|
||||
httpPost.setConfig(requestConfig);
|
||||
try {
|
||||
for (String key : HeaderMap.keySet()) {
|
||||
httpPost.setHeader(key, HeaderMap.get(key).toString());
|
||||
}
|
||||
|
||||
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");
|
||||
System.out.println("restsfagfasfas=======>>>>>>>>>>"+retStr);
|
||||
}
|
||||
// 释放资源
|
||||
closeableHttpClient.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return retStr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信任全部https证书
|
||||
*/
|
||||
private static void trustAllHttpsCertificates() throws Exception {
|
||||
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
|
||||
public boolean verify(String str, SSLSession session) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
javax.net.ssl.TrustManager[] trustAllCerts = new javax.net.ssl.TrustManager[1];
|
||||
javax.net.ssl.TrustManager tm = new miTM();
|
||||
trustAllCerts[0] = tm;
|
||||
javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
sc.init(null, trustAllCerts, null);
|
||||
javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||
}
|
||||
|
||||
static class miTM implements javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager {
|
||||
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isServerTrusted(java.security.cert.X509Certificate[] certs) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isClientTrusted(java.security.cert.X509Certificate[] certs) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType)
|
||||
throws java.security.cert.CertificateException {
|
||||
return;
|
||||
}
|
||||
|
||||
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType)
|
||||
throws java.security.cert.CertificateException {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static String sendPost(String url, String param, Map<String, String> HeaderMap) {
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
String result = "";
|
||||
try {
|
||||
URL realUrl = new URL(url);
|
||||
// 打开和URL之间的连接
|
||||
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
|
||||
|
||||
// 设置header
|
||||
for (String key : HeaderMap.keySet()) {
|
||||
conn.setRequestProperty(key, HeaderMap.get(key).toString());
|
||||
}
|
||||
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
conn.setConnectTimeout(5000000);
|
||||
conn.setReadTimeout(5000000);
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
// 发送请求参数
|
||||
out.print(param);
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送 POST 请求出现异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 使用finally块来关闭输出流、输入流
|
||||
finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,252 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oauth;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.commons.oauth.AbstractOauth;
|
||||
import com.actionsoft.bpms.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.server.RequestParams;
|
||||
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.actionsoft.sdk.local.api.LogAPI;
|
||||
import com.actionsoft.sdk.local.api.Logger;
|
||||
import com.actionsoft.sdk.local.api.ORGAPI;
|
||||
import com.actionsoft.sdk.service.model.UserModel;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yili.wsclient.ClientService;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* OA系统 跳转登陆PAl
|
||||
*
|
||||
* @author lihy
|
||||
*/
|
||||
|
||||
public class OauthLogin extends AbstractOauth {
|
||||
private Logger logger = LogAPI.getLogger(OauthLogin.class);
|
||||
|
||||
static String clientId = "testClient";
|
||||
static String clientSecret = "1234567890";
|
||||
/**
|
||||
* 这个方法代表是否有登录授权页,返回的值取决于三方系统提供的 SSO 认证方式。一类认 证方式如 Oauth2.0
|
||||
* 认证,需要先跳转到三方系统的登录授权页面,授权成功后再跳转到调 用方指定的页面,这类认证方式下,hasOauthPage()方法需要返回 true。
|
||||
* 另外一类认证时不 需要跳转到登录授权页, 会直接传过来 ticket 或者 token 参数, hasOauthPage()方法需要返 回 false。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean hasOauthPage() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果 hasOauthPage()方法返回的值是 false, 返回 null 即可。 如果 hasOauthPage()方法返回 的值是
|
||||
* true,则此处返回三方系统的登录授权页地址。
|
||||
* @param requestParams
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getOauthPage(RequestParams requestParams) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String validate(RequestParams params) throws IOException {
|
||||
BO bo = new BO();
|
||||
String id = params.get("id");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
long begintime = System.currentTimeMillis();
|
||||
bo.set("BEGIN_TIME",sdf.format(new Date()));
|
||||
String userid = "";
|
||||
long login_end_time = 0L;
|
||||
if (StringUtils.isNotEmpty(params.get("casaccount"))){
|
||||
BO detail = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("LOGINID=", params.get("casaccount")).detail();
|
||||
String workcode = detail.getString("WORKCODE");
|
||||
if (workcode.length()!=8){
|
||||
login_end_time = System.currentTimeMillis();
|
||||
bo.set("END_TIME",sdf.format(new Date()));
|
||||
bo.set("USER_ID","00"+workcode);
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext);
|
||||
if (("5af46cd5-a1bc-4125-a144-86d1a199eec1").equals(id)){
|
||||
try {
|
||||
setUserLog("00"+workcode,"1");
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
return "00"+workcode;
|
||||
}else{
|
||||
login_end_time = System.currentTimeMillis();
|
||||
bo.set("END_TIME",login_end_time);
|
||||
bo.set("USER_ID",params.get("casaccount"));
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext);
|
||||
if (("5af46cd5-a1bc-4125-a144-86d1a199eec1").equals(id)){
|
||||
try {
|
||||
setUserLog(params.get("casaccount"),"1");
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
return params.get("casaccount");
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(params.get("usercode"))){
|
||||
|
||||
login_end_time = System.currentTimeMillis();
|
||||
bo.set("END_TIME",sdf.format(new Date()));
|
||||
bo.set("USER_ID",params.get("usercode"));
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext);
|
||||
if (("5af46cd5-a1bc-4125-a144-86d1a199eec1").equals(id)){
|
||||
try {
|
||||
setUserLog(params.get("usercode"),"1");
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
return params.get("usercode");
|
||||
}
|
||||
|
||||
|
||||
logger.info("单点登录验证---------"+params);
|
||||
try {
|
||||
|
||||
long loginbegintime = System.currentTimeMillis();
|
||||
bo.set("LOGIN_BEGIN_TIME",sdf.format(new Date()));
|
||||
String redirect_uri = params.get("code");
|
||||
|
||||
|
||||
if(StringUtils.isEmpty(redirect_uri)){
|
||||
logger.error("跳转地址为空,请重新输入");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
App app = new App();
|
||||
String tokens = app.getTokens("http://10.114.11.135:8088/portal/yili.html", redirect_uri);
|
||||
if(StringUtils.isEmpty(tokens)){
|
||||
logger.error("获取token为空,请重新输入登录信息获取code");
|
||||
return null;
|
||||
}else {
|
||||
JSONObject jsonObjects = JSONObject.parseObject(tokens);
|
||||
String access_token = jsonObjects.getString("access_token");
|
||||
String userInfo = app.getUserInfo(access_token);
|
||||
|
||||
if (StringUtils.isNotEmpty(userInfo)){
|
||||
JSONObject json = JSONObject.parseObject(userInfo);
|
||||
System.out.println("json-=====>>>>"+json);
|
||||
if (StringUtils.isNotEmpty(json.getString("employeenumber"))){
|
||||
System.out.println("userid》》》》》》》》》》"+json.getString("employeenumber"));
|
||||
if (("5af46cd5-a1bc-4125-a144-86d1a199eec1").equals(id)){
|
||||
try {
|
||||
setUserLog(json.getString("employeenumber"),"1");
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
userid = json.getString("employeenumber");
|
||||
login_end_time = System.currentTimeMillis();
|
||||
bo.set("END_TIME",sdf.format(new Date()));
|
||||
bo.set("SCENDTIME",(login_end_time-loginbegintime));
|
||||
bo.set("LOGIN_END_TIME",sdf.format(new Date()));
|
||||
bo.set("USER_ID",userid);
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext);
|
||||
return json.getString("employeenumber");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("统一身份认证失败!", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public long getCookieTime(UserModel user) {
|
||||
System.out.println("session时间>>>>>>>>>>"+user.getSessionTime());
|
||||
//下面的值代表与 AWS PaaS 会话过期时间一致,
|
||||
//因平台会话过期时间以分钟计,所以需要乘以 60
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一身份认证接口
|
||||
* @param1 webserviceUrl 身份认证接口地址
|
||||
* @param2 casaccount 登录账号 OA账号
|
||||
* @param3 appaccount 应用系统登录账号
|
||||
* @param4 appid 应用系统id
|
||||
* @param5 validcode 验证码
|
||||
* @return true/false
|
||||
*/
|
||||
public static String getToken(String casaccount,String appaccount,String appid,String validcode) {
|
||||
//身份认证接口地址
|
||||
String webserviceUrl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "webserviceUrl");
|
||||
String checkLogin = ClientService.checkLogin(webserviceUrl,casaccount,appaccount,appid,validcode);
|
||||
return checkLogin ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String geAuthorization(String clientId, String clientSecret) {
|
||||
try {
|
||||
byte[] key = (clientId + ":" + clientSecret).getBytes("utf-8");
|
||||
String cc = new String(Base64.encodeBase64(key), "utf-8");
|
||||
// String cc = new String(java.util.Base64.getEncoder().encode(key), "utf-8");
|
||||
return "Basic " + cc;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户登录日志
|
||||
* @param userid
|
||||
* @param logType
|
||||
*/
|
||||
public void setUserLog(String userid,String logType) {
|
||||
System.err.println("用户登录记录存入日志========>"+userid+"_类型:"+logType);
|
||||
if (UtilString.isNotEmpty(userid)) {
|
||||
String logTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
BO bo = new BO();
|
||||
/*String slq = "SELECT ID,LOGINCOUNTS FROM BO_EU_USER_LOGIN_LOG WHERE LOGINUSERNAME = '"+userid+"' AND LOGINTIME = '"+logTime+"'";
|
||||
List<RowMap> maps = DBSql.getMaps(slq);
|
||||
if(maps.size()!=0) {
|
||||
bo = SDK.getBOAPI().get("BO_EU_USER_LOGIN_LOG", maps.get(0).getString("ID"));
|
||||
bo.set("LOGINCOUNTS", maps.get(0).getInt("LOGINCOUNTS")+1);
|
||||
SDK.getBOAPI().update("BO_EU_USER_LOGIN_LOG", bo);
|
||||
}else {*/
|
||||
ORGAPI orgapi = SDK.getORGAPI();
|
||||
com.actionsoft.bpms.org.model.UserModel user = orgapi.getUser(userid);
|
||||
DepartmentModel departmentByUser = orgapi.getDepartmentByUser(userid);
|
||||
bo.set("LOGINUSERNAME", userid);
|
||||
bo.set("USERBUNAME",user.getExt4());
|
||||
bo.set("USERPOST",user.getPositionName());
|
||||
bo.set("USERDEPTNAME", departmentByUser.getPathNameOfCache());
|
||||
bo.set("LOGINTIME", logTime);
|
||||
bo.set("LOGINCOUNTS", 1);
|
||||
bo.set("LOGTYPE", Integer.valueOf(logType));
|
||||
|
||||
SDK.getBOAPI().createDataBO("BO_EU_USER_LOGIN_LOG", bo, UserContext.fromUID("admin"));
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,181 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oauth;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.commons.oauth.AbstractOauth;
|
||||
import com.actionsoft.bpms.server.RequestParams;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.LogAPI;
|
||||
import com.actionsoft.sdk.local.api.Logger;
|
||||
import com.actionsoft.sdk.service.model.UserModel;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yili.wsclient.ClientService;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* OA系统 跳转登陆PAl
|
||||
*
|
||||
* @author lihy
|
||||
*/
|
||||
|
||||
public class ProcessOathLogin extends AbstractOauth {
|
||||
private Logger logger = LogAPI.getLogger(OauthLogin.class);
|
||||
|
||||
static String clientId = "testClient";
|
||||
static String clientSecret = "1234567890";
|
||||
/**
|
||||
* 这个方法代表是否有登录授权页,返回的值取决于三方系统提供的 SSO 认证方式。一类认 证方式如 Oauth2.0
|
||||
* 认证,需要先跳转到三方系统的登录授权页面,授权成功后再跳转到调 用方指定的页面,这类认证方式下,hasOauthPage()方法需要返回 true。
|
||||
* 另外一类认证时不 需要跳转到登录授权页, 会直接传过来 ticket 或者 token 参数, hasOauthPage()方法需要返 回 false。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean hasOauthPage() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果 hasOauthPage()方法返回的值是 false, 返回 null 即可。 如果 hasOauthPage()方法返回 的值是
|
||||
* true,则此处返回三方系统的登录授权页地址。
|
||||
* @param requestParams
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getOauthPage(RequestParams requestParams) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String validate(RequestParams params) throws IOException {
|
||||
BO bo = new BO();
|
||||
long begintime = System.currentTimeMillis();
|
||||
bo.set("BEGIN_TIME",begintime);
|
||||
String userid = "";
|
||||
long login_end_time = 0L;
|
||||
if (StringUtils.isNotEmpty(params.get("casaccount"))){
|
||||
BO detail = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("LOGINID=", params.get("casaccount")).detail();
|
||||
String workcode = detail.getString("WORKCODE");
|
||||
if (workcode.length()!=8){
|
||||
login_end_time = System.currentTimeMillis();
|
||||
bo.set("END_TIME",login_end_time);
|
||||
bo.set("USER_ID","00"+workcode);
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext);
|
||||
return "00"+workcode;
|
||||
}else{
|
||||
login_end_time = System.currentTimeMillis();
|
||||
bo.set("END_TIME",login_end_time);
|
||||
bo.set("USER_ID",params.get("casaccount"));
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext);
|
||||
return params.get("casaccount");
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(params.get("usercode"))){
|
||||
|
||||
login_end_time = System.currentTimeMillis();
|
||||
bo.set("END_TIME",login_end_time);
|
||||
bo.set("USER_ID",params.get("usercode"));
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext);
|
||||
|
||||
return params.get("usercode");
|
||||
}
|
||||
|
||||
|
||||
logger.info("单点登录验证---------"+params);
|
||||
try {
|
||||
|
||||
long loginbegintime = System.currentTimeMillis();
|
||||
bo.set("LOGIN_BEGIN_TIME",loginbegintime);
|
||||
String redirect_uri = params.get("code");
|
||||
|
||||
if(StringUtils.isEmpty(redirect_uri)){
|
||||
logger.error("跳转地址为空,请重新输入");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
App app = new App();
|
||||
String tokens = app.getTokens("http://10.114.11.135:8088/portal/process_center.html", redirect_uri);
|
||||
if(StringUtils.isEmpty(tokens)){
|
||||
logger.error("获取token为空,请重新输入登录信息获取code");
|
||||
return null;
|
||||
}else {
|
||||
JSONObject jsonObjects = JSONObject.parseObject(tokens);
|
||||
String access_token = jsonObjects.getString("access_token");
|
||||
String userInfo = app.getUserInfo(access_token);
|
||||
|
||||
if (StringUtils.isNotEmpty(userInfo)){
|
||||
JSONObject json = JSONObject.parseObject(userInfo);
|
||||
System.out.println("json-=====>>>>"+json);
|
||||
if (StringUtils.isNotEmpty(json.getString("employeenumber"))){
|
||||
System.out.println("userid》》》》》》》》》》"+json.getString("employeenumber"));
|
||||
userid = json.getString("employeenumber");
|
||||
login_end_time = System.currentTimeMillis();
|
||||
bo.set("END_TIME",login_end_time);
|
||||
bo.set("SCENDTIME",(login_end_time-loginbegintime));
|
||||
bo.set("LOGIN_END_TIME",login_end_time);
|
||||
bo.set("USER_ID",userid);
|
||||
UserContext userContext = UserContext.fromUID("admin");
|
||||
SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext);
|
||||
return json.getString("employeenumber");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("统一身份认证失败!", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public long getCookieTime(UserModel user) {
|
||||
System.out.println("session时间>>>>>>>>>>"+user.getSessionTime());
|
||||
//下面的值代表与 AWS PaaS 会话过期时间一致,
|
||||
//因平台会话过期时间以分钟计,所以需要乘以 60
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一身份认证接口
|
||||
* @param1 webserviceUrl 身份认证接口地址
|
||||
* @param2 casaccount 登录账号 OA账号
|
||||
* @param3 appaccount 应用系统登录账号
|
||||
* @param4 appid 应用系统id
|
||||
* @param5 validcode 验证码
|
||||
* @return true/false
|
||||
*/
|
||||
public static String getToken(String casaccount,String appaccount,String appid,String validcode) {
|
||||
//身份认证接口地址
|
||||
String webserviceUrl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "webserviceUrl");
|
||||
String checkLogin = ClientService.checkLogin(webserviceUrl,casaccount,appaccount,appid,validcode);
|
||||
return checkLogin ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String geAuthorization(String clientId, String clientSecret) {
|
||||
try {
|
||||
byte[] key = (clientId + ":" + clientSecret).getBytes("utf-8");
|
||||
String cc = new String(Base64.encodeBase64(key), "utf-8");
|
||||
// String cc = new String(java.util.Base64.getEncoder().encode(key), "utf-8");
|
||||
return "Basic " + cc;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,858 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oauth;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.OutputAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.constant.OutputConst;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
|
||||
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
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.client.form.UserTaskFormsWeb;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.org.model.DepartmentModel;
|
||||
import com.actionsoft.bpms.org.model.UserModel;
|
||||
import com.actionsoft.bpms.server.RequestParams;
|
||||
import com.actionsoft.bpms.server.SSOUtil;
|
||||
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.server.fs.DCContext;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.bpms.util.UUIDGener;
|
||||
import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.exception.AWSException;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.actionsoft.sdk.local.api.ORGAPI;
|
||||
import com.actionsoft.sdk.local.api.TaskAPI;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.awspaas.user.apps.integration.event.OutputDCFileProcessor;
|
||||
import com.awspaas.user.apps.integration.util.HttpClientUtils;
|
||||
import com.awspaas.user.apps.integration.util.UtilUrl;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.RequestEntity;
|
||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
@Controller
|
||||
public class TaskController {
|
||||
|
||||
/**
|
||||
* OA系统单点访问PAL系统
|
||||
* @return
|
||||
*/
|
||||
@Mapping("com.yili_pal_portal_open")
|
||||
public String openPALConsole(String code) throws Exception {
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
|
||||
|
||||
String userid = "";
|
||||
|
||||
App app = new App();
|
||||
String tokens = app.getTokens("http://10.114.11.135:8088/portal/yili.html", code);
|
||||
if(StringUtils.isEmpty(tokens)){
|
||||
System.out.println("这个认证是失败的,code为空,请联系管理员");;
|
||||
}else {
|
||||
JSONObject jsonObjects = JSONObject.parseObject(tokens);
|
||||
String access_token = jsonObjects.getString("access_token");
|
||||
String userInfo = app.getUserInfo(access_token);
|
||||
|
||||
if (StringUtils.isNotEmpty(userInfo)){
|
||||
JSONObject json = JSONObject.parseObject(userInfo);
|
||||
System.out.println("json-=====>>>>"+json);
|
||||
if (StringUtils.isNotEmpty(json.getString("employeenumber"))){
|
||||
System.out.println("userid》》》》》》》》》》"+json.getString("employeenumber"));
|
||||
userid = json.getString("employeenumber");
|
||||
try {
|
||||
setUserLog(userid,"1");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
String sessionId = UserContext.fromUID(userid).getSessionId();
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
|
||||
String url = portalUrl +"/r/w?sid="+sessionId+"&cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1";
|
||||
// String palPortalUrl= portalUrl + "/r/w?sid="+sessionId+"&cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1";
|
||||
|
||||
String portal_url = "https://bpm.yili.com:8088"+"/portal/r/or?cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1&sid="+sessionId+"&oauthName=oauthLogin&code="+code;
|
||||
|
||||
//ro.put("new_url",url);
|
||||
|
||||
return portal_url;
|
||||
|
||||
}
|
||||
|
||||
@Mapping("com.wechat.oathLogin")
|
||||
public String postFr(String sid,String code){
|
||||
WechatApp app = new WechatApp();
|
||||
String tokens = app.getTokens(code);
|
||||
JSONObject jsonObjects = JSONObject.parseObject(tokens);
|
||||
String access_token = jsonObjects.getString("UserId");
|
||||
return access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录日志
|
||||
* @param userid
|
||||
* @param logType
|
||||
*/
|
||||
public void setUserLog(String userid,String logType) {
|
||||
System.err.println("用户登录记录存入日志========>"+userid+"_类型:"+logType);
|
||||
if (UtilString.isNotEmpty(userid)) {
|
||||
String logTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
BO bo = new BO();
|
||||
/*String slq = "SELECT ID,LOGINCOUNTS FROM BO_EU_USER_LOGIN_LOG WHERE LOGINUSERNAME = '"+userid+"' AND LOGINTIME = '"+logTime+"'";
|
||||
List<RowMap> maps = DBSql.getMaps(slq);
|
||||
if(maps.size()!=0) {
|
||||
bo = SDK.getBOAPI().get("BO_EU_USER_LOGIN_LOG", maps.get(0).getString("ID"));
|
||||
bo.set("LOGINCOUNTS", maps.get(0).getInt("LOGINCOUNTS")+1);
|
||||
SDK.getBOAPI().update("BO_EU_USER_LOGIN_LOG", bo);
|
||||
}else {*/
|
||||
ORGAPI orgapi = SDK.getORGAPI();
|
||||
UserModel user = orgapi.getUser(userid);
|
||||
DepartmentModel departmentByUser = orgapi.getDepartmentByUser(userid);
|
||||
bo.set("LOGINUSERNAME", userid);
|
||||
bo.set("USERBUNAME",user.getExt4());
|
||||
bo.set("USERPOST",user.getPositionName());
|
||||
bo.set("USERDEPTNAME", departmentByUser.getPathNameOfCache());
|
||||
bo.set("LOGINTIME", logTime);
|
||||
bo.set("LOGINCOUNTS", 1);
|
||||
bo.set("LOGTYPE", Integer.valueOf(logType));
|
||||
|
||||
SDK.getBOAPI().createDataBO("BO_EU_USER_LOGIN_LOG", bo, UserContext.fromUID("admin"));
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* OA系统单点访问表单数据
|
||||
* @param me
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Mapping("com.yili_form_page_open")
|
||||
public String openFormPage(UserContext me, RequestParams params) {
|
||||
System.out.println("进入表单了===========");
|
||||
System.out.println("参数输出==========="+params.asMap());
|
||||
//打开待办时记录日志
|
||||
try {
|
||||
setUserLog(me.getUID(),"2");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String sessionId = me.getSessionId();
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
if(!SDK.getPortalAPI().checkSession(sessionId)) {
|
||||
SSOUtil ssoUtil = new SSOUtil();
|
||||
sessionId = ssoUtil.registerClientSessionNoPassword(me.getUID(), "cn",portalUrl, me.getDeviceType());
|
||||
}
|
||||
UserContext uc = UserContext.fromSessionId(sessionId);
|
||||
UserTaskFormsWeb web = new UserTaskFormsWeb(uc);
|
||||
String processInstId = params.get("processInstId");
|
||||
String taskInstId = params.get("taskInstId");
|
||||
if (!UtilString.isEmpty(taskInstId) && taskInstId.equals("null")) {
|
||||
taskInstId = "";
|
||||
}
|
||||
int openState = 0;
|
||||
//根据流程实例去获取表单的 状态
|
||||
if (!taskInstId.equals("")){
|
||||
TaskAPI taskAPI = SDK.getTaskAPI();
|
||||
final TaskInstance taskInstance = taskAPI.getTaskInstance(taskInstId);
|
||||
if (null == taskInstance){
|
||||
taskInstId="";
|
||||
}else{
|
||||
if ("delete".equals(taskInstance.getControlState())){
|
||||
taskInstId="";
|
||||
}else{
|
||||
openState = taskInstance.getState();
|
||||
}
|
||||
}
|
||||
}
|
||||
int currentPage = params.getInt("currentPage", 1);
|
||||
String formDefId = params.get("formDefId", "");
|
||||
String boId = params.get("boId", "");
|
||||
String lang = params.get("lang");
|
||||
if (!UtilString.isEmpty(lang)) {
|
||||
me.setLanguages(lang);
|
||||
}
|
||||
String extParam = params.get("extParam");
|
||||
JSONObject extParamJO = null;
|
||||
if (!UtilString.isEmpty(extParam)) {
|
||||
try {
|
||||
extParamJO = JSONObject.parseObject(URLDecoder.decode(extParam, StandardCharsets.UTF_8.name()));
|
||||
} catch (UnsupportedEncodingException var14) {
|
||||
var14.printStackTrace();
|
||||
}
|
||||
}
|
||||
boolean isDisplayToolbar = params.getBoolean("displayToolbar", true);
|
||||
String formPage = web.getFormPage(processInstId, taskInstId, openState, currentPage, formDefId, boId, isDisplayToolbar, extParamJO);
|
||||
//String formURL = SDK.getFormAPI().getFormURL("", sessionId, processInstId,taskInstId, 1, null, null, null);
|
||||
//System.err.println("单点登录页面链接--->"+formURL);
|
||||
//return portalUrl+"/r"+formURL.substring(1);
|
||||
//System.out.println("输出表单==========="+formPage);
|
||||
return formPage;
|
||||
}
|
||||
|
||||
@Mapping("com.yili_process_page")
|
||||
public String processTest(UserContext me, RequestParams params) throws IOException, SQLException {
|
||||
System.out.println("params>>>>>>>>>>>>"+params.toString());
|
||||
System.out.println("UserContext>>>>>>>>>>>>"+me.getUID());
|
||||
String userMobile = me.getDeviceType();
|
||||
String html = "index_web.html";
|
||||
Connection conn = DBSql.open();
|
||||
//用户打开阅览界面日志
|
||||
try {
|
||||
setUserLog(me.getUID(),"3");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
||||
try {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
|
||||
//UserContext uc = UserContext.fromSessionId(sid);
|
||||
String sid = me.getSessionId();
|
||||
String processInstId = params.get("processInstId");
|
||||
String taskInstId = params.get("taskInstId");
|
||||
String usercode = "admin";
|
||||
if(UtilString.isNotEmpty(params.get("usercode"))){
|
||||
usercode = params.get("usercode");
|
||||
}
|
||||
map.put("sid", sid);
|
||||
|
||||
|
||||
|
||||
List<BO> list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processInstId).list();
|
||||
List<BO> lists = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processInstId).list();
|
||||
int num = 1;
|
||||
|
||||
|
||||
|
||||
for (BO bo : list) {
|
||||
System.out.println("开始时间》》》》》》》"+System.currentTimeMillis());
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID ='" + bo.get("PUBLISHFILEID") + "'";
|
||||
RowMap Row_maps_is_not_publish = DBSql.getMap(conn, is_not_publish_sql);
|
||||
/*boolean havingStartProcessPermission =SDK.getPermAPI().havingStartProcessPermission(uc.getUID(), processDefId);
|
||||
if(havingStartProcessPermission) {*/
|
||||
String id = bo.getString("TASKID");
|
||||
jsonObject.put("title",bo.get("PUBLISHFILENAME"));
|
||||
jsonObject.put("link",SDK.getPortalAPI().getPortalUrl()+ "/r/w?cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open&uuid=" + Row_maps_is_not_publish.getString("id") + "&sid=" + sid);
|
||||
jsonObject.put("size","");
|
||||
jsonObject.put("id",num);
|
||||
jsonObject.put("taskId",id);
|
||||
// OutputTaskModel model = new OutputTask().getTaskReportById(id);
|
||||
//JSONObject json = new JSONObject();
|
||||
/*
|
||||
* if (model != null) { //三员管理,步骤横表下载重新生成手册
|
||||
*
|
||||
* String taskName = model.getTaskName();
|
||||
*
|
||||
* String str = "";
|
||||
*
|
||||
* if ("步骤横表".equals(taskName)){ // 重新设置生成id,与用户id String uuid =
|
||||
* UUIDGener.getUUID(); model.setUserId(me.getUID());
|
||||
*
|
||||
* // 重新生成手册文件 OutputAPIManager.getInstance().reGennerReport(me,model,uuid);
|
||||
*
|
||||
* // 重新构建手册下载URL id = uuid; }
|
||||
*
|
||||
* try { //jsonObject.put("url",
|
||||
* OutputDCFileProcessor.getReportDownloadURL(model.getWsId(), id,
|
||||
* model.getProfileId(), me, bo.get("PUBLISHFILENAME")+model.getTaskName()));
|
||||
* jsonObject.put("taskId",id); } catch (Exception e) {
|
||||
*
|
||||
* e.printStackTrace(); } }
|
||||
*/
|
||||
jsonObject.put("id",num);
|
||||
System.out.println("查询完成后时间》》》》》》》"+System.currentTimeMillis());
|
||||
/* OutputTaskModel model = new OutputTask().getTaskReportById(id);
|
||||
if (model != null) {
|
||||
//三员管理,步骤横表下载重新生成手册
|
||||
|
||||
String taskName = model.getTaskName();
|
||||
if ("步骤横表".equals(taskName)){
|
||||
// 重新设置生成id,与用户id
|
||||
String uuid = UUIDGener.getUUID();
|
||||
model.setUserId(me.getUID());
|
||||
|
||||
// 重新生成手册文件
|
||||
OutputAPIManager.getInstance().reGennerReport(me,model,uuid);
|
||||
|
||||
// 重新构建手册下载URL
|
||||
id = uuid;
|
||||
}
|
||||
|
||||
try {
|
||||
jsonObject.put("url", OutputDCFileProcessor.getReportDownloadURL(model.getWsId(), id, model.getProfileId(), me, bo.get("PUBLISHFILENAME")+model.getTaskName()));
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
System.out.println("构建表完成时间》》》》》》》"+System.currentTimeMillis());
|
||||
jsonArray.add(jsonObject);
|
||||
num++;
|
||||
|
||||
}
|
||||
|
||||
for (BO bo : lists) {
|
||||
System.out.println("开始时间》》》》》》》"+System.currentTimeMillis());
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID ='" + bo.get("CHANGEDFILEIDNEW") + "'";
|
||||
RowMap Row_maps_is_not_publish = DBSql.getMap(conn, is_not_publish_sql);
|
||||
/*boolean havingStartProcessPermission =SDK.getPermAPI().havingStartProcessPermission(uc.getUID(), processDefId);
|
||||
if(havingStartProcessPermission) {*/
|
||||
String id = bo.getString("TASKID");
|
||||
jsonObject.put("title",bo.get("CHANGEDFILENAMENEW"));
|
||||
jsonObject.put("link",SDK.getPortalAPI().getPortalUrl()+ "/r/w?cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open&uuid=" + Row_maps_is_not_publish.getString("id") + "&sid=" + sid);
|
||||
jsonObject.put("size","");
|
||||
jsonObject.put("id",num);
|
||||
jsonObject.put("taskId",id);
|
||||
// OutputTaskModel model = new OutputTask().getTaskReportById(id);
|
||||
//JSONObject json = new JSONObject();
|
||||
/*
|
||||
* if (model != null) { //三员管理,步骤横表下载重新生成手册
|
||||
*
|
||||
* String taskName = model.getTaskName();
|
||||
*
|
||||
* String str = "";
|
||||
*
|
||||
* if ("步骤横表".equals(taskName)){ // 重新设置生成id,与用户id String uuid =
|
||||
* UUIDGener.getUUID(); model.setUserId(me.getUID());
|
||||
*
|
||||
* // 重新生成手册文件 OutputAPIManager.getInstance().reGennerReport(me,model,uuid);
|
||||
*
|
||||
* // 重新构建手册下载URL id = uuid; }
|
||||
*
|
||||
* try { //jsonObject.put("url",
|
||||
* OutputDCFileProcessor.getReportDownloadURL(model.getWsId(), id,
|
||||
* model.getProfileId(), me, bo.get("PUBLISHFILENAME")+model.getTaskName()));
|
||||
* jsonObject.put("taskId",id); } catch (Exception e) {
|
||||
*
|
||||
* e.printStackTrace(); } }
|
||||
*/
|
||||
jsonObject.put("id",num);
|
||||
System.out.println("查询完成后时间》》》》》》》"+System.currentTimeMillis());
|
||||
/* OutputTaskModel model = new OutputTask().getTaskReportById(id);
|
||||
if (model != null) {
|
||||
//三员管理,步骤横表下载重新生成手册
|
||||
|
||||
String taskName = model.getTaskName();
|
||||
if ("步骤横表".equals(taskName)){
|
||||
// 重新设置生成id,与用户id
|
||||
String uuid = UUIDGener.getUUID();
|
||||
model.setUserId(me.getUID());
|
||||
|
||||
// 重新生成手册文件
|
||||
OutputAPIManager.getInstance().reGennerReport(me,model,uuid);
|
||||
|
||||
// 重新构建手册下载URL
|
||||
id = uuid;
|
||||
}
|
||||
|
||||
try {
|
||||
jsonObject.put("url", OutputDCFileProcessor.getReportDownloadURL(model.getWsId(), id, model.getProfileId(), me, bo.get("PUBLISHFILENAME")+model.getTaskName()));
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
System.out.println("构建表完成时间》》》》》》》"+System.currentTimeMillis());
|
||||
jsonArray.add(jsonObject);
|
||||
num++;
|
||||
|
||||
}
|
||||
|
||||
String substring = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).detail().getString("RELEASE_INSTRUCTIONS");
|
||||
BO bo_act_coe_publishs = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).detail();
|
||||
|
||||
//}
|
||||
map.put("subString",substring);
|
||||
map.put("ProcessTile",bo_act_coe_publishs.getString("PROCESS_TITLE"));
|
||||
map.put("processInstId",processInstId);
|
||||
map.put("sid",sid);
|
||||
System.out.println("jsonArray=====>>>>>>>>>"+jsonArray);
|
||||
map.put("jsonlist",jsonArray);
|
||||
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
String url = portalUrl + "/r/or?cmd=com.yili_process_page&processInstId=" + processInstId + "&taskInstId=" + taskInstId;
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
jsonObject.put("action", "read");
|
||||
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
// String s = httpClientUtil.SendPreview("http://10.119.22.207:80/services/service_lcglpt?wsdl", jsonObject);
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).detail();
|
||||
List<BO> bo_act_dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).list();
|
||||
|
||||
if (bo_act_dataid != null) {
|
||||
try {
|
||||
|
||||
if (SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=",usercode).detail()!=null){
|
||||
|
||||
String dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=",usercode).detail().getString("DATAID");
|
||||
jsonObject.put("dataid", dataid);
|
||||
}else {
|
||||
jsonObject.put("dataid", "");
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
jsonObject.put("status","1");
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
|
||||
" <soapenv:Header/>" +
|
||||
" <soapenv:Body>" +
|
||||
" <web:service>" +
|
||||
" <web:in0>" +
|
||||
"<![CDATA[" + jsonObject + "]]>" +
|
||||
" </web:in0>" +
|
||||
" </web:service>" +
|
||||
" </soapenv:Body>" +
|
||||
"</soapenv:Envelope>";
|
||||
//HttpClientUtil httpClientUtil = new HttpClientUtil();
|
||||
System.out.println("HttpClient 发送SOAP请求");
|
||||
HttpClient client = new HttpClient();
|
||||
int timeout = 10000;
|
||||
PostMethod postMethod = new PostMethod("http://10.105.1.59:80/services/service_lcglpt");
|
||||
// 设置连接超时
|
||||
client.getHttpConnectionManager().getParams().setConnectionTimeout(timeout);
|
||||
// 设置读取时间超时
|
||||
client.getHttpConnectionManager().getParams().setSoTimeout(timeout);
|
||||
// 然后把Soap请求数据添加到PostMethod中
|
||||
RequestEntity requestEntity = new StringRequestEntity(xmlStr, "text/xml", "UTF-8");
|
||||
// 设置请求体
|
||||
postMethod.setRequestEntity(requestEntity);
|
||||
int status = client.executeMethod(postMethod);
|
||||
// 打印请求状态码
|
||||
System.out.println("status:" + status);
|
||||
// 获取响应体输入流
|
||||
System.out.println("xmlstr=================" + xmlStr);
|
||||
InputStream is = postMethod.getResponseBodyAsStream();
|
||||
System.out.println("s=================+s" + new String(ByteStreams.toByteArray(is)));
|
||||
//System.out.println("s==============>>>>>>>>>>>"+s);
|
||||
|
||||
//}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
conn.close();
|
||||
}
|
||||
return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration",html, map);
|
||||
}
|
||||
|
||||
|
||||
@Mapping("com.yili_process_page_phone")
|
||||
public String processPhone(UserContext me, RequestParams params) throws SQLException {
|
||||
|
||||
System.out.println("params>>>>>>>>>>>>"+params.get("userid"));
|
||||
System.out.println("UserContext>>>>>>>>>>>>"+me.getUID());
|
||||
String userMobile = me.getDeviceType();
|
||||
Connection conn = DBSql.open();
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
//用户打开阅览界面日志
|
||||
try {
|
||||
setUserLog(me.getUID(),"3");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String html = "index_phone.html";
|
||||
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
||||
try{
|
||||
//UserContext uc = UserContext.fromSessionId(sid);
|
||||
String sid = me.getSessionId();
|
||||
String processInstId = params.get("processInstId");
|
||||
String taskInstId = params.get("taskInstId");
|
||||
|
||||
String usercode = "admin";
|
||||
if(UtilString.isNotEmpty(me.getUID())){
|
||||
usercode = me.getUID();
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId);
|
||||
String sourceAppId = instanceById.getAppId();
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview";
|
||||
String substring = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).detail().getString("RELEASE_INSTRUCTIONS");
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).detail();
|
||||
|
||||
List<BO> list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processInstId).list();
|
||||
List<BO> lists = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processInstId).list();
|
||||
int num = 1;
|
||||
|
||||
for (BO bo:list) {
|
||||
|
||||
if(StringUtils.isNotEmpty(bo.getString("TASKID"))&& !bo.getString("TASKID").equals("submit_create")){
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID"));
|
||||
System.out.println(",odel>>>>>>>>"+bo.getString("TASKID"));
|
||||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||||
if (appProfile==null){
|
||||
throw new AWSException("Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1");
|
||||
}
|
||||
DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT);
|
||||
if (dcProfile == null)
|
||||
throw new AWSException("Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT);
|
||||
String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '"+bo.getString("PUBLISHFILEID")+"'";
|
||||
String lever = DBSql.getString(conn, sql_lever);
|
||||
System.out.println("lever====>>>>>"+lever);
|
||||
if (lever.length()!=5){
|
||||
lever = lever+".0";
|
||||
}
|
||||
String name = bo.getString("PUBLISHFILENAME").replaceAll("/","");
|
||||
DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bo.getString("TASKID"),name+"_"+lever+".doc");
|
||||
|
||||
|
||||
|
||||
// 调用App
|
||||
|
||||
// 参数定义列表
|
||||
Map params_preview = new HashMap<String, Object>();
|
||||
//文档是否允许下载,必填
|
||||
params_preview.put("isDownload", true);
|
||||
//显示文件名,必填
|
||||
params_preview.put("fileNameOriginal", name+"_"+lever+".doc");
|
||||
//PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填
|
||||
params_preview.put("isPDFCovertPNG", 0);
|
||||
//groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
|
||||
params_preview.put("extParams", "");
|
||||
//文档是否允许打印,必填
|
||||
params_preview.put("isPrint", true);
|
||||
//是否显示顶部工具栏的返回按钮,默认显示,非必填
|
||||
params_preview.put("isShowBackbtn", false);
|
||||
//原文件DC,必填
|
||||
params_preview.put("sourceDc", dcContext);
|
||||
//是否显示默认预览工具栏,必填
|
||||
params_preview.put("isShowDefaultToolbar", true);
|
||||
//文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填
|
||||
params_preview.put("isCopy", true);
|
||||
//sessionid,必填
|
||||
params_preview.put("sid", sid);
|
||||
//文档是否加密,必填
|
||||
params_preview.put("isEncrypt", false);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//文档预览
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params_preview);
|
||||
|
||||
System.out.println("ro>>>>>>>>>>>>>>>>"+ro);
|
||||
String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE id ='"+bo.get("PUBLISHFILEID")+"'";
|
||||
List<RowMap> Row_maps_is_not_publish = DBSql.getMaps(conn, is_not_publish_sql);
|
||||
|
||||
/*boolean havingStartProcessPermission =SDK.getPermAPI().havingStartProcessPermission(uc.getUID(), processDefId);
|
||||
if(havingStartProcessPermission) {*/
|
||||
BigDecimal big=new BigDecimal(Row_maps_is_not_publish.get(0).getString("PLVER"));
|
||||
|
||||
JSONObject jsonObjects = new JSONObject();
|
||||
jsonObjects.put("title",bo.get("PUBLISHFILENAME"));
|
||||
jsonObjects.put("link","https://bpm.yili.com:8088/portal/r"+ro.get("url").toString().substring(1));
|
||||
// jsonObjects.put("size","12k");
|
||||
jsonArray.add(jsonObjects);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'" +
|
||||
")";
|
||||
List<RowMap> maps = DBSql.getMaps(conn,sql_upfile);
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
UpfileWeb upfileWeb = new UpfileWeb(userContext);
|
||||
|
||||
for (RowMap row : maps) {
|
||||
UpfileModel upfileModel = new UpfileModel();
|
||||
upfileModel.setType(row.getString("FILETYPE"));
|
||||
upfileModel.setFileName(row.getString("FILENAME"));
|
||||
upfileModel.setPl_uuid(row.getString("PALREPOSITORYID"));
|
||||
upfileModel.setShape_uuid(row.getString("SHAPEID"));
|
||||
DCContext dcContexts = upfileWeb.getDCContext(upfileModel);
|
||||
Map params_previews = new HashMap<String, Object>();
|
||||
//文档是否允许下载,必填
|
||||
params_previews.put("isDownload", true);
|
||||
//显示文件名,必填
|
||||
params_previews.put("fileNameOriginal", row.getString("FILENAME"));
|
||||
//PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填
|
||||
params_previews.put("isPDFCovertPNG", 0);
|
||||
//groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
|
||||
params_previews.put("extParams", "");
|
||||
//文档是否允许打印,必填
|
||||
params_previews.put("isPrint", true);
|
||||
//是否显示顶部工具栏的返回按钮,默认显示,非必填
|
||||
params_previews.put("isShowBackbtn", "");
|
||||
//原文件DC,必填
|
||||
params_previews.put("sourceDc", dcContexts);
|
||||
//是否显示默认预览工具栏,必填
|
||||
params_previews.put("isShowDefaultToolbar", true);
|
||||
//文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填
|
||||
params_previews.put("isCopy", true);
|
||||
//sessionid,必填
|
||||
params_previews.put("sid", sid);
|
||||
//文档是否加密,必填
|
||||
params_previews.put("isEncrypt", false);
|
||||
AppAPI appAPIs = SDK.getAppAPI();
|
||||
//文档预览
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, params_previews);
|
||||
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("title",row.getString("FILENAME"));
|
||||
String base_url = "https://bpm.yili.com:8088/portal/r";
|
||||
if (row.getString("FILENAME").toString().contains(".xls")||row.getString("FILENAME").toString().contains(".xlsx")){
|
||||
jsonObject1.put("link",ros.get("url").toString().substring(0));
|
||||
}else {
|
||||
jsonObject1.put("link",base_url+ros.get("url").toString().substring(1));
|
||||
}
|
||||
|
||||
// jsonObject1.put("size","12k");
|
||||
jsonArray.add(jsonObject1);
|
||||
num++;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
|
||||
|
||||
for (BO bo:lists) {
|
||||
|
||||
if(StringUtils.isNotEmpty(bo.getString("TASKID"))&& !bo.getString("TASKID").equals("submit_create")){
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID"));
|
||||
System.out.println(",odel>>>>>>>>"+bo.getString("TASKID"));
|
||||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||||
if (appProfile==null){
|
||||
throw new AWSException("Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1");
|
||||
}
|
||||
DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT);
|
||||
if (dcProfile == null)
|
||||
throw new AWSException("Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT);
|
||||
String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '"+bo.getString("CHANGEDFILEIDNEW")+"'";
|
||||
String lever = DBSql.getString(conn, sql_lever);
|
||||
System.out.println("lever====>>>>>"+lever);
|
||||
if (lever.length()!=5){
|
||||
lever = lever+".0";
|
||||
}
|
||||
String name = bo.getString("CHANGEDFILENAMENEW").replaceAll("/","");
|
||||
DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bo.getString("TASKID"),name+"_"+lever+".doc");
|
||||
|
||||
|
||||
|
||||
// 调用App
|
||||
|
||||
// 参数定义列表
|
||||
Map params_preview = new HashMap<String, Object>();
|
||||
//文档是否允许下载,必填
|
||||
params_preview.put("isDownload", true);
|
||||
//显示文件名,必填
|
||||
params_preview.put("fileNameOriginal", name+"_"+lever+".doc");
|
||||
//PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填
|
||||
params_preview.put("isPDFCovertPNG", 0);
|
||||
//groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
|
||||
params_preview.put("extParams", "");
|
||||
//文档是否允许打印,必填
|
||||
params_preview.put("isPrint", true);
|
||||
//是否显示顶部工具栏的返回按钮,默认显示,非必填
|
||||
params_preview.put("isShowBackbtn", false);
|
||||
//原文件DC,必填
|
||||
params_preview.put("sourceDc", dcContext);
|
||||
//是否显示默认预览工具栏,必填
|
||||
params_preview.put("isShowDefaultToolbar", true);
|
||||
//文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填
|
||||
params_preview.put("isCopy", true);
|
||||
//sessionid,必填
|
||||
params_preview.put("sid", sid);
|
||||
//文档是否加密,必填
|
||||
params_preview.put("isEncrypt", false);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//文档预览
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params_preview);
|
||||
|
||||
System.out.println("ro>>>>>>>>>>>>>>>>"+ro);
|
||||
String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE id ='"+bo.get("CHANGEDFILEIDNEW")+"'";
|
||||
RowMap Row_maps_is_not_publish = DBSql.getMap(conn, is_not_publish_sql);
|
||||
|
||||
/*boolean havingStartProcessPermission =SDK.getPermAPI().havingStartProcessPermission(uc.getUID(), processDefId);
|
||||
if(havingStartProcessPermission) {*/
|
||||
BigDecimal big=new BigDecimal(Row_maps_is_not_publish.getString("PLVER"));
|
||||
|
||||
JSONObject jsonObjects = new JSONObject();
|
||||
jsonObjects.put("title",bo.get("CHANGEDFILENAMENEW"));
|
||||
jsonObjects.put("link","https://bpm.yili.com:8088/portal/r"+ro.get("url").toString().substring(1));
|
||||
// jsonObjects.put("size","12k");
|
||||
jsonArray.add(jsonObjects);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("CHANGEDFILEIDNEW")+"'" +
|
||||
")";
|
||||
List<RowMap> maps = DBSql.getMaps(conn,sql_upfile);
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
UpfileWeb upfileWeb = new UpfileWeb(userContext);
|
||||
|
||||
for (RowMap row : maps) {
|
||||
UpfileModel upfileModel = new UpfileModel();
|
||||
upfileModel.setType(row.getString("FILETYPE"));
|
||||
upfileModel.setFileName(row.getString("FILENAME"));
|
||||
upfileModel.setPl_uuid(row.getString("PALREPOSITORYID"));
|
||||
upfileModel.setShape_uuid(row.getString("SHAPEID"));
|
||||
DCContext dcContexts = upfileWeb.getDCContext(upfileModel);
|
||||
Map params_previews = new HashMap<String, Object>();
|
||||
//文档是否允许下载,必填
|
||||
params_previews.put("isDownload", true);
|
||||
//显示文件名,必填
|
||||
params_previews.put("fileNameOriginal", row.getString("FILENAME"));
|
||||
//PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填
|
||||
params_previews.put("isPDFCovertPNG", 0);
|
||||
//groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
|
||||
params_previews.put("extParams", "");
|
||||
//文档是否允许打印,必填
|
||||
params_previews.put("isPrint", true);
|
||||
//是否显示顶部工具栏的返回按钮,默认显示,非必填
|
||||
params_previews.put("isShowBackbtn", "");
|
||||
//原文件DC,必填
|
||||
params_previews.put("sourceDc", dcContexts);
|
||||
//是否显示默认预览工具栏,必填
|
||||
params_previews.put("isShowDefaultToolbar", true);
|
||||
//文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填
|
||||
params_previews.put("isCopy", true);
|
||||
//sessionid,必填
|
||||
params_previews.put("sid", sid);
|
||||
//文档是否加密,必填
|
||||
params_previews.put("isEncrypt", false);
|
||||
AppAPI appAPIs = SDK.getAppAPI();
|
||||
//文档预览
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, params_previews);
|
||||
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("title",row.getString("FILENAME"));
|
||||
if (row.getString("FILENAME").contains(".xlsx")||row.getString("FILENAME").contains(".xls")){
|
||||
jsonObject1.put("link",ros.get("url").toString().substring(0));
|
||||
}else {
|
||||
jsonObject1.put("link","https://bpm.yili.com:8088/portal/r"+ros.get("url").toString().substring(1));
|
||||
}
|
||||
|
||||
// jsonObject1.put("size","12k");
|
||||
jsonArray.add(jsonObject1);
|
||||
num++;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
|
||||
|
||||
//}
|
||||
System.out.println("substring>>>>>>>>>>"+substring);
|
||||
map.put("subString",substring);
|
||||
map.put("ProcessTile",bo_act_coe_publish.getString("PROCESS_TITLE"));
|
||||
map.put("processInstId",processInstId);
|
||||
map.put("sid",sid);
|
||||
System.out.println("jsonArray=====>>>>>>>>>"+jsonArray);
|
||||
map.put("jsonlist",jsonArray);
|
||||
//DBSql.close(conn);
|
||||
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
String url = portalUrl+"/r/or?cmd=com.yili_process_page&processInstId="+processInstId+"&taskInstId="+taskInstId;
|
||||
String mobileurl = portalUrl+"/r/or?cmd=com.yili_process_page_phone&processInstId="+processInstId+"&taskInstId="+taskInstId;
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String sql = "SELECT * FROM WFC_PROCESS WHERE ID ='"+processInstId+"'";
|
||||
List<RowMap> rowMaps = DBSql.getMaps(conn,sql);
|
||||
if (rowMaps.size()==1){
|
||||
|
||||
jsonObject.put("action","read");
|
||||
//jsonObject.put("dept",me.getDepartmentModel().getNo());
|
||||
// jsonObject.put("user",me.getUID());
|
||||
// jsonObject.put("remark","");
|
||||
jsonObject.put("status","1");
|
||||
//jsonObject.put("pcurl",url);
|
||||
// jsonObject.put("mobileurl",mobileurl);
|
||||
try {
|
||||
BO bo_act_dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=", usercode).detail();
|
||||
if (bo_act_dataid!=null){
|
||||
jsonObject.put("dataid",bo_act_dataid.getString("DATAID"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
//jsonObject.put("userList","00345531");
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
// String s = httpClientUtil.SendPreview("http://10.119.22.207:80/services/service_lcglpt?wsdl", jsonObject);
|
||||
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
|
||||
" <soapenv:Header/>" +
|
||||
" <soapenv:Body>" +
|
||||
" <web:service>" +
|
||||
" <web:in0>" +
|
||||
"<![CDATA["+jsonObject+"]]>"+
|
||||
" </web:in0>" +
|
||||
" </web:service>" +
|
||||
" </soapenv:Body>" +
|
||||
"</soapenv:Envelope>";
|
||||
//HttpClientUtil httpClientUtil = new HttpClientUtil();
|
||||
String s = UtilUrl.doPostSoap("http://10.105.1.59:80/services/service_lcglpt", xmlStr, "");
|
||||
System.out.println("s==============>>>>>>>>>>>"+s);
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
conn.close();
|
||||
}
|
||||
return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration",html, map);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从 String 中提取数字
|
||||
* @param string
|
||||
* @return
|
||||
*/
|
||||
public static String getNumberFromString(String string){
|
||||
String str = string;
|
||||
str = str.trim();
|
||||
StringBuffer str2 = new StringBuffer();
|
||||
if(str != null && !"".equals(str)) {
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
if (str.charAt(i) >= 48 && str.charAt(i) <= 57) {
|
||||
String s = String.valueOf(str.charAt(i));
|
||||
str2.append(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
return str2.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oauth;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class WechatApp {
|
||||
// Basic testClient:qwertyuio0987654rfg :: Basic ???
|
||||
static String clientId = "wwb0ae23173b140618";
|
||||
static String clientSecret = "kkuVjcNmkjqvGs36l2L2_p6iJMk0eTsxcKDyydsX36k";
|
||||
|
||||
public String getAccessTokens() {
|
||||
String tokenJson = "";
|
||||
|
||||
//String url = "https://wechat.yili.com/connect/oauth2/authorize?appid=prcmgr&redirect_uri=https://bpm.yili.com:8088/portal//r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId=274157ca-cd16-47bc-b055-f440d2ff718f&taskInstId=5ad2abeb-25ce-4388-a7b3-92572ed4b389&casaccount=10056870&validcode=8d62447812dbfd5ef4727fb8b8c05ecf&fromsys=OA&response_type=code&scope=SCOPE&agentid=AGENTID&state=STATE#wechat_redirect";
|
||||
|
||||
String url = "https://wechat.eyili.com/cgi-bin/gettoken?corpid="+clientId+"&corpsecret="+clientSecret;
|
||||
|
||||
HashMap<String, String> HeaderMap = new HashMap();
|
||||
//HeaderMap.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
|
||||
tokenJson = HttpJavaUtil.doPost(url, "", HeaderMap);
|
||||
System.out.println(tokenJson);
|
||||
return tokenJson;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// http://cs.idm.yili.com:7777/ms_oauth/oauth2/endpoints/oauthservice/tokens?redirect_uri=http://192.168.88.100:8080/ecs-console/&grant_type=authorization_code&code=
|
||||
// 获取授权Token接口(authorization_code模式)
|
||||
public String getTokens( String code) {
|
||||
String tokenJson = "";
|
||||
|
||||
//String url = "https://wechat.yili.com/connect/oauth2/authorize?appid=prcmgr&redirect_uri=https://bpm.yili.com:8088/portal//r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId=274157ca-cd16-47bc-b055-f440d2ff718f&taskInstId=5ad2abeb-25ce-4388-a7b3-92572ed4b389&casaccount=10056870&validcode=8d62447812dbfd5ef4727fb8b8c05ecf&fromsys=OA&response_type=code&scope=SCOPE&agentid=AGENTID&state=STATE#wechat_redirect";
|
||||
String accessTokens = getAccessTokens();
|
||||
JSONObject jsonObjects = JSONObject.parseObject(accessTokens);
|
||||
String access_token = jsonObjects.getString("access_token");
|
||||
String url = "https://wechat.yili.com/cgi-bin/user/getuserinfo?access_token="+access_token+"&code="+code;
|
||||
System.out.println("url======>>>>>"+url);
|
||||
HashMap<String, String> HeaderMap = new HashMap();
|
||||
HeaderMap.put("grant_type", "aauthorization_code");
|
||||
|
||||
tokenJson = HttpJavaUtil.doPost(url, "", HeaderMap);
|
||||
System.out.println(tokenJson);
|
||||
return tokenJson;
|
||||
|
||||
}
|
||||
|
||||
public String getUserInfo(String token) {
|
||||
String userInfoJson = "";
|
||||
String url = "https://idm.yili.com:7777/ms_oauth/resources/userprofile/me";
|
||||
|
||||
String authoStr = token;
|
||||
HashMap<String, String> HeaderMap = new HashMap();
|
||||
HeaderMap.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
HeaderMap.put("Authorization", authoStr);
|
||||
HeaderMap.put("accept", "*/*");
|
||||
HeaderMap.put("connection", "Keep-Alive");
|
||||
|
||||
// do request get
|
||||
userInfoJson = HttpJavaUtil.doGet(url, HeaderMap);
|
||||
System.out.println(userInfoJson);
|
||||
return userInfoJson;
|
||||
}
|
||||
|
||||
public String geAuthorization(String clientId, String clientSecret) {
|
||||
try {
|
||||
byte[] key = (clientId + ":" + clientSecret).getBytes("utf-8");
|
||||
String cc = new String(Base64.encodeBase64(key), "utf-8");
|
||||
// String cc = new String(java.util.Base64.getEncoder().encode(key), "utf-8");
|
||||
return "Basic " + cc;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,128 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.oauth;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.commons.oauth.AbstractOauth;
|
||||
import com.actionsoft.bpms.server.RequestParams;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.LogAPI;
|
||||
import com.actionsoft.sdk.local.api.Logger;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yili.wsclient.ClientService;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* OA系统 跳转登陆PAl
|
||||
*
|
||||
* @author lihy
|
||||
*/
|
||||
|
||||
public class WechatOauthLogin extends AbstractOauth {
|
||||
private Logger logger = LogAPI.getLogger(WechatOauthLogin.class);
|
||||
|
||||
//static String clientId = "testClient";
|
||||
//static String clientSecret = "1234567890";
|
||||
/**
|
||||
* 这个方法代表是否有登录授权页,返回的值取决于三方系统提供的 SSO 认证方式。一类认 证方式如 Oauth2.0
|
||||
* 认证,需要先跳转到三方系统的登录授权页面,授权成功后再跳转到调 用方指定的页面,这类认证方式下,hasOauthPage()方法需要返回 true。
|
||||
* 另外一类认证时不 需要跳转到登录授权页, 会直接传过来 ticket 或者 token 参数, hasOauthPage()方法需要返 回 false。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean hasOauthPage() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果 hasOauthPage()方法返回的值是 false, 返回 null 即可。 如果 hasOauthPage()方法返回 的值是
|
||||
* true,则此处返回三方系统的登录授权页地址。
|
||||
* @param requestParams
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getOauthPage(RequestParams requestParams) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String validate(RequestParams params) throws IOException {
|
||||
|
||||
|
||||
logger.info("企业微信单点登录单点登录验证---------"+params);
|
||||
try {
|
||||
String redirect_uri = params.get("code");
|
||||
System.out.println("code=====>>>>>"+redirect_uri);
|
||||
if(StringUtils.isEmpty(redirect_uri)){
|
||||
logger.error("跳转地址为空,请重新输入");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
WechatApp app = new WechatApp();
|
||||
String tokens = app.getTokens(redirect_uri);
|
||||
if(StringUtils.isEmpty(tokens)){
|
||||
logger.error("获取token为空,请重新输入登录信息获取code");
|
||||
return null;
|
||||
}else {
|
||||
JSONObject jsonObjects = JSONObject.parseObject(tokens);
|
||||
String access_token = jsonObjects.getString("UserId");
|
||||
|
||||
if (StringUtils.isNotEmpty(access_token)){
|
||||
UserContext userContext = UserContext.fromUID(access_token);
|
||||
if (userContext!=null){
|
||||
return access_token;
|
||||
}else{
|
||||
BO detail = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("LOGINID=", access_token).detail();
|
||||
String workcode = detail.getString("WORKCODE");
|
||||
if (workcode.length()!=8){
|
||||
return "00"+workcode;
|
||||
}else{
|
||||
return params.get("htcode");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("统一身份认证失败!", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一身份认证接口
|
||||
* @param1 webserviceUrl 身份认证接口地址
|
||||
* @param2 casaccount 登录账号 OA账号
|
||||
* @param3 appaccount 应用系统登录账号
|
||||
* @param4 appid 应用系统id
|
||||
* @param5 validcode 验证码
|
||||
* @return true/false
|
||||
*/
|
||||
public static String getToken(String casaccount,String appaccount,String appid,String validcode) {
|
||||
//身份认证接口地址
|
||||
String webserviceUrl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "webserviceUrl");
|
||||
String checkLogin = ClientService.checkLogin(webserviceUrl,casaccount,appaccount,appid,validcode);
|
||||
return checkLogin ;
|
||||
}
|
||||
|
||||
|
||||
public static String geAuthorization(String clientId, String clientSecret) {
|
||||
try {
|
||||
byte[] key = (clientId + ":" + clientSecret).getBytes("utf-8");
|
||||
String cc = new String(Base64.encodeBase64(key), "utf-8");
|
||||
// String cc = new String(java.util.Base64.getEncoder().encode(key), "utf-8");
|
||||
return "Basic " + cc;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.plugins;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.actionsoft.apps.listener.PluginListener;
|
||||
import com.actionsoft.apps.resource.AppContext;
|
||||
import com.actionsoft.apps.resource.plugin.profile.AWSPluginProfile;
|
||||
import com.actionsoft.apps.resource.plugin.profile.OauthPluginProfile;
|
||||
import com.actionsoft.apps.resource.plugin.profile.ProcessPublicEventPluginProfile;
|
||||
import com.awspaas.user.apps.integration.oa.TaskListener;
|
||||
import com.awspaas.user.apps.integration.oauth.OauthLogin;
|
||||
import com.awspaas.user.apps.integration.oauth.WechatOauthLogin;
|
||||
import com.awspaas.user.apps.integration.oauth.ProcessOathLogin;
|
||||
|
||||
/**
|
||||
* @author LHY
|
||||
*/
|
||||
public class Plugins implements PluginListener {
|
||||
@Override
|
||||
public List<AWSPluginProfile> register(AppContext context) {
|
||||
List<AWSPluginProfile> list = new ArrayList<>();
|
||||
|
||||
//注册监听器
|
||||
//注册外部系统跳转PAL系统 登陆插件
|
||||
list.add(new ProcessPublicEventPluginProfile(TaskListener.class.getName(), "待办推送监听器"));
|
||||
list.add(new OauthPluginProfile("oauthLogin", OauthLogin.class.getName(), "OA系统 跳转登陆PAl"));
|
||||
list.add(new OauthPluginProfile("WechatOauthLogin", WechatOauthLogin.class.getName(), "企业微信认证"));
|
||||
list.add(new OauthPluginProfile("processOathLogin", ProcessOathLogin.class.getName(), "流程中心发布"));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.util;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.Key;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.KeyGenerator;
|
||||
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
/**
|
||||
* AES加密解密工具类
|
||||
*
|
||||
* @author M-Y
|
||||
*/
|
||||
public class AesUtil {
|
||||
|
||||
public static String DES = "AES"; // optional value AES/DES/DESede
|
||||
|
||||
public static String CIPHER_ALGORITHM = "AES"; // optional value
|
||||
// AES/DES/DESede
|
||||
|
||||
public Key getKey(String strKey) {
|
||||
try {
|
||||
if (strKey == null) {
|
||||
strKey = "";
|
||||
}
|
||||
KeyGenerator _generator = KeyGenerator.getInstance("AES");
|
||||
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
|
||||
secureRandom.setSeed(strKey.getBytes());
|
||||
_generator.init(128, secureRandom);
|
||||
return _generator.generateKey();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(" 初始化密钥出现异常 ");
|
||||
}
|
||||
}
|
||||
|
||||
public String encrypt(String data, String key) throws Exception {
|
||||
SecureRandom sr = new SecureRandom();
|
||||
Key secureKey = getKey(key);
|
||||
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, secureKey, sr);
|
||||
byte[] bt = cipher.doFinal(data.getBytes());
|
||||
String strS = new BASE64Encoder().encode(bt);
|
||||
return strS;
|
||||
}
|
||||
|
||||
public String decrypt(String message, String key) {
|
||||
try {
|
||||
SecureRandom sr = new SecureRandom();
|
||||
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
|
||||
Key secureKey = getKey(key);
|
||||
cipher.init(Cipher.DECRYPT_MODE, secureKey, sr);
|
||||
byte[] res = new BASE64Decoder().decodeBuffer(message);
|
||||
res = cipher.doFinal(res);
|
||||
return new String(res);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String DecryptedMsg(String message, String key) throws Exception, Exception {
|
||||
String Msg1 = encrypt(message, key);
|
||||
System.out.println("message is :" + Msg1);
|
||||
String encryptMsg1 = URLEncoder.encode(encrypt(message, key), "UTF-8");
|
||||
System.out.println("encrypted message is :" + encryptMsg1);
|
||||
return encryptMsg1;
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String data = "AUDIT##202210181611";
|
||||
String key = "auditY809kUih23";
|
||||
String url = "http://10.60.143.183:8088/portal/r/df?groupValue=7d3ca852-a0bd-42e6-80b1-3dcea6f55083&fileValue=d1135309-e376-4ec6-bd27-51947abe26ea&sid=null&repositoryName=output&appId=com.actionsoft.apps.coe.pal.output.pr&attachment=true&fileName=%E5%B9%BF%E5%91%8A%E5%88%9B%E6%84%8F%E7%94%9F%E6%88%90%E6%B5%81%E7%A8%8B_1.0.doc&lastModified=1666352134000";
|
||||
String str1 = url.substring(0, url.indexOf("/df"));
|
||||
|
||||
System.out.println("str1>"+str1);
|
||||
//String encryptMsg1 = AesUtil.encrypt(data, key);
|
||||
//System.out.println("加密后:" + encryptMsg1);
|
||||
/*message = "YPS5F%2F%2BVmdbVj0iuxrSINw%3D%3D";
|
||||
System.out.println("解密后:" + AesUtil.decrypt(URLDecoder.decode(message), key));*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,222 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ChineseIntoLetters {
|
||||
|
||||
/**
|
||||
|
||||
* 返回首字母
|
||||
|
||||
* @param strChinese
|
||||
|
||||
* @param bUpCase
|
||||
|
||||
* @return
|
||||
|
||||
*/
|
||||
|
||||
public static String getPYIndexStr(String strChinese, boolean bUpCase){
|
||||
|
||||
try{
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
String chinese = "";
|
||||
|
||||
byte b[] = strChinese.getBytes("GBK");//把中文转化成byte数组
|
||||
|
||||
for(int i = 0; i < b.length; i++){
|
||||
|
||||
if((b[i] & 255) > 128){
|
||||
|
||||
int char1 = b[i++] & 255;
|
||||
|
||||
char1 <<= 8;//左移运算符用“<<”表示,是将运算符左边的对象,向左移动运算符右边指定的位数,并且在低位补零。其实,向左移n位,就相当于乘上2的n次方
|
||||
|
||||
int chart = char1 + (b[i] & 255);
|
||||
|
||||
buffer.append(getPYIndexChar((char)chart, bUpCase));
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
char c = (char)b[i];
|
||||
|
||||
//确定指定字符是否是汉字、大写字母、数字
|
||||
if(!Character.isJavaIdentifierPart(c) || (c >= 'A' && c <= 'Z') || Character.isDigit(c)){
|
||||
|
||||
buffer.append(c);
|
||||
|
||||
}if (c >= 'a' && c <= 'z'){
|
||||
|
||||
buffer.append((char) (c - 'a' + 'A'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (buffer.toString().contains("-")){
|
||||
chinese = buffer.toString().replaceAll("-","_");
|
||||
}else if (buffer.toString().contains(" ")){
|
||||
chinese = buffer.toString().replaceAll(" ","_");
|
||||
}else {
|
||||
chinese = buffer.toString();
|
||||
}
|
||||
|
||||
if (chinese.contains("\\(")){
|
||||
chinese = buffer.toString().replaceAll("\\(","L");
|
||||
}
|
||||
|
||||
if (chinese.contains(")")){
|
||||
chinese = buffer.toString().replaceAll("[)]","R");
|
||||
}
|
||||
|
||||
return chinese;
|
||||
|
||||
}catch(Exception e){
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* 得到首字母
|
||||
|
||||
* @param strChinese
|
||||
|
||||
* @param bUpCase
|
||||
|
||||
* @return
|
||||
|
||||
*/
|
||||
|
||||
private static char getPYIndexChar(char strChinese, boolean bUpCase){
|
||||
|
||||
int charGBK = strChinese;
|
||||
|
||||
char result;
|
||||
|
||||
if(charGBK >= 45217 && charGBK <= 45252){
|
||||
|
||||
result = 'A';
|
||||
|
||||
}else if(charGBK >= 45253 && charGBK <= 45760){
|
||||
|
||||
result = 'B';
|
||||
|
||||
}else if(charGBK >= 45761 && charGBK <= 46317){
|
||||
|
||||
result = 'C';
|
||||
|
||||
}else if(charGBK >= 46318 && charGBK <= 46825){
|
||||
|
||||
result = 'D';
|
||||
|
||||
} else if(charGBK >= 46826 && charGBK <= 47009){
|
||||
|
||||
result = 'E';
|
||||
|
||||
}else if(charGBK >= 47010 && charGBK <= 47296){
|
||||
|
||||
result = 'F';
|
||||
|
||||
}else if(charGBK >= 47297 && charGBK <= 47613){
|
||||
|
||||
result = 'G';
|
||||
|
||||
}else if(charGBK >= 47614 && charGBK <= 48118){
|
||||
|
||||
result = 'H';
|
||||
|
||||
}else if(charGBK >= 48119 && charGBK <= 49061){
|
||||
|
||||
result = 'J';
|
||||
|
||||
} else if(charGBK >= 49062 && charGBK <= 49323){
|
||||
|
||||
result = 'K';
|
||||
|
||||
}else if(charGBK >= 49324 && charGBK <= 49895){
|
||||
|
||||
result = 'L';
|
||||
|
||||
}else if(charGBK >= 49896 && charGBK <= 50370){
|
||||
|
||||
result = 'M';
|
||||
|
||||
}else if(charGBK >= 50371 && charGBK <= 50613){
|
||||
|
||||
result = 'N';
|
||||
|
||||
}else if(charGBK >= 50614 && charGBK <= 50621){
|
||||
|
||||
result = 'O';
|
||||
|
||||
}else if(charGBK >= 50622 && charGBK <= 50905){
|
||||
|
||||
result = 'P';
|
||||
|
||||
}else if(charGBK >= 50906 && charGBK <= 51386){
|
||||
|
||||
result = 'Q';
|
||||
|
||||
}else if(charGBK >= 51387 && charGBK <= 51445){
|
||||
|
||||
result = 'R';
|
||||
|
||||
}else if(charGBK >= 51446 && charGBK <= 52217){
|
||||
|
||||
result = 'S';
|
||||
|
||||
}else if(charGBK >= 52218 && charGBK <= 52697){
|
||||
|
||||
result = 'T';
|
||||
|
||||
}else if(charGBK >= 52698 && charGBK <= 52979){
|
||||
|
||||
result = 'W';
|
||||
|
||||
}else if(charGBK >= 52980 && charGBK <= 53688){
|
||||
|
||||
result = 'X';
|
||||
|
||||
}else if(charGBK >= 53689 && charGBK <= 54480){
|
||||
|
||||
result = 'Y';
|
||||
|
||||
}else if(charGBK >= 54481 && charGBK <= 55289){
|
||||
|
||||
result = 'Z';
|
||||
|
||||
}else{
|
||||
|
||||
result = (char)(65 + (new Random()).nextInt(25));
|
||||
|
||||
}
|
||||
|
||||
if(!bUpCase){
|
||||
result = Character.toLowerCase(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String str=",.;'90中国cD///*-+";
|
||||
|
||||
System.out.println("中文首字母:" + getPYIndexStr(str,true));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,138 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.util;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.output.OutputAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.dao.OutputTask;
|
||||
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
|
||||
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.fs.DCContext;
|
||||
import com.actionsoft.bpms.server.fs.dc.DCProfileManager;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.bpms.util.UUIDGener;
|
||||
import com.actionsoft.bpms.util.UtilFile;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.AppAPI;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.awspaas.user.apps.integration.event.OutputDCFileProcessor;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DownloadUtil {
|
||||
|
||||
/**
|
||||
* 流程手册下载
|
||||
* @param _uc
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
public LinkedHashMap<String,String> outputReportDownload(UserContext _uc, String taskId, String ruuid) {
|
||||
System.out.println("usercontext>>>>>>>>>>>"+_uc.getUID());
|
||||
System.out.println("sid>>>>>>>>>>>"+_uc.getSessionId());
|
||||
LinkedHashMap<String,String> map = new LinkedHashMap<>();
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
|
||||
ResponseObject result = ResponseObject.newOkResponse();
|
||||
if (model != null) {
|
||||
try {
|
||||
UtilFile file = OutputAPIManager.getInstance().getFilePath(model.getWsId(), taskId, model.getProfileId());
|
||||
if (file.exists()) {
|
||||
File[] fileList = file.listFiles();
|
||||
if (fileList.length > 0) {
|
||||
File docFile = null;
|
||||
for (File file2 : fileList) {
|
||||
if (file2.isFile() && "doc".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) {
|
||||
docFile = file2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (docFile == null) {
|
||||
// return ResponseObject.newErrResponse("没有找到文件").toString();
|
||||
}
|
||||
|
||||
PALRepositoryModel plmodel = PALRepositoryCache.getCache().get(ruuid);
|
||||
if(plmodel!=null) {
|
||||
String sourceAppId = "com.actionsoft.apps.coe.pal.output.pr";
|
||||
String methodId = plmodel.getMethodId();
|
||||
if(methodId.contains("control")) {
|
||||
sourceAppId = "com.awspaas.user.apps.coe.pal.output.zd";
|
||||
}else if(methodId.contains("data")) {
|
||||
sourceAppId = "com.awspaas.user.apps.coe.pal.output.bd";
|
||||
}
|
||||
String filename = docFile.getName();
|
||||
DCContext sourceDc = new DCContext(_uc, DCProfileManager.getDCProfile(sourceAppId, "output"), sourceAppId, model.getWsId(), taskId, filename);
|
||||
String downUrl= SDK.getConfAPI().getPortalUrl() + "/r/" + sourceDc.getDownloadURL().replace("./", "");
|
||||
// result.put("url",downUrl);
|
||||
map.put(filename,downUrl);
|
||||
}
|
||||
|
||||
String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+ruuid+"'" +
|
||||
")";
|
||||
List<RowMap> maps = DBSql.getMaps(sql_upfile);
|
||||
UpfileWeb upfileWeb = new UpfileWeb(_uc);
|
||||
|
||||
for (RowMap row : maps) {
|
||||
UpfileModel upfileModel = new UpfileModel();
|
||||
upfileModel.setType(row.getString("FILETYPE"));
|
||||
upfileModel.setFileName(row.getString("FILENAME"));
|
||||
upfileModel.setPl_uuid(row.getString("PALREPOSITORYID"));
|
||||
upfileModel.setShape_uuid(row.getString("SHAPEID"));
|
||||
DCContext dcContexts = upfileWeb.getDCContext(upfileModel);
|
||||
String downUrl= SDK.getConfAPI().getPortalUrl() + "/r/" + dcContexts.getDownloadURL().replace("./", "");
|
||||
map.put(row.getString("FILENAME"),downUrl);
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
result = ResponseObject.newErrResponse("没有可预览文件");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// return ResponseObject.newErrResponse().toString();
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public String getzipURL(String sid,String taskId,String title){
|
||||
System.out.println("taskid》》》》》》》》》》"+taskId);
|
||||
System.out.println("fileName》》》》》》》》》》"+title);
|
||||
String reportDownloadURL = "";
|
||||
UserContext me = UserContext.fromSessionId(sid);
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
|
||||
JSONObject result = new JSONObject();
|
||||
if (model != null) {
|
||||
//三员管理,步骤横表下载重新生成手册
|
||||
|
||||
String taskName = model.getTaskName();
|
||||
if ("步骤横表".equals(taskName)){
|
||||
// 重新设置生成id,与用户id
|
||||
String uuid = UUIDGener.getUUID();
|
||||
model.setUserId(me.getUID());
|
||||
|
||||
// 重新生成手册文件
|
||||
OutputAPIManager.getInstance().reGennerReport(me,model,uuid);
|
||||
|
||||
// 重新构建手册下载URL
|
||||
taskId = uuid;
|
||||
}
|
||||
|
||||
try {
|
||||
reportDownloadURL = OutputDCFileProcessor.getReportDownloadURL(model.getWsId(), taskId, model.getProfileId(), me, title+model.getTaskName());
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return reportDownloadURL;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,123 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.util;
|
||||
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.awspaas.user.apps.integration.XmlDatasUtil;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import org.apache.commons.httpclient.*;
|
||||
import org.apache.commons.httpclient.methods.*;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class HttpClientUtils {
|
||||
|
||||
|
||||
|
||||
public String SendPend(String url, XmlDatasUtil xmlDatasUtil) throws IOException {
|
||||
String result = "true";
|
||||
StringBuffer sendSoapString = new StringBuffer();
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:com=\"com.synctooa.webservices\">\n" +
|
||||
" <soapenv:Header/>\n" +
|
||||
" <soapenv:Body>\n" +
|
||||
" <com:InsertTodoCominfo>\n" +
|
||||
" <com:in0>\n" +
|
||||
"<![CDATA[ \n" +
|
||||
"<?xml version='1.0' encoding='UTF-8'?>\n" +
|
||||
"<root>\n" +
|
||||
" <Todo>\n" +
|
||||
" <outsysid>"+ xmlDatasUtil.getExternal_system_ID() +"</outsysid>\n" +
|
||||
" <todoid>"+ xmlDatasUtil.getOther_system_to_do_ID() +"</todoid>\n" +
|
||||
" <content>"+ xmlDatasUtil.getProcess_title() +"</content>\n" +
|
||||
" <pcurl>"+ xmlDatasUtil.getPcurl() + "</pcurl>\n" +
|
||||
" <mobileurl>"+ xmlDatasUtil.getMobileurl() +"</mobileurl>\n" +
|
||||
" <hrcode>"+ xmlDatasUtil.getTo_do_login_account() +"</hrcode>\n" +
|
||||
" <createtime>"+ xmlDatasUtil.getTo_do_creation_time() +"</createtime>\n" +
|
||||
" <donetime>"+ xmlDatasUtil.getTo_do_completion_time() +"</donetime>\n" +
|
||||
" <status>"+ xmlDatasUtil.getTo_do_status() +"</status>\n" +
|
||||
" <wftype>"+ xmlDatasUtil.getTo_do_official_type() +"</wftype>\n" +
|
||||
" <viewtype>"+ xmlDatasUtil.getViewtype() +"</viewtype>\n" +
|
||||
" <createdate>"+ xmlDatasUtil.getCreatedate() +"</createdate>\n" +
|
||||
" <donedate>"+ xmlDatasUtil.getDonedate() +"</donedate>\n" +
|
||||
" <receivedate>"+ xmlDatasUtil.getReceivedate() +"</receivedate>\n" +
|
||||
" <receivetime>" + xmlDatasUtil.getReceivetime() +"</receivetime>\n" +
|
||||
" <currentnodetype>"+ xmlDatasUtil.getCurrentnodetype() +"</currentnodetype>\n" +
|
||||
" <requestcode>"+ xmlDatasUtil.getRequestcode() +"</requestcode>\n" +
|
||||
" <currentnodename>"+ xmlDatasUtil.getCurrentnodename() +"</currentnodename>\n" +
|
||||
" <nooperator>"+ xmlDatasUtil.getNooperator() +"</nooperator>\n" +
|
||||
" <workcode>"+ xmlDatasUtil.getWorkcode() +"</workcode>\n" +
|
||||
" <workflowname>"+ xmlDatasUtil.getWorkflowname() +"</workflowname>\n" +
|
||||
" <createrhrcode>"+ xmlDatasUtil.getCreaterhrcode() +"</createrhrcode>\n" +
|
||||
" <createrworkcode>"+ xmlDatasUtil.getCreaterworkcode() +"</createrworkcode>\n" +
|
||||
" </Todo>\n" +
|
||||
"</root>\n" +
|
||||
"]]>\n" +
|
||||
"</com:in0>\n" +
|
||||
" </com:InsertTodoCominfo>\n" +
|
||||
" </soapenv:Body>\n" +
|
||||
"</soapenv:Envelope>";
|
||||
|
||||
System.out.println("xmlstr================"+xmlStr);
|
||||
String postSoap = UtilUrl.doPostSoap(url, xmlStr, "");
|
||||
|
||||
return postSoap;
|
||||
}
|
||||
|
||||
|
||||
public String readOa(String url, String taskid) throws IOException {
|
||||
String result = "true";
|
||||
StringBuffer sendSoapString = new StringBuffer();
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:com=\"com.synctooa.webservices\">\n" +
|
||||
" <soapenv:Header/>\n" +
|
||||
" <soapenv:Body>\n" +
|
||||
" <com:updateRead>\n" +
|
||||
" <com:in0>LCZD</com:in0>\n" +
|
||||
" <com:in1>"+taskid+"</com:in1>\n" +
|
||||
" </com:updateRead>\n" +
|
||||
" </soapenv:Body>\n" +
|
||||
"</soapenv:Envelope>";
|
||||
|
||||
System.out.println("xmlstr================"+xmlStr);
|
||||
String postSoap = UtilUrl.doPostSoap(url, xmlStr, "");
|
||||
|
||||
return postSoap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String SendPreview(String url, String xmlStr) {
|
||||
String result = "true";
|
||||
|
||||
|
||||
PostMethod postMethod = new PostMethod(url);
|
||||
StringBuffer soapRequestData = new StringBuffer(xmlStr);
|
||||
byte[] b = (byte[])null;
|
||||
|
||||
try {
|
||||
b = soapRequestData.toString().getBytes("utf-8");
|
||||
} catch (UnsupportedEncodingException var16) {
|
||||
var16.printStackTrace();
|
||||
}
|
||||
|
||||
InputStream is = new ByteArrayInputStream(b, 0, b.length);
|
||||
RequestEntity re = new InputStreamRequestEntity(is, (long)b.length, "text/xml; charset=utf-8");
|
||||
postMethod.setRequestEntity(re);
|
||||
HttpClient httpClient = new HttpClient();
|
||||
httpClient.setConnectionTimeout(500000000);
|
||||
httpClient.setTimeout(500000000);
|
||||
|
||||
try {
|
||||
int statusCode = httpClient.executeMethod(postMethod);
|
||||
if (statusCode == 200) {
|
||||
String soapResponseData = postMethod.getResponseBodyAsString();
|
||||
return soapResponseData.indexOf("Success") == -1 ? "fail" : result;
|
||||
} else {
|
||||
return "error:[" + statusCode + "]!";
|
||||
}
|
||||
} catch (Exception var15) {
|
||||
var15.printStackTrace();
|
||||
return "Exception:[" + var15 + "]!";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
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.HttpClients;
|
||||
import org.apache.http.message.BasicHeader;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
/**
|
||||
* http请求⼯具
|
||||
* @Author wangcy
|
||||
*/
|
||||
public class HttpUtil {
|
||||
private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
|
||||
/**
|
||||
* 发送post请求
|
||||
* @param json
|
||||
* @param URL
|
||||
* @return
|
||||
*/
|
||||
public String sendPost(JSONObject json,String URL) {
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
HttpPost post = new HttpPost(URL);
|
||||
post.setHeader("Content-Type", "application/json");
|
||||
//post.addHeader("Authorization", "Basic YWRtaW46");
|
||||
String result;
|
||||
try {
|
||||
StringEntity s = new StringEntity(json.toString(), "utf-8");
|
||||
s.setContentType(new BasicHeader(HTTP.CONTENT_TYPE,
|
||||
"application/json"));
|
||||
post.setEntity(s);
|
||||
// 发送请求
|
||||
HttpResponse httpResponse = client.execute(post);
|
||||
// 获取响应输⼊流
|
||||
InputStream inStream = httpResponse.getEntity().getContent();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||
inStream, "utf-8"));
|
||||
StringBuilder strber = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null)
|
||||
strber.append(line + "\n");
|
||||
inStream.close();
|
||||
result = strber.toString();
|
||||
if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||
System.out.println("请求服务器成功,做相应处理");
|
||||
} else {
|
||||
System.out.println("请求服务端失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("请求异常:"+e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.util;
|
||||
|
||||
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
|
||||
import oracle.jdbc.pool.OracleDataSource;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
public class JDBCUtil {
|
||||
|
||||
|
||||
public void comment(String tablename,String flid,String flidname) throws SQLException {
|
||||
|
||||
try {
|
||||
//加载驱动
|
||||
Class.forName("oracle.jdbc.driver.OracleDriver");
|
||||
String url ="jdbc:oracle:thin:@10.119.71.12:1521/bpmprod" ;
|
||||
Connection conn= DriverManager.getConnection(url,"bpmprod","456rty$%^RTY");
|
||||
Statement stmt = conn.createStatement();
|
||||
String sql = "COMMENT ON T"+tablename+"."+flid+" IS '"+flidname+"'";
|
||||
PreparedStatement pstmt = conn.prepareStatement(sql);
|
||||
boolean execute = pstmt.execute();
|
||||
System.out.println("执行成功与否》》》》》》》》》》》》"+execute);
|
||||
/*while (rs.next()) {
|
||||
System.out.println(rs.getString("user_password"));
|
||||
System.out.println(rs.getString("user_name"));
|
||||
}*/
|
||||
pstmt.close();
|
||||
stmt.close();
|
||||
} catch (Exception e) {
|
||||
// TODO 自动生成 catch 块
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,106 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PreviewDataUtil {
|
||||
|
||||
String action; //固定值"read"
|
||||
String title; //标题
|
||||
String dept;//发布机构(部门编码)
|
||||
String user; //发布人(员工编码)
|
||||
String date; //发布日期 yyyy-MM-dd
|
||||
String remark;//备注
|
||||
String status;//发布状态 0未读、1已读
|
||||
String pcurl;//PC端链接地址
|
||||
String mobileurl;//移动端链接地址
|
||||
String dataid;//未读更新为已读时必填
|
||||
List userList;//接收人 string数组
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDept() {
|
||||
return dept;
|
||||
}
|
||||
|
||||
public void setDept(String dept) {
|
||||
this.dept = dept;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getPcurl() {
|
||||
return pcurl;
|
||||
}
|
||||
|
||||
public void setPcurl(String pcurl) {
|
||||
this.pcurl = pcurl;
|
||||
}
|
||||
|
||||
public String getMobileurl() {
|
||||
return mobileurl;
|
||||
}
|
||||
|
||||
public void setMobileurl(String mobileurl) {
|
||||
this.mobileurl = mobileurl;
|
||||
}
|
||||
|
||||
public String getDataid() {
|
||||
return dataid;
|
||||
}
|
||||
|
||||
public void setDataid(String dataid) {
|
||||
this.dataid = dataid;
|
||||
}
|
||||
|
||||
public List getUserList() {
|
||||
return userList;
|
||||
}
|
||||
|
||||
public void setUserList(List userList) {
|
||||
this.userList = userList;
|
||||
}
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.util;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.*;
|
||||
|
||||
public class SoapUtil {
|
||||
|
||||
|
||||
public static String getWebServiceAndSoap(String url,StringBuffer sendSoapString) throws IOException {
|
||||
String soap = sendSoapString.toString();
|
||||
if (soap == null) {
|
||||
return null;
|
||||
}
|
||||
URL soapUrl = new URL(url);
|
||||
URLConnection conn = soapUrl.openConnection();
|
||||
conn.setUseCaches(false);
|
||||
conn.setDoInput(true);
|
||||
conn.setDoOutput(true);
|
||||
conn.setRequestProperty("Content-Length",
|
||||
Integer.toString(soap.length()));
|
||||
conn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
|
||||
// 调用的接口方法是
|
||||
// conn.setRequestProperty(isClass,isMethod);
|
||||
OutputStream os = conn.getOutputStream();
|
||||
OutputStreamWriter osw = new OutputStreamWriter(os, "utf-8");
|
||||
osw.write(soap);
|
||||
osw.flush();
|
||||
osw.close();
|
||||
// 获取webserivce返回的流
|
||||
InputStream is = conn.getInputStream();
|
||||
if (is!=null) {
|
||||
byte[] bytes = new byte[0];
|
||||
bytes = new byte[is.available()];
|
||||
is.read(bytes);
|
||||
String str = new String(bytes);
|
||||
return str;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.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 UtilUrl {
|
||||
|
||||
//使用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(600000)
|
||||
.setConnectTimeout(600000).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;
|
||||
}
|
||||
}
|
||||
@ -1,263 +0,0 @@
|
||||
package com.awspaas.user.apps.integration.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.bind.annotation.Controller;
|
||||
import com.actionsoft.bpms.server.bind.annotation.HandlerType;
|
||||
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.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.awspaas.user.apps.integration.util.UtilUrl;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
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 javax.ws.rs.QueryParam;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@Controller(type = HandlerType.RESTFUL, apiName = "workfolwapi", desc = "这是workflow的相关接口文档")
|
||||
@Path("/workfolw")
|
||||
public class WorkFlowAPI {
|
||||
|
||||
@GET
|
||||
public String sayHello() {
|
||||
return "hello,world! - get";
|
||||
}
|
||||
|
||||
@POST
|
||||
public String sayHelloPost() {
|
||||
return "hello,world!- post ";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取activiti流程信息
|
||||
* @return activiti流程信息
|
||||
* @throws DocumentException
|
||||
* @throws ParseException
|
||||
*/
|
||||
@Path("/process/history/getProcessByProcessDefId")
|
||||
@POST
|
||||
public String sayHelloQueryParam() throws DocumentException, ParseException {
|
||||
System.out.println("12312313312");
|
||||
//return "{\"code\":\"1\",\"msg\":\"success\",\"body\":[{\"processInstanceId\":\"17253376\",\"processDefinitionId\":\"747487\",\"startUserId\":\"00107759\",\"durationInMillis\":7199,\"processDefinitionName\":\"组织主数据维护流程\",\"startTime\":\"2021-04-03 16:24:03\",\"endTime\":\"2021-04-08 16:24:00\",\"processDefinitionVersion\":\"4\"}]}";
|
||||
System.out.println("参数===============接口进来了");
|
||||
JSONObject result = new JSONObject(new LinkedHashMap<>());
|
||||
List<RowMap> rowMap = DBSql.getMaps("SELECT DISTINCT WORKFLOWID FROM BO_EU_OA_PROCESS_TASK ");
|
||||
|
||||
|
||||
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
|
||||
for (RowMap rowMapsw:
|
||||
rowMap) {
|
||||
|
||||
List<BO> list = SDK. getBOAPI().query("BO_EU_PROCESS_NEW").addQuery("WORKFLOWID=", rowMapsw.getString("WORKFLOWID")).list();
|
||||
for (int i=0;i<list.size();i++) {
|
||||
if (SDK.getORGAPI().getUser(list.get(i).getString("OPERATORWORKCODE"))!=null){
|
||||
JSONObject jsonObject2 = new JSONObject();
|
||||
jsonObject2.put("processInstanceId",list.get(i).getString("REQUESTID"));
|
||||
jsonObject2.put("processDefinitionId",list.get(i).getString("WORKFLOWID"));
|
||||
jsonObject2.put("processDefinitionName",list.get(i).getString("WORKFLOWNAME"));
|
||||
jsonObject2.put("startUserId",list.get(i).getString("OPERATORWORKCODE"));
|
||||
jsonObject2.put("startTime",list.get(i).getString("OPERATEDATE"));
|
||||
jsonObject2.put("endTime",list.get(i).getString("RECEIVEDATE"));
|
||||
System.out.println("renyuanzhanghu"+list.get(i).getString("OPERATORWORKCODE"));
|
||||
if (SDK.getORGAPI().getCompanyByUser(list.get(i).getString("OPERATORWORKCODE"))!=null){
|
||||
jsonObject2.put("CREATEUSERORGID",SDK.getORGAPI().getCompanyByUser(list.get(i).getString("OPERATORWORKCODE")).getId());
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date beginDate = sdf.parse(list.get(i).getString("OPERATEDATE"));
|
||||
Date endDate = sdf.parse(list.get(i).getString("RECEIVEDATE"));
|
||||
long dates = (endDate.getTime()-beginDate.getTime())/(1000 * 60);
|
||||
jsonObject2.put("durationInMillis",dates);
|
||||
BO bo = SDK.getBOAPI().query("BO_EU_OA_PROCESS", true).addQuery("WORKFLOWID=",rowMapsw.getString("WORKFLOWID") ).detail();
|
||||
if (bo.getString("VERSION")!=null||bo.getString("VERSION")!=""){
|
||||
jsonObject2.put("processDefinitionVersion",bo.getString("VERSION"));
|
||||
}else {
|
||||
jsonObject2.put("processDefinitionVersion","1");
|
||||
}
|
||||
|
||||
jsonArray_new.add(jsonObject2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
result.put("code","1");
|
||||
result.put("msg","success");
|
||||
result.put("body",jsonArray_new);
|
||||
|
||||
|
||||
return result.toString() ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.获取任务信息
|
||||
* @return 任务信息
|
||||
* @throws DocumentException
|
||||
* @throws ParseException
|
||||
*/
|
||||
|
||||
@Path("/task/history/getTasksByProcessDefId")
|
||||
@POST
|
||||
public String sayHelloQueryParam2() throws DocumentException, ParseException {
|
||||
JSONObject result = new JSONObject(new LinkedHashMap<>());
|
||||
System.out.println("参数===============接口进来了");
|
||||
|
||||
|
||||
|
||||
/*JSONObject jsonObject = new JSONObject(new LinkedHashMap());
|
||||
jsonObject.put("workflowId",747487);
|
||||
//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",1);
|
||||
jsonObject.put("pageSize",3000);
|
||||
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 = UtilUrl.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 results = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out");
|
||||
String resultString = results.getData().toString();
|
||||
System.out.println("resultString=>>>>>>>>>>"+resultString);
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("datas");
|
||||
JSONArray jsonArrays = JSONArray.parseArray(datas);
|
||||
|
||||
System.out.println("jsonArrayData》》》》》》》》》》》》"+jsonArrays);*/
|
||||
List<RowMap> rowMap = DBSql.getMaps("SELECT DISTINCT WORKFLOWID FROM BO_EU_OA_PROCESS_TASK where WORKFLOWID = '747487'");
|
||||
|
||||
|
||||
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
|
||||
for (RowMap rowMapsw:
|
||||
rowMap) {
|
||||
|
||||
List<BO> list = SDK. getBOAPI().query("BO_EU_OA_PROCESS_TASK").addQuery("WORKFLOWID=", rowMapsw.getString("WORKFLOWID")).list();
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (SDK.getORGAPI().getUser(list.get(i).getString("OPERATORWORKCODE")) != null) {
|
||||
JSONObject jsonObject2 = new JSONObject();
|
||||
jsonObject2.put("id", list.get(i).getString("TASKID"));
|
||||
// String node_key = JSONObject.parseObject(jsonArrays.get(i).toString()).get("nodeid").toString();
|
||||
jsonObject2.put("taskDefinitionKey", list.get(i).getString("NODEID"));
|
||||
jsonObject2.put("processInstanceId", list.get(i).getString("REQUESTID"));
|
||||
jsonObject2.put("processDefinitionId", list.get(i).getString("WORKFLOWID"));
|
||||
jsonObject2.put("name", list.get(i).getString("NODENAME"));
|
||||
jsonObject2.put("assignee", list.get(i).getString("OPERATORWORKCODE"));
|
||||
if (SDK.getORGAPI().getCompanyByUser(list.get(i).getString("OPERATORWORKCODE")) != null) {
|
||||
jsonObject2.put("TARGETCOMPANYID", SDK.getORGAPI().getCompanyByUser(list.get(i).getString("OPERATORWORKCODE")).getId());
|
||||
}
|
||||
//String user = JSONObject.parseObject(jsonArrays.get(i).toString()).get("operatorWorkCode").toString();
|
||||
System.out.println("user>>>>>>>" + list.get(i).getString("OPERATORWORKCODE"));
|
||||
UserModel model = SDK.getORGAPI().getUser(list.get(i).getString("OPERATORWORKCODE"));
|
||||
System.out.println("model>>>>>>>>>>" + model);
|
||||
if (model != null) {
|
||||
jsonObject2.put("assigneeDeptId", model.getDepartmentId());
|
||||
jsonObject2.put("assigneeRoleId", model.getRoleId());
|
||||
} else {
|
||||
jsonObject2.put("assigneeDeptId", "a93a7f77-8b11-4261-8770-20b0cdfab315");
|
||||
jsonObject2.put("assigneeRoleId", "d102c89d-55f3-4865-9d5c-c00b7f47b803");
|
||||
}
|
||||
|
||||
|
||||
jsonObject2.put("actionName", list.get(i).getString("OPERATETYPE"));
|
||||
jsonObject2.put("startTime", list.get(i).getString("OPERATEDATE"));
|
||||
jsonObject2.put("endTime", list.get(i).getString("RECEIVEDATE"));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date beginDate = sdf.parse(list.get(i).getString("OPERATEDATE"));
|
||||
Date endDate = sdf.parse(list.get(i).getString("RECEIVEDATE"));
|
||||
long dates = (endDate.getTime() - beginDate.getTime()) / (1000 * 60);
|
||||
jsonObject2.put("durationInMillis", dates);
|
||||
jsonArray_new.add(jsonObject2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.put("code","1");
|
||||
result.put("msg","success");
|
||||
result.put("body",jsonArray_new);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@Path("/task/history/getTaskNodesByProcessDefId")
|
||||
@POST
|
||||
public String getTasksByProcessDefId() throws DocumentException {
|
||||
JSONObject result = new JSONObject(new LinkedHashMap<>());
|
||||
JSONObject jsonObject_newe = new JSONObject(new LinkedHashMap<>());
|
||||
JSONArray jsonArray = new JSONArray(new LinkedList<>());
|
||||
System.out.println("参数===============接口进来了");
|
||||
List<RowMap> rowMap = DBSql.getMaps("SELECT DISTINCT WORKFLOWID FROM BO_EU_OA_PROCESS_TASK ");
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
for (RowMap rowMapsw:
|
||||
rowMap) {
|
||||
|
||||
List<BO> list = SDK. getBOAPI().query("BO_EU_OA_PROCESS_TASK").addQuery("WORKFLOWID=", rowMapsw.getString("WORKFLOWID")).list();
|
||||
jsonObject.put("processName",list.get(0).getString("WORKFLOWNAME"));
|
||||
jsonObject.put("category",list.get(0).getString("WORKFLOWTYPE_OA"));
|
||||
BO bos = SDK.getBOAPI().query("BO_EU_OA_PROCESS", true).addQuery("WORKFLOWID=", rowMapsw.getString("WORKFLOWID")).detail();
|
||||
if (bos.getString("VERSION")!=null||bos.getString("VERSION")!=""){
|
||||
jsonObject.put("version",bos.getString("VERSION"));
|
||||
}else {
|
||||
jsonObject.put("version","1");
|
||||
}
|
||||
JSONArray jsonArray1 =new JSONArray();
|
||||
for (BO bo:
|
||||
list) {
|
||||
JSONObject jsonObject1 = new JSONObject(new LinkedHashMap<>());
|
||||
jsonObject1.put("taskNo",bo.getString("NODEID"));
|
||||
jsonObject1.put("taskName",bo.getString("NODENAME"));
|
||||
jsonArray1.add(jsonObject1);
|
||||
}
|
||||
jsonObject.put("taskNodesList",jsonArray1);
|
||||
jsonObject_newe.put(rowMapsw.getString("WORKFLOWID"),jsonObject);
|
||||
}
|
||||
|
||||
|
||||
/*JSONArray jsonArray_body = new JSONArray();
|
||||
jsonArray_body.add(jsonObject_newe);*/
|
||||
result.put("code","1");
|
||||
result.put("msg","success");
|
||||
result.put("body",jsonObject_newe);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user