单个文件发布,将发布部门set到权限阅览表中

This commit is contained in:
Mr-wang 2023-08-30 12:18:30 +08:00
parent 94413a9387
commit 5cfdf752fe

View File

@ -6,6 +6,8 @@ import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.sdk.local.api.BOQueryAPI;
import com.alibaba.fastjson.JSONArray;
import com.awspaas.user.apps.app.util.RepositoryAttribute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -23,6 +25,8 @@ import com.alibaba.fastjson.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 修改文件状态
@ -79,6 +83,7 @@ public class UpateFileStateController {
}
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
if(Integer.valueOf(state) == 1){
UpdateDept(plModel,plId);
createPermScopeData(plId , me);
SDK.getLogAPI().consoleInfo("修改为发布状态后同步权限数据到权限阅览成功===========>");
}
@ -176,6 +181,11 @@ public class UpateFileStateController {
BO scopeBo = new BO();
scopeBo.set("PALVERSIONID" , plVersionid);
scopeBo.set("PALNAME" , parentModel.getName());
String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '"+palId+"'";
RowMap map = DBSql.getMap(sql);
if (map!=null){
scopeBo.set("ORGPERM" ,map.getString("EXT6"));
}
ProcessInstance processInst = SDK.getProcessAPI().createBOProcessInstance("obj_e076b01bd0d04bc39e5af12e2c8c188c", me.getUID(), "权限阅览");
SDK.getBOAPI().create("BO_ACT_PUBLISH_PERM_SCOPE", scopeBo, processInst, me);
}
@ -204,5 +214,61 @@ public class UpateFileStateController {
}
return taskId;
}
public void UpdateDept(PALRepositoryModel palRepositoryModel,String id){
int count = 0;
int count2 = 0;
try {
Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(id);
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
// 发布部门
String dempId = "";
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
if (null != Issuing_department && !Issuing_department.equals("")) {
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
SDK.getLogAPI().consoleInfo(Issuing_department.toString());
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
for (Object PUBDEPTO : PUBDEPTJA) {
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
dempId += PUBDEPTJO.getString("id")+",";
}
dempId = dempId.substring(0,dempId.length()-1);
count2 += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('"+dempId+"') WHERE ID = '"+id+"'");
}
}
}
} catch (Exception e) {
// TODO: handle exception
}
// String methodId = palRepositoryModel.getMethodId();
String plVersionId = palRepositoryModel.getVersionId();
String sqly = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + plVersionId + "'";
List<RowMap> maps = DBSql.getMaps(sqly);
if (maps.size() > 1) {
String sqlu = "SELECT ID FROM (SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '"
+ plVersionId + "' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2";
String palId = DBSql.getString(sqlu);
if (UtilString.isNotEmpty(palId)) {
if (!id.equals(palId)) {
count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+id+"'");
// continue;
} else {
count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+id+"'");
}
}
}
//刷新状态
if(palRepositoryModel.isStop()) {
count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+id+"'");
}
}
}