工作流修改判断
This commit is contained in:
parent
fb91b3350f
commit
0336abec3b
@ -168,18 +168,34 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
|||||||
// 判断是否存在工作流的流程中
|
// 判断是否存在工作流的流程中
|
||||||
List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery().unfinished().list();
|
List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery().unfinished().list();
|
||||||
Set<String> processDefinitionId = list.stream().map(l -> l.getProcessDefinitionId()).collect(Collectors.toSet());
|
Set<String> processDefinitionId = list.stream().map(l -> l.getProcessDefinitionId()).collect(Collectors.toSet());
|
||||||
List<WflowModels> models = wflowModelsMapper.selectList(Wrappers.<WflowModels>lambdaQuery()
|
|
||||||
.in(WflowModels::getProcessDefId, processDefinitionId));
|
|
||||||
List<String> modelName = new ArrayList<>();
|
List<String> modelName = new ArrayList<>();
|
||||||
for (WflowModels model : models) {
|
if (processDefinitionId.size() > 0) {
|
||||||
List<String> orgIds = new ArrayList<>();
|
List<WflowModels> models = wflowModelsMapper.selectList(Wrappers.<WflowModels>lambdaQuery()
|
||||||
getOrg(model, orgIds);
|
.in(WflowModels::getProcessDefId, processDefinitionId));
|
||||||
if (orgIds.contains(id)) {
|
for (WflowModels model : models) {
|
||||||
modelName.add(model.getFormName());
|
List<String> orgIds = new ArrayList<>();
|
||||||
|
getOrg(model, orgIds);
|
||||||
|
if (orgIds.contains(id)) {
|
||||||
|
modelName.add(model.getFormName());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
JSONObject process = JSONObject.parseObject(model.getProcess());
|
||||||
|
JSONArray assignedUser1 = process.getJSONObject("props").getJSONArray("assignedUser");
|
||||||
|
if (assignedUser1 != null) {
|
||||||
|
for (int i = 0; i < assignedUser1.size(); i++) {
|
||||||
|
JSONObject jsonObject = assignedUser1.getJSONObject(i);
|
||||||
|
userIds.add(jsonObject.getString("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getUserIds(process.getJSONObject("children"), userIds);
|
||||||
|
if (userIds.contains(id)) {
|
||||||
|
modelName.add(model.getFormName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (modelName.size() > 0) {
|
||||||
|
throw new CustomException("该组织有正在进行中审批流程,请完成流程后再删除", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (modelName.size() > 0) {
|
|
||||||
throw new CustomException("该组织有正在进行中审批流程,请完成流程后再删除", HttpStatus.INTERNAL_SERVER_ERROR);
|
|
||||||
}
|
}
|
||||||
List<WflowModels> modelList = wflowModelsMapper.selectList(null);
|
List<WflowModels> modelList = wflowModelsMapper.selectList(null);
|
||||||
modelName = new ArrayList<>();
|
modelName = new ArrayList<>();
|
||||||
@ -189,6 +205,19 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
|||||||
if (orgIds.contains(id)) {
|
if (orgIds.contains(id)) {
|
||||||
modelName.add(model.getFormName());
|
modelName.add(model.getFormName());
|
||||||
}
|
}
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
JSONObject process = JSONObject.parseObject(model.getProcess());
|
||||||
|
JSONArray assignedUser1 = process.getJSONObject("props").getJSONArray("assignedUser");
|
||||||
|
if (assignedUser1 != null) {
|
||||||
|
for (int i = 0; i < assignedUser1.size(); i++) {
|
||||||
|
JSONObject jsonObject = assignedUser1.getJSONObject(i);
|
||||||
|
userIds.add(jsonObject.getString("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getUserIds(process.getJSONObject("children"), userIds);
|
||||||
|
if (userIds.contains(id)) {
|
||||||
|
modelName.add(model.getFormName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (modelName.size() > 0) {
|
if (modelName.size() > 0) {
|
||||||
throw new CustomException("该组织有参与工作流流程审批,请调整流程后再删除", HttpStatus.INTERNAL_SERVER_ERROR);
|
throw new CustomException("该组织有参与工作流流程审批,请调整流程后再删除", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
@ -206,7 +235,7 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
|||||||
List<SystemUser> systemUserList = systemUserMapper.selectList(new LambdaQueryWrapper<SystemUser>()
|
List<SystemUser> systemUserList = systemUserMapper.selectList(new LambdaQueryWrapper<SystemUser>()
|
||||||
.eq(SystemUser::getXzProjectOrgId, id));
|
.eq(SystemUser::getXzProjectOrgId, id));
|
||||||
if (CollUtil.isNotEmpty(systemUserList)) {
|
if (CollUtil.isNotEmpty(systemUserList)) {
|
||||||
throw new OpenAlertException("该部门下有人员,无法删除");
|
throw new OpenAlertException("该组织下有人员,无法删除");
|
||||||
}
|
}
|
||||||
baseMapper.deleteById(id);
|
baseMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
@ -319,4 +348,20 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getUserIds(JSONObject children, List<String> userIds) {
|
||||||
|
if (children != null) {
|
||||||
|
JSONObject props = children.getJSONObject("props");
|
||||||
|
if (props != null) {
|
||||||
|
getUserIds(children.getJSONObject("children"), userIds);
|
||||||
|
JSONArray assignedUser = props.getJSONArray("assignedUser");
|
||||||
|
if (assignedUser != null) {
|
||||||
|
for (int i = 0; i < assignedUser.size(); i++) {
|
||||||
|
JSONObject jsonObject = assignedUser.getJSONObject(i);
|
||||||
|
userIds.add(jsonObject.getString("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user