|
@@ -0,0 +1,134 @@
|
|
|
+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;
|
|
|
+
|
|
|
+import cn.cslg.pas.exception.XiaoShiException;
|
|
|
+import cn.cslg.pas.mapper.ScratchWordsMapper;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 划词高亮表 服务类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author 李仁杰
|
|
|
+ * @since 2023-06-13
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
|
+public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, ScratchWords> {
|
|
|
+ private final ScratchWordsMapper scratchWordsMapper;
|
|
|
+ private final CacheUtils cacheUtils;
|
|
|
+ private final LoginUtils loginUtils;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增划词高亮
|
|
|
+ *
|
|
|
+ * @param scratchWordsDTO
|
|
|
+ */
|
|
|
+ public void add(ScratchWordsDTO scratchWordsDTO){
|
|
|
+ ScratchWords scratchWords = new ScratchWords();
|
|
|
+ //判断传入列表不为空
|
|
|
+ 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("传入对象不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新划词高亮
|
|
|
+ * @param scratchWordsUpdateDTO
|
|
|
+ */
|
|
|
+ public void update(ScratchWordsUpdateDTO scratchWordsUpdateDTO){
|
|
|
+ ScratchWords scratchWords = new ScratchWords();
|
|
|
+ //判断传入列表不为空
|
|
|
+ if(scratchWordsUpdateDTO != null){
|
|
|
+ BeanUtils.copyProperties(scratchWordsUpdateDTO, scratchWords);
|
|
|
+ scratchWords.updateById();
|
|
|
+ } else {
|
|
|
+ throw new XiaoShiException("传入对象不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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<>();
|
|
|
+ LW.eq(ScratchWords::getId, ids.get(i));
|
|
|
+ ScratchWords scratchWords = this.getOne(LW);
|
|
|
+ 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);
|
|
|
+// }
|
|
|
+}
|