feat: 标准库 左侧树 相关 配置标准 相关等
This commit is contained in:
+18
@@ -4,15 +4,19 @@ package com.adc.da.slrs.sarResource.controller;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandard;
|
||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -28,6 +32,20 @@ import java.util.List;
|
||||
public class TsResourceController extends BaseController<TsResource> {
|
||||
@Autowired
|
||||
private ITsResourceService tsResourceService;
|
||||
|
||||
@ApiOperation("根据ID查询菜单")
|
||||
@GetMapping("/getMenuById")
|
||||
public ResponseMessage<TsResource> getMenuById(@RequestParam String menuId){
|
||||
TsResource sarMenus = tsResourceService.getById(menuId);
|
||||
if(sarMenus != null && sarMenus.getParentIds() != null && StringUtils.isNotBlank(sarMenus.getParentIds())){
|
||||
List<TsResource> menuStandards = tsResourceService.getMenuByIds(Arrays.asList(sarMenus.getParentIds().split(",")));
|
||||
if(!menuStandards.isEmpty()){
|
||||
String parentIdsName = menuStandards.stream().map(TsResource::getMenuName).collect(Collectors.joining(","));
|
||||
sarMenus.setParentIdsName(parentIdsName);
|
||||
}
|
||||
}
|
||||
return Result.success(sarMenus);
|
||||
}
|
||||
|
||||
@ApiOperation("查询所有资源")
|
||||
@GetMapping
|
||||
|
||||
@@ -87,4 +87,8 @@ public class TsResource extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private List<TsResource> children;
|
||||
|
||||
@ApiModelProperty(value = "上级菜单名称")
|
||||
@TableField(exist = false)
|
||||
private String parentIdsName;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.adc.da.slrs.sarResource.service;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandard;
|
||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@@ -16,6 +17,15 @@ import java.util.List;
|
||||
*/
|
||||
public interface ITsResourceService extends IService<TsResource> {
|
||||
|
||||
List<String> getParentMenuId(String menuId);
|
||||
|
||||
/**
|
||||
* 通过Ids查询menu
|
||||
* @param menuIds :菜单Ids
|
||||
* @return List<Menu>
|
||||
*/
|
||||
List<TsResource> getMenuByIds(List<String> menuIds);
|
||||
|
||||
List<TsResource> getAll(TsResource tsResource);
|
||||
|
||||
ResponseMessage<Object> addResource(TsResource tsResource);
|
||||
|
||||
+34
-2
@@ -3,6 +3,8 @@ package com.adc.da.slrs.sarResource.service.impl;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
|
||||
import com.adc.da.slrs.sarMenu.entity.SarMenu;
|
||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandard;
|
||||
import com.adc.da.slrs.sarResource.dao.TsResourceDao;
|
||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
||||
@@ -29,6 +31,36 @@ import java.util.List;
|
||||
public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource> implements ITsResourceService {
|
||||
@Autowired
|
||||
private TsResourceDao dao;
|
||||
|
||||
public List<String> getParentMenuId (String menuId) {
|
||||
List<String> parentIds = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(menuId)) {
|
||||
List<TsResource> sarMenuEOList = dao.selectList(new QueryWrapper<>());
|
||||
Tree tree = new Tree(sarMenuEOList);
|
||||
TreeNode treeNode = tree.getTreeNode(menuId);
|
||||
while (treeNode.getParent() != null) {
|
||||
parentIds.add(treeNode.getParent().getNodeId());
|
||||
treeNode = treeNode.getParent();
|
||||
}
|
||||
}
|
||||
return parentIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过Ids查询menu
|
||||
* @param menuIds :菜单Ids
|
||||
* @return List<Menu>
|
||||
*/
|
||||
@Override
|
||||
public List<TsResource> getMenuByIds(List<String> menuIds) {
|
||||
if(menuIds!=null&&menuIds.size()>0){
|
||||
QueryWrapper<TsResource> sarMenuQueryWrapper=new QueryWrapper<>();
|
||||
sarMenuQueryWrapper.in("id",menuIds);
|
||||
return dao.selectList(sarMenuQueryWrapper);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有菜单
|
||||
* @param tsResource
|
||||
@@ -54,7 +86,7 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
|
||||
*/
|
||||
@Override
|
||||
public ResponseMessage<Object> addResource(TsResource TsResource) {
|
||||
if(TsResource.getParentId()!=null){
|
||||
if(TsResource.getParentId() != null && StringUtils.isNotBlank(TsResource.getParentId())){
|
||||
TsResource parent=dao.selectById(TsResource.getParentId());
|
||||
if(parent==null){
|
||||
return Result.error("该父菜单不存在");
|
||||
@@ -75,7 +107,7 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
|
||||
if(oldResource==null){
|
||||
return Result.error("该菜单不存在");
|
||||
}
|
||||
if(TsResource.getParentId()!=null){
|
||||
if(TsResource.getParentId() != null && StringUtils.isNotBlank(TsResource.getParentId())){
|
||||
TsResource parent=dao.selectById(TsResource.getParentId());
|
||||
if(parent==null){
|
||||
return Result.error("父节点不存在");
|
||||
|
||||
+32
-14
@@ -1,6 +1,8 @@
|
||||
package com.adc.da.slrs.sarStandardsInfo.controller;
|
||||
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.adc.da.att.entity.AttFileEO;
|
||||
import com.adc.da.common.FileUnZip;
|
||||
@@ -38,6 +40,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@@ -67,6 +70,10 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
||||
@Value("${file.downloadUrl}")
|
||||
private String fileDownloadPath;
|
||||
|
||||
private static String stringTy = "UTF8";
|
||||
private static String responseParam1 = "Content-Disposition";
|
||||
private static String responseParam2 = "attachment;filename=";
|
||||
|
||||
@Autowired
|
||||
ISarLawsInfoService sarLawsInfoEOService;
|
||||
|
||||
@@ -197,7 +204,7 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=" + ReadExcel.encodeFileName(standardsInfoExcelVO.getExportName()+".xlsx",
|
||||
request));
|
||||
response.setContentType("application/force-download");
|
||||
// response.setContentType("application/force-download");
|
||||
// 导出所有数据
|
||||
List<SarStandardsInfo> datas = sarStandardsInfoEOService.getExportDatas(standardsInfoExcelVO);
|
||||
workbook = StandExportUtil.exportDatas(datas,standardsInfoExcelVO.getStandType());
|
||||
@@ -419,20 +426,31 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
||||
@PostMapping("/saveStandardsMenu")
|
||||
//@RequiresPermissions("lawss:sarStandardsInfo:saveStandardsMenu")
|
||||
public ResponseMessage saveStandardsMenu(@RequestBody SarStandardsInfoEOPage standardsInfoEO) throws Exception {
|
||||
if ("wdsc".equals(standardsInfoEO.getMenuId()) || "gxhbq".equals(standardsInfoEO.getMenuId())) {
|
||||
return Result.error("所选节点不支持配置标准");
|
||||
} else {
|
||||
boolean flag = false;
|
||||
try {
|
||||
flag = sarStandardsInfoEOService.updateStandardsMenu(standardsInfoEO);
|
||||
}catch (NullPointerException e){
|
||||
flag = sarStandardsInfoEOService.updateStandInfo(standardsInfoEO);
|
||||
}
|
||||
if (flag){
|
||||
return Result.success("200","配置成功",true);
|
||||
}
|
||||
return Result.error("-1","配置失败");
|
||||
// if ("wdsc".equals(standardsInfoEO.getMenuId()) || "gxhbq".equals(standardsInfoEO.getMenuId())) {
|
||||
// return Result.error("所选节点不支持配置标准");
|
||||
// } else {
|
||||
// boolean flag = false;
|
||||
// try {
|
||||
// flag = sarStandardsInfoEOService.updateStandardsMenu(standardsInfoEO);
|
||||
// }catch (NullPointerException e){
|
||||
// flag = sarStandardsInfoEOService.updateStandInfo(standardsInfoEO);
|
||||
// }
|
||||
// if (flag){
|
||||
// return Result.success("200","配置成功",true);
|
||||
// }
|
||||
// return Result.error("-1","配置失败");
|
||||
// }
|
||||
boolean flag = false;
|
||||
try {
|
||||
flag = sarStandardsInfoEOService.updateStandardsMenu(standardsInfoEO);
|
||||
}catch (NullPointerException e){
|
||||
flag = sarStandardsInfoEOService.updateStandInfo(standardsInfoEO);
|
||||
}
|
||||
if (flag){
|
||||
return Result.success("200","配置成功",true);
|
||||
}
|
||||
return Result.error("-1","配置失败");
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|SarStandardsInfoEO|详情页面查询相近标准")
|
||||
|
||||
+2
@@ -32,7 +32,9 @@ public interface ISarStandardsInfoService extends IService<SarStandardsInfo> {
|
||||
List<SarStandardsInfo> selectStandardsByStandnumber(String replaceStandNum, String standType);
|
||||
|
||||
SarStandardsInfo selectStandardsInfoByKey(String id) throws Exception;
|
||||
|
||||
public void attrInfoDetails (SarStandardsInfo row) throws Exception;
|
||||
|
||||
boolean updateStandardsMenu(SarStandardsInfoEOPage standardsInfoEO);
|
||||
|
||||
boolean updateStandInfo(SarStandardsInfoEOPage standardsInfoEO);
|
||||
|
||||
+3
-2
@@ -94,7 +94,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
private SarStandardsInfoDao dao;
|
||||
|
||||
@Autowired
|
||||
private ISarMenuService sarMenuEOService;
|
||||
private ITsResourceService sarMenuEOService;
|
||||
|
||||
@Autowired
|
||||
private SarSarAccessInfoDao sarSarAccessInfoEODao;
|
||||
@@ -1122,7 +1122,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
page = (SarStandardsInfoEOPage) JSONObject.toBean(jsonObject, SarStandardsInfoEOPage.class);
|
||||
page.setStandType(standardsInfoExcelVO.getStandType());
|
||||
//查询当前登录人角色拥有权限的菜单
|
||||
List<String> getMenuIdList = sarMenuEOService.queryRoleMenuIdList(page.getStandType() + "_STAND", null);
|
||||
List<String> getMenuIdList=tsUserService.getResourceId(new TsResource());
|
||||
// List<String> getMenuIdList = sarMenuEOService.queryRoleMenuIdList(page.getStandType() + "_STAND", null);
|
||||
if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
|
||||
page.setMenuRoleList(getMenuIdList);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user