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

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