|
@@ -1,21 +1,25 @@
|
|
|
package cn.cslg.pas.service.business;
|
|
|
|
|
|
+import cn.cslg.pas.common.dto.business.OtherPatentInfoDTO;
|
|
|
import cn.cslg.pas.common.dto.business.OtherReferencesDTO;
|
|
|
import cn.cslg.pas.common.model.cronModel.Personnel;
|
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
|
+import cn.cslg.pas.common.model.cronModel.Records;
|
|
|
+import cn.cslg.pas.common.model.cronModel.SystemFile;
|
|
|
import cn.cslg.pas.common.utils.CacheUtils;
|
|
|
import cn.cslg.pas.common.utils.LoginUtils;
|
|
|
import cn.cslg.pas.common.utils.StringUtils;
|
|
|
-import cn.cslg.pas.common.vo.business.LitigationHistoryVO;
|
|
|
import cn.cslg.pas.common.vo.business.OtherReferencesVO;
|
|
|
-import cn.cslg.pas.domain.business.AssoOtherReferencesFile;
|
|
|
-import cn.cslg.pas.domain.business.LitigationHistory;
|
|
|
+import cn.cslg.pas.domain.business.AssoOtherPatentInfoFile;
|
|
|
import cn.cslg.pas.domain.business.OtherReferences;
|
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
|
import cn.cslg.pas.mapper.OtherReferencesMapper;
|
|
|
+import cn.cslg.pas.service.common.FileManagerService;
|
|
|
import cn.cslg.pas.service.permissions.PermissionService;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -45,7 +49,10 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
|
|
|
private PermissionService permissionService;
|
|
|
|
|
|
@Autowired
|
|
|
- private AssoOtherReferencesFileService assoReferencesFileService;
|
|
|
+ private AssoOtherPatentInfoFileService assoOtherPatentInfoFileService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FileManagerService fileManagerService;
|
|
|
|
|
|
/**
|
|
|
* 新增or更新其他参考资料
|
|
@@ -59,17 +66,19 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
|
|
|
Integer id = otherReferencesDTO.getId();
|
|
|
List<String> fileGuids = otherReferencesDTO.getFileGuids();
|
|
|
OtherReferences otherReferences = new OtherReferences();
|
|
|
+ Integer type = 1;
|
|
|
if (id != null) {
|
|
|
//update
|
|
|
otherReferences = this.getById(id);
|
|
|
BeanUtils.copyProperties(otherReferencesDTO, otherReferences);
|
|
|
otherReferences.updateById();
|
|
|
//先删除 后添加
|
|
|
- LambdaQueryWrapper<AssoOtherReferencesFile> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(AssoOtherReferencesFile::getOtherReferencesId, id);
|
|
|
- assoReferencesFileService.remove(queryWrapper);
|
|
|
+ LambdaQueryWrapper<AssoOtherPatentInfoFile> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(AssoOtherPatentInfoFile::getOtherPatentInfoId, id)
|
|
|
+ .eq(AssoOtherPatentInfoFile::getType, type);
|
|
|
+ assoOtherPatentInfoFileService.remove(queryWrapper);
|
|
|
if (!fileGuids.isEmpty()) {
|
|
|
- List<Integer> fileIds = this.addFile(otherReferences.getId(), fileGuids);
|
|
|
+ List<Integer> fileIds = this.addFile(otherReferences.getId(), fileGuids, type);
|
|
|
}
|
|
|
} else {
|
|
|
BeanUtils.copyProperties(otherReferencesDTO, otherReferences);
|
|
@@ -83,7 +92,7 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
|
|
|
otherReferences.insert();
|
|
|
if (!fileGuids.isEmpty()) {
|
|
|
//先删除 后添加
|
|
|
- List<Integer> fileIds = this.addFile(otherReferences.getId(), fileGuids);
|
|
|
+ List<Integer> fileIds = this.addFile(otherReferences.getId(), fileGuids, type);
|
|
|
}
|
|
|
}
|
|
|
return otherReferences.getId();
|
|
@@ -93,37 +102,46 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
|
|
|
* 新增文件与其他参考资料关联
|
|
|
* @param id
|
|
|
* @param fileGuids
|
|
|
+ * @param type
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<Integer> addFile(Integer id, List<String> fileGuids){
|
|
|
+ public List<Integer> addFile(Integer id, List<String> fileGuids, Integer type){
|
|
|
List<Integer> ids = new ArrayList<>();
|
|
|
if (!fileGuids.isEmpty()) {
|
|
|
- List<AssoOtherReferencesFile> assoOtherReferencesFiles = new ArrayList<>();
|
|
|
+ List<AssoOtherPatentInfoFile> assoOtherPatentInfoFiles = new ArrayList<>();
|
|
|
fileGuids.forEach(item -> {
|
|
|
- AssoOtherReferencesFile assoOtherReferencesFile = new AssoOtherReferencesFile();
|
|
|
- assoOtherReferencesFile.setOtherReferencesId(id);
|
|
|
- assoOtherReferencesFile.setFileGuid(item);
|
|
|
- assoOtherReferencesFiles.add(assoOtherReferencesFile);
|
|
|
+ AssoOtherPatentInfoFile assoOtherPatentInfoFile = new AssoOtherPatentInfoFile();
|
|
|
+ assoOtherPatentInfoFile.setOtherPatentInfoId(id);
|
|
|
+ assoOtherPatentInfoFile.setType(type);
|
|
|
+ assoOtherPatentInfoFile.setFileGuid(item);
|
|
|
+ assoOtherPatentInfoFiles.add(assoOtherPatentInfoFile);
|
|
|
});
|
|
|
- assoReferencesFileService.saveBatch(assoOtherReferencesFiles);
|
|
|
+ assoOtherPatentInfoFileService.saveBatch(assoOtherPatentInfoFiles);
|
|
|
}
|
|
|
return ids;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 查询
|
|
|
- * @param patentNo
|
|
|
+ * 分页查询
|
|
|
+ * @param otherPatentInfoDTO
|
|
|
* @return
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- public List<OtherReferencesVO> getOtherReferences(String patentNo) throws IOException {
|
|
|
+ public Records getOtherReferences(OtherPatentInfoDTO otherPatentInfoDTO) throws IOException {
|
|
|
+ List<OtherReferencesVO> otherReferencesVOS = new ArrayList<>();
|
|
|
+ String patentNo = otherPatentInfoDTO.getPatentNo();
|
|
|
if (patentNo == null || StringUtils.isEmpty(patentNo)) {
|
|
|
throw new XiaoShiException("入参为空");
|
|
|
}
|
|
|
- List<OtherReferencesVO> otherReferencesVOS = new ArrayList<>();
|
|
|
+ Integer current = otherPatentInfoDTO.getCurrent();
|
|
|
+ Integer size = otherPatentInfoDTO.getSize();
|
|
|
+ Page<OtherReferences> page = new Page<>(current, size);
|
|
|
+
|
|
|
LambdaQueryWrapper<OtherReferences> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(OtherReferences::getPatentNo, patentNo);
|
|
|
- List<OtherReferences> otherReferencesList = this.list(queryWrapper);
|
|
|
+ IPage<OtherReferences> otherReferencesPage = this.page(page, queryWrapper);
|
|
|
+ List<OtherReferences> otherReferencesList = otherReferencesPage.getRecords();
|
|
|
+ long total = otherReferencesPage.getTotal();
|
|
|
|
|
|
if (!otherReferencesList.isEmpty()) {
|
|
|
otherReferencesList.forEach(item -> {
|
|
@@ -133,7 +151,12 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
|
|
|
});
|
|
|
this.loadOtherReferencesVOS(otherReferencesVOS);
|
|
|
}
|
|
|
- return otherReferencesVOS;
|
|
|
+ Records records = new Records();
|
|
|
+ records.setTotal(total);
|
|
|
+ records.setCurrent((long)current);
|
|
|
+ records.setSize((long) size);
|
|
|
+ records.setData(otherReferencesVOS);
|
|
|
+ return records;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -162,13 +185,23 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
|
|
|
if (personnel != null) {
|
|
|
otherReferencesVO.setCreateName(personnel.getPersonnelName());
|
|
|
}
|
|
|
- LambdaQueryWrapper<AssoOtherReferencesFile> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(AssoOtherReferencesFile::getOtherReferencesId, otherReferencesVO.getId());
|
|
|
- List<AssoOtherReferencesFile> assoOtherReferencesFiles = assoReferencesFileService.list(queryWrapper);
|
|
|
- if (!assoOtherReferencesFiles.isEmpty()) {
|
|
|
- List<String> fileGuids = assoOtherReferencesFiles.stream().map(AssoOtherReferencesFile::getFileGuid).collect(Collectors.toList());
|
|
|
+ LambdaQueryWrapper<AssoOtherPatentInfoFile> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(AssoOtherPatentInfoFile::getOtherPatentInfoId, otherReferencesVO.getId())
|
|
|
+ .eq(AssoOtherPatentInfoFile::getType, 1);
|
|
|
+ List<AssoOtherPatentInfoFile> assoOtherPatentInfoFiles = assoOtherPatentInfoFileService.list(queryWrapper);
|
|
|
+ if (!assoOtherPatentInfoFiles.isEmpty()) {
|
|
|
+ List<String> fileGuids = assoOtherPatentInfoFiles.stream().map(AssoOtherPatentInfoFile::getFileGuid).collect(Collectors.toList());
|
|
|
otherReferencesVO.setFileGuids(fileGuids);
|
|
|
+ List<SystemFile> systemFiles = new ArrayList<>();
|
|
|
+ if (fileGuids.size() != 0) {
|
|
|
+ String res = fileManagerService.getSystemFileFromFMS(fileGuids);
|
|
|
+ systemFiles = JSONObject.parseArray(res, SystemFile.class);
|
|
|
+ }
|
|
|
+ if (!systemFiles.isEmpty()) {
|
|
|
+ otherReferencesVO.setSystemFileList(systemFiles);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -181,9 +214,10 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
|
|
|
public List<Integer> deleteOtherReferences(List<Integer> ids) {
|
|
|
if (!ids.isEmpty()) {
|
|
|
//先删除附件
|
|
|
- LambdaQueryWrapper<AssoOtherReferencesFile> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.in(AssoOtherReferencesFile::getOtherReferencesId, ids);
|
|
|
- assoReferencesFileService.remove(queryWrapper);
|
|
|
+ LambdaQueryWrapper<AssoOtherPatentInfoFile> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(AssoOtherPatentInfoFile::getOtherPatentInfoId, ids)
|
|
|
+ .eq(AssoOtherPatentInfoFile::getType, 1);
|
|
|
+ assoOtherPatentInfoFileService.remove(queryWrapper);
|
|
|
this.removeBatchByIds(ids);
|
|
|
}
|
|
|
return ids;
|