修改文档对比-修改比对信息中英文显示

This commit is contained in:
gaosong
2022-08-08 23:32:48 +08:00
parent a85314bfcb
commit 76f3d12cc7
3 changed files with 190 additions and 147 deletions
@@ -1,26 +1,27 @@
package com.jero.modules.compare.controller; package com.jero.modules.compare.controller;
import java.util.Arrays; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List; import com.baomidou.mybatisplus.core.metadata.IPage;
import javax.servlet.http.HttpServletRequest; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.compare.entity.SarFileCompareResComVO; import com.jero.modules.compare.entity.SarFileCompareResComVO;
import com.jero.modules.compare.entity.SarFileCompareResComment; import com.jero.modules.compare.entity.SarFileCompareResComment;
import com.jero.modules.compare.service.ISarFileCompareResCommentService; import com.jero.modules.compare.service.ISarFileCompareResCommentService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.swagger.annotations.Api;
import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.ApiOperation;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController;
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 org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import javax.servlet.http.HttpServletRequest;
import com.jero.common.aspect.annotation.AutoLog; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/** /**
@@ -181,4 +182,13 @@ public class SarFileCompareResCommentController extends JeroController<SarFileCo
return Result.OK(list); 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);
return Result.OK(list);
}
} }
@@ -61,4 +61,6 @@ public interface ISarFileCompareResCommentService extends IService<SarFileCompar
List<SarFileCompareResComment> queryList(); List<SarFileCompareResComment> queryList();
List<SarFileCompareResComVO> queryListByInfoId(String id); List<SarFileCompareResComVO> queryListByInfoId(String id);
List<SarFileCompareResComVO> searchResComment(String id, String str);
} }
@@ -2,6 +2,7 @@ package com.jero.modules.compare.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.jero.modules.compare.entity.SarFileCompareResComVO; import com.jero.modules.compare.entity.SarFileCompareResComVO;
import com.jero.modules.compare.entity.SarFileCompareResComment; import com.jero.modules.compare.entity.SarFileCompareResComment;
import com.jero.modules.compare.mapper.SarFileCompareResCommentMapper; import com.jero.modules.compare.mapper.SarFileCompareResCommentMapper;
@@ -10,9 +11,7 @@ import com.jero.modules.system.util.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
/** /**
* @Description: 文档对比信息结果评论表 * @Description: 文档对比信息结果评论表
@@ -125,5 +124,37 @@ public class SarFileCompareResCommentServiceImpl extends ServiceImpl<SarFileComp
return resComVO; return resComVO;
} }
@Override
public List<SarFileCompareResComVO> searchResComment(String id, String str) {
if (StringUtils.isBlank(str)) {
return queryListByInfoId(id);
}
LambdaQueryWrapper<SarFileCompareResComment> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SarFileCompareResComment::getInfoId, id);
queryWrapper.like(SarFileCompareResComment::getComment, str);
queryWrapper.orderBy(true, true, SarFileCompareResComment::getCreateTime);
List<SarFileCompareResComment> list = this.list(queryWrapper);
Map<String, SarFileCompareResComVO> resCommentMap = new HashMap<>();
List<SarFileCompareResComment> subList = new ArrayList<>();
//先找到一级评论
for (SarFileCompareResComment rc : list) {
if (StringUtils.isEmpty(rc.getParentId())) {
resCommentMap.put(rc.getId(), wrapperSarFileCompareResComVO(rc));
} else {
subList.add(rc);
}
}
//把回复评论放进一级评论下,没有一级评论要查出来放上
for (SarFileCompareResComment rc : subList) {
if (resCommentMap.keySet().contains(rc.getParentId())) {
resCommentMap.get(rc.getParentId()).addResComVo(wrapperSarFileCompareResComVO(rc));
} else {
SarFileCompareResComment prc = this.queryById(rc.getParentId());
SarFileCompareResComVO prcVo = wrapperSarFileCompareResComVO(prc);
prcVo.addResComVo(wrapperSarFileCompareResComVO(rc));
resCommentMap.put(prcVo.getId(), prcVo);
}
}
return Lists.newArrayList(resCommentMap.values());
}
} }