| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.highdatas.mdm.entity.DeletedTableLog; |
| | | import com.highdatas.mdm.entity.MenuMapping; |
| | | import com.highdatas.mdm.entity.SysField; |
| | | import com.highdatas.mdm.entity.SysMenu; |
| | | import com.highdatas.mdm.entity.*; |
| | | import com.highdatas.mdm.pojo.ActivitiBusinessType; |
| | | import com.highdatas.mdm.pojo.ActivitiStatus; |
| | | import com.highdatas.mdm.pojo.CodeMsg; |
| | | import com.highdatas.mdm.pojo.Result; |
| | | import com.highdatas.mdm.service.IDeletedTableLogService; |
| | | import com.highdatas.mdm.service.IMenuMappingService; |
| | | import com.highdatas.mdm.service.ISysFieldService; |
| | | import com.highdatas.mdm.service.ISysMenuService; |
| | | import com.highdatas.mdm.service.*; |
| | | import com.highdatas.mdm.util.Constant; |
| | | import com.highdatas.mdm.util.DbUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | ISysFieldService fieldService; |
| | | @Autowired |
| | | IDeletedTableLogService deletedTableLogService; |
| | | |
| | | |
| | | @Autowired |
| | | IFlowsService flowsService; |
| | | @Autowired |
| | | IMaintainService maintainService; |
| | | @Autowired |
| | | IMaintainFieldService maintainFieldService; |
| | | |
| | | @RequestMapping(value = "/all", method = RequestMethod.GET) |
| | | public Result<List<SysMenu>> getAll() { |
| | | EntityWrapper<SysMenu> sysMenuEntityWrapper = new EntityWrapper<>(); |
| | | sysMenuEntityWrapper.orderBy(" parent_id, order_no"); |
| | | sysMenuEntityWrapper.orderBy("parent_id, order_no"); |
| | | return Result.success(menuService.selectList(sysMenuEntityWrapper)) ; |
| | | } |
| | | |
| | | @RequestMapping(value = "/audit", method = RequestMethod.GET) |
| | | public Result<List<SysMenu>> audit(HttpServletRequest request) { |
| | | HttpSession session = request.getSession(); |
| | | TUser user = (TUser) session.getAttribute("user"); |
| | | String userId = user.getUserId(); |
| | | List<Flows> flows = flowsService.selectList(new EntityWrapper<Flows>().ne("business_type", ActivitiBusinessType.exists).ne("status", ActivitiStatus.open).ne("status", ActivitiStatus.close)); |
| | | // flows = flows.stream().filter(flow -> flowsService.isNextAudit(flow, userId)).collect(Collectors.toList()); |
| | | |
| | | HashSet<String> tableNameSet = new HashSet<>(); |
| | | List<String> maintainIds = flows.stream().map(Flows::getBusinessId).collect(Collectors.toList()); |
| | | if (maintainIds.size() == 0) { |
| | | return Result.success(null); |
| | | } |
| | | List<Maintain> maintains = maintainService.selectBatchIds(maintainIds); |
| | | List<String> tableNameList = maintains.stream().map(Maintain::getTableName).collect(Collectors.toList()); |
| | | tableNameSet.addAll(tableNameList); |
| | | // |
| | | List<MaintainField> maintainFields = maintainFieldService.selectBatchIds(maintainIds); |
| | | tableNameSet.addAll(maintainFields.stream().map(MaintainField::getTableName).collect(Collectors.toList())); |
| | | if (tableNameSet.size() == 0) { |
| | | return Result.success(null); |
| | | } |
| | | List<MenuMapping> menuMappingList = menuMappingService.selectList(new EntityWrapper<MenuMapping>().in("table_name", tableNameSet)); |
| | | List<String> menuIds = menuMappingList.stream().map(MenuMapping::getMenuId).collect(Collectors.toList()); |
| | | LinkedHashSet<String> parentIdSet = new LinkedHashSet<>(menuIds); |
| | | Set<String> byParentId = menuService.getByParentId(parentIdSet); |
| | | List<SysMenu> parentList = menuService.selectBatchIds(byParentId); |
| | | |
| | | return Result.success(parentList); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/list", method = RequestMethod.GET) |
| | | public Result<List<SysMenu>> getMenuList() { |
| | | EntityWrapper<SysMenu> sysMenuEntityWrapper = new EntityWrapper<>(); |
| | | sysMenuEntityWrapper.eq("DataMenu", "DataMenu"); |
| | | sysMenuEntityWrapper.eq("menu_type", "DataMenu"); |
| | | sysMenuEntityWrapper.orderBy("parent_id, order_no"); |
| | | List<SysMenu> sysMenus = menuService.selectList(sysMenuEntityWrapper); |
| | | LinkedHashSet<String> parentIdSet = new LinkedHashSet<>(); |
| | |
| | | } |
| | | String tableName = menuMapping.getTableName(); |
| | | List<SysField> fieldByTable = fieldService.getFieldByTable(tableName); |
| | | if (fieldByTable == null) { |
| | | if (fieldByTable == null || fieldByTable.size() == 0) { |
| | | continue; |
| | | } |
| | | parentIdSet.add(sysMenu.getId()); |