Merge remote-tracking branch 'origin/guoshengxiong' into guoshengxiong
This commit is contained in:
commit
95c0ddb8d5
@ -14,10 +14,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -161,4 +158,11 @@ public class BaseMenuController {
|
||||
public Result<Map<String,Object>> getDefaultProjectMenu() {
|
||||
return Result.success(baseMenuService.getDefaultProjectMenu());
|
||||
}*/
|
||||
|
||||
@ApiOperation(value = "解决项目子账号的菜单按钮无法分配", notes = "解决项目子账号的菜单按钮无法分配", httpMethod="GET")
|
||||
@GetMapping(value = "/fixAuthDistribute")
|
||||
public Result fixAuthDistribute() {
|
||||
baseMenuService.fixAuthDistribute();
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,4 +50,7 @@ public interface IBaseMenuService extends IService<BaseMenu> {
|
||||
List<EntityMap> getSupplierMenuList(Map<String, Object> param);
|
||||
|
||||
List<EntityMap> getSupplierActionList(Map<String, Object> param);
|
||||
|
||||
void fixAuthDistribute();
|
||||
|
||||
}
|
||||
|
||||
@ -2,8 +2,10 @@ package com.zhgd.xmgl.modules.basicdata.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseAction;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.CompanyConfig;
|
||||
@ -19,21 +21,24 @@ import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 系统菜单
|
||||
* @author: pds
|
||||
* @date: 2020-10-12
|
||||
* @date: 2020-10-12
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> implements IBaseMenuService {
|
||||
@Autowired
|
||||
BaseActionServiceImpl baseActionService;
|
||||
@Autowired
|
||||
private BaseMenuMapper baseMenuMapper;
|
||||
@Autowired
|
||||
@ -67,6 +72,19 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
return baseMenuMapper.getSupplierActionList(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fixAuthDistribute() {
|
||||
List<BaseMenu> baseMenus = baseMenuMapper.selectList(null);
|
||||
for (BaseMenu baseMenu : baseMenus) {
|
||||
editBaseMenu(baseMenu);
|
||||
}
|
||||
|
||||
List<BaseAction> baseActions = baseActionMapper.selectList(null);
|
||||
for (BaseAction baseAction : baseActions) {
|
||||
baseActionService.editBaseAction(baseAction);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProjectModuleAndMenu(Map<String, Object> map) {
|
||||
map.put("styleType", getStyleType(MapUtils.getString(map, "projectSn")));
|
||||
@ -125,18 +143,18 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityMap> groupMenu(List<EntityMap> list,List<EntityMap> actionList){
|
||||
List<EntityMap> tempList=new ArrayList<>();
|
||||
List<EntityMap> childList=new ArrayList<>();
|
||||
if(list!=null&&list.size()>0){
|
||||
for (EntityMap menu:list){
|
||||
if("0".equals(MapUtils.getString(menu,"parentId"))){
|
||||
public List<EntityMap> groupMenu(List<EntityMap> list, List<EntityMap> actionList) {
|
||||
List<EntityMap> tempList = new ArrayList<>();
|
||||
List<EntityMap> childList = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (EntityMap menu : list) {
|
||||
if ("0".equals(MapUtils.getString(menu, "parentId"))) {
|
||||
tempList.add(menu);
|
||||
}else{
|
||||
} else {
|
||||
childList.add(menu);
|
||||
}
|
||||
}
|
||||
tempList=groupList(tempList,childList,actionList);
|
||||
tempList = groupList(tempList, childList, actionList);
|
||||
}
|
||||
return tempList;
|
||||
}
|
||||
@ -184,12 +202,12 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
|
||||
}
|
||||
|
||||
private List<BaseModule> groupModuleMenu(List<BaseModule> moduleList,List<EntityMap> menuList){
|
||||
if(menuList!=null&&menuList.size()>0){
|
||||
for (BaseModule module:moduleList){
|
||||
List<EntityMap> tempList=new ArrayList<>();
|
||||
for (EntityMap menu:menuList){
|
||||
if(MapUtils.getString(menu,"moduleId").equals(String.valueOf(module.getModuleId()))){
|
||||
private List<BaseModule> groupModuleMenu(List<BaseModule> moduleList, List<EntityMap> menuList) {
|
||||
if (menuList != null && menuList.size() > 0) {
|
||||
for (BaseModule module : moduleList) {
|
||||
List<EntityMap> tempList = new ArrayList<>();
|
||||
for (EntityMap menu : menuList) {
|
||||
if (MapUtils.getString(menu, "moduleId").equals(String.valueOf(module.getModuleId()))) {
|
||||
tempList.add(menu);
|
||||
}
|
||||
}
|
||||
@ -199,40 +217,40 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
return moduleList;
|
||||
}
|
||||
|
||||
private List<EntityMap> groupList(List<EntityMap> list, List<EntityMap> childList,List<EntityMap> actionList){
|
||||
for(EntityMap menu:list){
|
||||
List<EntityMap> tempList=new ArrayList<>();
|
||||
List<EntityMap> List2=new ArrayList<>();
|
||||
for(EntityMap childMenu:childList){
|
||||
if(MapUtils.getString(menu,"menuId").equals(MapUtils.getString(childMenu,"parentId"))){
|
||||
private List<EntityMap> groupList(List<EntityMap> list, List<EntityMap> childList, List<EntityMap> actionList) {
|
||||
for (EntityMap menu : list) {
|
||||
List<EntityMap> tempList = new ArrayList<>();
|
||||
List<EntityMap> List2 = new ArrayList<>();
|
||||
for (EntityMap childMenu : childList) {
|
||||
if (MapUtils.getString(menu, "menuId").equals(MapUtils.getString(childMenu, "parentId"))) {
|
||||
tempList.add(childMenu);
|
||||
}else{
|
||||
} else {
|
||||
List2.add(childMenu);
|
||||
}
|
||||
}
|
||||
if(List2.size()>0) {
|
||||
tempList = groupList(tempList, List2,actionList);
|
||||
if (List2.size() > 0) {
|
||||
tempList = groupList(tempList, List2, actionList);
|
||||
}
|
||||
if(tempList.size()>0){
|
||||
menu.put("menu_list",tempList);
|
||||
}else{
|
||||
List<EntityMap> tempActionList=new ArrayList<>();
|
||||
for(EntityMap actionMenu:actionList){
|
||||
if(MapUtils.getString(menu,"menuId").equals(MapUtils.getString(actionMenu,"menuId"))){
|
||||
if (tempList.size() > 0) {
|
||||
menu.put("menu_list", tempList);
|
||||
} else {
|
||||
List<EntityMap> tempActionList = new ArrayList<>();
|
||||
for (EntityMap actionMenu : actionList) {
|
||||
if (MapUtils.getString(menu, "menuId").equals(MapUtils.getString(actionMenu, "menuId"))) {
|
||||
tempActionList.add(actionMenu);
|
||||
}
|
||||
}
|
||||
menu.put("menu_list",tempActionList);
|
||||
menu.put("menu_list", tempActionList);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private Integer getStyleType(String projectSn){
|
||||
CompanyConfig companyConfig=companyConfigMapper.selectConfigByProject(projectSn);
|
||||
if(companyConfig!=null&&companyConfig.getStyleType()!=null){
|
||||
private Integer getStyleType(String projectSn) {
|
||||
CompanyConfig companyConfig = companyConfigMapper.selectConfigByProject(projectSn);
|
||||
if (companyConfig != null && companyConfig.getStyleType() != null) {
|
||||
return companyConfig.getStyleType();
|
||||
}else{
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,9 +11,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gexin.fastjson.JSON;
|
||||
import com.wflow.bean.entity.WflowModels;
|
||||
import com.wflow.mapper.WflowModelsMapper;
|
||||
import com.zhgd.exception.CustomException;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
@ -50,6 +53,13 @@ import com.zhgd.xmgl.util.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@ -148,6 +158,12 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
private XzSystemUserToCompanyProjectMapper xzSystemUserToCompanyProjectMapper;
|
||||
@Value("${mqtt-scope}")
|
||||
private String scope;
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
@Autowired
|
||||
private WflowModelsMapper wflowModelsMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getToken(Map<String, Object> map) {
|
||||
@ -1186,16 +1202,56 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
@Override
|
||||
public void delete(Map<String, Object> map) {
|
||||
String id = MapUtils.getString(map, "id");
|
||||
String projectSn = MapUtils.getString(map, "projectSn");
|
||||
SystemUser systemUser = getById(id);
|
||||
if (systemUser == null) {
|
||||
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
||||
// 判断是否存在工作流的流程中
|
||||
List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery().unfinished().list();
|
||||
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<>();
|
||||
for (WflowModels model : models) {
|
||||
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 (systemUser.getAccountType() == 10) {
|
||||
//新用户
|
||||
deleteTenantOrSupplier(id, projectSn);
|
||||
} else {
|
||||
deleteUser(id);
|
||||
if (modelName.size() > 0) {
|
||||
throw new CustomException("该人员有正在进行中审批流程,请完成流程后再删除账号", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
// String projectSn = MapUtils.getString(map, "projectSn");
|
||||
// SystemUser systemUser = getById(id);
|
||||
// if (systemUser == null) {
|
||||
// throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
||||
// }
|
||||
// if (systemUser.getAccountType() == 10) {
|
||||
// //新用户
|
||||
// deleteTenantOrSupplier(id, projectSn);
|
||||
// } else {
|
||||
// deleteUser(id);
|
||||
// }
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,11 +2,17 @@ package com.zhgd.xmgl.modules.xz.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wflow.bean.entity.WflowModels;
|
||||
import com.wflow.mapper.WflowModelsMapper;
|
||||
import com.zhgd.exception.CustomException;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.xz.entity.XzProjectOrg;
|
||||
@ -16,13 +22,15 @@ import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -37,6 +45,13 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
||||
@Autowired
|
||||
private XzProjectOrgMapper xzProjectOrgMapper;
|
||||
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
@Autowired
|
||||
private WflowModelsMapper wflowModelsMapper;
|
||||
|
||||
@Override
|
||||
public IPage<XzProjectOrg> queryPageList(HashMap<String, Object> paramMap) {
|
||||
QueryWrapper<XzProjectOrg> queryWrapper = getQueryWrapper(paramMap);
|
||||
@ -148,6 +163,45 @@ public class XzProjectOrgServiceImpl extends ServiceImpl<XzProjectOrgMapper, XzP
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
// 判断是否存在工作流的流程中
|
||||
List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery().unfinished().list();
|
||||
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<>();
|
||||
for (WflowModels model : models) {
|
||||
List<String> orgIds = new ArrayList<>();
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (orgIds.contains(id)) {
|
||||
modelName.add(model.getFormName());
|
||||
}
|
||||
}
|
||||
if (modelName.size() > 0) {
|
||||
throw new CustomException("该组织有正在进行中审批流程,请完成流程后再删除", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
XzProjectOrg xzProjectOrg = baseMapper.selectById(id);
|
||||
if (xzProjectOrg == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user