部门视图重新生成手册问题修改

This commit is contained in:
Mr-wang 2023-10-31 17:03:13 +08:00
parent 1ea43abc31
commit d33aa94392

View File

@ -14,12 +14,15 @@ import java.util.Map;
import java.util.TreeSet;
import java.util.stream.Collectors;
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
@ -28,6 +31,7 @@ import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.server.RequestParams;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONObject;
@ -88,9 +92,9 @@ public class DataViewService extends ActionWeb {
public String queryTermsPosition(UserContext uc, RequestParams params) {
ResponseObject ro = ResponseObject.newOkResponse();
// 岗位查询
Object[] sqlParams = new Object[] {};
Object[] sqlParams = new Object[]{};
String departmentById = uc.getDepartmentModel().getId();
sqlParams = new Object[] { departmentById };
sqlParams = new Object[]{departmentById};
List<RowMap> positionRowMapsOrg = DBSql.getMaps(
"SELECT ID, POSITION_NO, POSITION_NAME, DEPARTMENTID, ORDERINDEX FROM ORGUSER WHERE POSITION_NO IS NOT NULL AND DEPARTMENTID=?",
sqlParams);
@ -148,27 +152,27 @@ public class DataViewService extends ActionWeb {
return ro.toString();
}
public String personalSyb(UserContext uc){
public String personalSyb(UserContext uc) {
ResponseObject ro = ResponseObject.newOkResponse();
String pathNameOfCache = uc.getDepartmentModel().getPathNameOfCache();
if (pathNameOfCache.contains("事业部")){
if (pathNameOfCache.contains("事业部")) {
String pathIdOfCache = uc.getDepartmentModel().getPathIdOfCache();
String[] split = pathIdOfCache.split("/");
ro.put("departId",split[0]);
ro.put("departName",SDK.getORGAPI().getDepartmentById(split[0]).getName());
ro.put("pathId",pathIdOfCache);
}else {
ro.put("departId", split[0]);
ro.put("departName", SDK.getORGAPI().getDepartmentById(split[0]).getName());
ro.put("pathId", pathIdOfCache);
} else {
String pathIdOfCache = uc.getDepartmentModel().getPathIdOfCache();
String[] split = pathIdOfCache.split("/");
System.out.println("split>>>>>>"+split.toString());
if (split.length>=2){
ro.put("departId",split[1]);
ro.put("departName",SDK.getORGAPI().getDepartmentById(split[1]).getName());
ro.put("pathId",pathIdOfCache);
}else {
ro.put("departId",split[0]);
ro.put("departName",SDK.getORGAPI().getDepartmentById(split[0]).getName());
ro.put("pathId",pathIdOfCache);
System.out.println("split>>>>>>" + split.toString());
if (split.length >= 2) {
ro.put("departId", split[1]);
ro.put("departName", SDK.getORGAPI().getDepartmentById(split[1]).getName());
ro.put("pathId", pathIdOfCache);
} else {
ro.put("departId", split[0]);
ro.put("departName", SDK.getORGAPI().getDepartmentById(split[0]).getName());
ro.put("pathId", pathIdOfCache);
}
}
return ro.toString();
@ -222,7 +226,7 @@ public class DataViewService extends ActionWeb {
Integer totalNum = 0;
Integer aNum = 0;
Integer bNum = 0;
Object[] sqlParams = new Object[] {};
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
@ -247,7 +251,7 @@ public class DataViewService extends ActionWeb {
long start = System.currentTimeMillis();
ArrayList<String> positionNameList = new ArrayList<>();
for (String positionID : positionIDs) {
RowMap POSITIONMap = DBSql.getMap("SELECT POSITION_NAME FROM ORGUSER WHERE POSITION_NO= '"+positionID+"'");
RowMap POSITIONMap = DBSql.getMap("SELECT POSITION_NAME FROM ORGUSER WHERE POSITION_NO= '" + positionID + "'");
if (null != POSITIONMap && !POSITIONMap.isEmpty()) {
String positionName = POSITIONMap.getString("POSITION_NAME");
// if (nodeRowMap.getString("ROLE").equals(positionID) ||
@ -258,7 +262,7 @@ public class DataViewService extends ActionWeb {
List<RowMap> nodeRowMaps = DBSql.getMaps(
"SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE6 WHERE POST LIKE '%"
+ positionName + "%' ");
System.out.println("=========nodeRowMaps========>"+nodeRowMaps);
System.out.println("=========nodeRowMaps========>" + nodeRowMaps);
for (RowMap nodeRowMap : nodeRowMaps) {
String plId = nodeRowMap.getString("PLID");
@ -343,7 +347,7 @@ public class DataViewService extends ActionWeb {
if (null != RELEVANTFILE && !RELEVANTFILE.equals("")) {
String[] reFileIDs = RELEVANTFILE.split(" ");
for (String reFileID : reFileIDs) {
sqlParams = new Object[] { reFileID };
sqlParams = new Object[]{reFileID};
RowMap refileRowMap = DBSql.getMap(
"SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?",
sqlParams);
@ -414,7 +418,7 @@ public class DataViewService extends ActionWeb {
if (null != SUPPORTFILE && !SUPPORTFILE.equals("")) {
String[] reFileIDs = SUPPORTFILE.split(" ");
for (String reFileID : reFileIDs) {
sqlParams = new Object[] { reFileID };
sqlParams = new Object[]{reFileID};
RowMap refileRowMap = DBSql.getMap(
"SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?",
sqlParams);
@ -485,7 +489,7 @@ public class DataViewService extends ActionWeb {
if (null != PROCESSKPI && !PROCESSKPI.equals("")) {
String[] PROCESSKPIIDS = PROCESSKPI.split(" ");
for (String PROCESSKPIID : PROCESSKPIIDS) {
sqlParams = new Object[] { PROCESSKPIID };
sqlParams = new Object[]{PROCESSKPIID};
RowMap refileRowMap = DBSql.getMap(
"SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?",
sqlParams);
@ -630,11 +634,9 @@ public class DataViewService extends ActionWeb {
String subDepartments = getSubDepartments(new ArrayList<>(), departId);
List<RowMap> nodeRowMaps = DBSql.getMaps(
"SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE6 WHERE POST LIKE '%"
+ POSITION_NAME + "%' AND POST NOT LIKE '%"+uc.getDepartmentModel().getName()+"%' ");
+ POSITION_NAME + "%' AND POST NOT LIKE '%" + uc.getDepartmentModel().getName() + "%' ");
for (RowMap nodeRowMap : nodeRowMaps) {
String PLID = nodeRowMap.getString("PLID");
RowMap fileRowMap = DBSql.getMap(
@ -724,7 +726,7 @@ public class DataViewService extends ActionWeb {
if (null != RELEVANTFILE && !RELEVANTFILE.equals("")) {
String[] reFileIDs = RELEVANTFILE.split(" ");
for (String reFileID : reFileIDs) {
sqlParams = new Object[] { reFileID };
sqlParams = new Object[]{reFileID};
RowMap refileRowMap = DBSql.getMap(
"SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?",
sqlParams);
@ -795,7 +797,7 @@ public class DataViewService extends ActionWeb {
if (null != SUPPORTFILE && !SUPPORTFILE.equals("")) {
String[] reFileIDs = SUPPORTFILE.split(" ");
for (String reFileID : reFileIDs) {
sqlParams = new Object[] { reFileID };
sqlParams = new Object[]{reFileID};
RowMap refileRowMap = DBSql.getMap(
"SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?",
sqlParams);
@ -866,7 +868,7 @@ public class DataViewService extends ActionWeb {
if (null != PROCESSKPI && !PROCESSKPI.equals("")) {
String[] PROCESSKPIIDS = PROCESSKPI.split(" ");
for (String PROCESSKPIID : PROCESSKPIIDS) {
sqlParams = new Object[] { PROCESSKPIID };
sqlParams = new Object[]{PROCESSKPIID};
RowMap refileRowMap = DBSql.getMap(
"SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?",
sqlParams);
@ -1005,7 +1007,7 @@ public class DataViewService extends ActionWeb {
* @date: 2023/6/36 14:12
*/
public String personalView_right(UserContext uc) {
System.out.println("uc>>>>>>>>"+uc.getUID());
System.out.println("uc>>>>>>>>" + uc.getUID());
ResponseObject ro = ResponseObject.newOkResponse();
String positionKeys = null;
String positionVals = null;
@ -1034,7 +1036,7 @@ public class DataViewService extends ActionWeb {
Integer totalNum = 0;
Integer aNum = 0;
Integer bNum = 0;
Object[] sqlParams = new Object[] {};
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
@ -1064,15 +1066,15 @@ public class DataViewService extends ActionWeb {
DepartmentModel departId = uc.getDepartmentModel();
String subDepartments = getSubDepartments(new ArrayList<>(), departId);
String depaertName = "";
if (UtilString.isNotEmpty(subDepartments)){
subDepartments.substring(0,subDepartments.length()-1);
if (UtilString.isNotEmpty(subDepartments)) {
subDepartments.substring(0, subDepartments.length() - 1);
String[] split = subDepartments.split(",");
for (String name:
for (String name :
split) {
depaertName += "'"+name+"'";
depaertName += "'" + name + "'";
}
}else {
depaertName = "'"+departId.getName()+"'";
} else {
depaertName = "'" + departId.getName() + "'";
}
List<RowMap> nodeRowMaps = DBSql.getMaps(
"SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE6 WHERE " +
@ -1082,100 +1084,100 @@ public class DataViewService extends ActionWeb {
" POST LIKE '%内蒙古伊利实业集团股份有限公司%' OR POST IS NOT NULL OR ROLE LIKE '%内蒙古伊利实业集团股份有限公司%' OR ROLE IS NOT NULL");
List<RowMap> new_nodeRowMaps = new LinkedList<>();
List<RowMap> new_DepartnodeRowMaps = new LinkedList<>();
for (RowMap rowMap:
nodeRowMaps) {
for (RowMap rowMap :
nodeRowMaps) {
String post = rowMap.getString("POST");
String role = rowMap.getString("ROLE");
boolean role_flag = false;
boolean post_flag = false;
if (!StringUtils.isEmpty(role)){
if (role.contains(",")){
if (!StringUtils.isEmpty(role)) {
if (role.contains(",")) {
String[] split = role.split(",");
for (String rolw:
for (String rolw :
split) {
if (depaertName.contains(rolw)){
if (depaertName.contains(rolw)) {
new_nodeRowMaps.add(rowMap);
role_flag = true;
break;
}
}
if (role_flag){
if (role_flag) {
continue;
}
}else {
if (depaertName.contains(role)){
} else {
if (depaertName.contains(role)) {
new_nodeRowMaps.add(rowMap);
continue;
}
}
}
if (!StringUtils.isEmpty(post)){
if (post.contains(",")){
if (!StringUtils.isEmpty(post)) {
if (post.contains(",")) {
String[] split = post.split(",");
for (String rolw:
for (String rolw :
split) {
if (depaertName.contains(rolw)){
if (depaertName.contains(rolw)) {
new_nodeRowMaps.add(rowMap);
post_flag = true;
break;
}
}
if (post_flag){
if (post_flag) {
continue;
}
}else {
if (depaertName.contains(post)){
} else {
if (depaertName.contains(post)) {
new_nodeRowMaps.add(rowMap);
continue;
}
}
}
}
System.out.println("new_nodeRowMaps>>>>>>>>>>>>>>>>>"+new_nodeRowMaps.size());
System.out.println("new_nodeRowMaps>>>>>>>>>>>>>>>>>" + new_nodeRowMaps.size());
for (RowMap rowMap:
for (RowMap rowMap :
DepartnodeRowMaps) {
String post = rowMap.getString("POST");
String role = rowMap.getString("ROLE");
boolean role_flag = false;
boolean post_flag = false;
if (!StringUtils.isEmpty(role)){
if (role.contains(",")){
if (!StringUtils.isEmpty(role)) {
if (role.contains(",")) {
String[] split = role.split(",");
for (String rolw:
for (String rolw :
split) {
if (depaertName.contains(rolw)){
if (depaertName.contains(rolw)) {
new_DepartnodeRowMaps.add(rowMap);
role_flag = true;
break;
}
}
if (role_flag){
if (role_flag) {
continue;
}
}else {
if (depaertName.contains(role)){
} else {
if (depaertName.contains(role)) {
new_DepartnodeRowMaps.add(rowMap);
continue;
}
}
}
if (!StringUtils.isEmpty(post)){
if (post.contains(",")){
if (!StringUtils.isEmpty(post)) {
if (post.contains(",")) {
String[] split = post.split(",");
for (String rolw:
for (String rolw :
split) {
if (depaertName.contains(rolw)){
if (depaertName.contains(rolw)) {
new_DepartnodeRowMaps.add(rowMap);
post_flag = true;
break;
}
}
if (post_flag){
if (post_flag) {
continue;
}
}else {
if (depaertName.contains(post)){
} else {
if (depaertName.contains(post)) {
new_DepartnodeRowMaps.add(rowMap);
continue;
}
@ -1184,18 +1186,18 @@ public class DataViewService extends ActionWeb {
}
nodeRowMaps = new LinkedList<>();
for (RowMap rowMap:
new_nodeRowMaps) {
nodeRowMaps = new LinkedList<>();
for (RowMap rowMap :
new_nodeRowMaps) {
nodeRowMaps.add(rowMap);
}
DepartnodeRowMaps = new LinkedList<>();
for (RowMap rowMap:
new_DepartnodeRowMaps) {
for (RowMap rowMap :
new_DepartnodeRowMaps) {
DepartnodeRowMaps.add(rowMap);
}
System.out.println("=========nodeRowMaps========>"+nodeRowMaps);
System.out.println("=========DepartnodeRowMaps========>"+DepartnodeRowMaps);
System.out.println("=========nodeRowMaps========>" + nodeRowMaps);
System.out.println("=========DepartnodeRowMaps========>" + DepartnodeRowMaps);
for (RowMap nodeRowMap : nodeRowMaps) {
String plId = nodeRowMap.getString("PLID");
RowMap fileRowMap = DBSql.getMap(
@ -1328,7 +1330,7 @@ public class DataViewService extends ActionWeb {
if (null != RELEVANTFILE && !RELEVANTFILE.equals("")) {
String[] reFileIDs = RELEVANTFILE.split(" ");
for (String reFileID : reFileIDs) {
sqlParams = new Object[] { reFileID };
sqlParams = new Object[]{reFileID};
RowMap refileRowMap = DBSql.getMap(
"SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?",
sqlParams);
@ -1399,7 +1401,7 @@ public class DataViewService extends ActionWeb {
if (null != SUPPORTFILE && !SUPPORTFILE.equals("")) {
String[] reFileIDs = SUPPORTFILE.split(" ");
for (String reFileID : reFileIDs) {
sqlParams = new Object[] { reFileID };
sqlParams = new Object[]{reFileID};
RowMap refileRowMap = DBSql.getMap(
"SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?",
sqlParams);
@ -1470,7 +1472,7 @@ public class DataViewService extends ActionWeb {
if (null != PROCESSKPI && !PROCESSKPI.equals("")) {
String[] PROCESSKPIIDS = PROCESSKPI.split(" ");
for (String PROCESSKPIID : PROCESSKPIIDS) {
sqlParams = new Object[] { PROCESSKPIID };
sqlParams = new Object[]{PROCESSKPIID};
RowMap refileRowMap = DBSql.getMap(
"SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?",
sqlParams);
@ -1719,10 +1721,10 @@ public class DataViewService extends ActionWeb {
// 正式环境 伊利集团总部id 5c8e2d14-25a8-4baf-aa3a-344064007ef3
if (pathIdOfCache.contains("5c8e2d14-25a8-4baf-aa3a-344064007ef3")) {
ucDeptID = GetNodesUtil.getParentDept(ucDeptID, 2);
}else if (_uc.getDepartmentModel().getPathNameOfCache().contains("事业部")){
} else if (_uc.getDepartmentModel().getPathNameOfCache().contains("事业部")) {
ucDeptID = pathIdOfCache.split("/")[0];
}
System.out.println("部门ID>>>>>>>>>>>>+"+ucDeptID);
System.out.println("部门ID>>>>>>>>>>>>+" + ucDeptID);
deptIDList = new ArrayList<String>();
deptIDList = GetNodesUtil.getChildDept(ucDeptID, deptIDList);
if (deptIDList != null) {
@ -1780,25 +1782,25 @@ public class DataViewService extends ActionWeb {
}
try {
String sqltt = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE,EXT6 FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND EXT6 IS NOT NULL AND PLMETHODID in ('process.epc','control.policy','process.flowchart')";
SDK.getLogAPI().consoleInfo("sql>>>>>>>>>>>>>>"+sqltt);
List<RowMap> maps = DBSql.getMaps(sqltt);
SDK.getLogAPI().consoleInfo("maps是多少个>>>>>>>>>>>>"+maps.size());
String sqltt = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE,EXT6 FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND EXT6 IS NOT NULL AND PLMETHODID in ('process.epc','control.policy','process.flowchart')";
SDK.getLogAPI().consoleInfo("sql>>>>>>>>>>>>>>" + sqltt);
List<RowMap> maps = DBSql.getMaps(sqltt);
SDK.getLogAPI().consoleInfo("maps是多少个>>>>>>>>>>>>" + maps.size());
List<RowMap> last_maps = new LinkedList<>();
for (RowMap map:
maps) {
for (RowMap map :
maps) {
String ext6 = map.getString("EXT6");
if (ext6.contains(",")){
if (ext6.contains(",")) {
String[] split = ext6.split(",");
for (String departId:
split) {
if (deptString.contains(departId)){
last_maps.add(map);
break;
}
for (String departId :
split) {
if (deptString.contains(departId)) {
last_maps.add(map);
break;
}
}else {
if (deptString.contains(ext6)){
}
} else {
if (deptString.contains(ext6)) {
last_maps.add(map);
continue;
}
@ -1901,7 +1903,7 @@ public class DataViewService extends ActionWeb {
// reFileRowMap);
}
fileRowMaps = fileHandleRowMaps;
System.err.println("=======fileRowMaps========="+fileRowMaps);
System.err.println("=======fileRowMaps=========" + fileRowMaps);
// 遍历选择的结果
List<Map> fileMaps = new ArrayList<>();
List<RowMap> frameRowMaps = new ArrayList<>();
@ -1976,8 +1978,11 @@ public class DataViewService extends ActionWeb {
formFileNum += 1;
}
model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID"));
if (null != model) {
/*if (null != model) {
taskId = getLastPublishTaskIdByModelId(model.getId());
}*/
if (null!=model){
taskId = createFile(model.getId(),_uc);
}
path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&"
+ "uuid=" + fileRowMap.getString("FILEID") + "&" + "sid=" + sid + "&" + "taskId="
@ -2070,7 +2075,7 @@ public class DataViewService extends ActionWeb {
} finally {
// System.err.println("====执行完毕====>");
}
System.out.println("ro================="+ro.toString());
System.out.println("ro=================" + ro.toString());
return ro.toString();
}
@ -2177,7 +2182,7 @@ public class DataViewService extends ActionWeb {
PALRepositoryModel reFileModel = PALRepositoryCache.getCache().get(supportFileId);
if (reFileModel != null) {
String PLMETHODID = reFileModel.getMethodId();
if (PLMETHODID.equals("data.form")&&reFileModel.isPublish()) {
if (PLMETHODID.equals("data.form") && reFileModel.isPublish()) {
HashMap<String, Object> reFileMap = new HashMap<>();
reFileMap.put("FILEID", supportFileId);
reFileMap.put("PLNAME", reFileModel.getName());
@ -2194,8 +2199,8 @@ public class DataViewService extends ActionWeb {
}
public String getSubDepartments( ArrayList<String> arr,
DepartmentModel departmentById) {
public String getSubDepartments(ArrayList<String> arr,
DepartmentModel departmentById) {
String departName = "";
if (!departmentById.isClosed()) {
List<DepartmentModel> subDepartments = SDK.getORGAPI().getSubDepartments(departmentById.getId());
@ -2203,17 +2208,141 @@ public class DataViewService extends ActionWeb {
if (!departmentModel.isClosed()) {
String name = departmentModel.getName();
String id = departmentModel.getId();
departName+=name+",";
departName += name + ",";
// 递归获取子部门下的子部门
if (SDK.getORGAPI().isExistSubDepartment(id)) {
getSubDepartments( arr, SDK.getORGAPI().getDepartmentById(id));
getSubDepartments(arr, SDK.getORGAPI().getDepartmentById(id));
}
}
}
}
return departName;
return departName;
}
/**
* 创建手册,如果是未发布的流程模型,会在N表中创建一个数据
* @param plId 流程模型ID
* @param me 用户信息
*/
public String createFile(String plId,UserContext me){
String taskIds = "";
int count = 0;
// 生成手册
PALRepositoryModel model = PALRepositoryCache.getCache().get(plId);
String taskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin", "", plId);
System.err.println("======手动生成手册id======"+taskId);
// 刷新预览加载的表
String sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + taskId + "' WHERE PLID = '" + plId + "'";
DBSql.update(sqlr);
String sql1 = "SELECT ID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID = '" + plId + "'";
String string = DBSql.getString(sql1);
System.out.println(">>>>>>>>>>>>>>>"+string);
String sql2 = "SELECT ID FROM BO_ACT_COE_PUBLISH_C WHERE CHANGEDFILEIDNEW = '" + plId + "'";
if (UtilString.isNotEmpty(DBSql.getString(sql1))) {
count = DBSql.update(
"UPDATE BO_ACT_COE_PUBLISH_N SET TASKID='" + taskId + "'WHERE PUBLISHFILEID ='" + plId + "'");
}
if (UtilString.isNotEmpty(DBSql.getString(sql2))) {
count = DBSql.update(
"UPDATE BO_ACT_COE_PUBLISH_C SET TASKID='" + taskId + "'WHERE CHANGEDFILEIDNEW ='" + plId + "'");
}
if (count != 0) {
DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + taskId + "'WHERE PALREPOSITORYID='"
+ plId + "'");
}
if(UtilString.isEmpty(DBSql.getString(sql1)) && UtilString.isEmpty(DBSql.getString(sql2))){
System.out.println("发布流程无数据===================================================");
////String sql = "SELECT pl.TASKID FROM APP_ACT_COE_PAL_PUBLISH p, APP_ACT_COE_PAL_PUBLISH_LIST pl
// // WHERE pl.pid = p.id AND pl.palrepositoryid = ? ORDER BY publishdate DESC";
//审批改为发布如果发布表未存数据则自动生成发布关联表数据可使部门视图正常使用
BO publishN=new BO();
publishN.set("PUBLISTHTYPE","N");
publishN.set("PUBLISHFILENAME",model.getName());
publishN.set("PUBLISHFILEID",plId);
ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_e1c15e74a56e4596959205f4e4e2513a", "admin", "");
SDK.getBOAPI().create("BO_ACT_COE_PUBLISH_N",publishN,processInstance,me);
/*BO publish=new BO();
publish.set("PROCESSINSTID",processInstance.getId());
publish.set("PUBLISH","1");
SDK.getBOAPI().createDataBO("APP_ACT_COE_PAL_PUBLISH",publish,me);*/
String sql = "insert into APP_ACT_COE_PAL_PUBLISH (ID,PROCESSINSTID,PUBLISHN) values ('%s', '%s', '%s')";
String id = UUIDGener.getUUID();
int update = DBSql.update(String.format(sql, id, processInstance.getId(), '1'));
//BO app_act_coe_pal_publish = SDK.getBOAPI().query("APP_ACT_COE_PAL_PUBLISH").addQuery("BINDID=", processInstance.getId()).detail();
RowMap map = DBSql.getMap("select * from APP_ACT_COE_PAL_PUBLISH where PROCESSINSTID = '" + processInstance.getId() + "'");
/*BO publishList=new BO();
publishList.set("PID",app_act_coe_pal_publish.getString("ID"));
publishList.set("PALREPOSITORYID",plId);
SDK.getBOAPI().createDataBO("APP_ACT_COE_PAL_PUBLISH_LIST",publishList,me);*/
String app_act_coe_pal_publishsql = "insert into APP_ACT_COE_PAL_PUBLISH_LIST (ID,PID,PALREPOSITORYID) values ('%s', '%s', '%s')";
String app_act_coe_pal_publishid = UUIDGener.getUUID();
int app_act_coe_pal_publishupdate = DBSql.update(String.format(app_act_coe_pal_publishsql, app_act_coe_pal_publishid,map.getString("ID"), plId));
String repetition_TaskId = createOutputReport(model, "7d3ca852-a0bd-42e6-80b1-3dcea6f55083", "admin", "", plId);
System.err.println("======手动生成手册id======"+repetition_TaskId);
taskIds = repetition_TaskId;
// 刷新预览加载的表
String repetition_sqlr = "UPDATE BO_EU_PAL_OUTPUTREPORT SET TASKID = '" + repetition_TaskId + "' WHERE PLID = '" + plId + "'";
String n_sql = "UPDATE BO_ACT_COE_PUBLISH_N SET TASKID = '" + repetition_TaskId + "' WHERE PUBLISHFILEID = '" + plId + "'";
DBSql.update(sqlr);
DBSql.update(n_sql);
String repetition_sql1 = "SELECT ID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID = '" + plId + "'";
BO bo_act_coe_publish_n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("PUBLISHFILEID = ", plId).detail();
System.out.println("bo_act_coe_publish_nL>>>>>>>>>>>>>>>>>>"+bo_act_coe_publish_n);
String repetition_sql2 = "SELECT ID FROM BO_ACT_COE_PUBLISH_C WHERE CHANGEDFILEIDNEW = '" + plId + "'";
if (UtilString.isNotEmpty(DBSql.getString(repetition_sql1))) {
count = DBSql.update(
"UPDATE BO_ACT_COE_PUBLISH_N SET TASKID='" + repetition_TaskId + "'WHERE PUBLISHFILEID ='" + plId + "'");
}
if (UtilString.isNotEmpty(DBSql.getString(repetition_sql2))) {
count = DBSql.update(
"UPDATE BO_ACT_COE_PUBLISH_C SET TASKID='" + repetition_TaskId + "'WHERE CHANGEDFILEIDNEW ='" + plId + "'");
}
if (count != 0) {
DBSql.update("UPDATE APP_ACT_COE_PAL_PUBLISH_LIST SET TASKID='" + repetition_TaskId + "'WHERE PALREPOSITORYID='"
+ plId + "'");
}
}
System.err.println("重新生成手册成功=====》" + count);
return taskIds;
}
private String createOutputReport(PALRepositoryModel model, String wsId, String userId, String teamId, String uuid) {
String taskId = "";
if (model.getMethodId().contains("process.")) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
taskId = object.getJSONObject("data").getString("taskId");
}
} else if ("data.form".equals(model.getMethodId())) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
taskId = object.getJSONObject("data").getString("taskId");
}
} else if ("control.policy".equals(model.getMethodId())) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
taskId = object.getJSONObject("data").getString("taskId");
}
}
return taskId;
}
}