修改文档对比-修改搜索评论和导出文件的接口

This commit is contained in:
gaosong
2022-08-09 09:45:26 +08:00
parent 6307e1ef28
commit ec24b084e6
6 changed files with 25 additions and 45 deletions
@@ -21,7 +21,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
@@ -162,10 +161,12 @@ public class SarFileCompareItemCommentController extends JeroController<SarFileC
@AutoLog(value = "文档对比信息条款评论表-导出结果")
@ApiOperation(value = "文档对比信息条款评论表-导出结果", notes = "文档对比信息条款评论表-导出结果")
@GetMapping(value = "/exportResXls")
public Result<?> exportResXls(@RequestParam Map<String, Object> map,
HttpServletResponse response,
HttpServletRequest request) {
sarFileCompareItemCommentService.exportResXls(map, response, request);
public Result<?> exportResXls(@RequestParam(name = "infoId", required = true) String infoId,
@RequestParam(name = "selectIds", required = true) String selectIds,
@RequestParam(name = "includeComments", required = true) boolean includeComments,
@RequestParam(name = "cut", required = true) String cut,
HttpServletResponse response) {
sarFileCompareItemCommentService.exportResXls(response, infoId, selectIds, includeComments, cut);
return Result.OK();
}
@@ -177,17 +177,9 @@ public class SarFileCompareResCommentController extends JeroController<SarFileCo
@AutoLog(value = "文档对比信息结果评论表-根据infoId查询列表")
@ApiOperation(value = "文档对比信息结果评论表-根据infoId查询列表", notes = "文档对比信息结果评论表-根据infoId查询列表")
@GetMapping(value = "/queryListByInfoId")
public Result<List<SarFileCompareResComVO>> queryListByInfoId(@RequestParam(name = "id", required = true) String id) {
List<SarFileCompareResComVO> list = sarFileCompareResCommentService.queryListByInfoId(id);
return Result.OK(list);
}
@AutoLog(value = "文档对比信息结果评论表-搜索评论")
@ApiOperation(value = "文档对比信息结果评论表-搜索评论", notes = "文档对比信息结果评论表-搜索评论")
@GetMapping(value = "/searchResComment")
public Result<List<SarFileCompareResComVO>> searchResComment(@RequestParam(name = "id", required = true) String id,
@RequestParam(name = "str", required = true) String str) {
List<SarFileCompareResComVO> list = sarFileCompareResCommentService.searchResComment(id, str);
public Result<List<SarFileCompareResComVO>> queryListByInfoId(@RequestParam(name = "id", required = true) String id,
@RequestParam(name = "str") String str) {
List<SarFileCompareResComVO> list = sarFileCompareResCommentService.queryListByInfoId(id, str);
return Result.OK(list);
}
@@ -67,7 +67,5 @@ public interface ISarFileCompareItemCommentService extends IService<SarFileCompa
SarFileCompareResultVO queryCompareResult(String infoId);
void exportResXls(Map<String, Object> map,
HttpServletResponse response,
HttpServletRequest request);
void exportResXls(HttpServletResponse response, String infoId, String selectIds, boolean includeComments, String cut);
}
@@ -60,7 +60,6 @@ public interface ISarFileCompareResCommentService extends IService<SarFileCompar
*/
List<SarFileCompareResComment> queryList();
List<SarFileCompareResComVO> queryListByInfoId(String id);
List<SarFileCompareResComVO> queryListByInfoId(String id, String str);
List<SarFileCompareResComVO> searchResComment(String id, String str);
}
@@ -17,10 +17,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
@@ -170,13 +167,7 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
}
@Override
public void exportResXls(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request) {
String cut = (String) map.get("cut");
//是否包含评论
String includeComments = (String) map.get("includeComments");
String infoId = (String) map.get("infoId");
String selectIds = (String) map.get("selectIds");
public void exportResXls(HttpServletResponse response, String infoId, String selectIds, boolean includeComments, String cut) {
LambdaQueryWrapper<SarFileCompareItemComment> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SarFileCompareItemComment::getInfoId, infoId);
if (!StringUtils.isEmpty(selectIds)) {
@@ -239,18 +230,18 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
row.createCell(6).setCellValue(itemComment.getComment());
i++;
}
if (!StringUtils.isEmpty(includeComments) && includeComments.equals("1")) {
Row row = sheet.createRow(i);
if (CutEnum.CN.getValue().equals(cut)) {
row.createCell(0).setCellValue("全文评论");
} else {
row.createCell(0).setCellValue("The full text comments");
}
//合并单元格
CellRangeAddress rangeAddress = new CellRangeAddress(row.getRowNum(), row.getRowNum(), 1, 6);
sheet.addMergedRegion(rangeAddress);
SarFileCompareInfo compareInfo = sarFileCompareInfoServiceImpl.queryById(infoId);
row.createCell(1).setCellValue(compareInfo.getComments());
if (includeComments) {
Row row = sheet.createRow(i);
if (CutEnum.CN.getValue().equals(cut)) {
row.createCell(0).setCellValue("全文评论");
} else {
row.createCell(0).setCellValue("The full text comments");
}
//合并单元格
CellRangeAddress rangeAddress = new CellRangeAddress(row.getRowNum(), row.getRowNum(), 1, 6);
sheet.addMergedRegion(rangeAddress);
SarFileCompareInfo compareInfo = sarFileCompareInfoServiceImpl.queryById(infoId);
row.createCell(1).setCellValue(compareInfo.getComments());
}
for (int j = 0; j < 7; j++) {
sheet.autoSizeColumn(j, true);//设置列宽
@@ -94,7 +94,6 @@ public class SarFileCompareResCommentServiceImpl extends ServiceImpl<SarFileComp
return list();
}
@Override
public List<SarFileCompareResComVO> queryListByInfoId(String id) {
LambdaQueryWrapper<SarFileCompareResComment> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SarFileCompareResComment::getInfoId, id);
@@ -125,7 +124,7 @@ public class SarFileCompareResCommentServiceImpl extends ServiceImpl<SarFileComp
}
@Override
public List<SarFileCompareResComVO> searchResComment(String id, String str) {
public List<SarFileCompareResComVO> queryListByInfoId(String id, String str) {
if (StringUtils.isBlank(str)) {
return queryListByInfoId(id);
}