|
@@ -2,8 +2,10 @@ package cn.cslg.pas.service;
|
|
|
|
|
|
|
|
|
import cn.cslg.pas.common.model.PersonnelVO;
|
|
|
+import cn.cslg.pas.common.model.dto.SWQueryDTO;
|
|
|
import cn.cslg.pas.common.model.dto.ScratchWordsDTO;
|
|
|
import cn.cslg.pas.common.model.dto.ScratchWordsUpdateDTO;
|
|
|
+import cn.cslg.pas.common.model.vo.ScratchWordsVO;
|
|
|
import cn.cslg.pas.common.utils.CacheUtils;
|
|
|
import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
|
|
|
import cn.cslg.pas.domain.ScratchWords;
|
|
@@ -18,6 +20,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@@ -32,58 +35,80 @@ import java.util.List;
|
|
|
@Service
|
|
|
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
|
public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, ScratchWords> {
|
|
|
+ private final ScratchWordsMapper scratchWordsMapper;
|
|
|
private final CacheUtils cacheUtils;
|
|
|
private final LoginUtils loginUtils;
|
|
|
|
|
|
/**
|
|
|
* 新增划词高亮
|
|
|
*
|
|
|
- * @param scratchWordsDTOS
|
|
|
+ * @param scratchWordsDTO
|
|
|
*/
|
|
|
- public void add(List<ScratchWordsDTO> scratchWordsDTOS){
|
|
|
+ public void add(ScratchWordsDTO scratchWordsDTO){
|
|
|
ScratchWords scratchWords = new ScratchWords();
|
|
|
//判断传入列表不为空
|
|
|
- if(scratchWordsDTOS != null && scratchWordsDTOS.size() != 0){
|
|
|
- //遍历传入列表
|
|
|
- for(int i = 0; i < scratchWordsDTOS.size(); i++){
|
|
|
- ScratchWordsDTO scratchWordsDTO = scratchWordsDTOS.get(i);
|
|
|
- BeanUtils.copyProperties(scratchWordsDTO, scratchWords);
|
|
|
- //获取当前登陆人信息
|
|
|
- PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
- //设置创建人id
|
|
|
- scratchWords.setCreateId(personnelVO.getId());
|
|
|
- //数据入表
|
|
|
- scratchWords.insert();
|
|
|
- }
|
|
|
+ if(scratchWordsDTO != null){
|
|
|
+ BeanUtils.copyProperties(scratchWordsDTO, scratchWords);
|
|
|
+ //获取当前登陆人信息
|
|
|
+ PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
+ //设置创建人id
|
|
|
+ scratchWords.setCreateId(personnelVO.getId());
|
|
|
+ //设置租户id
|
|
|
+ scratchWords.setTenantId(personnelVO.getTenantId());
|
|
|
+ //数据入表
|
|
|
+ scratchWords.insert();
|
|
|
} else {
|
|
|
- throw new XiaoShiException("传入列表不能为空");
|
|
|
+ throw new XiaoShiException("传入对象不能为空");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新划词高亮
|
|
|
- * @param scratchWordsUpdateDTOS
|
|
|
+ * @param scratchWordsUpdateDTO
|
|
|
*/
|
|
|
- public void update(List<ScratchWordsUpdateDTO> scratchWordsUpdateDTOS){
|
|
|
+ public void update(ScratchWordsUpdateDTO scratchWordsUpdateDTO){
|
|
|
ScratchWords scratchWords = new ScratchWords();
|
|
|
//判断传入列表不为空
|
|
|
- if(scratchWordsUpdateDTOS != null && scratchWordsUpdateDTOS.size() != 0){
|
|
|
- //遍历传入列表
|
|
|
- for(int i = 0; i < scratchWordsUpdateDTOS.size(); i++) {
|
|
|
- ScratchWordsUpdateDTO scratchWordsUpdateDTO = scratchWordsUpdateDTOS.get(i);
|
|
|
- BeanUtils.copyProperties(scratchWordsUpdateDTO, scratchWords);
|
|
|
- scratchWordsUpdateDTO.updateById();
|
|
|
- }
|
|
|
+ if(scratchWordsUpdateDTO != null){
|
|
|
+ BeanUtils.copyProperties(scratchWordsUpdateDTO, scratchWords);
|
|
|
+ scratchWordsUpdateDTO.updateById();
|
|
|
} else {
|
|
|
- throw new XiaoShiException("传入列表不能为空");
|
|
|
+ throw new XiaoShiException("传入对象不能为空");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public List<ScratchWords> queryAll(){
|
|
|
- List<ScratchWords> scratchWords = this.list();
|
|
|
- return scratchWords;
|
|
|
+
|
|
|
+ public List<ScratchWordsVO> queryAll(SWQueryDTO swQueryDTO){
|
|
|
+ if(swQueryDTO.getPatentNo() != null && swQueryDTO.getId() != null && swQueryDTO.getCreateFrom() != null) {
|
|
|
+ //获取当前登陆人信息
|
|
|
+ PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
+ Integer tenantId = personnelVO.getTenantId();
|
|
|
+ Integer createId = personnelVO.getId();
|
|
|
+// Integer tenantId = 10;
|
|
|
+// Integer createId = 10;
|
|
|
+ if(swQueryDTO.getCreateFrom().equals(1)){
|
|
|
+ Integer projectId = swQueryDTO.getId();
|
|
|
+ Integer reportId = -1;
|
|
|
+ List<ScratchWordsVO> scratchWords = scratchWordsMapper.querySW(swQueryDTO.getPatentNo(), tenantId, createId, projectId, reportId);
|
|
|
+ return scratchWords;
|
|
|
+ }
|
|
|
+ if(swQueryDTO.getCreateFrom().equals(2)){
|
|
|
+ Integer reportId = swQueryDTO.getId();
|
|
|
+ Integer projectId = -1;
|
|
|
+ List<ScratchWordsVO> scratchWords = scratchWordsMapper.querySW(swQueryDTO.getPatentNo(), tenantId, createId, projectId, reportId);
|
|
|
+ return scratchWords;
|
|
|
+ } else {
|
|
|
+ throw new XiaoShiException("暂无该情况");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new XiaoShiException("传入参数不可为空");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除划词高亮
|
|
|
+ * @param ids
|
|
|
+ */
|
|
|
public void delete(List<Integer> ids){
|
|
|
for(int i = 0; i < ids.size(); i++){
|
|
|
LambdaQueryWrapper<ScratchWords> LW = new LambdaQueryWrapper<>();
|
|
@@ -92,4 +117,18 @@ public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, Scratch
|
|
|
scratchWords.deleteById();
|
|
|
}
|
|
|
}
|
|
|
+//
|
|
|
+// public List<ScratchWordsVO> querySW(String patentNo, Integer id, Integer type){
|
|
|
+// //多重情况考虑
|
|
|
+// //根据tenantId(公司)、patentNo(专利号),
|
|
|
+// // permissionType为1,全公司人都可见的批注;
|
|
|
+// // 查询rangeType为F的(全部地方可见);
|
|
|
+// // 查询rangeType为T的(只在来源处可见),但是要判断传入type=createFrom创建来源,传入id=rangeId;
|
|
|
+// // permissionType为0,只有自己可见的批注,需要满足登陆人信息=createId;
|
|
|
+// // 查询rangeType为F的(全部地方可见);
|
|
|
+// // 查询rangeType为T的(只在来源处可见),但是要判断传入type=createFrom创建来源,传入id=rangeId;
|
|
|
+// List<ScratchWordsVO> swVOS = new ArrayList<>();
|
|
|
+// List<ScratchWordsVO> swvos = new ArrayList<>();
|
|
|
+// swVOS.add(swvos);
|
|
|
+// }
|
|
|
}
|