人员修改
This commit is contained in:
parent
4f89f0254d
commit
824f08436f
@ -1258,28 +1258,32 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
// 判断是否存在工作流的流程中
|
// 判断是否存在工作流的流程中
|
||||||
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());
|
||||||
Set<String> startUserIds = list.stream().map(l -> l.getStartUserId()).collect(Collectors.toSet());
|
StringBuilder stringBuilder = new StringBuilder("该人员有正在进行中的");
|
||||||
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> userIds = new ArrayList<>();
|
Set<String> startUserIds = list.stream().map(l -> l.getStartUserId()).collect(Collectors.toSet());
|
||||||
JSONObject process = JSONObject.parseObject(model.getProcess());
|
if (processDefinitionId.size() > 0) {
|
||||||
JSONArray assignedUser1 = process.getJSONObject("props").getJSONArray("assignedUser");
|
List<WflowModels> models = wflowModelsMapper.selectList(Wrappers.<WflowModels>lambdaQuery()
|
||||||
if (assignedUser1 != null) {
|
.in(WflowModels::getProcessDefId, processDefinitionId));
|
||||||
for (int i = 0; i < assignedUser1.size(); i++) {
|
for (WflowModels model : models) {
|
||||||
JSONObject jsonObject = assignedUser1.getJSONObject(i);
|
List<String> userIds = new ArrayList<>();
|
||||||
userIds.add(jsonObject.getString("id"));
|
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 || startUserIds.contains(id)) {
|
||||||
|
stringBuilder.append("审批流程");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getUserIds(process.getJSONObject("children"), userIds);
|
|
||||||
if (userIds.contains(id)) {
|
|
||||||
modelName.add(model.getFormName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("该人员有正在进行中的");
|
|
||||||
if (modelName.size() > 0 || startUserIds.contains(id)) {
|
|
||||||
stringBuilder.append("审批流程");
|
|
||||||
}
|
}
|
||||||
// 判断是否存在安全检查中
|
// 判断是否存在安全检查中
|
||||||
List<XzSecurityQualityInspectionRecord> xzSecurityQualityInspectionRecords = xzSecurityQualityInspectionRecordService.list(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
|
List<XzSecurityQualityInspectionRecord> xzSecurityQualityInspectionRecords = xzSecurityQualityInspectionRecordService.list(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
|
||||||
@ -1332,6 +1336,27 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
if (stringBuilder.length() > 10) {
|
if (stringBuilder.length() > 10) {
|
||||||
throw new CustomException(stringBuilder + ",请完成流程后再删除账号", HttpStatus.INTERNAL_SERVER_ERROR);
|
throw new CustomException(stringBuilder + ",请完成流程后再删除账号", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
// 判断是否有参与到流程审批中
|
||||||
|
List<WflowModels> modelList = wflowModelsMapper.selectList(null);
|
||||||
|
modelName = new ArrayList<>();
|
||||||
|
for (WflowModels model : modelList) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
String projectSn = MapUtils.getString(map, "projectSn");
|
String projectSn = MapUtils.getString(map, "projectSn");
|
||||||
SystemUser systemUser = getById(id);
|
SystemUser systemUser = getById(id);
|
||||||
if (systemUser == null) {
|
if (systemUser == null) {
|
||||||
|
|||||||
@ -15,6 +15,8 @@ import com.wflow.mapper.WflowModelsMapper;
|
|||||||
import com.zhgd.exception.CustomException;
|
import com.zhgd.exception.CustomException;
|
||||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||||
import com.zhgd.xmgl.modules.xz.entity.XzProjectOrg;
|
import com.zhgd.xmgl.modules.xz.entity.XzProjectOrg;
|
||||||
import com.zhgd.xmgl.modules.xz.mapper.XzProjectOrgMapper;
|
import com.zhgd.xmgl.modules.xz.mapper.XzProjectOrgMapper;
|
||||||
import com.zhgd.xmgl.modules.xz.service.IXzProjectOrgService;
|
import com.zhgd.xmgl.modules.xz.service.IXzProjectOrgService;
|
||||||
@ -48,7 +50,7 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
|||||||
@Autowired
|
@Autowired
|
||||||
private HistoryService historyService;
|
private HistoryService historyService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RuntimeService runtimeService;
|
private SystemUserMapper systemUserMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WflowModelsMapper wflowModelsMapper;
|
private WflowModelsMapper wflowModelsMapper;
|
||||||
|
|
||||||
@ -171,29 +173,7 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
|||||||
List<String> modelName = new ArrayList<>();
|
List<String> modelName = new ArrayList<>();
|
||||||
for (WflowModels model : models) {
|
for (WflowModels model : models) {
|
||||||
List<String> orgIds = new ArrayList<>();
|
List<String> orgIds = new ArrayList<>();
|
||||||
JSONObject process = JSONObject.parseObject(model.getProcess());
|
getOrg(model, orgIds);
|
||||||
JSONArray branchs = process.getJSONObject("children").getJSONArray("branchs");
|
|
||||||
if (branchs != null && branchs.size() > 0) {
|
|
||||||
for (int i = 0; i < branchs.size(); i++) {
|
|
||||||
JSONArray groups = branchs.getJSONObject(i).getJSONObject("props").getJSONArray("groups");
|
|
||||||
if (groups != null && groups.size() > 0) {
|
|
||||||
for (int j = 0; j < groups.size(); j++) {
|
|
||||||
JSONArray conditions = groups.getJSONObject(j).getJSONArray("conditions");
|
|
||||||
if (conditions != null && conditions.size() > 0) {
|
|
||||||
for (int k = 0; k < conditions.size(); k++) {
|
|
||||||
JSONArray value = conditions.getJSONObject(k).getJSONArray("value");
|
|
||||||
if (value != null && value.size() > 0) {
|
|
||||||
for (int z = 0; z < value.size(); z++) {
|
|
||||||
JSONObject jsonObject = value.getJSONObject(z);
|
|
||||||
orgIds.add(jsonObject.getString("id"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (orgIds.contains(id)) {
|
if (orgIds.contains(id)) {
|
||||||
modelName.add(model.getFormName());
|
modelName.add(model.getFormName());
|
||||||
}
|
}
|
||||||
@ -201,7 +181,18 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
|||||||
if (modelName.size() > 0) {
|
if (modelName.size() > 0) {
|
||||||
throw new CustomException("该组织有正在进行中审批流程,请完成流程后再删除", HttpStatus.INTERNAL_SERVER_ERROR);
|
throw new CustomException("该组织有正在进行中审批流程,请完成流程后再删除", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
List<WflowModels> modelList = wflowModelsMapper.selectList(null);
|
||||||
|
modelName = new ArrayList<>();
|
||||||
|
for (WflowModels model : modelList) {
|
||||||
|
List<String> orgIds = new ArrayList<>();
|
||||||
|
getOrg(model, orgIds);
|
||||||
|
if (orgIds.contains(id)) {
|
||||||
|
modelName.add(model.getFormName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (modelName.size() > 0) {
|
||||||
|
throw new CustomException("该组织有参与工作流流程审批,请调整流程后再删除", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
XzProjectOrg xzProjectOrg = baseMapper.selectById(id);
|
XzProjectOrg xzProjectOrg = baseMapper.selectById(id);
|
||||||
if (xzProjectOrg == null) {
|
if (xzProjectOrg == null) {
|
||||||
throw new OpenAlertException("未找到对应实体");
|
throw new OpenAlertException("未找到对应实体");
|
||||||
@ -211,6 +202,12 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
|||||||
if (CollUtil.isNotEmpty(xzProjectOrgs)) {
|
if (CollUtil.isNotEmpty(xzProjectOrgs)) {
|
||||||
throw new OpenAlertException("该部门有下级部门,无法删除");
|
throw new OpenAlertException("该部门有下级部门,无法删除");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<SystemUser> systemUserList = systemUserMapper.selectList(new LambdaQueryWrapper<SystemUser>()
|
||||||
|
.eq(SystemUser::getXzProjectOrgId, id));
|
||||||
|
if (CollUtil.isNotEmpty(systemUserList)) {
|
||||||
|
throw new OpenAlertException("该部门下有人员,无法删除");
|
||||||
|
}
|
||||||
baseMapper.deleteById(id);
|
baseMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,4 +293,30 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getOrg(WflowModels model, List<String> orgIds) {
|
||||||
|
JSONObject process = JSONObject.parseObject(model.getProcess());
|
||||||
|
JSONArray branchs = process.getJSONObject("children").getJSONArray("branchs");
|
||||||
|
if (branchs != null && branchs.size() > 0) {
|
||||||
|
for (int i = 0; i < branchs.size(); i++) {
|
||||||
|
JSONArray groups = branchs.getJSONObject(i).getJSONObject("props").getJSONArray("groups");
|
||||||
|
if (groups != null && groups.size() > 0) {
|
||||||
|
for (int j = 0; j < groups.size(); j++) {
|
||||||
|
JSONArray conditions = groups.getJSONObject(j).getJSONArray("conditions");
|
||||||
|
if (conditions != null && conditions.size() > 0) {
|
||||||
|
for (int k = 0; k < conditions.size(); k++) {
|
||||||
|
JSONArray value = conditions.getJSONObject(k).getJSONArray("value");
|
||||||
|
if (value != null && value.size() > 0) {
|
||||||
|
for (int z = 0; z < value.size(); z++) {
|
||||||
|
JSONObject jsonObject = value.getJSONObject(z);
|
||||||
|
orgIds.add(jsonObject.getString("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user