Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage
This commit is contained in:
+15
-2
@@ -86,6 +86,19 @@ public class SarFileCompareItemCommentController extends JeroController<SarFileC
|
|||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一致评估
|
||||||
|
* @param sarFileCompareItemComment
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "一致评估")
|
||||||
|
@ApiOperation(value = "一致评估", notes = "一致评估")
|
||||||
|
@PostMapping(value = "/consensusAssessment")
|
||||||
|
public Result<?> consensusAssessment(@Validated @RequestBody SarFileCompareItemComment sarFileCompareItemComment) {
|
||||||
|
sarFileCompareItemCommentService.consensusAssessment(sarFileCompareItemComment);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
*
|
*
|
||||||
@@ -165,8 +178,8 @@ public class SarFileCompareItemCommentController extends JeroController<SarFileC
|
|||||||
@RequestParam(name = "selectIds", required = true) String selectIds,
|
@RequestParam(name = "selectIds", required = true) String selectIds,
|
||||||
@RequestParam(name = "includeComments", required = true) boolean includeComments,
|
@RequestParam(name = "includeComments", required = true) boolean includeComments,
|
||||||
@RequestParam(name = "cut", required = true) String cut,
|
@RequestParam(name = "cut", required = true) String cut,
|
||||||
HttpServletResponse response) {
|
HttpServletResponse response,HttpServletRequest request) {
|
||||||
sarFileCompareItemCommentService.exportResXls(response, infoId, selectIds, includeComments, cut);
|
sarFileCompareItemCommentService.exportResXls(request,response, infoId, selectIds, includeComments, cut);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -67,5 +67,7 @@ public interface ISarFileCompareItemCommentService extends IService<SarFileCompa
|
|||||||
|
|
||||||
SarFileCompareResultVO queryCompareResult(String infoId);
|
SarFileCompareResultVO queryCompareResult(String infoId);
|
||||||
|
|
||||||
void exportResXls(HttpServletResponse response, String infoId, String selectIds, boolean includeComments, String cut);
|
void exportResXls(HttpServletRequest request,HttpServletResponse response, String infoId, String selectIds, boolean includeComments, String cut);
|
||||||
|
|
||||||
|
void consensusAssessment(SarFileCompareItemComment sarFileCompareItemComment);
|
||||||
}
|
}
|
||||||
|
|||||||
+93
-13
@@ -11,17 +11,29 @@ import com.jero.modules.compare.service.ISarFileCompareInfoService;
|
|||||||
import com.jero.modules.compare.service.ISarFileCompareItemCommentService;
|
import com.jero.modules.compare.service.ISarFileCompareItemCommentService;
|
||||||
import com.jero.modules.compare.service.ISarFileCompareItemService;
|
import com.jero.modules.compare.service.ISarFileCompareItemService;
|
||||||
import com.jero.modules.system.util.StringUtils;
|
import com.jero.modules.system.util.StringUtils;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 文档对比信息条款评论表
|
* @Description: 文档对比信息条款评论表
|
||||||
@@ -38,6 +50,13 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISarFileCompareItemService SarFileCompareItemServiceImpl;
|
private ISarFileCompareItemService SarFileCompareItemServiceImpl;
|
||||||
|
|
||||||
|
@Value("${jero.path.upload}")
|
||||||
|
private String filePath;
|
||||||
|
@Value("${jero.path.uploadCos}")
|
||||||
|
private String filePathCos;
|
||||||
|
@Value("${jero.splitUrl}")
|
||||||
|
private String splitUrl;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
@@ -164,7 +183,7 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportResXls(HttpServletResponse response, String infoId, String selectIds, boolean includeComments, String cut) {
|
public void exportResXls(HttpServletRequest request,HttpServletResponse response, String infoId, String selectIds, boolean includeComments, String cut) {
|
||||||
List<SarFileCompareItemComment> list = null;
|
List<SarFileCompareItemComment> list = null;
|
||||||
if (includeComments && StringUtils.isEmpty(selectIds)) {
|
if (includeComments && StringUtils.isEmpty(selectIds)) {
|
||||||
//只导出全文评论的情况
|
//只导出全文评论的情况
|
||||||
@@ -180,8 +199,10 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
|||||||
}
|
}
|
||||||
Map<String, SarFileCompareItem> sfcItemMap = SarFileCompareItemServiceImpl.queryMapByInfoId(infoId);
|
Map<String, SarFileCompareItem> sfcItemMap = SarFileCompareItemServiceImpl.queryMapByInfoId(infoId);
|
||||||
|
|
||||||
|
SarFileCompareInfo sarFileCompareInfo = sarFileCompareInfoServiceImpl.queryById(infoId);
|
||||||
|
|
||||||
OutputStream os = null;
|
OutputStream os = null;
|
||||||
Workbook workbook = new XSSFWorkbook();
|
Workbook workbook = new HSSFWorkbook();
|
||||||
try {
|
try {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
String fileName = "导出对比结果 " + sdf.format(new Date()) + ".xlsx";
|
String fileName = "导出对比结果 " + sdf.format(new Date()) + ".xlsx";
|
||||||
@@ -195,15 +216,15 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
|||||||
sheetName = "Comparing results";
|
sheetName = "Comparing results";
|
||||||
}
|
}
|
||||||
Sheet sheet = workbook.createSheet(sheetName);
|
Sheet sheet = workbook.createSheet(sheetName);
|
||||||
|
HSSFPatriarch patriarch = (HSSFPatriarch) sheet.createDrawingPatriarch();
|
||||||
// 创建头部
|
// 创建头部
|
||||||
String header = "";
|
String header = "";
|
||||||
if (CutEnum.CN.getValue().equals(cut)) {
|
if (CutEnum.CN.getValue().equals(cut)) {
|
||||||
header = "条款号,条款名称,条款内容,条款号,条款名称,条款内容,评论";
|
header = "所选标准,条款号,条款名称,条款内容,所选标准,条款号,条款名称,条款内容,评论";
|
||||||
} else {
|
} else {
|
||||||
header = "Number,Title,Content,Number,Title,Content,Comment";
|
header = "Selected Standard,Number,Title,Content,Selected Standard,Number,Title,Content,Comment";
|
||||||
}
|
}
|
||||||
int[] columnWidth = {5000, 5000, 10000, 5000, 5000, 10000, 10000};
|
int[] columnWidth = {5000,5000, 5000, 10000, 5000,5000, 5000, 10000, 10000};
|
||||||
CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象
|
CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象
|
||||||
cellStyle.setAlignment(HorizontalAlignment.LEFT);
|
cellStyle.setAlignment(HorizontalAlignment.LEFT);
|
||||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
@@ -219,15 +240,39 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
|||||||
int i = 1;
|
int i = 1;
|
||||||
for (SarFileCompareItemComment itemComment : list) {
|
for (SarFileCompareItemComment itemComment : list) {
|
||||||
Row row = sheet.createRow(i);
|
Row row = sheet.createRow(i);
|
||||||
|
row.createCell(0).setCellValue(sarFileCompareInfo == null ? "" : sarFileCompareInfo.getTitleLeft() + " " + sarFileCompareInfo.getFileNameLeft());
|
||||||
|
row.createCell(4).setCellValue(sarFileCompareInfo == null ? "" : sarFileCompareInfo.getTitleRight() + " " + sarFileCompareInfo.getFileNameRight());
|
||||||
String itemIdLeft = itemComment.getItemsIdLeft();
|
String itemIdLeft = itemComment.getItemsIdLeft();
|
||||||
if (!StringUtils.isEmpty(itemIdLeft)) {
|
if (!StringUtils.isEmpty(itemIdLeft)) {
|
||||||
SarFileCompareItem itemLeft = sfcItemMap.get(itemIdLeft);
|
SarFileCompareItem itemLeft = sfcItemMap.get(itemIdLeft);
|
||||||
if (null != itemLeft) {
|
if (null != itemLeft) {
|
||||||
row.createCell(0).setCellValue(itemLeft.getItemsNum());
|
row.createCell(1).setCellValue(itemLeft.getItemsNum());
|
||||||
row.createCell(1).setCellValue(itemLeft.getItemsName());
|
row.createCell(2).setCellValue(itemLeft.getItemsName());
|
||||||
String text = itemLeft.getItemsText();
|
String text = itemLeft.getItemsText();
|
||||||
text = text.replace("<p>", "").replace("</p>", "\r\n");
|
text = text.replace("<p>", "").replace("</p>", "\r\n");
|
||||||
row.createCell(2).setCellValue(text);
|
BufferedImage bufferImg = null;
|
||||||
|
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
||||||
|
addImgdata(text,request.getSession());
|
||||||
|
String rowdata = "";
|
||||||
|
String rowDataAndPath = (String) request.getSession().getAttribute("txtAndImg");
|
||||||
|
for (String s : rowDataAndPath.split("---")) {
|
||||||
|
if (s.contains(".jpg") || s.contains(".png")) {
|
||||||
|
File file = new File(filePath + s);
|
||||||
|
if (file.exists()) {
|
||||||
|
bufferImg = ImageIO.read(file);
|
||||||
|
ImageIO.write(bufferImg, "jpg", byteArrayOut);
|
||||||
|
//anchor主要用于设置图片的属性
|
||||||
|
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 600, 200,(short)3, i, (short) 3, i);
|
||||||
|
patriarch.createPicture(anchor, workbook.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rowdata = rowdata + s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
row.createCell(3).setCellValue(rowdata);
|
||||||
row.setRowStyle(cellStyle);
|
row.setRowStyle(cellStyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,15 +280,15 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
|||||||
if (!StringUtils.isEmpty(itemIdRight)) {
|
if (!StringUtils.isEmpty(itemIdRight)) {
|
||||||
SarFileCompareItem itemRight = sfcItemMap.get(itemIdRight);
|
SarFileCompareItem itemRight = sfcItemMap.get(itemIdRight);
|
||||||
if (null != itemRight) {
|
if (null != itemRight) {
|
||||||
row.createCell(3).setCellValue(itemRight.getItemsNum());
|
row.createCell(5).setCellValue(itemRight.getItemsNum());
|
||||||
row.createCell(4).setCellValue(itemRight.getItemsName());
|
row.createCell(6).setCellValue(itemRight.getItemsName());
|
||||||
String text = itemRight.getItemsText();
|
String text = itemRight.getItemsText();
|
||||||
text = text.replace("<p>", "").replace("</p>", "\r\n");
|
text = text.replace("<p>", "").replace("</p>", "\r\n");
|
||||||
row.createCell(5).setCellValue(text);
|
row.createCell(7).setCellValue(text);
|
||||||
row.setRowStyle(cellStyle);
|
row.setRowStyle(cellStyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
row.createCell(6).setCellValue(itemComment.getComment());
|
row.createCell(8).setCellValue(itemComment.getComment());
|
||||||
for (int j = 0; j < 7; j++) {
|
for (int j = 0; j < 7; j++) {
|
||||||
Cell cell = row.getCell(j);
|
Cell cell = row.getCell(j);
|
||||||
if (null != cell) {
|
if (null != cell) {
|
||||||
@@ -280,4 +325,39 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
|||||||
IOUtils.closeQuietly(os);
|
IOUtils.closeQuietly(os);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提取字符串中<img>标签内容中的图片路径,并重新按顺序拼接
|
||||||
|
* @param text
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private void addImgdata(String text,HttpSession session) {
|
||||||
|
if (text.contains("<") || text.contains(">")) {
|
||||||
|
String txtLeft = text.substring(0, text.indexOf("<"));
|
||||||
|
String txtRight = text.substring(text.indexOf(">") + 1);
|
||||||
|
String img = text.substring(text.indexOf("<"), text.indexOf(">"));
|
||||||
|
String path = img.substring(img.lastIndexOf("=") + 1, img.lastIndexOf("\""));
|
||||||
|
text = txtLeft + "---" + path + "---" + txtRight;
|
||||||
|
addImgdata(text, session);
|
||||||
|
} else {
|
||||||
|
session.setAttribute("txtAndImg", text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一致评估
|
||||||
|
* @param sarFileCompareItemComment
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void consensusAssessment(SarFileCompareItemComment sarFileCompareItemComment) {
|
||||||
|
Date now = new Date();
|
||||||
|
sarFileCompareItemComment.setCreateTime(now);
|
||||||
|
sarFileCompareItemComment.setUpdateTime(now);
|
||||||
|
sarFileCompareItemComment.setComment("一致");
|
||||||
|
save(sarFileCompareItemComment);
|
||||||
|
SarFileCompareItemServiceImpl.updateReviewedById(sarFileCompareItemComment.getItemsIdLeft());
|
||||||
|
SarFileCompareItemServiceImpl.updateReviewedById(sarFileCompareItemComment.getItemsIdRight());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-7
@@ -13,10 +13,12 @@ import com.jero.modules.extRepo.service.IExtRepoFolderService;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +49,7 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
|
|||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
public Result<ERFTreeDataVO> queryList() {
|
public Result<ERFTreeDataVO> queryList() {
|
||||||
ERFTreeDataVO dataVO = new ERFTreeDataVO();
|
ERFTreeDataVO dataVO = new ERFTreeDataVO();
|
||||||
dataVO.setManager(extRepoFolderService.isManager());
|
dataVO.setManager(true);
|
||||||
dataVO.setList(extRepoFolderService.queryTreeList());
|
dataVO.setList(extRepoFolderService.queryTreeList());
|
||||||
return Result.OK(dataVO);
|
return Result.OK(dataVO);
|
||||||
}
|
}
|
||||||
@@ -61,9 +63,11 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
|
|||||||
@AutoLog(value = "对外报告文件夹表-添加")
|
@AutoLog(value = "对外报告文件夹表-添加")
|
||||||
@ApiOperation(value = "对外报告文件夹表-添加", notes = "对外报告文件夹表-添加")
|
@ApiOperation(value = "对外报告文件夹表-添加", notes = "对外报告文件夹表-添加")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder) {
|
public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) {
|
||||||
Result<ExtRepoFolder> result = new Result();
|
Result<ExtRepoFolder> result = new Result();
|
||||||
if (extRepoFolderService.haveManageAuth(extRepoFolder.getSupFolder())) {
|
session.setAttribute("haveSuperiorManageAuth", false);
|
||||||
|
extRepoFolderService.haveSuperiorManageAuth(extRepoFolder.getSupFolder(),session);
|
||||||
|
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
|
||||||
if (!extRepoFolder.isAddSub()) {
|
if (!extRepoFolder.isAddSub()) {
|
||||||
//增加同级文件夹
|
//增加同级文件夹
|
||||||
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getSupFolder());
|
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getSupFolder());
|
||||||
@@ -94,9 +98,11 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
|
|||||||
@AutoLog(value = "对外报告文件夹表-编辑")
|
@AutoLog(value = "对外报告文件夹表-编辑")
|
||||||
@ApiOperation(value = "对外报告文件夹表-编辑", notes = "对外报告文件夹表-编辑")
|
@ApiOperation(value = "对外报告文件夹表-编辑", notes = "对外报告文件夹表-编辑")
|
||||||
@PutMapping(value = "/edit")
|
@PutMapping(value = "/edit")
|
||||||
public Result<?> edit(@Validated @RequestBody ExtRepoFolder extRepoFolder) {
|
public Result<?> edit(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) {
|
||||||
Result<ExtRepoFolder> result = new Result();
|
Result<ExtRepoFolder> result = new Result();
|
||||||
if (extRepoFolderService.haveManageAuth(extRepoFolder.getId())) {
|
session.setAttribute("haveSuperiorManageAuth", false);
|
||||||
|
extRepoFolderService.haveSuperiorManageAuth(extRepoFolder.getSupFolder(),session);
|
||||||
|
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
|
||||||
extRepoFolderService.editById(extRepoFolder);
|
extRepoFolderService.editById(extRepoFolder);
|
||||||
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||||
result.success("编辑成功!");
|
result.success("编辑成功!");
|
||||||
@@ -123,9 +129,11 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
|
|||||||
@ApiOperation(value = "对外报告文件夹表-通过id删除", notes = "对外报告文件夹表-通过id删除")
|
@ApiOperation(value = "对外报告文件夹表-通过id删除", notes = "对外报告文件夹表-通过id删除")
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id,
|
public Result<?> delete(@RequestParam(name = "id", required = true) String id,
|
||||||
@RequestParam(name = "cut", defaultValue = "cn") String cut) {
|
@RequestParam(name = "cut", defaultValue = "cn") String cut, HttpSession session) {
|
||||||
Result<ExtRepoFolder> result = new Result();
|
Result<ExtRepoFolder> result = new Result();
|
||||||
if (extRepoFolderService.haveManageAuth(id)) {
|
session.setAttribute("haveSuperiorManageAuth", false);
|
||||||
|
extRepoFolderService.haveSuperiorManageAuth(id,session);
|
||||||
|
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
|
||||||
List<ExtRepoFolder> resList = extRepoFolderService.getListBySupFolder(id);
|
List<ExtRepoFolder> resList = extRepoFolderService.getListBySupFolder(id);
|
||||||
if (resList.isEmpty()) {
|
if (resList.isEmpty()) {
|
||||||
ExtRepoFolder erf = extRepoFolderService.queryById(id);
|
ExtRepoFolder erf = extRepoFolderService.queryById(id);
|
||||||
|
|||||||
+10
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import com.jero.modules.extRepo.entity.ERFTreeData;
|
import com.jero.modules.extRepo.entity.ERFTreeData;
|
||||||
import com.jero.modules.extRepo.entity.ExtRepoFolder;
|
import com.jero.modules.extRepo.entity.ExtRepoFolder;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,4 +92,13 @@ public interface IExtRepoFolderService extends IService<ExtRepoFolder> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ExtRepoFolder> getListBySupFolder(String supFolder);
|
List<ExtRepoFolder> getListBySupFolder(String supFolder);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断上级是否有权限
|
||||||
|
* @param supFolder
|
||||||
|
* @param session
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void haveSuperiorManageAuth(String supFolder, HttpSession session);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+45
-1
@@ -14,10 +14,12 @@ import com.jero.modules.extRepo.service.IExtRepoFolderService;
|
|||||||
import com.jero.modules.system.entity.SysUserRole;
|
import com.jero.modules.system.entity.SysUserRole;
|
||||||
import com.jero.modules.system.service.ISysUserRoleService;
|
import com.jero.modules.system.service.ISysUserRoleService;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -246,7 +248,7 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
|
|||||||
date.setAuthManageIds(erf.getAuthManageIds());
|
date.setAuthManageIds(erf.getAuthManageIds());
|
||||||
date.setAuthViewIdsName(erf.getAuthViewIdsName());
|
date.setAuthViewIdsName(erf.getAuthViewIdsName());
|
||||||
date.setAuthViewIds(erf.getAuthViewIds());
|
date.setAuthViewIds(erf.getAuthViewIds());
|
||||||
date.setChildren(getSubFolder(erf.getId(), list, childLevel));
|
date.setChildren(subFolderTree(erf.getId(),new ArrayList<ERFTreeData>(),childLevel));
|
||||||
date.sortChildren();
|
date.sortChildren();
|
||||||
resList.add(date);
|
resList.add(date);
|
||||||
} else {
|
} else {
|
||||||
@@ -257,6 +259,28 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
|
|||||||
return resList;
|
return resList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父文件夹有权限则获取其下全部子文件夹
|
||||||
|
* @param folder
|
||||||
|
* @param level
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<ERFTreeData> subFolderTree(String folder,List<ERFTreeData> childTree,int level) {
|
||||||
|
int childLevel = level + 1;
|
||||||
|
List<ExtRepoFolder> listBySupFolder = getListBySupFolder(folder);
|
||||||
|
for (ExtRepoFolder extRepoFolder : listBySupFolder) {
|
||||||
|
ERFTreeData date = new ERFTreeData(extRepoFolder.getFolderName(), extRepoFolder.getId(), childLevel, extRepoFolder.getOrderId());
|
||||||
|
date.setAuthManageIdsName(extRepoFolder.getAuthManageIdsName());
|
||||||
|
date.setAuthManageIds(extRepoFolder.getAuthManageIds());
|
||||||
|
date.setAuthViewIdsName(extRepoFolder.getAuthViewIdsName());
|
||||||
|
date.setAuthViewIds(extRepoFolder.getAuthViewIds());
|
||||||
|
date.setChildren(subFolderTree(extRepoFolder.getId(), new ArrayList<ERFTreeData>(),childLevel));
|
||||||
|
date.sortChildren();
|
||||||
|
childTree.add(date);
|
||||||
|
}
|
||||||
|
return childTree;
|
||||||
|
}
|
||||||
|
|
||||||
private List<String> getStringList(String listStr) {
|
private List<String> getStringList(String listStr) {
|
||||||
List<String> res = new ArrayList<>();
|
List<String> res = new ArrayList<>();
|
||||||
if (null != listStr) {
|
if (null != listStr) {
|
||||||
@@ -324,4 +348,24 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断上级是否有权限
|
||||||
|
* @param supFolder
|
||||||
|
* @param session
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void haveSuperiorManageAuth(String supFolder, HttpSession session) {
|
||||||
|
if (haveManageAuth(supFolder)) {
|
||||||
|
session.setAttribute("haveSuperiorManageAuth", true);
|
||||||
|
} else {
|
||||||
|
ExtRepoFolder extRepoFolder = queryById(supFolder);
|
||||||
|
if (ObjectUtils.isNotEmpty(extRepoFolder)) {
|
||||||
|
haveSuperiorManageAuth(extRepoFolder.getSupFolder(),session);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user