|
@@ -1,19 +1,181 @@
|
|
|
package cn.cslg.report.service.business.InvalidReReport;
|
|
|
|
|
|
+import cn.cslg.report.common.model.dto.invalidReReport.ArgumentsDTO;
|
|
|
+import cn.cslg.report.common.model.dto.invalidReReport.ArgumentsQueryDTO;
|
|
|
+import cn.cslg.report.common.model.vo.invalidReReport.ArgumentsVO;
|
|
|
+import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
|
|
|
import cn.cslg.report.entity.invalidReReport.Arguments;
|
|
|
import cn.cslg.report.entity.invalidReReport.AssoArguments;
|
|
|
+import cn.cslg.report.entity.invalidReReport.Proof;
|
|
|
+import cn.cslg.report.entity.invalidReReport.Scratch;
|
|
|
import cn.cslg.report.mapper.InvalidReReport.ArgumentsMapper;
|
|
|
import cn.cslg.report.mapper.InvalidReReport.AssoArgumentsMapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import io.swagger.v3.oas.models.security.SecurityScheme;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
|
-public class ArgumentsService extends ServiceImpl<ArgumentsMapper,Arguments> {
|
|
|
+public class ArgumentsService extends ServiceImpl<ArgumentsMapper, Arguments> {
|
|
|
+ private static ProofService proofService;
|
|
|
+ private static LoginUtils loginUtils;
|
|
|
+ private static ScratchService scratchService;
|
|
|
+ private static AssoArgumentsService assoArgumentsService;
|
|
|
+ /**
|
|
|
+ * 添加陈述意见
|
|
|
+ *
|
|
|
+ * @param argumentsDTO
|
|
|
+ */
|
|
|
+ public void addArguments(ArgumentsDTO argumentsDTO) {
|
|
|
+ // 检验参数
|
|
|
+ if (argumentsDTO == null||argumentsDTO.getReportId() == null || argumentsDTO.getFeatureId() == null || argumentsDTO.getRightId() == null||argumentsDTO.getProofId()==null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Integer loginId=loginUtils.getId();
|
|
|
+ //装载陈述意见实体类
|
|
|
+ Arguments arguments = new Arguments();
|
|
|
+ BeanUtils.copyProperties(argumentsDTO, arguments);
|
|
|
+ arguments.setCreateId(loginId);
|
|
|
+ arguments.insert();
|
|
|
+ //若划词不为空
|
|
|
+ if(argumentsDTO.getContent()!=null){
|
|
|
+ Scratch scratch =new Scratch();
|
|
|
+ BeanUtils.copyProperties(argumentsDTO,scratch);
|
|
|
+ //根据证据类型获得证据的专利号
|
|
|
+ Proof proof = proofService.getById(arguments.getProofId());
|
|
|
+ String patenNo =proof.getPatentNo();
|
|
|
+ scratch.setPatentNo(patenNo);
|
|
|
+ scratch.setCreateId(loginId);
|
|
|
+ scratch.insert();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询陈述意见详情
|
|
|
+ *
|
|
|
+ * @param argumentsId
|
|
|
+ */
|
|
|
+ public ArgumentsVO queryArgumentsDetail(Integer argumentsId) {
|
|
|
+ //判断argumentsId是否为空
|
|
|
+ if(argumentsId==null){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ ArgumentsVO argumentsVO =new ArgumentsVO();
|
|
|
+ //根据argumentsId查询陈述意见
|
|
|
+ Arguments arguments =this.getById(argumentsId);
|
|
|
+ BeanUtils.copyProperties(arguments,argumentsVO);
|
|
|
+ //根据证据id获得专利号
|
|
|
+ Proof proof =proofService.getById(arguments.getProofId());
|
|
|
+ if(proof.getPatentNo()!=null){
|
|
|
+ //根据专利号和报告id获得划词内容
|
|
|
+ LambdaQueryWrapper<Scratch> scratchLambdaQueryWrapper =new LambdaQueryWrapper<>();
|
|
|
+ scratchLambdaQueryWrapper.eq(Scratch::getPatentNo,proof.getPatentNo());
|
|
|
+ scratchLambdaQueryWrapper.eq(Scratch::getReportId,arguments.getReportId());
|
|
|
+ List<Scratch> scratchList =scratchService.list(scratchLambdaQueryWrapper);
|
|
|
+ if(scratchList.size()>0){
|
|
|
+ Scratch scratch =scratchList.get(0);
|
|
|
+ BeanUtils.copyProperties(scratch,argumentsVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return argumentsVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除陈述意见详情
|
|
|
+ *
|
|
|
+ * @param argumentsIds
|
|
|
+ */
|
|
|
+ public void deleteArguments(List<Integer> argumentsIds) {
|
|
|
+ //判断argumentsId是否为空
|
|
|
+ if(argumentsIds==null){
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ //判断陈述意见方案中是否有正在使用的陈述意见
|
|
|
+ LambdaQueryWrapper<AssoArguments> assoArgumentsWrapper=new LambdaQueryWrapper<>();
|
|
|
+ assoArgumentsWrapper.in(AssoArguments::getArgumentId,argumentsIds);
|
|
|
+ List<AssoArguments> assoArguments =assoArgumentsService.list(assoArgumentsWrapper);
|
|
|
+ if(assoArguments.size()>0){
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ //根据argumentsId查询陈述意见
|
|
|
+ LambdaQueryWrapper<Arguments> argumentsWrapper=new LambdaQueryWrapper<>();
|
|
|
+ argumentsWrapper.in(Arguments::getId,argumentsIds);
|
|
|
+ List<Arguments> arguments =this.list(argumentsWrapper);
|
|
|
+ List<Integer> proofIds =arguments.stream().map(Arguments::getProofId).collect(Collectors.toList());
|
|
|
+ //根据proofIds获得proof
|
|
|
+ LambdaQueryWrapper<Proof> proofWrapper =new LambdaQueryWrapper<>();
|
|
|
+ proofWrapper.in(Proof::getId,proofIds);
|
|
|
+ List<Proof> proofs = proofService.list(proofWrapper);
|
|
|
+ List<String> patentNos =proofs.stream().map(Proof::getPatentNo).collect(Collectors.toList());
|
|
|
+ if(patentNos.size()>0){
|
|
|
+ //根据专利号和报告id获得划词内容
|
|
|
+ LambdaQueryWrapper<Scratch> scratchLambdaQueryWrapper =new LambdaQueryWrapper<>();
|
|
|
+ scratchLambdaQueryWrapper.in(Scratch::getPatentNo,patentNos);
|
|
|
+ scratchLambdaQueryWrapper.eq(Scratch::getReportId,arguments.get(0).getReportId());
|
|
|
+ scratchService.remove(scratchLambdaQueryWrapper);
|
|
|
+ }
|
|
|
+ this.remove(argumentsWrapper);
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询陈述意见列表
|
|
|
+ *
|
|
|
+ * @param argumentsQueryDTO
|
|
|
+ */
|
|
|
+ public void queryArguments(ArgumentsQueryDTO argumentsQueryDTO) {
|
|
|
+ //判断reportId是否为空
|
|
|
+ if(argumentsQueryDTO.getReportId()==null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<Arguments> argumentsLambdaQueryWrapper =new LambdaQueryWrapper<>();
|
|
|
+ argumentsLambdaQueryWrapper.eq(Arguments::getReportId,argumentsQueryDTO.getReportId());
|
|
|
+ if(argumentsQueryDTO.getReportId()!=null){
|
|
|
+ argumentsLambdaQueryWrapper.eq(Arguments::getRightId,argumentsQueryDTO.getRightId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加陈述意见
|
|
|
+ *
|
|
|
+ * @param argumentsDTO
|
|
|
+ */
|
|
|
+ public void updateArgumentsBatch(ArgumentsDTO argumentsDTO) {
|
|
|
+ // 检验参数
|
|
|
+ if (argumentsDTO == null||argumentsDTO.getReportId() == null || argumentsDTO.getFeatureId() == null || argumentsDTO.getRightId() == null||argumentsDTO.getProofId()==null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Integer loginId=loginUtils.getId();
|
|
|
+ //装载陈述意见实体类
|
|
|
+ Arguments arguments = new Arguments();
|
|
|
+ BeanUtils.copyProperties(argumentsDTO, arguments);
|
|
|
+ arguments.setCreateId(loginId);
|
|
|
+ arguments.insert();
|
|
|
+ //若划词不为空
|
|
|
+ if(argumentsDTO.getContent()!=null){
|
|
|
+ Scratch scratch =new Scratch();
|
|
|
+ BeanUtils.copyProperties(argumentsDTO,scratch);
|
|
|
+ //根据证据类型获得证据的专利号
|
|
|
+ Proof proof = proofService.getById(arguments.getProofId());
|
|
|
+ String patenNo =proof.getPatentNo();
|
|
|
+ scratch.setPatentNo(patenNo);
|
|
|
+ scratch.setCreateId(loginId);
|
|
|
+ scratch.insert();
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
}
|