提交管理看板伊利集成代码
This commit is contained in:
parent
e947053131
commit
c59d79830c
15
com.awspaas.user.apps.yili.integration/.classpath
Normal file
15
com.awspaas.user.apps.yili.integration/.classpath
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/aws"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/doc"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/event"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ftp"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/http"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/oauthjar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/pal"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/sso"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/xcweb"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
com.awspaas.user.apps.yili.integration/.project
Normal file
17
com.awspaas.user.apps.yili.integration/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.awspaas.user.apps.yili.integration</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -1398,9 +1398,7 @@ public class GetmeritsController {
|
||||
deoa= "'"+ds[0]+"'";
|
||||
}
|
||||
deoa ="'"+ StringUtils.join(ds, "','")+"'";
|
||||
System.out.println(
|
||||
"deoa》》》》》》》》》》"+deoa
|
||||
);
|
||||
//System.out.println("deoa》》》》》》》》》》"+deoa);
|
||||
}else {
|
||||
deoa = "'" +synchronous_home+"'";
|
||||
}
|
||||
@ -1425,10 +1423,7 @@ public class GetmeritsController {
|
||||
dleass = "'"+deptSplit[0]+"'";
|
||||
}
|
||||
dleass ="'"+ StringUtils.join(deptSplit, "','")+"'";
|
||||
System.out.println(
|
||||
"dleass》》》》》》》》》》"+dleass
|
||||
);
|
||||
|
||||
//System.out.println("dleass》》》》》》》》》》"+dleass);
|
||||
String[] plid = dleass.split(",");
|
||||
|
||||
int y=0;
|
||||
@ -1452,9 +1447,7 @@ public class GetmeritsController {
|
||||
deoa = "'" + ds[0] + "'";
|
||||
}
|
||||
deoa = "'" + StringUtils.join(ds, "','") + "'";
|
||||
System.out.println(
|
||||
"deoa》》》》》》》》》》" + deoa
|
||||
);
|
||||
//System.out.println("deoa》》》》》》》》》》" + deoa);
|
||||
} else {
|
||||
deoa = "'" + data + "'";
|
||||
}
|
||||
@ -1472,7 +1465,7 @@ public class GetmeritsController {
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println("mmap>>>>>>>>>>>>>>>>>>>"+map_name);
|
||||
//System.out.println("mmap>>>>>>>>>>>>>>>>>>>"+map_name);
|
||||
list_pq_2.add(y, map_name);
|
||||
y++;
|
||||
}
|
||||
@ -1482,7 +1475,7 @@ public class GetmeritsController {
|
||||
jsonObject_child_2_father.put("child",jsonArray_child_2);
|
||||
// jsonObject_child_2_1_father.put("child",jsonArray_child_2_1);
|
||||
jsonArray_levels_2.add(jsonObject_child_2_father);
|
||||
System.out.println("maxs.>>>>>>>>>>>+"+maxs);
|
||||
//System.out.println("maxs.>>>>>>>>>>>+"+maxs);
|
||||
for (int i=0;i<maxs;i++){
|
||||
JSONObject jsonObject_child_3_last = new JSONObject(new LinkedHashMap<>());
|
||||
|
||||
@ -1500,7 +1493,7 @@ public class GetmeritsController {
|
||||
* 这是L3流程绩效名称中的流程架构
|
||||
*/
|
||||
JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>());
|
||||
System.out.println("h>>>>>>>>>>>>>>>" + h);
|
||||
//System.out.println("h>>>>>>>>>>>>>>>" + h);
|
||||
jsonObject_child_content_3_name_last.put("name", list_pq_2.get(h).get(i));
|
||||
if(StringUtils.isNotEmpty(list_pq_2.get(h).get(i))){
|
||||
|
||||
@ -1676,17 +1669,8 @@ public class GetmeritsController {
|
||||
dpliea = "'"+deptSplits[0]+"'";
|
||||
}
|
||||
dpliea ="'"+ StringUtils.join(deptSplits, "','")+"'";
|
||||
System.out.println(
|
||||
"dpliea》》》》》》》》》》"+dpliea
|
||||
);
|
||||
|
||||
//System.out.println("dpliea》》》》》》》》》》"+dpliea);
|
||||
String[] plids = dpliea.split(",");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (int i=0;i<max;i++){
|
||||
JSONObject jsonObject_child_3_last = new JSONObject(new LinkedHashMap<>());
|
||||
|
||||
@ -1704,7 +1688,7 @@ public class GetmeritsController {
|
||||
* 这是L3流程绩效名称中的流程架构
|
||||
*/
|
||||
JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>());
|
||||
System.out.println("h>>>>>>>>>>>>>>>"+h);
|
||||
//System.out.println("h>>>>>>>>>>>>>>>"+h);
|
||||
jsonObject_child_content_3_name_last.put("name",list_pq.get(h).get(i));
|
||||
if (StringUtils.isNotEmpty(list_pq.get(h).get(i))){
|
||||
|
||||
@ -1719,7 +1703,7 @@ public class GetmeritsController {
|
||||
if(mapss.size()==0){
|
||||
JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>());
|
||||
jsonObject_child_content_3_name_last.put("name",list_pq.get(h).get(i));
|
||||
System.out.println("h>>>>>>>>>>>>>>>"+h);
|
||||
//System.out.println("h>>>>>>>>>>>>>>>"+h);
|
||||
if (StringUtils.isNotEmpty(list_pq.get(h).get(i))){
|
||||
|
||||
jsonObject_child_content_3_name_last.put("num","1");
|
||||
@ -1847,9 +1831,7 @@ public class GetmeritsController {
|
||||
dleass = "'"+deptSplit[0]+"'";
|
||||
}
|
||||
dleass ="'"+ StringUtils.join(deptSplit, "','")+"'";
|
||||
System.out.println(
|
||||
"dleass》》》》》》》》》》"+dleass
|
||||
);
|
||||
//System.out.println("dleass》》》》》》》》》》"+dleass);
|
||||
|
||||
String[] plid = dleass.split(",");
|
||||
|
||||
@ -1873,9 +1855,7 @@ public class GetmeritsController {
|
||||
deoa= "'"+ds[0]+"'";
|
||||
}
|
||||
deoa ="'"+ StringUtils.join(ds, "','")+"'";
|
||||
System.out.println(
|
||||
"deoa》》》》》》》》》》"+deoa
|
||||
);
|
||||
//System.out.println("deoa》》》》》》》》》》"+deoa);
|
||||
}else {
|
||||
deoa = "'"+data+"'";
|
||||
}
|
||||
@ -1902,7 +1882,7 @@ public class GetmeritsController {
|
||||
jsonObject_child_2_father.put("child",jsonArray_child_2);
|
||||
// jsonObject_child_2_1_father.put("child",jsonArray_child_2_1);
|
||||
jsonArray_levels_2.add(jsonObject_child_2_father);
|
||||
System.out.println("maxs.>>>>>>>>>>>+"+maxs);
|
||||
//System.out.println("maxs.>>>>>>>>>>>+"+maxs);
|
||||
for (int i=0;i<maxs;i++){
|
||||
JSONObject jsonObject_child_3_last = new JSONObject(new LinkedHashMap<>());
|
||||
|
||||
@ -1920,7 +1900,7 @@ public class GetmeritsController {
|
||||
* 这是L3流程绩效名称中的流程架构
|
||||
*/
|
||||
JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>());
|
||||
System.out.println("h>>>>>>>>>>>>>>>" + h);
|
||||
//System.out.println("h>>>>>>>>>>>>>>>" + h);
|
||||
jsonObject_child_content_3_name_last.put("name", list_pq_2.get(h).get(i));
|
||||
if (StringUtils.isNotEmpty(list_pq_2.get(h).get(i))){
|
||||
jsonObject_child_content_3_name_last.put("num", "1");
|
||||
@ -2086,17 +2066,8 @@ public class GetmeritsController {
|
||||
dpliea = "'"+deptSplits[0]+"'";
|
||||
}
|
||||
dpliea ="'"+ StringUtils.join(deptSplits, "','")+"'";
|
||||
System.out.println(
|
||||
"dpliea》》》》》》》》》》"+dpliea
|
||||
);
|
||||
|
||||
//System.out.println("dpliea》》》》》》》》》》"+dpliea);
|
||||
String[] plids = dpliea.split(",");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (int i=0;i<max;i++){
|
||||
JSONObject jsonObject_child_3_last = new JSONObject(new LinkedHashMap<>());
|
||||
|
||||
@ -2114,7 +2085,7 @@ public class GetmeritsController {
|
||||
* 这是L3流程绩效名称中的流程架构
|
||||
*/
|
||||
JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>());
|
||||
System.out.println("h>>>>>>>>>>>>>>>"+h);
|
||||
//System.out.println("h>>>>>>>>>>>>>>>"+h);
|
||||
jsonObject_child_content_3_name_last.put("name",list_pq.get(h).get(i));
|
||||
if (StringUtils.isNotEmpty(list_pq.get(h).get(i))) {
|
||||
jsonObject_child_content_3_name_last.put("num","1");
|
||||
@ -2126,7 +2097,7 @@ public class GetmeritsController {
|
||||
}
|
||||
if (mapss.size()==0){
|
||||
JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>());
|
||||
System.out.println("h>>>>>>>>>>>>>>>"+h);
|
||||
//System.out.println("h>>>>>>>>>>>>>>>"+h);
|
||||
jsonObject_child_content_3_name_last.put("name",list_pq.get(h).get(i));
|
||||
if (StringUtils.isNotEmpty(list_pq.get(h).get(i))) {
|
||||
jsonObject_child_content_3_name_last.put("num","1");
|
||||
@ -2139,14 +2110,14 @@ public class GetmeritsController {
|
||||
|
||||
|
||||
jsonObject_child_content_3_last.put("content",jsonArray_child_content_3_last);
|
||||
System.out.println("jsonObject_child_content_3_last>>>>>>>>>>>>>>"+jsonObject_child_content_3_last);
|
||||
//System.out.println("jsonObject_child_content_3_last>>>>>>>>>>>>>>"+jsonObject_child_content_3_last);
|
||||
jsonArray_child_3_last.add(jsonObject_child_content_3_last);
|
||||
}
|
||||
jsonObject_child_3_last.put("child",jsonArray_child_3_last);
|
||||
jsonArray_levels_3.add(jsonObject_child_3_last);
|
||||
}
|
||||
jsonObject_L3.put("levels_3",jsonArray_levels_3);
|
||||
System.out.println("jsonArray>>>>>>>>>>"+jsonArray_levels_3);
|
||||
//System.out.println("jsonArray>>>>>>>>>>"+jsonArray_levels_3);
|
||||
JSONObject jsonObject_4 = new JSONObject(new LinkedHashMap<>());
|
||||
jsonObject_4.put("levels_name","关键流程清单");
|
||||
jsonObject_4.put("levels_4",new JSONArray(new LinkedList<>()));
|
||||
|
||||
@ -12,6 +12,7 @@ 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.HistoryTaskInstance;
|
||||
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;
|
||||
@ -419,13 +420,29 @@ public class OaPendComponent {
|
||||
}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");
|
||||
//流程结束时,归档所有任务
|
||||
try {
|
||||
String processInstId = pec.getProcessInstance().getId();
|
||||
List<HistoryTaskInstance> list = SDK.getHistoryTaskQueryAPI().processInstId(processInstId).list();
|
||||
System.err.println(pec.getProcessInstance().getTitle()+"_当前流程的历史任务========>"+list);
|
||||
for (HistoryTaskInstance historyTaskInstance : list) {
|
||||
try {
|
||||
//updatePending2(historyTaskInstance, pec);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
xmlDatasUtil.setCurrentnodetype("0");
|
||||
}
|
||||
@ -554,6 +571,216 @@ public class OaPendComponent {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void updatePending2(TaskInstance taskInstance, ProcessExecutionContext pec) throws IOException, SOAPException, DocumentException {
|
||||
if("admin".equals(taskInstance.getTarget())) {
|
||||
return;
|
||||
}
|
||||
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 {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条传阅流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理");
|
||||
}
|
||||
}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 {
|
||||
xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessInstance().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/";
|
||||
}
|
||||
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(" ")));
|
||||
}
|
||||
|
||||
|
||||
//0待办,1已办
|
||||
xmlDatasUtil.setTo_do_status("1");
|
||||
//0:未读 -2:已读
|
||||
xmlDatasUtil.setViewtype("-2");
|
||||
//0:未归档 1:已归档
|
||||
xmlDatasUtil.setCurrentnodetype("1");
|
||||
|
||||
|
||||
xmlDatasUtil.setTo_do_official_type("0");
|
||||
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");
|
||||
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 taskurl= SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "taskurl");
|
||||
|
||||
String s = httpClientUtil.SendPend(taskurl, 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 taskurl= SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "taskurl");
|
||||
|
||||
@ -340,7 +340,10 @@ public class TaskController {
|
||||
}
|
||||
}
|
||||
|
||||
//停用
|
||||
/**
|
||||
* 当发布和变更为空时,显示作废的文件
|
||||
*/
|
||||
if(list.size()==0&&lists.size()==0) {
|
||||
if (list_stop.size()>0) {
|
||||
//System.out.println("这个是作废的架构数据");
|
||||
for (BO bo : list_stop) {
|
||||
@ -355,10 +358,72 @@ public class TaskController {
|
||||
jsonObject.put("id", bo.getString("STOPFILEID"));
|
||||
jsonObject.put("taskId", id);
|
||||
jsonArray.add(jsonObject);
|
||||
|
||||
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("STOPFILEID")+"'" + ") ORDER BY CREATETIME ASC";
|
||||
String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"'");
|
||||
if(UtilString.isNotEmpty(methodId)) {
|
||||
if(methodId.equals("control.policy")) {
|
||||
sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC";
|
||||
}
|
||||
}
|
||||
//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")+"') AND FILETYPE = 'f'";
|
||||
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();
|
||||
//文档预览
|
||||
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId);
|
||||
String sourceAppId = instanceById.getAppId();
|
||||
String aslp = "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview";
|
||||
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++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//变更
|
||||
if(lists.size()>0) {
|
||||
for (BO bo : lists) {
|
||||
@ -532,28 +597,28 @@ public class TaskController {
|
||||
@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());
|
||||
// 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();
|
||||
|
||||
String html = "index_phone.html";
|
||||
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
||||
try{
|
||||
//UserContext uc = UserContext.fromSessionId(sid);
|
||||
try {
|
||||
// UserContext uc = UserContext.fromSessionId(sid);
|
||||
String sid = me.getSessionId();
|
||||
String processInstId = params.get("processInstId");
|
||||
String taskInstId = params.get("taskInstId");
|
||||
|
||||
try {
|
||||
//用户打开阅览界面日志
|
||||
setUserLog(processInstId,me.getUID(),"3");
|
||||
// 用户打开阅览界面日志
|
||||
setUserLog(processInstId, me.getUID(), "3");
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String usercode = "admin";
|
||||
if(UtilString.isNotEmpty(me.getUID())){
|
||||
if (UtilString.isNotEmpty(me.getUID())) {
|
||||
usercode = me.getUID();
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
@ -561,36 +626,46 @@ public class TaskController {
|
||||
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).addQuery("OPTIONTYPE IS NOT NULL",null).detail().getString("RELEASE_INSTRUCTIONS");
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).addQuery("OPTIONTYPE IS NOT NULL",null).detail();
|
||||
String substring = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId)
|
||||
.addQuery("OPTIONTYPE IS NOT NULL", null).detail().getString("RELEASE_INSTRUCTIONS");
|
||||
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId)
|
||||
.addQuery("OPTIONTYPE IS NOT NULL", null).detail();
|
||||
|
||||
List<BO> list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list();
|
||||
List<BO> lists = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list();
|
||||
List<BO> list_stop = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list();
|
||||
List<BO> list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processInstId)
|
||||
.orderByCreated().asc().list();
|
||||
List<BO> lists = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processInstId)
|
||||
.orderByCreated().asc().list();
|
||||
List<BO> list_stop = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processInstId)
|
||||
.orderByCreated().asc().list();
|
||||
int num = 1;
|
||||
|
||||
for (BO bo:list) {
|
||||
if (list.size() > 0) {
|
||||
for (BO bo : list) {
|
||||
|
||||
if(StringUtils.isNotEmpty(bo.getString("TASKID"))&& !bo.getString("TASKID").equals("submit_create")){
|
||||
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"));
|
||||
// System.out.println(",odel>>>>>>>>"+bo.getString("TASKID"));
|
||||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||||
if (appProfile==null){
|
||||
throw new AWSException("Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1");
|
||||
if (appProfile == null) {
|
||||
throw new AWSException(
|
||||
"Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1");
|
||||
}
|
||||
DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT);
|
||||
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")+"'";
|
||||
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";
|
||||
// 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");
|
||||
|
||||
|
||||
String name = bo.getString("PUBLISHFILENAME").replaceAll("/", "");
|
||||
DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(),
|
||||
model.getWsId(), bo.getString("TASKID"), name + "_" + lever + ".doc");
|
||||
|
||||
// 调用App
|
||||
|
||||
@ -599,7 +674,7 @@ public class TaskController {
|
||||
//文档是否允许下载,必填
|
||||
params_preview.put("isDownload", true);
|
||||
//显示文件名,必填
|
||||
params_preview.put("fileNameOriginal", name+"_"+lever+".doc");
|
||||
params_preview.put("fileNameOriginal", name + "_" + lever + ".doc");
|
||||
//PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填
|
||||
params_preview.put("isPDFCovertPNG", 0);
|
||||
//groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
|
||||
@ -622,33 +697,40 @@ public class TaskController {
|
||||
//文档预览
|
||||
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")+"'";
|
||||
// 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"));
|
||||
/*
|
||||
* 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("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")+"'" + ") ORDER BY CREATETIME ASC";
|
||||
String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'");
|
||||
if(UtilString.isNotEmpty(methodId)) {
|
||||
if(methodId.equals("control.policy")) {
|
||||
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")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC";
|
||||
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") + "'" + ") ORDER BY CREATETIME ASC";
|
||||
String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"
|
||||
+ bo.getString("PUBLISHFILEID") + "'");
|
||||
if (UtilString.isNotEmpty(methodId)) {
|
||||
if (methodId.equals("control.policy")) {
|
||||
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") + "') AND FILETYPE = 'f' ORDER BY CREATETIME ASC";
|
||||
}
|
||||
}
|
||||
//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")+"') AND FILETYPE = 'f'";
|
||||
List<RowMap> maps = DBSql.getMaps(conn,sql_upfile);
|
||||
// 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")+"') AND FILETYPE = 'f'";
|
||||
List<RowMap> maps = DBSql.getMaps(conn, sql_upfile);
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
UpfileWeb upfileWeb = new UpfileWeb(userContext);
|
||||
|
||||
@ -684,15 +766,17 @@ public class TaskController {
|
||||
params_previews.put("isEncrypt", false);
|
||||
AppAPI appAPIs = SDK.getAppAPI();
|
||||
//文档预览
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, params_previews);
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp,
|
||||
params_previews);
|
||||
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("title",row.getString("FILENAME"));
|
||||
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));
|
||||
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");
|
||||
@ -702,96 +786,111 @@ public class TaskController {
|
||||
num++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 这个是作废的显示的文件
|
||||
/**
|
||||
* 当发布和变更为空时,显示作废的文件
|
||||
*/
|
||||
for (BO bo:list_stop) {
|
||||
if (list.size() == 0 && lists.size() == 0) {
|
||||
if (list_stop.size() > 0) {
|
||||
for (BO bo : list_stop) {
|
||||
|
||||
if(StringUtils.isNotEmpty(bo.getString("TASKID"))&& !bo.getString("TASKID").equals("submit_create")){
|
||||
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"));
|
||||
// System.out.println(",odel>>>>>>>>"+bo.getString("TASKID"));
|
||||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||||
if (appProfile==null){
|
||||
throw new AWSException("Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1");
|
||||
if (appProfile == null) {
|
||||
throw new AWSException(
|
||||
"Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1");
|
||||
}
|
||||
DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT);
|
||||
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("STOPFILEID")+"'";
|
||||
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("STOPFILEID") + "'";
|
||||
String lever = DBSql.getString(conn, sql_lever);
|
||||
//System.out.println("lever====>>>>>"+lever);
|
||||
if (lever.length()!=5){
|
||||
lever = lever+".0";
|
||||
// System.out.println("lever====>>>>>"+lever);
|
||||
if (lever.length() != 5) {
|
||||
lever = lever + ".0";
|
||||
}
|
||||
String name = bo.getString("STOPFILENAME").replaceAll("/","");
|
||||
DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bo.getString("TASKID"),name+"_"+lever+".doc");
|
||||
String name = bo.getString("STOPFILENAME").replaceAll("/", "");
|
||||
DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(),
|
||||
model.getWsId(), bo.getString("TASKID"), name + "_" + lever + ".doc");
|
||||
|
||||
// 调用App
|
||||
|
||||
|
||||
// 调用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("fileNameOriginal", name + "_" + lever + ".doc");
|
||||
// PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填
|
||||
params_preview.put("isPDFCovertPNG", 0);
|
||||
//groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
|
||||
// groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
|
||||
params_preview.put("extParams", "");
|
||||
//文档是否允许打印,必填
|
||||
// 文档是否允许打印,必填
|
||||
params_preview.put("isPrint", true);
|
||||
//是否显示顶部工具栏的返回按钮,默认显示,非必填
|
||||
// 是否显示顶部工具栏的返回按钮,默认显示,非必填
|
||||
params_preview.put("isShowBackbtn", false);
|
||||
//原文件DC,必填
|
||||
// 原文件DC,必填
|
||||
params_preview.put("sourceDc", dcContext);
|
||||
//是否显示默认预览工具栏,必填
|
||||
// 是否显示默认预览工具栏,必填
|
||||
params_preview.put("isShowDefaultToolbar", true);
|
||||
//文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填
|
||||
// 文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填
|
||||
params_preview.put("isCopy", true);
|
||||
//sessionid,必填
|
||||
// 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);
|
||||
// 文档预览
|
||||
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("STOPFILEID")+"'";
|
||||
// System.out.println("ro>>>>>>>>>>>>>>>>"+ro);
|
||||
String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE id ='"
|
||||
+ bo.get("STOPFILEID") + "'";
|
||||
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"));
|
||||
/*
|
||||
* 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("STOPFILENAME"));
|
||||
jsonObjects.put("link","https://bpm.yili.com:8088/portal/r"+ro.get("url").toString().substring(1));
|
||||
jsonObjects.put("title", bo.get("STOPFILENAME"));
|
||||
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("STOPFILEID")+"'" + ")";
|
||||
*/
|
||||
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("STOPFILEID")+"'" + ") ORDER BY CREATETIME ASC";
|
||||
String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"'");
|
||||
if(UtilString.isNotEmpty(methodId)) {
|
||||
if(methodId.equals("control.policy")) {
|
||||
sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC";
|
||||
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("STOPFILEID") + "'" + ") ORDER BY CREATETIME ASC";
|
||||
String methodId = DBSql
|
||||
.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"
|
||||
+ bo.getString("STOPFILEID") + "'");
|
||||
if (UtilString.isNotEmpty(methodId)) {
|
||||
if (methodId.equals("control.policy")) {
|
||||
sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"
|
||||
+ bo.getString("STOPFILEID") + "') AND FILETYPE = 'f' ORDER BY CREATETIME ASC";
|
||||
}
|
||||
}
|
||||
//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("STOPFILEID")+"') AND FILETYPE = 'f'";
|
||||
List<RowMap> maps = DBSql.getMaps(conn,sql_upfile);
|
||||
// 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("STOPFILEID")+"') AND FILETYPE = 'f'";
|
||||
List<RowMap> maps = DBSql.getMaps(conn, sql_upfile);
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
UpfileWeb upfileWeb = new UpfileWeb(userContext);
|
||||
|
||||
@ -803,39 +902,41 @@ public class TaskController {
|
||||
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,非必填
|
||||
// PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填
|
||||
params_previews.put("isPDFCovertPNG", 0);
|
||||
//groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
|
||||
// groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
|
||||
params_previews.put("extParams", "");
|
||||
//文档是否允许打印,必填
|
||||
// 文档是否允许打印,必填
|
||||
params_previews.put("isPrint", true);
|
||||
//是否显示顶部工具栏的返回按钮,默认显示,非必填
|
||||
// 是否显示顶部工具栏的返回按钮,默认显示,非必填
|
||||
params_previews.put("isShowBackbtn", "");
|
||||
//原文件DC,必填
|
||||
// 原文件DC,必填
|
||||
params_previews.put("sourceDc", dcContexts);
|
||||
//是否显示默认预览工具栏,必填
|
||||
// 是否显示默认预览工具栏,必填
|
||||
params_previews.put("isShowDefaultToolbar", true);
|
||||
//文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填
|
||||
// 文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填
|
||||
params_previews.put("isCopy", true);
|
||||
//sessionid,必填
|
||||
// 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);
|
||||
// 文档预览
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp,
|
||||
params_previews);
|
||||
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("title",row.getString("FILENAME"));
|
||||
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));
|
||||
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");
|
||||
@ -844,30 +945,37 @@ public class TaskController {
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (BO bo:lists) {
|
||||
if (lists.size() > 0) {
|
||||
for (BO bo : lists) {
|
||||
|
||||
if(StringUtils.isNotEmpty(bo.getString("TASKID"))&& !bo.getString("TASKID").equals("submit_create")){
|
||||
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"));
|
||||
// System.out.println(",odel>>>>>>>>"+bo.getString("TASKID"));
|
||||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||||
if (appProfile==null){
|
||||
throw new AWSException("Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1");
|
||||
if (appProfile == null) {
|
||||
throw new AWSException(
|
||||
"Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1");
|
||||
}
|
||||
DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT);
|
||||
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")+"'";
|
||||
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";
|
||||
// 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");
|
||||
|
||||
|
||||
String name = bo.getString("CHANGEDFILENAMENEW").replaceAll("/", "");
|
||||
DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(),
|
||||
model.getWsId(), bo.getString("TASKID"), name + "_" + lever + ".doc");
|
||||
|
||||
// 调用App
|
||||
|
||||
@ -876,7 +984,7 @@ public class TaskController {
|
||||
//文档是否允许下载,必填
|
||||
params_preview.put("isDownload", true);
|
||||
//显示文件名,必填
|
||||
params_preview.put("fileNameOriginal", name+"_"+lever+".doc");
|
||||
params_preview.put("fileNameOriginal", name + "_" + lever + ".doc");
|
||||
//PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填
|
||||
params_preview.put("isPDFCovertPNG", 0);
|
||||
//groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填
|
||||
@ -899,32 +1007,39 @@ public class TaskController {
|
||||
//文档预览
|
||||
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")+"'";
|
||||
// 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"));
|
||||
/*
|
||||
* 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("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")+"'" + ") ORDER BY CREATETIME ASC";
|
||||
String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("CHANGEDFILEIDNEW")+"'");
|
||||
if(UtilString.isNotEmpty(methodId)) {
|
||||
if(methodId.equals("control.policy")) {
|
||||
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")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC";
|
||||
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") + "'" + ") ORDER BY CREATETIME ASC";
|
||||
String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"
|
||||
+ bo.getString("CHANGEDFILEIDNEW") + "'");
|
||||
if (UtilString.isNotEmpty(methodId)) {
|
||||
if (methodId.equals("control.policy")) {
|
||||
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")
|
||||
+ "') AND FILETYPE = 'f' ORDER BY CREATETIME ASC";
|
||||
}
|
||||
}
|
||||
|
||||
List<RowMap> maps = DBSql.getMaps(conn,sql_upfile);
|
||||
List<RowMap> maps = DBSql.getMaps(conn, sql_upfile);
|
||||
UserContext userContext = UserContext.fromSessionId(sid);
|
||||
UpfileWeb upfileWeb = new UpfileWeb(userContext);
|
||||
|
||||
@ -960,14 +1075,16 @@ public class TaskController {
|
||||
params_previews.put("isEncrypt", false);
|
||||
AppAPI appAPIs = SDK.getAppAPI();
|
||||
//文档预览
|
||||
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, params_previews);
|
||||
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("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");
|
||||
@ -977,77 +1094,79 @@ public class TaskController {
|
||||
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);
|
||||
// }
|
||||
// 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;
|
||||
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){
|
||||
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("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("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"));
|
||||
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){
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
//jsonObject.put("userList","00345531");
|
||||
// jsonObject.put("userList","00345531");
|
||||
HttpClientUtils httpClientUtil = new HttpClientUtils();
|
||||
// String s = httpClientUtil.SendPreview("http://10.119.22.207:80/services/service_lcglpt?wsdl", jsonObject);
|
||||
// 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 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 readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
|
||||
String s = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
//System.out.println("s==============>>>>>>>>>>>"+s);
|
||||
// System.out.println("s==============>>>>>>>>>>>"+s);
|
||||
|
||||
}
|
||||
String nums = DBSql.getString("select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'");
|
||||
if (UtilString.isNotEmpty(nums)){
|
||||
String nums = DBSql
|
||||
.getString("select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'");
|
||||
if (UtilString.isNotEmpty(nums)) {
|
||||
|
||||
Integer read_num = Integer.valueOf(nums);
|
||||
read_num+=1;
|
||||
DBSql.update("update BO_EU_PAL_READ_LOG set READNUM = '"+read_num+"' where PROCESSID = '"+processInstId+"'");
|
||||
read_num += 1;
|
||||
DBSql.update("update BO_EU_PAL_READ_LOG set READNUM = '" + read_num + "' where PROCESSID = '"
|
||||
+ processInstId + "'");
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
} finally {
|
||||
conn.close();
|
||||
}
|
||||
return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration",html, map);
|
||||
return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration", html, map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
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 UtilUrls {
|
||||
|
||||
//使用SOAP1.1发送消息
|
||||
public static String doPostSoap(String postUrl, String soapXml, String soapAction) {
|
||||
String retStr = "";
|
||||
// 创建HttpClientBuilder
|
||||
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
||||
// HttpClient
|
||||
CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
|
||||
HttpPost httpPost = new HttpPost(postUrl);
|
||||
// 设置请求和传输超时时间
|
||||
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(999999999)
|
||||
.setConnectTimeout(999999999).build();
|
||||
httpPost.setConfig(requestConfig);
|
||||
try {
|
||||
httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8");
|
||||
httpPost.setHeader("SOAPAction", soapAction);
|
||||
StringEntity data = new StringEntity(soapXml, Charset.forName("UTF-8"));
|
||||
httpPost.setEntity(data);
|
||||
CloseableHttpResponse response = closeableHttpClient.execute(httpPost);
|
||||
HttpEntity httpEntity = response.getEntity();
|
||||
if (httpEntity != null) {
|
||||
// 打印响应内容
|
||||
retStr = EntityUtils.toString(httpEntity, "UTF-8");
|
||||
}
|
||||
// 释放资源
|
||||
closeableHttpClient.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return retStr;
|
||||
}
|
||||
}
|
||||
8
com.awspaas.user.apps.yili.reportform/.classpath
Normal file
8
com.awspaas.user.apps.yili.reportform/.classpath
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/aws"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/pal"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
com.awspaas.user.apps.yili.reportform/.project
Normal file
17
com.awspaas.user.apps.yili.reportform/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.awspaas.user.apps.yili.reportform</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -48,7 +48,7 @@ public class AttrSynController {
|
||||
System.err.println("=====fromSessionId======="+fromSessionId);
|
||||
JSONObject result = new JSONObject();
|
||||
Map<String,Object> claims = new HashMap<> ();
|
||||
claims.put("userName","10036614");
|
||||
claims.put("userName",fromSessionId.getUID());
|
||||
//生成token
|
||||
String jwt_token = JwtUtils.getAccessToken ("userId",claims);
|
||||
System.out.println ("jwt_token="+jwt_token);
|
||||
|
||||
@ -4,13 +4,8 @@ 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.bpms.util.DBSql;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.awspaas.user.apps.yili.reportform.service.DataViewService;
|
||||
import com.awspaas.user.apps.yili.reportform.service.DataViewService2;
|
||||
import com.awspaas.user.apps.yili.reportform.service.ToPageService;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
/**
|
||||
* @author:Lizj
|
||||
@ -45,14 +40,11 @@ public class DataViewController {
|
||||
@Mapping(value = "com.awspaas.user.apps.yili.reportform.service.DataViewService_personalView",
|
||||
desc = "个人视图")
|
||||
public String personalView(UserContext uc, RequestParams params) {
|
||||
String personalViewVal = null;
|
||||
try {
|
||||
personalViewVal = new DataViewService(uc).personalView(uc, params);
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleErr("personalView异常");
|
||||
}
|
||||
return personalViewVal;
|
||||
return new DataViewService(uc).personalView(uc, params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Mapping(value = "com.awspaas.user.apps.yili.reportform.service.DataViewService_queryTermsDept",
|
||||
desc = "筛选条件:当前用户部门、部门")
|
||||
public String queryTermsDept(UserContext uc, RequestParams params) {
|
||||
|
||||
@ -436,6 +436,7 @@ public class SyncData implements IJob {
|
||||
SDK.getLogAPI().consoleInfo("获取节点属性过程中,"+"文件ID:"+FILEID+"获取节点形状属性异常");
|
||||
}
|
||||
}
|
||||
//同步角色岗位
|
||||
if (null != nodeElements && !nodeElements.isEmpty()) {
|
||||
for (Map<String, Object> nodeElement : nodeElements) {
|
||||
String NODETYPE = String.valueOf(nodeElement.get("type"));
|
||||
|
||||
@ -0,0 +1,676 @@
|
||||
package com.awspaas.user.apps.yili.reportform.job;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.bpms.api.Utils;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.awspaas.user.apps.yili.reportform.util.CheckUtil;
|
||||
import com.awspaas.user.apps.yili.reportform.util.GetNodesUtil;
|
||||
import com.awspaas.user.apps.yili.reportform.util.RepositoryAttribute;
|
||||
|
||||
/**
|
||||
* @author:Lizj
|
||||
* @create: 2022-07-05 15:58
|
||||
* @Description: 定时同步数据
|
||||
*/
|
||||
@DisallowConcurrentExecution
|
||||
public class SyncData2 implements IJob {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
SDK.getLogAPI().consoleInfo("全量定时同步文件信息开始执行");
|
||||
long startTime = System.currentTimeMillis();
|
||||
Date nowDateJ = new Date(System.currentTimeMillis());
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String format = sdf2.format(nowDateJ);
|
||||
SDK.getLogAPI().consoleInfo("开始时间" + format);
|
||||
|
||||
String wsId = SDK.getJobAPI().getJobParameter(jobExecutionContext);
|
||||
|
||||
//总文件集合
|
||||
String process = "process";
|
||||
String org = "org";
|
||||
String data = "data";
|
||||
String itsystem = "itsystem";
|
||||
String control = "control";
|
||||
List<PALRepositoryModel> palProcessList = new ArrayList<>();
|
||||
Set<String> palProcessIds = new HashSet<>();
|
||||
List<PALRepositoryModel> palOrgList = new ArrayList<>();
|
||||
Set<String> palOrgIds = new HashSet<>();
|
||||
List<PALRepositoryModel> palDataList = new ArrayList<>();
|
||||
Set<String> palDataIds = new HashSet<>();
|
||||
List<PALRepositoryModel> palItsystemList = new ArrayList<>();
|
||||
Set<String> palItsystemIds = new HashSet<>();
|
||||
List<PALRepositoryModel> palControlList = new ArrayList<>();
|
||||
Set<String> palControlIds = new HashSet<>();
|
||||
PALRepositoryCache.getAllChildrenModelsByPid(wsId, process, palProcessList, palProcessIds);
|
||||
PALRepositoryCache.getAllChildrenModelsByPid(wsId, org, palOrgList, palOrgIds);
|
||||
PALRepositoryCache.getAllChildrenModelsByPid(wsId, data, palDataList, palDataIds);
|
||||
PALRepositoryCache.getAllChildrenModelsByPid(wsId, itsystem, palItsystemList, palItsystemIds);
|
||||
PALRepositoryCache.getAllChildrenModelsByPid(wsId, control, palControlList, palControlIds);
|
||||
//合并为文件总量list
|
||||
List<PALRepositoryModel> palTotalList = new ArrayList<>();
|
||||
palTotalList.addAll(palProcessList);
|
||||
palTotalList.addAll(palOrgList);
|
||||
palTotalList.addAll(palDataList);
|
||||
palTotalList.addAll(palItsystemList);
|
||||
palTotalList.addAll(palControlList);
|
||||
SDK.getLogAPI().consoleInfo("process下文件数量:" + palProcessList.size());
|
||||
SDK.getLogAPI().consoleInfo("org下文件数量:" + palOrgList.size());
|
||||
SDK.getLogAPI().consoleInfo("data下文件数量:" + palDataList.size());
|
||||
SDK.getLogAPI().consoleInfo("itsystem下文件数量:" + palItsystemList.size());
|
||||
SDK.getLogAPI().consoleInfo("control下文件数量:" + palControlList.size());
|
||||
SDK.getLogAPI().consoleInfo("文件总数量:" + palTotalList.size());
|
||||
//过滤出角色文件
|
||||
/* List<PALRepositoryModel> palRoleFileList = palOrgList.stream().filter(x -> x.getMethodId().equals("org.role")).collect(Collectors.toList());
|
||||
SDK.getLogAPI().consoleInfo("角色文件数量:" + palRoleFileList.size());*/
|
||||
|
||||
//初始化架构、文件、节点 old/new/del/fromDataID/dis list
|
||||
ArrayList<Map<String, ?>> oldFrameDataMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> newFrameDataMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> delFrameDataMaps = new ArrayList<>();
|
||||
ArrayList<String> fromFrameDataIDMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> oldFileDataMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> newFileDataMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> delFileDataMaps = new ArrayList<>();
|
||||
ArrayList<String> fromFileDataIDMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> oldNodeDataMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> newNodeDataMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> delNodeDataMaps = new ArrayList<>();
|
||||
ArrayList<String> fromNodeDataIDMaps = new ArrayList<>();
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
Object[] sqlParams = new Object[]{};
|
||||
//获取底表数据
|
||||
List<String> frameIdList = DBSql.getList("SELECT FRAMEID FROM BO_EU_PAL_FRAME", String.class);
|
||||
SDK.getLogAPI().consoleInfo("架构底表长度:" + frameIdList.size());
|
||||
List<String> fileIdList = DBSql.getList("SELECT FILEID FROM BO_EU_PAL_FILE1", String.class);
|
||||
SDK.getLogAPI().consoleInfo("文件底表长度:" + fileIdList.size());
|
||||
List<String> nodeIdList = DBSql.getList("SELECT NODEID FROM BO_EU_PAL_FILENODE5", String.class);
|
||||
SDK.getLogAPI().consoleInfo("节点底表长度:" + nodeIdList.size());
|
||||
//系统字段
|
||||
String uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
|
||||
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
//遍历总文件集合
|
||||
for (PALRepositoryModel fileModel : palTotalList) {
|
||||
List<Map<String, Object>> nodeElements = new ArrayList<>();
|
||||
String PLMETHODID = fileModel.getMethodId();
|
||||
String FILEID = fileModel.getId();
|
||||
String PLNAME = fileModel.getName();
|
||||
String plRid = fileModel.getPlRid();
|
||||
String sql = "SELECT ID FROM (SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLRID = '"+plRid+"' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2";
|
||||
String palId = DBSql.getString(sql);
|
||||
if(UtilString.isNotEmpty(palId)) {
|
||||
if(!FILEID.equals(palId)) {
|
||||
SDK.getLogAPI().consoleInfo("同步数据发现旧版本文件名称:"+PLNAME+"——文件id:"+FILEID);
|
||||
String dsql = "DELETE FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+FILEID+"'";
|
||||
DBSql.update(dsql);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Timestamp MODIFYDATETIME = fileModel.getModifyDate();
|
||||
if (PLMETHODID.equals("process.framework")) {
|
||||
//更新/新增架构
|
||||
Integer FRAMELEVEL = fileModel.getLevel();
|
||||
String FRAMETYPE = null;
|
||||
String FRAMEPARENTID = fileModel.getParentId();
|
||||
Integer FRAMEORDERINDEX = fileModel.getOrderIndex();
|
||||
Map<String, JSONObject> frameAttrs = new HashMap<>();
|
||||
try {
|
||||
frameAttrs = new RepositoryAttribute().queryRepositoryAttributeById(FILEID);
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleInfo("更新架构时文件ID" + FILEID + "数据异常");
|
||||
}
|
||||
if (null != frameAttrs && !frameAttrs.isEmpty()) {
|
||||
JSONObject Frame_type = frameAttrs.get("Frame_type");
|
||||
FRAMETYPE = Frame_type.getString("text");
|
||||
}
|
||||
|
||||
fromFrameDataIDMaps.add(FILEID);
|
||||
|
||||
if (frameIdList.contains(FILEID)) {
|
||||
dataMap = new HashMap<>();
|
||||
nowDateJ = new Date(System.currentTimeMillis());
|
||||
Timestamp nowDateTime = new Timestamp(nowDateJ.getTime());
|
||||
dataMap.put("FRAMEID", FILEID);
|
||||
dataMap.put("UPDATEDATE", nowDateTime);
|
||||
dataMap.put("FRAMENAME", PLNAME);
|
||||
dataMap.put("FRAMELEVEL", FRAMELEVEL);
|
||||
dataMap.put("FRAMETYPE", FRAMETYPE);
|
||||
dataMap.put("FRAMEPARENTID", FRAMEPARENTID);
|
||||
dataMap.put("FRAMEORDERINDEX", FRAMEORDERINDEX);
|
||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||
oldFrameDataMaps.add(dataMap);
|
||||
} else {
|
||||
dataMap = new HashMap<>();
|
||||
uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
|
||||
dataMap.put("uuId", uuId);
|
||||
dataMap.put("FRAMEID", FILEID);
|
||||
dataMap.put("FRAMENAME", PLNAME);
|
||||
dataMap.put("FRAMELEVEL", FRAMELEVEL);
|
||||
dataMap.put("FRAMETYPE", FRAMETYPE);
|
||||
dataMap.put("FRAMEPARENTID", FRAMEPARENTID);
|
||||
dataMap.put("FRAMEORDERINDEX", FRAMEORDERINDEX);
|
||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||
newFrameDataMaps.add(dataMap);
|
||||
}
|
||||
} else {
|
||||
//更新/新增文件
|
||||
Integer PLLEVEL = fileModel.getLevel();
|
||||
String PLPARENTID = fileModel.getParentId();
|
||||
Integer PLORDERINDEX = fileModel.getOrderIndex();
|
||||
String PLCATEGORY = fileModel.getMethodCategory();
|
||||
String CREATEPER = fileModel.getCreateUser();
|
||||
String MODIFYPER = fileModel.getModifyUser();
|
||||
Timestamp CREATEDATETIME = fileModel.getCreateDate();
|
||||
double FILEVERSION = fileModel.getVersion();
|
||||
String PUBDEPT = "";
|
||||
String PUBDATETIME = "";
|
||||
String FILESTATE = "";
|
||||
String FILEUSESTATE = "";
|
||||
Long VIEWCOUNT = fileModel.getViewCount();
|
||||
String L1ID = "";
|
||||
String L2ID = "";
|
||||
String L3ID = "";
|
||||
String LEADPROCESS = "";
|
||||
String REARPROCESS = "";
|
||||
String PROCESSKPI = "";
|
||||
String RELEVANTFILE = "";
|
||||
String SUPPORTFILE = "";
|
||||
String POLICYTYPE = "";
|
||||
List<RowMap> parentMaps = new ArrayList<>();
|
||||
if (null != PLPARENTID && !PLPARENTID.equals("")) {
|
||||
parentMaps = GetNodesUtil.getParentFrame(PLPARENTID, parentMaps);
|
||||
}
|
||||
if (null != parentMaps && !parentMaps.isEmpty()) {
|
||||
for (RowMap parentMap : parentMaps) {
|
||||
Integer parentLevel = parentMap.getInt("FRAMELEVEL");
|
||||
String parentID = parentMap.getString("FRAMEID");
|
||||
if (parentLevel.equals(3)) {
|
||||
L3ID = parentID;
|
||||
}
|
||||
if (parentLevel.equals(2)) {
|
||||
L2ID = parentID;
|
||||
}
|
||||
if (parentLevel.equals(1)) {
|
||||
L1ID = parentID;
|
||||
}
|
||||
}
|
||||
}
|
||||
//文件状态
|
||||
FILESTATE = "0";
|
||||
if (fileModel.isPublish() == true) {
|
||||
FILESTATE = "1";
|
||||
}
|
||||
if (fileModel.isApproval() == true) {
|
||||
FILESTATE = "2";
|
||||
}
|
||||
if (fileModel.isStop() == true) {
|
||||
FILESTATE = "3";
|
||||
}
|
||||
|
||||
//文件生效状态
|
||||
if (fileModel.isUse() == true) {
|
||||
FILEUSESTATE = "1";
|
||||
} else {
|
||||
FILEUSESTATE = "0";
|
||||
}
|
||||
|
||||
|
||||
Map<String, JSONObject> fileAttrJsonMap = new HashMap<>();
|
||||
try {
|
||||
fileAttrJsonMap = new RepositoryAttribute().queryRepositoryAttributeById(FILEID);
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleInfo("更新文件时文件ID" + FILEID + "数据异常");
|
||||
}
|
||||
if (null != fileAttrJsonMap && !fileAttrJsonMap.isEmpty()) {
|
||||
//发布部门
|
||||
JSONObject Issuing_department = fileAttrJsonMap.get("Issuing_department");
|
||||
if (null != Issuing_department && !Issuing_department.equals("")) {
|
||||
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
|
||||
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
|
||||
for (Object PUBDEPTO : PUBDEPTJA) {
|
||||
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
|
||||
PUBDEPT = PUBDEPT + " " + PUBDEPTJO.getString("id");
|
||||
}
|
||||
PUBDEPT = PUBDEPT.substring(1);
|
||||
}
|
||||
}
|
||||
//发布时间
|
||||
PUBDATETIME = "";
|
||||
JSONObject effective_date = fileAttrJsonMap.get("Drafted_and_revised_date");
|
||||
if (null != effective_date && !effective_date.equals("")) {
|
||||
String pubDateString = effective_date.getString("text");
|
||||
if (null != pubDateString && !pubDateString.equals("")) {
|
||||
if (CheckUtil.isDate(pubDateString)) {
|
||||
Date parse = null;
|
||||
try {
|
||||
parse = sdf1.parse(pubDateString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PUBDATETIME = sdf1.format(parse);
|
||||
}
|
||||
}
|
||||
}
|
||||
//前置流程
|
||||
if (PLMETHODID.equals("process.epc")) {
|
||||
JSONObject lead_process = fileAttrJsonMap.get("lead_process");
|
||||
if (null != lead_process && !lead_process.equals("")) {
|
||||
JSONArray lpValue = lead_process.getJSONArray("value");
|
||||
if (null != lpValue && !lpValue.isEmpty()) {
|
||||
LEADPROCESS = "1";
|
||||
} else {
|
||||
LEADPROCESS = "0";
|
||||
}
|
||||
} else {
|
||||
LEADPROCESS = "0";
|
||||
}
|
||||
//后置流程
|
||||
JSONObject rear_process = fileAttrJsonMap.get("rear_process");
|
||||
if (null != rear_process && !rear_process.equals("")) {
|
||||
JSONArray rpValue = rear_process.getJSONArray("value");
|
||||
if (null != rpValue && !rpValue.isEmpty()) {
|
||||
REARPROCESS = "1";
|
||||
} else {
|
||||
REARPROCESS = "0";
|
||||
}
|
||||
} else {
|
||||
REARPROCESS = "0";
|
||||
}
|
||||
}
|
||||
//流程绩效
|
||||
JSONObject performance = fileAttrJsonMap.get("Process_performance_metrics");
|
||||
if (null != performance && !performance.equals("")) {
|
||||
JSONArray performanceJA = performance.getJSONArray("value");
|
||||
if (null != performanceJA && !performanceJA.isEmpty()) {
|
||||
for (Object performanceO : performanceJA) {
|
||||
JSONObject performanceJO = JSONObject.parseObject(String.valueOf(performanceO));
|
||||
PROCESSKPI = PROCESSKPI + " " + performanceJO.getString("fileId");
|
||||
}
|
||||
PROCESSKPI = PROCESSKPI.substring(1);
|
||||
}
|
||||
}
|
||||
//相关文件
|
||||
JSONObject R_relevant_flies = fileAttrJsonMap.get("R_relevant_flies");
|
||||
if (null != R_relevant_flies && !R_relevant_flies.equals("")) {
|
||||
JSONArray RELEVANTFILEJA = R_relevant_flies.getJSONArray("value");
|
||||
if (null != RELEVANTFILEJA && !RELEVANTFILEJA.isEmpty()) {
|
||||
for (Object RELEVANTFILEO : RELEVANTFILEJA) {
|
||||
JSONObject RELEVANTFILEJO = JSONObject.parseObject(String.valueOf(RELEVANTFILEO));
|
||||
RELEVANTFILE = RELEVANTFILE + " " + RELEVANTFILEJO.getString("fileId");
|
||||
}
|
||||
RELEVANTFILE = RELEVANTFILE.substring(1);
|
||||
}
|
||||
}
|
||||
//支持文件
|
||||
JSONObject support_files = fileAttrJsonMap.get("support_files");
|
||||
if (null != support_files && !support_files.equals("")) {
|
||||
JSONArray SUPPORTFILEJA = support_files.getJSONArray("value");
|
||||
if (null != SUPPORTFILEJA && !SUPPORTFILEJA.isEmpty()) {
|
||||
for (Object SUPPORTFILEO : SUPPORTFILEJA) {
|
||||
JSONObject SUPPORTFILEJO = JSONObject.parseObject(String.valueOf(SUPPORTFILEO));
|
||||
SUPPORTFILE = SUPPORTFILE + " " + SUPPORTFILEJO.getString("fileId");
|
||||
}
|
||||
SUPPORTFILE = SUPPORTFILE.substring(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
//制度类型
|
||||
nodeElements = new ArrayList<>();
|
||||
if (PLMETHODID.equals("control.policy")) {
|
||||
try {
|
||||
nodeElements = CoeDesignerUtil.getShapeMessageJson4(FILEID);
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleInfo("获取制度类型过程中," + "文件ID:" + FILEID + "获取节点形状属性异常");
|
||||
}
|
||||
}
|
||||
if (null != nodeElements && !nodeElements.isEmpty()) {
|
||||
for (Map<String, Object> nodeElement : nodeElements) {
|
||||
String NODETYPE = String.valueOf(nodeElement.get("type"));
|
||||
if (NODETYPE.equals("regulation")) {
|
||||
POLICYTYPE = "regulation";
|
||||
} else if (NODETYPE.equals("I/O_L4")) {
|
||||
POLICYTYPE = "I/O_L4";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fromFileDataIDMaps.add(FILEID);
|
||||
|
||||
if (fileIdList.contains(FILEID)) {
|
||||
dataMap = new HashMap<>();
|
||||
nowDateJ = new Date(System.currentTimeMillis());
|
||||
Timestamp nowDateTime = new Timestamp(nowDateJ.getTime());
|
||||
dataMap.put("FILEID", FILEID);
|
||||
dataMap.put("UPDATEDATE", nowDateTime);
|
||||
dataMap.put("PLNAME", PLNAME);
|
||||
dataMap.put("PLLEVEL", PLLEVEL);
|
||||
dataMap.put("PLPARENTID", PLPARENTID);
|
||||
dataMap.put("PLORDERINDEX", PLORDERINDEX);
|
||||
dataMap.put("PLCATEGORY", PLCATEGORY);
|
||||
dataMap.put("PLMETHODID", PLMETHODID);
|
||||
dataMap.put("FILEVERSION", FILEVERSION);
|
||||
dataMap.put("CREATEPER", CREATEPER);
|
||||
dataMap.put("MODIFYPER", MODIFYPER);
|
||||
dataMap.put("CREATEDATETIME", CREATEDATETIME);
|
||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||
dataMap.put("PUBDEPT", PUBDEPT);
|
||||
dataMap.put("PUBDATETIME", PUBDATETIME);
|
||||
dataMap.put("FILESTATE", FILESTATE);
|
||||
dataMap.put("FILEUSESTATE", FILEUSESTATE);
|
||||
dataMap.put("VIEWCOUNT", VIEWCOUNT);
|
||||
dataMap.put("L1ID", L1ID);
|
||||
dataMap.put("L2ID", L2ID);
|
||||
dataMap.put("L3ID", L3ID);
|
||||
dataMap.put("LEADPROCESS", LEADPROCESS);
|
||||
dataMap.put("REARPROCESS", REARPROCESS);
|
||||
dataMap.put("PROCESSKPI", PROCESSKPI);
|
||||
dataMap.put("RELEVANTFILE", RELEVANTFILE);
|
||||
dataMap.put("SUPPORTFILE", SUPPORTFILE);
|
||||
dataMap.put("POLICYTYPE", POLICYTYPE);
|
||||
oldFileDataMaps.add(dataMap);
|
||||
} else {
|
||||
dataMap = new HashMap<>();
|
||||
uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
|
||||
dataMap.put("uuId", uuId);
|
||||
dataMap.put("FILEID", FILEID);
|
||||
dataMap.put("PLNAME", PLNAME);
|
||||
dataMap.put("PLLEVEL", PLLEVEL);
|
||||
dataMap.put("PLPARENTID", PLPARENTID);
|
||||
dataMap.put("PLORDERINDEX", PLORDERINDEX);
|
||||
dataMap.put("PLCATEGORY", PLCATEGORY);
|
||||
dataMap.put("PLMETHODID", PLMETHODID);
|
||||
dataMap.put("FILEVERSION", FILEVERSION);
|
||||
dataMap.put("CREATEPER", CREATEPER);
|
||||
dataMap.put("MODIFYPER", MODIFYPER);
|
||||
dataMap.put("CREATEDATETIME", CREATEDATETIME);
|
||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||
dataMap.put("PUBDEPT", PUBDEPT);
|
||||
dataMap.put("PUBDATETIME", PUBDATETIME);
|
||||
dataMap.put("FILESTATE", FILESTATE);
|
||||
dataMap.put("FILEUSESTATE", FILEUSESTATE);
|
||||
dataMap.put("VIEWCOUNT", VIEWCOUNT);
|
||||
dataMap.put("L1ID", L1ID);
|
||||
dataMap.put("L2ID", L2ID);
|
||||
dataMap.put("L3ID", L3ID);
|
||||
dataMap.put("LEADPROCESS", LEADPROCESS);
|
||||
dataMap.put("REARPROCESS", REARPROCESS);
|
||||
dataMap.put("PROCESSKPI", PROCESSKPI);
|
||||
dataMap.put("RELEVANTFILE", RELEVANTFILE);
|
||||
dataMap.put("SUPPORTFILE", SUPPORTFILE);
|
||||
dataMap.put("POLICYTYPE", POLICYTYPE);
|
||||
newFileDataMaps.add(dataMap);
|
||||
}
|
||||
|
||||
//更新/新增节点
|
||||
nodeElements = new ArrayList<>();
|
||||
if(PLMETHODID.equals("process.epc")) {
|
||||
try {
|
||||
nodeElements = CoeDesignerUtil.getShapeMessageJson4(FILEID);
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleInfo("获取节点属性过程中,"+"文件ID:"+FILEID+"获取节点形状属性异常");
|
||||
}
|
||||
}
|
||||
if (null != nodeElements && !nodeElements.isEmpty()) {
|
||||
for (Map<String, Object> nodeElement : nodeElements) {
|
||||
String NODETYPE = String.valueOf(nodeElement.get("type"));
|
||||
if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node") || NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) {
|
||||
//节点信息
|
||||
String NODEID = String.valueOf(nodeElement.get("id"));
|
||||
String NODENAME = String.valueOf(nodeElement.get("name"));
|
||||
//形状属性数组
|
||||
JSONArray attributesArray = JSON.parseArray(String.valueOf(nodeElement.get("attributes")));
|
||||
//形状属性:信息系统、活动序号、活动描述、角色、岗位
|
||||
String ITSYSVAL = "";
|
||||
String ACTIVITYNUMBER = "";
|
||||
String ACTIVITYDESC = "";
|
||||
String ROLE = "";
|
||||
String ROLENAME = "";
|
||||
String POST = "";
|
||||
String POSTNAME = "";
|
||||
if (null != attributesArray && !attributesArray.isEmpty()) {
|
||||
for (Object attribute : attributesArray) {
|
||||
JSONObject attributeJO = JSON.parseObject(String.valueOf(attribute));
|
||||
String SHAPEATTRKEY = attributeJO.getString("key");
|
||||
if (SHAPEATTRKEY.equals("information_systems")) {
|
||||
ITSYSVAL = attributeJO.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY.equals("activity_number")) {
|
||||
ACTIVITYNUMBER = attributeJO.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY.equals("activity_description")) {
|
||||
ACTIVITYDESC = attributeJO.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY.equals("role")) {
|
||||
String nodeRoleText = attributeJO.getString("value");
|
||||
ROLE = nodeRoleText;
|
||||
if (null!=ROLE && !ROLE.equals("")) {
|
||||
sqlParams = new Object[]{FILEID};
|
||||
List<RowMap> roleFileRowMaps = new ArrayList<>();
|
||||
try {
|
||||
roleFileRowMaps = DBSql.getMaps("SELECT RELATIONFILEID FROM APP_ACT_COE_PAL_SHAPE_RLAT WHERE FILEID=? AND ATTRID='role'", sqlParams);
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleInfo("获取流程节点角色属性关联文件时"+"文件ID:"+FILEID+"节点ID:"+NODEID+"异常");
|
||||
}
|
||||
if (null!=roleFileRowMaps && !roleFileRowMaps.isEmpty()) {
|
||||
for (RowMap roleFileRowMap : roleFileRowMaps) {
|
||||
String RELATIONFILEID = roleFileRowMap.getString("RELATIONFILEID");
|
||||
//角色文件属性
|
||||
List<Map<String, Object>> roleShapes = new ArrayList<>();
|
||||
try {
|
||||
roleShapes = CoeDesignerUtil.getShapeMessageJson4(RELATIONFILEID);
|
||||
} catch (Exception e) {
|
||||
|
||||
//SDK.getLogAPI().consoleInfo("获取关联角色文件属性"+"文件ID:"+RELATIONFILEID+"异常");
|
||||
}
|
||||
if (null != roleShapes && !roleShapes.isEmpty()) {
|
||||
for (Map<String, Object> roleShape : roleShapes) {
|
||||
String roleFileNodeName = String.valueOf(roleShape.get("name"));
|
||||
if (nodeRoleText.contains(roleFileNodeName)) {
|
||||
//角色节点形状属性
|
||||
JSONArray roleShapeJA = null;
|
||||
try {
|
||||
roleShapeJA = JSONArray.parseArray(String.valueOf(roleShape.get("attributes")));
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleInfo("获取角色节点形状属性jsonArray"+"文件ID:"+RELATIONFILEID+"异常");
|
||||
}
|
||||
if (null != roleShapeJA && !roleShapeJA.isEmpty()) {
|
||||
for (Object roleShapeO : roleShapeJA) {
|
||||
JSONObject roleShapeJO = JSON.parseObject(String.valueOf(roleShapeO));
|
||||
String roleShapeKey = roleShapeJO.getString("key");
|
||||
if (roleShapeKey.equals("post")) {
|
||||
//SDK.getLogAPI().consoleInfo("角色岗位"+roleShapeJO.getString("value"));
|
||||
POST = roleShapeJO.getString("value");
|
||||
}
|
||||
if (roleShapeKey.equals("post_text")) {
|
||||
//SDK.getLogAPI().consoleInfo("角色岗位文本"+roleShapeJO);
|
||||
ROLENAME = roleShapeJO.getString("value");
|
||||
POSTNAME = roleShapeJO.getString("value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Object attribute1 : attributesArray) {
|
||||
JSONObject attributeJO1 = JSON.parseObject(String.valueOf(attribute1));
|
||||
String SHAPEATTRKEY1 = attributeJO1.getString("key");
|
||||
if (SHAPEATTRKEY1.equals("post")) {
|
||||
POST = attributeJO1.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY1.equals("post_text")) {
|
||||
POSTNAME = attributeJO1.getString("value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fromNodeDataIDMaps.add(NODEID);
|
||||
|
||||
if (nodeIdList.contains(NODEID)) {
|
||||
dataMap = new HashMap<>();
|
||||
nowDateJ = new Date(System.currentTimeMillis());
|
||||
Timestamp nowDateTime = new Timestamp(nowDateJ.getTime());
|
||||
dataMap.put("UPDATEDATE", nowDateTime);
|
||||
dataMap.put("NODENAME", NODENAME);
|
||||
dataMap.put("NODETYPE", NODETYPE);
|
||||
dataMap.put("PLNAME", PLNAME);
|
||||
dataMap.put("NODECATEGORY", PLMETHODID);
|
||||
dataMap.put("ITSYSVAL", ITSYSVAL);
|
||||
dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER);
|
||||
dataMap.put("ACTIVITYDESC", ACTIVITYDESC);
|
||||
dataMap.put("ROLE", ROLE);
|
||||
dataMap.put("ROLENAME", ROLENAME);
|
||||
dataMap.put("POST", POST);
|
||||
dataMap.put("POSTNAME", POSTNAME);
|
||||
dataMap.put("PLID", FILEID);
|
||||
dataMap.put("NODEID", NODEID);
|
||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||
oldNodeDataMaps.add(dataMap);
|
||||
} else {
|
||||
dataMap = new HashMap<>();
|
||||
uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
|
||||
dataMap.put("uuId", uuId);
|
||||
dataMap.put("NODEID", NODEID);
|
||||
dataMap.put("NODENAME", NODENAME);
|
||||
dataMap.put("NODETYPE", NODETYPE);
|
||||
dataMap.put("PLID", FILEID);
|
||||
dataMap.put("PLNAME", PLNAME);
|
||||
dataMap.put("NODECATEGORY", PLMETHODID);
|
||||
dataMap.put("ITSYSVAL", ITSYSVAL);
|
||||
dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER);
|
||||
dataMap.put("ACTIVITYDESC", ACTIVITYDESC);
|
||||
dataMap.put("ROLE", ROLE);
|
||||
dataMap.put("POST", POST);
|
||||
dataMap.put("ROLENAME", ROLENAME);
|
||||
dataMap.put("POSTNAME", POSTNAME);
|
||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||
newNodeDataMaps.add(dataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//执行批量新增、修改、删除
|
||||
if (null != frameIdList && !frameIdList.isEmpty()) {
|
||||
for (String frameIdOfList : frameIdList) {
|
||||
if (!fromFrameDataIDMaps.contains(frameIdOfList)) {
|
||||
dataMap = new HashMap<>();
|
||||
dataMap.put("FRAMEID", frameIdOfList);
|
||||
delFrameDataMaps.add(dataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null != oldFrameDataMaps && !oldFrameDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("UPDATE BO_EU_PAL_FRAME SET"
|
||||
+ " FRAMENAME=:FRAMENAME, FRAMELEVEL=:FRAMELEVEL, FRAMETYPE=:FRAMETYPE, FRAMEPARENTID=:FRAMEPARENTID, FRAMEORDERINDEX=:FRAMEORDERINDEX, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE WHERE FRAMEID=:FRAMEID", oldFrameDataMaps);
|
||||
}
|
||||
if (null != newFrameDataMaps && !newFrameDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FRAME(ID,FRAMEID,FRAMENAME,FRAMELEVEL,FRAMETYPE,FRAMEPARENTID,FRAMEORDERINDEX,MODIFYDATETIME) "
|
||||
+ " VALUES(:uuId, :FRAMEID, :FRAMENAME, :FRAMELEVEL, :FRAMETYPE, :FRAMEPARENTID, :FRAMEORDERINDEX, :MODIFYDATETIME)", newFrameDataMaps);
|
||||
}
|
||||
if (null != delFrameDataMaps && !delFrameDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FRAME WHERE FRAMEID=:FRAMEID", delFrameDataMaps);
|
||||
}
|
||||
SDK.getLogAPI().consoleInfo("新增架构" + newFrameDataMaps.size());
|
||||
SDK.getLogAPI().consoleInfo("修改架构" + oldFrameDataMaps.size());
|
||||
SDK.getLogAPI().consoleInfo("删除架构" + delFrameDataMaps.size());
|
||||
|
||||
if (null != fileIdList && !fileIdList.isEmpty()) {
|
||||
for (String fileIdOfList : fileIdList) {
|
||||
if (!fromFileDataIDMaps.contains(fileIdOfList)) {
|
||||
dataMap = new HashMap<>();
|
||||
dataMap.put("FILEID", fileIdOfList);
|
||||
delFileDataMaps.add(dataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null != oldFileDataMaps && !oldFileDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("UPDATE BO_EU_PAL_FILE1 SET"
|
||||
+ " PLNAME=:PLNAME, PLLEVEL=:PLLEVEL, PLPARENTID=:PLPARENTID, PLORDERINDEX=:PLORDERINDEX, PLCATEGORY=:PLCATEGORY, "
|
||||
+ " PLMETHODID=:PLMETHODID, FILEVERSION=:FILEVERSION, CREATEPER=:CREATEPER, MODIFYPER=:MODIFYPER, "
|
||||
+ " PUBDEPT=:PUBDEPT, PUBDATETIME=:PUBDATETIME, FILESTATE=:FILESTATE, VIEWCOUNT=:VIEWCOUNT, L1ID=:L1ID, "
|
||||
+ " L2ID=:L2ID, L3ID=:L3ID, LEADPROCESS=:LEADPROCESS, REARPROCESS=:REARPROCESS, PROCESSKPI=:PROCESSKPI, "
|
||||
+ " RELEVANTFILE=:RELEVANTFILE, SUPPORTFILE=:SUPPORTFILE, POLICYTYPE=:POLICYTYPE, "
|
||||
+ " CREATEDATETIME=:CREATEDATETIME, MODIFYDATETIME=:MODIFYDATETIME, FILEUSESTATE=:FILEUSESTATE, UPDATEDATE=:UPDATEDATE "
|
||||
+ " WHERE FILEID=:FILEID", oldFileDataMaps);
|
||||
}
|
||||
if (null != newFileDataMaps && !newFileDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FILE1"
|
||||
+ " (ID, FILEID, PLNAME, PLLEVEL, PLPARENTID, PLORDERINDEX, PLCATEGORY, PLMETHODID, FILEVERSION, CREATEPER, MODIFYPER, PUBDEPT, PUBDATETIME, "
|
||||
+ " FILESTATE, VIEWCOUNT, L1ID, L2ID, L3ID, LEADPROCESS, REARPROCESS, PROCESSKPI, RELEVANTFILE, SUPPORTFILE, POLICYTYPE, FILEUSESTATE, CREATEDATETIME, MODIFYDATETIME ) "
|
||||
+ " VALUES(:uuId, :FILEID, :PLNAME, :PLLEVEL, :PLPARENTID, :PLORDERINDEX, :PLCATEGORY, :PLMETHODID, "
|
||||
+ " :FILEVERSION, :CREATEPER, :MODIFYPER, :PUBDEPT, :PUBDATETIME, :FILESTATE, :VIEWCOUNT, :L1ID, :L2ID, "
|
||||
+ " :L3ID, :LEADPROCESS, :REARPROCESS, :PROCESSKPI, :RELEVANTFILE, :SUPPORTFILE, :POLICYTYPE, :FILEUSESTATE, :CREATEDATETIME, :MODIFYDATETIME)", newFileDataMaps);
|
||||
}
|
||||
if (null != delFileDataMaps && !delFileDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FILE1 WHERE FILEID=:FILEID", delFileDataMaps);
|
||||
}
|
||||
SDK.getLogAPI().consoleInfo("新增文件" + newFileDataMaps.size());
|
||||
SDK.getLogAPI().consoleInfo("修改文件" + oldFileDataMaps.size());
|
||||
SDK.getLogAPI().consoleInfo("删除文件" + delFileDataMaps.size());
|
||||
|
||||
if (null != nodeIdList && !nodeIdList.isEmpty()) {
|
||||
for (String nodeIdOfList : nodeIdList) {
|
||||
if (!fromNodeDataIDMaps.contains(nodeIdOfList)) {
|
||||
dataMap = new HashMap<>();
|
||||
dataMap.put("NODEID", nodeIdOfList);
|
||||
delNodeDataMaps.add(dataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null != oldNodeDataMaps && !oldNodeDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("UPDATE BO_EU_PAL_FILENODE5 SET"
|
||||
+ " NODENAME=:NODENAME, NODETYPE=:NODETYPE, PLNAME=:PLNAME, NODECATEGORY=:NODECATEGORY, ITSYSVAL=:ITSYSVAL, "
|
||||
+ " ACTIVITYNUMBER=:ACTIVITYNUMBER, ACTIVITYDESC=:ACTIVITYDESC, ROLE=:ROLE, POST=:POST, ROLENAME=:ROLENAME, POSTNAME=:POSTNAME, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE "
|
||||
+ " WHERE PLID=:PLID AND NODEID=:NODEID", oldNodeDataMaps);
|
||||
}
|
||||
if (null != newNodeDataMaps && !newNodeDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FILENODE5"
|
||||
+ " (ID, NODEID, NODENAME, NODETYPE, PLID, PLNAME, NODECATEGORY, ITSYSVAL, ACTIVITYNUMBER, ACTIVITYDESC, ROLE, POST, ROLENAME, POSTNAME, MODIFYDATETIME) "
|
||||
+ " VALUES(:uuId, :NODEID, :NODENAME, :NODETYPE, :PLID, :PLNAME, :NODECATEGORY, :ITSYSVAL, :ACTIVITYNUMBER, :ACTIVITYDESC, :ROLE, :POST, :ROLENAME, :POSTNAME, :MODIFYDATETIME)", newNodeDataMaps);
|
||||
}
|
||||
if (null != delNodeDataMaps && !delNodeDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FILENODE5 WHERE NODEID=:NODEID", delNodeDataMaps);
|
||||
}
|
||||
SDK.getLogAPI().consoleInfo("新增节点" + newNodeDataMaps.size());
|
||||
SDK.getLogAPI().consoleInfo("修改节点" + oldNodeDataMaps.size());
|
||||
SDK.getLogAPI().consoleInfo("删除节点" + delNodeDataMaps.size());
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
SDK.getLogAPI().consoleInfo("结束时间" + endTime);
|
||||
SDK.getLogAPI().consoleInfo("运行时间" + (endTime - startTime));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,246 @@
|
||||
package com.awspaas.user.apps.yili.reportform.job;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.bpms.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;
|
||||
|
||||
/**
|
||||
* @author:lihongyu
|
||||
* @create: 2022-11-03 11:32
|
||||
* @Description: 全量同步文件
|
||||
*/
|
||||
@DisallowConcurrentExecution
|
||||
public class SyncData_job implements IJob {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
syncNodeData();
|
||||
|
||||
}
|
||||
//同步节点数据到 BO_EU_PAL_FILENODE6
|
||||
public void syncNodeData() {
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
ArrayList<String> fromNodeDataIDMaps = new ArrayList<>();
|
||||
List<PALRepositoryModel> palTotalList = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> oldNodeDataMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> newNodeDataMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> delNodeDataMaps = new ArrayList<>();
|
||||
long startTime = System.currentTimeMillis();
|
||||
List<String> nodeIdList = DBSql.getList("SELECT NODEID FROM BO_EU_PAL_FILENODE6", String.class);
|
||||
for (PALRepositoryModel fileModel : palTotalList) {
|
||||
List<Map<String, Object>> nodeElements = new ArrayList<>();
|
||||
String PLMETHODID = fileModel.getMethodId();
|
||||
String FILEID = fileModel.getId();
|
||||
String PLNAME = fileModel.getName();
|
||||
String plRid = fileModel.getPlRid();
|
||||
/*
|
||||
* String sql =
|
||||
* "SELECT ID FROM (SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLRID = '"
|
||||
* +plRid+"' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2"; String
|
||||
* palId = DBSql.getString(sql); if(UtilString.isNotEmpty(palId)) {
|
||||
* if(!FILEID.equals(palId)) {
|
||||
* SDK.getLogAPI().consoleInfo("同步数据发现旧版本文件名称:"+PLNAME+"——文件id:"+FILEID); String
|
||||
* dsql = "DELETE FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+FILEID+"'";
|
||||
* DBSql.update(dsql); continue; } }
|
||||
*/
|
||||
Timestamp MODIFYDATETIME = fileModel.getModifyDate();
|
||||
//同步角色岗位
|
||||
if (null != nodeElements && !nodeElements.isEmpty()) {
|
||||
for (Map<String, Object> nodeElement : nodeElements) {
|
||||
String NODETYPE = String.valueOf(nodeElement.get("type"));
|
||||
if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node") || NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) {
|
||||
//节点信息
|
||||
String NODEID = String.valueOf(nodeElement.get("id"));
|
||||
String NODENAME = String.valueOf(nodeElement.get("name"));
|
||||
//形状属性数组
|
||||
JSONArray attributesArray = JSON.parseArray(String.valueOf(nodeElement.get("attributes")));
|
||||
//形状属性:信息系统、活动序号、活动描述、角色、岗位
|
||||
String ITSYSVAL = "";
|
||||
String ACTIVITYNUMBER = "";
|
||||
String ACTIVITYDESC = "";
|
||||
String ROLE = "";
|
||||
String ROLENAME = "";
|
||||
String POST = "";
|
||||
String POSTNAME = "";
|
||||
if (null != attributesArray && !attributesArray.isEmpty()) {
|
||||
for (Object attribute : attributesArray) {
|
||||
JSONObject attributeJO = JSON.parseObject(String.valueOf(attribute));
|
||||
String SHAPEATTRKEY = attributeJO.getString("key");
|
||||
if (SHAPEATTRKEY.equals("information_systems")) {
|
||||
ITSYSVAL = attributeJO.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY.equals("activity_number")) {
|
||||
ACTIVITYNUMBER = attributeJO.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY.equals("activity_description")) {
|
||||
ACTIVITYDESC = attributeJO.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY.equals("role")) {
|
||||
String nodeRoleText = attributeJO.getString("value");
|
||||
ROLE = nodeRoleText;
|
||||
if (null!=ROLE && !ROLE.equals("")) {
|
||||
Object sqlParams = new Object[]{FILEID};
|
||||
List<RowMap> roleFileRowMaps = new ArrayList<>();
|
||||
try {
|
||||
roleFileRowMaps = DBSql.getMaps("SELECT RELATIONFILEID FROM APP_ACT_COE_PAL_SHAPE_RLAT WHERE FILEID=? AND ATTRID='role'", sqlParams);
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleInfo("获取流程节点角色属性关联文件时"+"文件ID:"+FILEID+"节点ID:"+NODEID+"异常");
|
||||
}
|
||||
if (null!=roleFileRowMaps && !roleFileRowMaps.isEmpty()) {
|
||||
for (RowMap roleFileRowMap : roleFileRowMaps) {
|
||||
String RELATIONFILEID = roleFileRowMap.getString("RELATIONFILEID");
|
||||
//角色文件属性
|
||||
List<Map<String, Object>> roleShapes = new ArrayList<>();
|
||||
try {
|
||||
roleShapes = CoeDesignerUtil.getShapeMessageJson4(RELATIONFILEID);
|
||||
} catch (Exception e) {
|
||||
|
||||
//SDK.getLogAPI().consoleInfo("获取关联角色文件属性"+"文件ID:"+RELATIONFILEID+"异常");
|
||||
}
|
||||
if (null != roleShapes && !roleShapes.isEmpty()) {
|
||||
for (Map<String, Object> roleShape : roleShapes) {
|
||||
String roleFileNodeName = String.valueOf(roleShape.get("name"));
|
||||
if (nodeRoleText.contains(roleFileNodeName)) {
|
||||
//角色节点形状属性
|
||||
JSONArray roleShapeJA = null;
|
||||
try {
|
||||
roleShapeJA = JSONArray.parseArray(String.valueOf(roleShape.get("attributes")));
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleInfo("获取角色节点形状属性jsonArray"+"文件ID:"+RELATIONFILEID+"异常");
|
||||
}
|
||||
if (null != roleShapeJA && !roleShapeJA.isEmpty()) {
|
||||
for (Object roleShapeO : roleShapeJA) {
|
||||
JSONObject roleShapeJO = JSON.parseObject(String.valueOf(roleShapeO));
|
||||
String roleShapeKey = roleShapeJO.getString("key");
|
||||
if (roleShapeKey.equals("post")) {
|
||||
//SDK.getLogAPI().consoleInfo("角色岗位"+roleShapeJO.getString("value"));
|
||||
POST = roleShapeJO.getString("value");
|
||||
}
|
||||
if (roleShapeKey.equals("post_text")) {
|
||||
//SDK.getLogAPI().consoleInfo("角色岗位文本"+roleShapeJO);
|
||||
ROLENAME = roleShapeJO.getString("value");
|
||||
POSTNAME = roleShapeJO.getString("value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Object attribute1 : attributesArray) {
|
||||
JSONObject attributeJO1 = JSON.parseObject(String.valueOf(attribute1));
|
||||
String SHAPEATTRKEY1 = attributeJO1.getString("key");
|
||||
if (SHAPEATTRKEY1.equals("post")) {
|
||||
POST = attributeJO1.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY1.equals("post_text")) {
|
||||
POSTNAME = attributeJO1.getString("value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fromNodeDataIDMaps.add(NODEID);
|
||||
|
||||
if (nodeIdList.contains(NODEID)) {
|
||||
dataMap = new HashMap<>();
|
||||
Date nowDateJ = new Date(System.currentTimeMillis());
|
||||
Timestamp nowDateTime = new Timestamp(nowDateJ.getTime());
|
||||
dataMap.put("UPDATEDATE", nowDateTime);
|
||||
dataMap.put("NODENAME", NODENAME);
|
||||
dataMap.put("NODETYPE", NODETYPE);
|
||||
dataMap.put("PLNAME", PLNAME);
|
||||
dataMap.put("NODECATEGORY", PLMETHODID);
|
||||
dataMap.put("ITSYSVAL", ITSYSVAL);
|
||||
dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER);
|
||||
dataMap.put("ACTIVITYDESC", ACTIVITYDESC);
|
||||
dataMap.put("ROLE", ROLE);
|
||||
dataMap.put("ROLENAME", ROLENAME);
|
||||
dataMap.put("POST", POST);
|
||||
dataMap.put("POSTNAME", POSTNAME);
|
||||
dataMap.put("PLID", FILEID);
|
||||
dataMap.put("NODEID", NODEID);
|
||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||
System.err.println("更新节点信息===========>"+dataMap);
|
||||
oldNodeDataMaps.add(dataMap);
|
||||
} else {
|
||||
dataMap = new HashMap<>();
|
||||
String uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
|
||||
dataMap.put("uuId", uuId);
|
||||
dataMap.put("NODEID", NODEID);
|
||||
dataMap.put("NODENAME", NODENAME);
|
||||
dataMap.put("NODETYPE", NODETYPE);
|
||||
dataMap.put("PLID", FILEID);
|
||||
dataMap.put("PLNAME", PLNAME);
|
||||
dataMap.put("NODECATEGORY", PLMETHODID);
|
||||
dataMap.put("ITSYSVAL", ITSYSVAL);
|
||||
dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER);
|
||||
dataMap.put("ACTIVITYDESC", ACTIVITYDESC);
|
||||
dataMap.put("ROLE", ROLE);
|
||||
dataMap.put("POST", POST);
|
||||
dataMap.put("ROLENAME", ROLENAME);
|
||||
dataMap.put("POSTNAME", POSTNAME);
|
||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||
System.err.println("同步节点信息===========>"+dataMap);
|
||||
newNodeDataMaps.add(dataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (null != nodeIdList && !nodeIdList.isEmpty()) {
|
||||
for (String nodeIdOfList : nodeIdList) {
|
||||
if (!fromNodeDataIDMaps.contains(nodeIdOfList)) {
|
||||
dataMap = new HashMap<>();
|
||||
dataMap.put("NODEID", nodeIdOfList);
|
||||
delNodeDataMaps.add(dataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null != oldNodeDataMaps && !oldNodeDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("UPDATE BO_EU_PAL_FILENODE6 SET"
|
||||
+ " NODENAME=:NODENAME, NODETYPE=:NODETYPE, PLNAME=:PLNAME, NODECATEGORY=:NODECATEGORY, ITSYSVAL=:ITSYSVAL, "
|
||||
+ " ACTIVITYNUMBER=:ACTIVITYNUMBER, ACTIVITYDESC=:ACTIVITYDESC, ROLE=:ROLE, POST=:POST, ROLENAME=:ROLENAME, POSTNAME=:POSTNAME, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE "
|
||||
+ " WHERE PLID=:PLID AND NODEID=:NODEID", oldNodeDataMaps);
|
||||
}
|
||||
if (null != newNodeDataMaps && !newNodeDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FILENODE6"
|
||||
+ " (ID, NODEID, NODENAME, NODETYPE, PLID, PLNAME, NODECATEGORY, ITSYSVAL, ACTIVITYNUMBER, ACTIVITYDESC, ROLE, POST, ROLENAME, POSTNAME, MODIFYDATETIME) "
|
||||
+ " VALUES(:uuId, :NODEID, :NODENAME, :NODETYPE, :PLID, :PLNAME, :NODECATEGORY, :ITSYSVAL, :ACTIVITYNUMBER, :ACTIVITYDESC, :ROLE, :POST, :ROLENAME, :POSTNAME, :MODIFYDATETIME)", newNodeDataMaps);
|
||||
}
|
||||
if (null != delNodeDataMaps && !delNodeDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FILENODE6 WHERE NODEID=:NODEID", delNodeDataMaps);
|
||||
}
|
||||
SDK.getLogAPI().consoleInfo("新增节点" + newNodeDataMaps.size());
|
||||
SDK.getLogAPI().consoleInfo("修改节点" + oldNodeDataMaps.size());
|
||||
SDK.getLogAPI().consoleInfo("删除节点" + delNodeDataMaps.size());
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
SDK.getLogAPI().consoleInfo("结束时间" + endTime);
|
||||
SDK.getLogAPI().consoleInfo("运行时间" + (endTime - startTime));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,312 @@
|
||||
package com.awspaas.user.apps.yili.reportform.job;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.bpms.commons.database.RowMap;
|
||||
import com.actionsoft.bpms.schedule.IJob;
|
||||
import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @author:lihongyu
|
||||
* @create: 2022-11-03 11:32
|
||||
* @Description: 全量同步文件
|
||||
*/
|
||||
@DisallowConcurrentExecution
|
||||
public class SyncData_job2 implements IJob {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
}
|
||||
//同步节点数据到 BO_EU_PAL_FILENODE6
|
||||
public void syncNodeData() {
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
ArrayList<String> fromNodeDataIDMaps = new ArrayList<>();
|
||||
List<PALRepositoryModel> palTotalList = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> oldNodeDataMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> newNodeDataMaps = new ArrayList<>();
|
||||
ArrayList<Map<String, ?>> delNodeDataMaps = new ArrayList<>();
|
||||
long startTime = System.currentTimeMillis();
|
||||
List<String> nodeIdList = DBSql.getList("SELECT NODEID FROM BO_EU_PAL_FILENODE6", String.class);
|
||||
for (PALRepositoryModel fileModel : palTotalList) {
|
||||
List<Map<String, Object>> nodeElements = new ArrayList<>();
|
||||
String PLMETHODID = fileModel.getMethodId();
|
||||
String FILEID = fileModel.getId();
|
||||
String PLNAME = fileModel.getName();
|
||||
String plRid = fileModel.getPlRid();
|
||||
String sql = "SELECT ID FROM (SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLRID = '"+plRid+"' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2";
|
||||
String palId = DBSql.getString(sql);
|
||||
if(UtilString.isNotEmpty(palId)) {
|
||||
if(!FILEID.equals(palId)) {
|
||||
SDK.getLogAPI().consoleInfo("同步数据发现旧版本文件名称:"+PLNAME+"——文件id:"+FILEID);
|
||||
String dsql = "DELETE FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+FILEID+"'";
|
||||
DBSql.update(dsql);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Timestamp MODIFYDATETIME = fileModel.getModifyDate();
|
||||
//同步角色岗位
|
||||
if (null != nodeElements && !nodeElements.isEmpty()) {
|
||||
for (Map<String, Object> nodeElement : nodeElements) {
|
||||
String NODETYPE = String.valueOf(nodeElement.get("type"));
|
||||
if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node") || NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) {
|
||||
//节点信息
|
||||
String NODEID = String.valueOf(nodeElement.get("id"));
|
||||
String NODENAME = String.valueOf(nodeElement.get("name"));
|
||||
//形状属性数组
|
||||
JSONArray attributesArray = JSON.parseArray(String.valueOf(nodeElement.get("attributes")));
|
||||
//形状属性:信息系统、活动序号、活动描述、角色、岗位
|
||||
String ITSYSVAL = "";
|
||||
String ACTIVITYNUMBER = "";
|
||||
String ACTIVITYDESC = "";
|
||||
String ROLE = "";
|
||||
String ROLENAME = "";
|
||||
String POST = "";
|
||||
String POSTNAME = "";
|
||||
if (null != attributesArray && !attributesArray.isEmpty()) {
|
||||
for (Object attribute : attributesArray) {
|
||||
JSONObject attributeJO = JSON.parseObject(String.valueOf(attribute));
|
||||
String SHAPEATTRKEY = attributeJO.getString("key");
|
||||
if (SHAPEATTRKEY.equals("information_systems")) {
|
||||
ITSYSVAL = attributeJO.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY.equals("activity_number")) {
|
||||
ACTIVITYNUMBER = attributeJO.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY.equals("activity_description")) {
|
||||
ACTIVITYDESC = attributeJO.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY.equals("role")) {
|
||||
String nodeRoleText = attributeJO.getString("value");
|
||||
ROLE = nodeRoleText;
|
||||
if (null!=ROLE && !ROLE.equals("")) {
|
||||
Object sqlParams = new Object[]{FILEID};
|
||||
List<RowMap> roleFileRowMaps = new ArrayList<>();
|
||||
try {
|
||||
roleFileRowMaps = DBSql.getMaps("SELECT RELATIONFILEID FROM APP_ACT_COE_PAL_SHAPE_RLAT WHERE FILEID=? AND ATTRID='role'", sqlParams);
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleInfo("获取流程节点角色属性关联文件时"+"文件ID:"+FILEID+"节点ID:"+NODEID+"异常");
|
||||
}
|
||||
if (null!=roleFileRowMaps && !roleFileRowMaps.isEmpty()) {
|
||||
for (RowMap roleFileRowMap : roleFileRowMaps) {
|
||||
String RELATIONFILEID = roleFileRowMap.getString("RELATIONFILEID");
|
||||
//角色文件属性
|
||||
List<Map<String, Object>> roleShapes = new ArrayList<>();
|
||||
try {
|
||||
roleShapes = CoeDesignerUtil.getShapeMessageJson4(RELATIONFILEID);
|
||||
} catch (Exception e) {
|
||||
|
||||
//SDK.getLogAPI().consoleInfo("获取关联角色文件属性"+"文件ID:"+RELATIONFILEID+"异常");
|
||||
}
|
||||
if (null != roleShapes && !roleShapes.isEmpty()) {
|
||||
for (Map<String, Object> roleShape : roleShapes) {
|
||||
String roleFileNodeName = String.valueOf(roleShape.get("name"));
|
||||
if (nodeRoleText.contains(roleFileNodeName)) {
|
||||
//角色节点形状属性
|
||||
JSONArray roleShapeJA = null;
|
||||
try {
|
||||
roleShapeJA = JSONArray.parseArray(String.valueOf(roleShape.get("attributes")));
|
||||
} catch (Exception e) {
|
||||
SDK.getLogAPI().consoleInfo("获取角色节点形状属性jsonArray"+"文件ID:"+RELATIONFILEID+"异常");
|
||||
}
|
||||
if (null != roleShapeJA && !roleShapeJA.isEmpty()) {
|
||||
for (Object roleShapeO : roleShapeJA) {
|
||||
JSONObject roleShapeJO = JSON.parseObject(String.valueOf(roleShapeO));
|
||||
String roleShapeKey = roleShapeJO.getString("key");
|
||||
if (roleShapeKey.equals("post")) {
|
||||
//SDK.getLogAPI().consoleInfo("角色岗位"+roleShapeJO.getString("value"));
|
||||
POST = roleShapeJO.getString("value");
|
||||
}
|
||||
if (roleShapeKey.equals("post_text")) {
|
||||
//SDK.getLogAPI().consoleInfo("角色岗位文本"+roleShapeJO);
|
||||
ROLENAME = roleShapeJO.getString("value");
|
||||
POSTNAME = roleShapeJO.getString("value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Object attribute1 : attributesArray) {
|
||||
JSONObject attributeJO1 = JSON.parseObject(String.valueOf(attribute1));
|
||||
String SHAPEATTRKEY1 = attributeJO1.getString("key");
|
||||
if (SHAPEATTRKEY1.equals("post")) {
|
||||
POST = attributeJO1.getString("value");
|
||||
}
|
||||
if (SHAPEATTRKEY1.equals("post_text")) {
|
||||
POSTNAME = attributeJO1.getString("value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fromNodeDataIDMaps.add(NODEID);
|
||||
|
||||
if (nodeIdList.contains(NODEID)) {
|
||||
dataMap = new HashMap<>();
|
||||
Date nowDateJ = new Date(System.currentTimeMillis());
|
||||
Timestamp nowDateTime = new Timestamp(nowDateJ.getTime());
|
||||
dataMap.put("UPDATEDATE", nowDateTime);
|
||||
dataMap.put("NODENAME", NODENAME);
|
||||
dataMap.put("NODETYPE", NODETYPE);
|
||||
dataMap.put("PLNAME", PLNAME);
|
||||
dataMap.put("NODECATEGORY", PLMETHODID);
|
||||
dataMap.put("ITSYSVAL", ITSYSVAL);
|
||||
dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER);
|
||||
dataMap.put("ACTIVITYDESC", ACTIVITYDESC);
|
||||
dataMap.put("ROLE", ROLE);
|
||||
dataMap.put("ROLENAME", ROLENAME);
|
||||
dataMap.put("POST", POST);
|
||||
dataMap.put("POSTNAME", POSTNAME);
|
||||
dataMap.put("PLID", FILEID);
|
||||
dataMap.put("NODEID", NODEID);
|
||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||
oldNodeDataMaps.add(dataMap);
|
||||
} else {
|
||||
dataMap = new HashMap<>();
|
||||
String uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
|
||||
dataMap.put("uuId", uuId);
|
||||
dataMap.put("NODEID", NODEID);
|
||||
dataMap.put("NODENAME", NODENAME);
|
||||
dataMap.put("NODETYPE", NODETYPE);
|
||||
dataMap.put("PLID", FILEID);
|
||||
dataMap.put("PLNAME", PLNAME);
|
||||
dataMap.put("NODECATEGORY", PLMETHODID);
|
||||
dataMap.put("ITSYSVAL", ITSYSVAL);
|
||||
dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER);
|
||||
dataMap.put("ACTIVITYDESC", ACTIVITYDESC);
|
||||
dataMap.put("ROLE", ROLE);
|
||||
dataMap.put("POST", POST);
|
||||
dataMap.put("ROLENAME", ROLENAME);
|
||||
dataMap.put("POSTNAME", POSTNAME);
|
||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||
newNodeDataMaps.add(dataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (null != nodeIdList && !nodeIdList.isEmpty()) {
|
||||
for (String nodeIdOfList : nodeIdList) {
|
||||
if (!fromNodeDataIDMaps.contains(nodeIdOfList)) {
|
||||
dataMap = new HashMap<>();
|
||||
dataMap.put("NODEID", nodeIdOfList);
|
||||
delNodeDataMaps.add(dataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null != oldNodeDataMaps && !oldNodeDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("UPDATE BO_EU_PAL_FILENODE6 SET"
|
||||
+ " NODENAME=:NODENAME, NODETYPE=:NODETYPE, PLNAME=:PLNAME, NODECATEGORY=:NODECATEGORY, ITSYSVAL=:ITSYSVAL, "
|
||||
+ " ACTIVITYNUMBER=:ACTIVITYNUMBER, ACTIVITYDESC=:ACTIVITYDESC, ROLE=:ROLE, POST=:POST, ROLENAME=:ROLENAME, POSTNAME=:POSTNAME, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE "
|
||||
+ " WHERE PLID=:PLID AND NODEID=:NODEID", oldNodeDataMaps);
|
||||
}
|
||||
if (null != newNodeDataMaps && !newNodeDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FILENODE6"
|
||||
+ " (ID, NODEID, NODENAME, NODETYPE, PLID, PLNAME, NODECATEGORY, ITSYSVAL, ACTIVITYNUMBER, ACTIVITYDESC, ROLE, POST, ROLENAME, POSTNAME, MODIFYDATETIME) "
|
||||
+ " VALUES(:uuId, :NODEID, :NODENAME, :NODETYPE, :PLID, :PLNAME, :NODECATEGORY, :ITSYSVAL, :ACTIVITYNUMBER, :ACTIVITYDESC, :ROLE, :POST, :ROLENAME, :POSTNAME, :MODIFYDATETIME)", newNodeDataMaps);
|
||||
}
|
||||
if (null != delNodeDataMaps && !delNodeDataMaps.isEmpty()) {
|
||||
DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FILENODE6 WHERE NODEID=:NODEID", delNodeDataMaps);
|
||||
}
|
||||
SDK.getLogAPI().consoleInfo("新增节点" + newNodeDataMaps.size());
|
||||
SDK.getLogAPI().consoleInfo("修改节点" + oldNodeDataMaps.size());
|
||||
SDK.getLogAPI().consoleInfo("删除节点" + delNodeDataMaps.size());
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
SDK.getLogAPI().consoleInfo("结束时间" + endTime);
|
||||
SDK.getLogAPI().consoleInfo("运行时间" + (endTime - startTime));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//同步文件数据到 BO_EU_PAL_FILE1
|
||||
public void syncFileData() {
|
||||
String sql = "SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISUSE =1 AND ISSTOP =0 AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')";
|
||||
ArrayList<RowMap> fileHandleRowMaps = new ArrayList<>();
|
||||
for (RowMap rowMap : fileHandleRowMaps) {
|
||||
String plId = rowMap.getString("ID");
|
||||
String plname = rowMap.getString("PLNAME");
|
||||
String plLevel = rowMap.getString("PLLEVEL");
|
||||
String plParentId = rowMap.getString("PLPARENTID");
|
||||
String plOrderIndex = rowMap.getString("PLORDERINDEX");
|
||||
//文件类型(建模方法)
|
||||
String plCategory = rowMap.getString("PLCATEGORY");
|
||||
//制度文件类型
|
||||
String policytype = rowMap.getString("EXT3");
|
||||
//文件版本
|
||||
String string = rowMap.getString("PLVER");
|
||||
//创建人
|
||||
String CREATEUSER = rowMap.getString("CREATEUSER");
|
||||
//最后修改人
|
||||
String MODIFYUSER = rowMap.getString("MODIFYUSER");
|
||||
//创建时间
|
||||
String CREATEDATE = rowMap.getString("CREATEDATE");
|
||||
//最后修改时间
|
||||
String MODIFYDATE = rowMap.getString("MODIFYDATE");
|
||||
|
||||
//发布单位
|
||||
String PUBDEPT = getArrtValue(plId, "Issuing_department","json");
|
||||
//发布时间
|
||||
String PUBDATETIME = getArrtValue(plId, "effective_date","json");
|
||||
//文件状态
|
||||
String FILESTATE = rowMap.getString("ISPUBLISH");
|
||||
//文件生效状态
|
||||
String FILEUSESTATE = rowMap.getString("ISPUBLISH");
|
||||
//查阅次数
|
||||
String VIEWCOUNT = rowMap.getString("VIEWCOUNT");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//获取属性
|
||||
public String getArrtValue(String plId,String ArrtKey,String type) {
|
||||
String arrtValue = "";
|
||||
try {
|
||||
String sql = "select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '"+plId+"' and PROPERTYID = '"+ArrtKey+"'";
|
||||
String relatFileJson = DBSql.getString(sql);
|
||||
if(UtilString.isNotEmpty(relatFileJson)) {
|
||||
|
||||
JSONObject parseObject = JSONObject.parseObject(relatFileJson);
|
||||
String fileNames = parseObject.getString("relationShapeText");
|
||||
if(UtilString.isNotEmpty(fileNames)) {
|
||||
arrtValue = fileNames;
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return arrtValue;
|
||||
|
||||
}
|
||||
|
||||
//同步架构数据到 BO_EU_PAL_FRAME
|
||||
public void syncFrameworkData() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -141,7 +141,7 @@ public class DataViewService extends ActionWeb {
|
||||
}
|
||||
}
|
||||
nodeType = "position";
|
||||
List<Map> deptTreeNodes = TreeUtil.buildTree("0",deptNodes, null, "dept", null, nodeType);
|
||||
List<Map> deptTreeNodes = TreeUtil.buildTree("0", deptNodes, null, "dept", null, nodeType);
|
||||
ro.put("positionTree", deptTreeNodes);
|
||||
return ro.toString();
|
||||
}
|
||||
@ -195,8 +195,11 @@ public class DataViewService extends ActionWeb {
|
||||
Integer aNum = 0;
|
||||
Integer bNum = 0;
|
||||
Object[] sqlParams = new Object[] {};
|
||||
//List<RowMap> fileRowMaps = DBSql.getMaps("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC");
|
||||
List<RowMap> fileRowMaps = DBSql.getMaps("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER BY PLLEVEL ASC, PLORDERINDEX ASC");
|
||||
// List<RowMap> fileRowMaps = DBSql.getMaps("SELECT
|
||||
// FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI
|
||||
// FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER
|
||||
// BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC");
|
||||
//List<RowMap> fileRowMaps1 = DBSql.getMaps("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER BY PLLEVEL ASC, PLORDERINDEX ASC");
|
||||
// AND FILESTATE='1' ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX)
|
||||
// ASC
|
||||
if (null != positionIDs && !positionIDs.isEmpty()) {
|
||||
@ -220,14 +223,12 @@ public class DataViewService extends ActionWeb {
|
||||
POSITION_NAME = POSITIONMap.getString("POSITION_NAME");
|
||||
positionNameList.add(POSITION_NAME);
|
||||
}
|
||||
}
|
||||
if (null != fileRowMaps && !fileRowMaps.isEmpty()) {
|
||||
for (RowMap fileRowMap : fileRowMaps) {
|
||||
String FILEID = fileRowMap.getString("FILEID");
|
||||
} long start = System.currentTimeMillis();
|
||||
if (null != nodeRowMaps && !nodeRowMaps.isEmpty()) {
|
||||
for (RowMap nodeRowMap : nodeRowMaps) {
|
||||
String PLID = nodeRowMap.getString("PLID");
|
||||
if (FILEID.equals(PLID)) {
|
||||
RowMap fileRowMap = DBSql.getMap("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+PLID+"'");
|
||||
if(fileRowMap!=null) {
|
||||
for (String positionName : positionNameList) {
|
||||
// if (nodeRowMap.getString("ROLE").equals(positionID) ||
|
||||
// nodeRowMap.getString("POST").equals(positionID)) {
|
||||
@ -279,13 +280,22 @@ public class DataViewService extends ActionWeb {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
System.err.println("个人视图(岗位流程)查询用时=========>"+(end-start)/1000+"秒");
|
||||
UoPProcessMaps = UoPProcessMaps.stream()
|
||||
.collect(collectingAndThen(
|
||||
toCollection(() -> new TreeSet<>(Comparator.comparing(o -> String.valueOf(o.get("id"))))),
|
||||
ArrayList::new));
|
||||
tempMaps = new ArrayList<Map>();
|
||||
if (nodeMaps.size() == 0) {
|
||||
ro.put("rootId", "");
|
||||
UoPProcessMaps = new ArrayList<Map>();
|
||||
ro.put("nodes", UoPProcessMaps);
|
||||
linksMaps = new LinkedList<Map>();
|
||||
ro.put("links", linksMaps);
|
||||
ro.info("您所查询的岗位暂无需执行的流程");
|
||||
|
||||
} else {
|
||||
for (Map uoPProcessMap : UoPProcessMaps) {
|
||||
reRegulationMaps = new ArrayList<>();
|
||||
reFormMaps = new ArrayList<>();
|
||||
@ -318,8 +328,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -335,8 +346,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -353,8 +365,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -386,8 +399,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -403,8 +417,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -421,8 +436,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -449,8 +465,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + PROCESSKPIID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + PROCESSKPIID + "&" + "sid=" + sid + "&" + "taskId="
|
||||
+ taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -534,6 +551,7 @@ public class DataViewService extends ActionWeb {
|
||||
ro.put("links", linksMaps);
|
||||
ro.info("您所查询的岗位暂无需执行的流程");
|
||||
|
||||
}
|
||||
}
|
||||
nodeAMaps = new ArrayList<>();
|
||||
nodeBMaps = new ArrayList<>();
|
||||
@ -559,7 +577,11 @@ public class DataViewService extends ActionWeb {
|
||||
ro.put("typeA", nodeAMaps);
|
||||
ro.put("typeBNum", bNum);
|
||||
ro.put("typeB", nodeBMaps);
|
||||
|
||||
|
||||
// 岗位流程/我的流程
|
||||
} else {
|
||||
int count = 0;
|
||||
UoPProcessMaps = new ArrayList<Map>();
|
||||
nodeMaps = new ArrayList<Map>();
|
||||
linksMaps = new LinkedList<Map>();
|
||||
@ -569,21 +591,16 @@ public class DataViewService extends ActionWeb {
|
||||
UoPProcessMap.put("text", "我的流程");
|
||||
UoPProcessMap.put("fileType", "UoPProcess");
|
||||
UoPProcessMaps.add(UoPProcessMap);
|
||||
long start = System.currentTimeMillis();
|
||||
List<RowMap> nodeRowMaps = DBSql.getMaps(
|
||||
"SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE5");
|
||||
String positionID = UserContext.fromUID(uid).getUserModel().getPositionNo();
|
||||
String POSITION_NAME = null;
|
||||
if (null != positionID && !positionID.equals("")) {
|
||||
sqlParams = new Object[] { positionID };
|
||||
RowMap POSITIONMap = DBSql.getMap("SELECT POSITION_NAME FROM ORGUSER WHERE POSITION_NO=?", sqlParams);
|
||||
if (null != POSITIONMap && !POSITIONMap.isEmpty()) {
|
||||
POSITION_NAME = POSITIONMap.getString("POSITION_NAME");
|
||||
if (null != fileRowMaps && !fileRowMaps.isEmpty()) {
|
||||
for (RowMap fileRowMap : fileRowMaps) {
|
||||
String FILEID = fileRowMap.getString("FILEID");
|
||||
String POSITION_NAME = UserContext.fromUID(uid).getUserModel().getPositionName();
|
||||
if (UtilString.isNotEmpty(POSITION_NAME)) {
|
||||
for (RowMap nodeRowMap : nodeRowMaps) {
|
||||
String PLID = nodeRowMap.getString("PLID");
|
||||
if (FILEID.equals(PLID)) {
|
||||
RowMap fileRowMap = DBSql.getMap("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+PLID+"'");
|
||||
count++;
|
||||
if(fileRowMap!=null) {
|
||||
if (nodeRowMap.getString("POST").contains(POSITION_NAME)) {
|
||||
// if (nodeRowMap.getString("ROLE").equals(positionID) ||
|
||||
// nodeRowMap.getString("POST").equals(positionID)) {
|
||||
@ -610,7 +627,7 @@ public class DataViewService extends ActionWeb {
|
||||
|
||||
UoPProcessMap = new HashMap<String, Object>();
|
||||
fileType = "process";
|
||||
model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID"));
|
||||
model = PALRepositoryCache.getCache().get(PLID);
|
||||
if (null != model) {
|
||||
if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
@ -618,9 +635,9 @@ public class DataViewService extends ActionWeb {
|
||||
}
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + fileRowMap.getString("FILEID") + "&" + "sid=" + sid + "&"
|
||||
+ "uuid=" + PLID + "&" + "sid=" + sid + "&"
|
||||
+ "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", fileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("id", PLID);
|
||||
UoPProcessMap.put("text", fileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
UoPProcessMap.put("RELEVANTFILE", fileRowMap.getString("RELEVANTFILE"));
|
||||
@ -630,19 +647,31 @@ public class DataViewService extends ActionWeb {
|
||||
UoPProcessMap.put("PARENTID", rootuuId);
|
||||
UoPProcessMaps.add(UoPProcessMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
}else {
|
||||
ro.info("当前用户未设置岗位");
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
System.err.println("个人视图(我的流程)查询用时=========>"+(end-start)/1000+"秒");
|
||||
UoPProcessMaps = UoPProcessMaps.stream()
|
||||
.collect(collectingAndThen(
|
||||
toCollection(() -> new TreeSet<>(Comparator.comparing(o -> String.valueOf(o.get("id"))))),
|
||||
ArrayList::new));
|
||||
tempMaps = new ArrayList<Map>();
|
||||
|
||||
if (nodeMaps.size() == 0) {
|
||||
ro.put("rootId", "");
|
||||
UoPProcessMaps = new ArrayList<Map>();
|
||||
ro.put("nodes", UoPProcessMaps);
|
||||
linksMaps = new LinkedList<Map>();
|
||||
ro.put("links", linksMaps);
|
||||
ro.info("您的岗位暂无需执行的流程");
|
||||
} else {
|
||||
for (Map uoPProcessMap : UoPProcessMaps) {
|
||||
reRegulationMaps = new ArrayList<>();
|
||||
reFormMaps = new ArrayList<>();
|
||||
@ -675,8 +704,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -692,8 +722,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -710,8 +741,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -743,8 +775,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -760,8 +793,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -778,8 +812,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?"
|
||||
+ "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -806,8 +841,9 @@ public class DataViewService extends ActionWeb {
|
||||
taskId = getLastPublishTaskIdByModelId(model.getId());
|
||||
}
|
||||
}
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
|
||||
+ "uuid=" + PROCESSKPIID + "&" + "sid=" + sid + "&" + "taskId=" + taskId;
|
||||
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open"
|
||||
+ "&" + "uuid=" + PROCESSKPIID + "&" + "sid=" + sid + "&" + "taskId="
|
||||
+ taskId;
|
||||
UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID"));
|
||||
UoPProcessMap.put("text", refileRowMap.getString("PLNAME"));
|
||||
UoPProcessMap.put("path", path);
|
||||
@ -861,7 +897,7 @@ public class DataViewService extends ActionWeb {
|
||||
tempMaps.addAll(reYSMaps);
|
||||
}
|
||||
}
|
||||
//所有数据
|
||||
// 所有数据
|
||||
UoPProcessMaps.addAll(tempMaps);
|
||||
if (UoPProcessMaps.size() > 1) {
|
||||
for (Map uoPProcessMap : UoPProcessMaps) {
|
||||
@ -890,7 +926,8 @@ public class DataViewService extends ActionWeb {
|
||||
ro.put("nodes", UoPProcessMaps);
|
||||
linksMaps = new LinkedList<Map>();
|
||||
ro.put("links", linksMaps);
|
||||
ro.info("您所在的岗位暂无需执行的流程");
|
||||
ro.info("您的岗位暂无需执行的流程");
|
||||
}
|
||||
}
|
||||
nodeAMaps = new ArrayList<>();
|
||||
nodeBMaps = new ArrayList<>();
|
||||
@ -916,6 +953,7 @@ public class DataViewService extends ActionWeb {
|
||||
ro.put("typeA", nodeAMaps);
|
||||
ro.put("typeBNum", bNum);
|
||||
ro.put("typeB", nodeBMaps);
|
||||
|
||||
}
|
||||
return ro.toString();
|
||||
}
|
||||
@ -971,7 +1009,7 @@ public class DataViewService extends ActionWeb {
|
||||
deptNode.put("nodeType", nodeType);
|
||||
deptNodes.add(deptNode);
|
||||
}
|
||||
List<Map> deptTreeNodes = TreeUtil.buildTree("0",deptNodes, "0", "dept", "3", null);
|
||||
List<Map> deptTreeNodes = TreeUtil.buildTree("0", deptNodes, "0", "dept", "3", null);
|
||||
ro.put("deptTree", deptTreeNodes);
|
||||
// 文件类型查询
|
||||
HashMap<String, Object> fileType = new HashMap<>();
|
||||
@ -1018,7 +1056,7 @@ public class DataViewService extends ActionWeb {
|
||||
String deptString = params.get("dept");
|
||||
String fileType = params.get("fileType");
|
||||
ArrayList<String> deptIDList = new ArrayList<>();
|
||||
String sql = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')";
|
||||
String sql = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')";
|
||||
ArrayList<RowMap> fileHandleRowMaps = new ArrayList<>();
|
||||
Map<String, Object> reFileMap = new HashMap<>();
|
||||
RowMap reFileRowMap = new RowMap(reFileMap);
|
||||
@ -1040,27 +1078,30 @@ public class DataViewService extends ActionWeb {
|
||||
deptString = deptIDList.toString();
|
||||
}
|
||||
}
|
||||
System.err.println("=====查询部门视图======"+fileListMap.size());
|
||||
System.err.println("查询部门视图===>" + fileListMap.size());
|
||||
for (RowMap rowMap : fileListMap) {
|
||||
|
||||
String id = rowMap.getString("FILEID");
|
||||
|
||||
/*
|
||||
* String plVersionId = rowMap.getString("PLVERSIONID"); String sqly
|
||||
* ="SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '"
|
||||
* +plVersionId+"'"; List<RowMap> maps = DBSql.getMaps(sql); if(maps.size()>1) {
|
||||
* String sqlu =
|
||||
* String plVersionId = rowMap.getString("PLVERSIONID"); String sqly =
|
||||
* "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" +
|
||||
* plVersionId + "'"; List<RowMap> maps = DBSql.getMaps(sqly); if (maps.size() >
|
||||
* 1) { String sqlu =
|
||||
* "SELECT ID FROM (SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '"
|
||||
* +plVersionId+"' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2";
|
||||
* String palId = DBSql.getString(sqlu); if(UtilString.isNotEmpty(palId)) {
|
||||
* if(!id.equals(palId)) { continue; } } }
|
||||
* + plVersionId + "' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2";
|
||||
* String palId = DBSql.getString(sqlu); if (UtilString.isNotEmpty(palId)) { if
|
||||
* (!id.equals(palId)) { continue; } } }
|
||||
*/
|
||||
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(id);
|
||||
if(model!=null) {
|
||||
if (model != null) {
|
||||
try {
|
||||
Integer PLLEVEL = model.getLevel();
|
||||
String methodId = model.getMethodId();
|
||||
|
||||
Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(model.getId());
|
||||
Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute()
|
||||
.queryRepositoryAttributeById(model.getId());
|
||||
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
|
||||
// 发布部门
|
||||
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
|
||||
@ -1073,7 +1114,8 @@ public class DataViewService extends ActionWeb {
|
||||
if (deptString.contains(dempId)) {
|
||||
// 默认添加所在部门的所有文件
|
||||
fileHandleRowMaps.add(rowMap);
|
||||
if ("process.epc".equals(methodId) || "process.flowchart".equals(methodId)) {
|
||||
if ("process.epc".equals(methodId)
|
||||
|| "process.flowchart".equals(methodId)) {
|
||||
// 支持文件
|
||||
getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap,
|
||||
fileHandleRowMaps);
|
||||
@ -1097,7 +1139,7 @@ public class DataViewService extends ActionWeb {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
System.err.println("==有问题的模型===>"+model.getName());
|
||||
System.err.println("==有问题的模型===>" + model.getName());
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
@ -1109,12 +1151,12 @@ public class DataViewService extends ActionWeb {
|
||||
// System.err.println("------测试1---------" + fileHandleRowMaps);
|
||||
// System.err.println("------测试2---------" + fileRowMaps);
|
||||
// System.out.println("代码段执行时间:" + (endTime - startTime) + "ms");
|
||||
//System.err.println("=========fileRowMaps1========>"+fileRowMaps);
|
||||
//System.err.println("=========fileType========>"+fileType);
|
||||
// System.err.println("=========fileRowMaps1========>"+fileRowMaps);
|
||||
// System.err.println("=========fileType========>"+fileType);
|
||||
if (null != fileRowMaps && fileRowMaps.size() > 0) {
|
||||
if (null != fileType && !fileType.equals("")) {
|
||||
fileHandleRowMaps = new ArrayList<>();
|
||||
//System.err.println("=====fileRowMaps2========"+fileRowMaps);
|
||||
// System.err.println("=====fileRowMaps2========"+fileRowMaps);
|
||||
if (null != fileRowMaps && !fileRowMaps.isEmpty()) {
|
||||
for (RowMap fileRowMap : fileRowMaps) {
|
||||
if (fileType.equals("processFile")) {
|
||||
@ -1166,12 +1208,12 @@ public class DataViewService extends ActionWeb {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//System.err.println("====执行2====" + fileHandleRowMaps);
|
||||
// System.err.println("====执行2====" + fileHandleRowMaps);
|
||||
// getind(dempId, fileType, fileRowMaps, fileHandleRowMaps, reFileMap,
|
||||
// reFileRowMap);
|
||||
}
|
||||
fileRowMaps = fileHandleRowMaps;
|
||||
//System.err.println("=======fileRowMaps========="+fileRowMaps);
|
||||
// System.err.println("=======fileRowMaps========="+fileRowMaps);
|
||||
// 遍历选择的结果
|
||||
List<Map> fileMaps = new ArrayList<>();
|
||||
List<RowMap> frameRowMaps = new ArrayList<>();
|
||||
@ -1222,7 +1264,7 @@ public class DataViewService extends ActionWeb {
|
||||
frameMap.put("nodeType", nodeType);
|
||||
fileMaps.add(frameMap);
|
||||
}
|
||||
//System.err.println("=====fileRowMaps1=====>" + fileRowMaps);
|
||||
// System.err.println("=====fileRowMaps1=====>" + fileRowMaps);
|
||||
|
||||
for (RowMap fileRowMap : fileRowMaps) {
|
||||
fileMap = new HashMap<String, Object>();
|
||||
@ -1260,14 +1302,15 @@ public class DataViewService extends ActionWeb {
|
||||
fileMap.put("PUBDATETIME", fileRowMap.getString("PUBDATETIME"));
|
||||
fileMap.put("path", path);
|
||||
fileMap.put("ORDERINDEX", fileRowMap.getString("PLORDERINDEX"));
|
||||
String sqlsss = "SELECT PLLEVEL FROM APP_ACT_COE_PAL_REPOSITORY_1124 WHERE ID = '"+fileRowMap.getString("FILEID")+"'";
|
||||
String sqlsss = "SELECT PLLEVEL FROM APP_ACT_COE_PAL_REPOSITORY_1124 WHERE ID = '"
|
||||
+ fileRowMap.getString("FILEID") + "'";
|
||||
String leve = DBSql.getString(sqlsss);
|
||||
fileMap.put("TLEVEL",leve);
|
||||
fileMap.put("TLEVEL", leve);
|
||||
fileMap.put("nodeType", nodeType);
|
||||
fileMaps.add(fileMap);
|
||||
}
|
||||
//System.err.println("=====fileMaps=====>" + fileMaps);
|
||||
List<Map> fileTreeNodes = TreeUtil.buildTree("0",fileMaps, "process", "frame", null, null);
|
||||
// System.err.println("=====fileMaps=====>" + fileMaps);
|
||||
List<Map> fileTreeNodes = TreeUtil.buildTree("0", fileMaps, "process", "frame", null, null);
|
||||
filesCount = new LinkedHashMap<>();
|
||||
filesCount.put("processFileNum", processFileNum);
|
||||
filesCount.put("policyFileNum", policyFileNum);
|
||||
@ -1297,8 +1340,10 @@ public class DataViewService extends ActionWeb {
|
||||
return ro.toString();
|
||||
|
||||
}
|
||||
//查询所有文件
|
||||
public void getind(String dempId,String fileType,List<RowMap> fileRowMaps,ArrayList<RowMap> fileHandleRowMaps,Map<String, Object> reFileMap,RowMap reFileRowMap) {
|
||||
|
||||
// 查询所有文件
|
||||
public void getind(String dempId, String fileType, List<RowMap> fileRowMaps, ArrayList<RowMap> fileHandleRowMaps,
|
||||
Map<String, Object> reFileMap, RowMap reFileRowMap) {
|
||||
fileHandleRowMaps = new ArrayList<>();
|
||||
if (null != fileRowMaps && !fileRowMaps.isEmpty()) {
|
||||
for (RowMap fileRowMap : fileRowMaps) {
|
||||
@ -1388,17 +1433,18 @@ public class DataViewService extends ActionWeb {
|
||||
}
|
||||
}
|
||||
|
||||
public void getArrt(String name,PALRepositoryModel model,String dempId,Integer PLLEVEL,RowMap reFileRowMap,ArrayList<RowMap> fileHandleRowMaps) {
|
||||
public void getArrt(String name, PALRepositoryModel model, String dempId, Integer PLLEVEL, RowMap reFileRowMap,
|
||||
ArrayList<RowMap> fileHandleRowMaps) {
|
||||
// 支持相关文件
|
||||
List<DesignerShapeRelationModel> support_filesList = DesignerShapeRelationCache
|
||||
.getListByAttrId(model.getId(), "",name);
|
||||
List<DesignerShapeRelationModel> support_filesList = DesignerShapeRelationCache.getListByAttrId(model.getId(),
|
||||
"", name);
|
||||
for (DesignerShapeRelationModel support : support_filesList) {
|
||||
String supportFileId = support.getRelationFileId();// 支持或相关文件的ID
|
||||
PALRepositoryModel reFileModel = PALRepositoryCache.getCache().get(supportFileId);
|
||||
if (reFileModel != null) {
|
||||
String PLMETHODID = reFileModel.getMethodId();
|
||||
if (PLMETHODID.equals("data.form")) {
|
||||
HashMap<String,Object> reFileMap = new HashMap<>();
|
||||
HashMap<String, Object> reFileMap = new HashMap<>();
|
||||
reFileMap.put("FILEID", supportFileId);
|
||||
reFileMap.put("PLNAME", reFileModel.getName());
|
||||
reFileMap.put("PLPARENTID", model.getId());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -539,9 +539,11 @@ public class FileManagementService extends ActionWeb {
|
||||
* @date: 2022/6/28 22:53
|
||||
*/
|
||||
public String deptFileYearRenewSituation(UserContext uc, RequestParams params) {
|
||||
/* 1)新增数=某单位年度新增文件
|
||||
2)修订数=某单位年度修订文件
|
||||
3)废止数=某单位年度废止文件 */
|
||||
/*
|
||||
* 1)新增数=某单位年度新增文件 一个版本是新增
|
||||
* 2)修订数=某单位年度修订文件 大于一个版本是修订
|
||||
* 3)废止数=某单位年度废止文件 停用
|
||||
*/
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
HashMap<String, Object> renewCountMap = new HashMap<>();
|
||||
ArrayList<Map> BDRenewCountMaps = new ArrayList<>();
|
||||
@ -551,14 +553,17 @@ public class FileManagementService extends ActionWeb {
|
||||
Integer updateCount = 0;
|
||||
Integer abolishCount = 0;
|
||||
ArrayList<String> deptIDList = new ArrayList<>();
|
||||
//获取当前年
|
||||
// 获取当前年
|
||||
LocalDateTime nowDate = LocalDateTime.now();
|
||||
int nowYear = nowDate.getYear();
|
||||
//事业部和职能部门ID,名称 list
|
||||
List<RowMap> fileRowMaps = DBSql.getMaps("SELECT FILEID,FILEVERSION,PUBDEPT,PUBDATETIME,FILESTATE FROM BO_EU_PAL_FILE1");
|
||||
List<RowMap> BDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'");
|
||||
List<RowMap> FDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'");
|
||||
if (null!=BDInfoMaps && !BDInfoMaps.isEmpty()) {
|
||||
// 事业部和职能部门ID,名称 list
|
||||
List<RowMap> fileRowMaps = DBSql
|
||||
.getMaps("SELECT FILEID,FILEVERSION,PUBDEPT,PUBDATETIME,FILESTATE FROM BO_EU_PAL_FILE1");
|
||||
List<RowMap> BDInfoMaps = DBSql.getMaps(
|
||||
"SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'");
|
||||
List<RowMap> FDInfoMaps = DBSql.getMaps(
|
||||
"SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'");
|
||||
if (null != BDInfoMaps && !BDInfoMaps.isEmpty()) {
|
||||
for (RowMap bdInfoMap : BDInfoMaps) {
|
||||
renewCountMap = new HashMap<String, Object>();
|
||||
createCount = 0;
|
||||
@ -569,7 +574,7 @@ public class FileManagementService extends ActionWeb {
|
||||
try {
|
||||
|
||||
deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList);
|
||||
if (null!=deptIDList && !deptIDList.isEmpty()) {
|
||||
if (null != deptIDList && !deptIDList.isEmpty()) {
|
||||
for (String deptID : deptIDList) {
|
||||
for (RowMap fileRowMap : fileRowMaps) {
|
||||
if (fileRowMap.getString("PUBDEPT").contains(deptID)) {
|
||||
@ -590,17 +595,23 @@ public class FileManagementService extends ActionWeb {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); String
|
||||
* pubdatetimeString= sdf.format(PUBDATETIME); LocalDate pubDate =
|
||||
* LocalDate.parse(pubdatetimeString,
|
||||
* DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
*
|
||||
* if (pubDate.getYear()==nowYear) { if (FILESTATE.equals("1") &&
|
||||
* FILEVERSION.equals("1.0")) { createCount += 1; } if (FILESTATE.equals("1") &&
|
||||
* !FILEVERSION.equals("1.0")) { updateCount += 1; } if (FILESTATE.equals("3"))
|
||||
* { abolishCount += 1; } }
|
||||
*/
|
||||
Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME");
|
||||
String pubdatetimeString = sdf.format(PUBDATETIME);
|
||||
LocalDate pubDate = LocalDate.parse(pubdatetimeString,
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
|
||||
if (pubDate.getYear() == nowYear) {
|
||||
if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) {
|
||||
createCount += 1;
|
||||
}
|
||||
if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) {
|
||||
updateCount += 1;
|
||||
}
|
||||
if (FILESTATE.equals("3")) {
|
||||
abolishCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -608,15 +619,15 @@ public class FileManagementService extends ActionWeb {
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
renewCountMap.put("deptID",bdDeptID);
|
||||
renewCountMap.put("deptName",bdInfoMap.getString("ABBREVIATION"));
|
||||
renewCountMap.put("createCount",createCount);
|
||||
renewCountMap.put("updateCount",updateCount);
|
||||
renewCountMap.put("abolishCount",abolishCount);
|
||||
renewCountMap.put("deptID", bdDeptID);
|
||||
renewCountMap.put("deptName", bdInfoMap.getString("ABBREVIATION"));
|
||||
renewCountMap.put("createCount", createCount);
|
||||
renewCountMap.put("updateCount", updateCount);
|
||||
renewCountMap.put("abolishCount", abolishCount);
|
||||
BDRenewCountMaps.add(renewCountMap);
|
||||
}
|
||||
}
|
||||
if (null!=FDInfoMaps && !FDInfoMaps.isEmpty()) {
|
||||
if (null != FDInfoMaps && !FDInfoMaps.isEmpty()) {
|
||||
for (RowMap fdInfoMap : FDInfoMaps) {
|
||||
renewCountMap = new HashMap<String, Object>();
|
||||
createCount = 0;
|
||||
@ -626,7 +637,7 @@ public class FileManagementService extends ActionWeb {
|
||||
deptIDList = new ArrayList<String>();
|
||||
try {
|
||||
deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList);
|
||||
if (null!=deptIDList && !deptIDList.isEmpty()) {
|
||||
if (null != deptIDList && !deptIDList.isEmpty()) {
|
||||
for (String deptID : deptIDList) {
|
||||
for (RowMap fileRowMap : fileRowMaps) {
|
||||
if (fileRowMap.getString("PUBDEPT").contains(deptID)) {
|
||||
@ -653,16 +664,16 @@ public class FileManagementService extends ActionWeb {
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
renewCountMap.put("deptID",fdDeptID);
|
||||
renewCountMap.put("deptName",fdInfoMap.getString("ABBREVIATION"));
|
||||
renewCountMap.put("createCount",createCount);
|
||||
renewCountMap.put("updateCount",updateCount);
|
||||
renewCountMap.put("abolishCount",abolishCount);
|
||||
renewCountMap.put("deptID", fdDeptID);
|
||||
renewCountMap.put("deptName", fdInfoMap.getString("ABBREVIATION"));
|
||||
renewCountMap.put("createCount", createCount);
|
||||
renewCountMap.put("updateCount", updateCount);
|
||||
renewCountMap.put("abolishCount", abolishCount);
|
||||
FDRenewCountMaps.add(renewCountMap);
|
||||
}
|
||||
}
|
||||
ro.put("BDRenewCount",BDRenewCountMaps);
|
||||
ro.put("FDRenewCount",FDRenewCountMaps);
|
||||
ro.put("BDRenewCount", BDRenewCountMaps);
|
||||
ro.put("FDRenewCount", FDRenewCountMaps);
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,213 @@
|
||||
package com.awspaas.user.apps.yili.reportform.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import cn.jpush.api.utils.StringUtils;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.JwtBuilder;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
|
||||
/**
|
||||
* @author neil
|
||||
* @date 2022/10/08
|
||||
*/
|
||||
public class JwtUtils {
|
||||
// JWT 密钥
|
||||
private static String secretKey="8944878877848fg)";
|
||||
//刷新token的过期时间
|
||||
private static Duration accessTokenExpireTime=Duration.parse("PT24H");
|
||||
//private static Duration accessTokenExpireTime=Duration.parse("PT60S");
|
||||
//刷新tokenPC端是8小时
|
||||
private static Duration refreshTokenExpireTime=Duration.parse("PT8H") ;
|
||||
//刷新tokenAPP端是一个月
|
||||
private static Duration refreshTokenExpireAppTime=Duration.parse("P30D") ;
|
||||
//签发人
|
||||
private static String issuer="ws";
|
||||
|
||||
/**
|
||||
* 生成 access_token
|
||||
*/
|
||||
public static String getAccessToken(String subject, Map<String,Object> claims){
|
||||
return generateToken(issuer,subject,claims,accessTokenExpireTime.toMillis(),secretKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 签发token
|
||||
*/
|
||||
public static String generateToken(String issuer, String subject, Map<String, Object> claims, long ttlMillis, String secret) {
|
||||
|
||||
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
|
||||
|
||||
long nowMillis = System.currentTimeMillis();
|
||||
Date now = new Date(nowMillis);
|
||||
|
||||
byte[] signingKey = DatatypeConverter.parseBase64Binary(secret);
|
||||
|
||||
JwtBuilder builder = Jwts.builder();
|
||||
if(null!=claims){
|
||||
builder.setClaims(claims);
|
||||
}
|
||||
if (!StringUtils.isEmpty(subject)) {
|
||||
builder.setSubject(subject);
|
||||
}
|
||||
if (!StringUtils.isEmpty(issuer)) {
|
||||
builder.setIssuer(issuer);
|
||||
}
|
||||
builder.setIssuedAt(now);
|
||||
if (ttlMillis >= 0) {
|
||||
long expMillis = nowMillis + ttlMillis;
|
||||
Date exp = new Date(expMillis);
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String format = simpleDateFormat.format(exp);
|
||||
System.out.println(format);
|
||||
builder.setExpiration(exp);
|
||||
}
|
||||
builder.signWith(signatureAlgorithm, signingKey);
|
||||
return builder.compact();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 上面我们已经有生成 access_token 的方法,下面加入生成 refresh_token 的方法(PC 端过期时间短一些)
|
||||
*/
|
||||
|
||||
/**
|
||||
* 生成 PC 刷新token
|
||||
*/
|
||||
public static String getRefreshToken(String subject,Map<String,Object> claims){
|
||||
return generateToken(issuer,subject,claims,refreshTokenExpireTime.toMillis(),secretKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 App端 刷新token
|
||||
*/
|
||||
public static String getRefreshAppToken(String subject,Map<String,Object> claims){
|
||||
return generateToken(issuer,subject,claims,refreshTokenExpireAppTime.toMillis(),secretKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从令牌中获取数据声明
|
||||
*/
|
||||
public static Claims getClaimsFromToken(String token) {
|
||||
Claims claims;
|
||||
try {
|
||||
claims = Jwts.parser().setSigningKey(DatatypeConverter.parseBase64Binary(secretKey)).parseClaimsJws(token).getBody();
|
||||
} catch (Exception e) {
|
||||
claims = null;
|
||||
//FineLoggerFactory.getLogger().error ("jwt从令牌中获取数据声明={}",e);
|
||||
}
|
||||
return claims;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户id
|
||||
*/
|
||||
public static String getUserId(String token){
|
||||
String userId=null;
|
||||
try {
|
||||
Claims claims = getClaimsFromToken(token);
|
||||
userId = claims.getSubject();
|
||||
} catch (Exception e) {
|
||||
//FineLoggerFactory.getLogger().error ("jwt获取用户id抛出的异常={}",e);
|
||||
}
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户名
|
||||
*/
|
||||
public static String getUserName(String token){
|
||||
String username = null;
|
||||
try {
|
||||
Claims claims = getClaimsFromToken(token);
|
||||
username = (String) claims .get("userName");
|
||||
} catch (Exception e) {
|
||||
//FineLoggerFactory.getLogger().error ("jwt获取获取用户名抛出的异常={}",e);
|
||||
}
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证token 是否过期
|
||||
*/
|
||||
public static Boolean isTokenExpired(String token) {
|
||||
try {
|
||||
//使用密钥解析
|
||||
Claims claims = getClaimsFromToken(token);
|
||||
//拿到过期时间
|
||||
Date expiration = claims.getExpiration();
|
||||
//与当前时间进行比较
|
||||
return expiration.before(new Date());
|
||||
} catch (Exception e) {
|
||||
System.out.println("验证token是否过期时候抛出的异常"+e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验令牌
|
||||
*/
|
||||
public static Boolean validateToken(String token) {
|
||||
//通过getClaimsFromToken解析传入的token
|
||||
Claims claimsFromToken = getClaimsFromToken(token);
|
||||
//校验是否为空,判断是否过期
|
||||
return (claimsFromToken!=null && !isTokenExpired(token));
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
public static String refreshToken(String refreshToken,Map<String, Object> claims) {
|
||||
String refreshedToken;
|
||||
try {
|
||||
//通过getClaimsFromToken解析传入的token
|
||||
Claims parserclaims = getClaimsFromToken(refreshToken);
|
||||
/**
|
||||
* 刷新token的时候如果为空说明原先的 用户信息不变 所以就引用上个token里的内容
|
||||
*/
|
||||
if(null==claims){
|
||||
claims=parserclaims;
|
||||
}
|
||||
refreshedToken = generateToken(parserclaims.getIssuer(),parserclaims.getSubject(),claims,accessTokenExpireTime.toMillis(),secretKey);
|
||||
} catch (Exception e) {
|
||||
refreshedToken = null;
|
||||
System.out.println("刷新token时候抛出异常="+e);
|
||||
}
|
||||
return refreshedToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取token的剩余过期时间
|
||||
*/
|
||||
public static long getRemainingTime(String token){
|
||||
long result=0;
|
||||
try {
|
||||
long nowMillis = System.currentTimeMillis();
|
||||
result= getClaimsFromToken(token).getExpiration().getTime()-nowMillis;
|
||||
} catch (Exception e) {
|
||||
System.out.println("获取token的剩余过期时间时候抛出异常="+e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟生产jwt_token
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
Map<String,Object> claims = new HashMap<> ();
|
||||
claims.put("userName","10036614");
|
||||
//生成token
|
||||
String jwt_token = JwtUtils.getAccessToken ("userId",claims);
|
||||
System.out.println ("jwt_token="+jwt_token);
|
||||
String username = JwtUtils.getUserName (jwt_token);
|
||||
System.out.println ("userName="+username);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user