|
@@ -2,14 +2,11 @@ package cn.cslg.report.service.impl;
|
|
|
|
|
|
import cn.cslg.report.common.model.dto.AvoidDesignDirectionDTO;
|
|
|
import cn.cslg.report.common.model.dto.AvoidDesignLittleDirectionDTO;
|
|
|
-import cn.cslg.report.common.model.dto.AvoidFeatures;
|
|
|
-import cn.cslg.report.common.model.vo.AvoidDesignDirectionVO;
|
|
|
-import cn.cslg.report.common.utils.CacheUtils;
|
|
|
-import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
|
|
|
-import cn.cslg.report.entity.AssoAvoidDesignWholeLittleDirection;
|
|
|
-import cn.cslg.report.entity.AvoidDesignLittleDirection;
|
|
|
-import cn.cslg.report.entity.AvoidDesignWholeDirection;
|
|
|
-import cn.cslg.report.entity.PatentRight;
|
|
|
+import cn.cslg.report.common.model.dto.AvoidFeaturesDTO;
|
|
|
+import cn.cslg.report.common.model.vo.AvoidDesignRightVO;
|
|
|
+import cn.cslg.report.common.model.vo.AvoidDesignWholeVO;
|
|
|
+import cn.cslg.report.common.model.vo.AvoidFeaturesVO;
|
|
|
+import cn.cslg.report.entity.*;
|
|
|
import cn.cslg.report.exception.XiaoShiException;
|
|
|
import cn.cslg.report.mapper.AssoAvoidDesignWholeLittleDirectionMapper;
|
|
|
import cn.cslg.report.mapper.AvoidDesignLittleDirectionMapper;
|
|
@@ -17,10 +14,12 @@ import cn.cslg.report.mapper.AvoidDesignWholeDirectionMapper;
|
|
|
import cn.cslg.report.mapper.AvoidFeatureMapper;
|
|
|
import cn.cslg.report.service.IAvoidDesignDirectionService;
|
|
|
import cn.cslg.report.service.OutInterfaceService;
|
|
|
+import cn.cslg.report.service.business.FeatureService;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
|
@@ -28,7 +27,7 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
- * 回避设计方向的Service层接口实现类
|
|
|
+ * 回避设计方案的Service层接口实现类
|
|
|
*
|
|
|
* @Author chenyu
|
|
|
* @Data 2023/2/2
|
|
@@ -42,6 +41,7 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
private final AssoAvoidDesignWholeLittleDirectionMapper assoAvoidDesignWholeLittleDirectionMapper; //回避设计总体方向和方向关联表的Mapper层接口装配
|
|
|
private final AvoidFeatureMapper avoidFeatureMapper; //特征标的Mapper层接口装配
|
|
|
private final OutInterfaceService outInterfaceService;
|
|
|
+ private final FeatureService featureService;
|
|
|
//private final CacheUtils cacheUtils;
|
|
|
//private final LoginUtils loginUtils;
|
|
|
|
|
@@ -62,10 +62,10 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
.setReportId(reportId)
|
|
|
.setWholeDirection(wholeDirection);
|
|
|
//先根据报告id删除原有回避设计总体方向表数据
|
|
|
- log.info("先根据报告id删除原有回避设计总体方向表数据");
|
|
|
+ log.info("删除原有回避设计总体方向表数据");
|
|
|
avoidDesignWholeDirectionMapper.deleteByReportId(reportId);
|
|
|
//将数据插入回避设计总体方向表
|
|
|
- log.info("将数据插入回避设计总体方向表");
|
|
|
+ log.info("新增数据插入回避设计总体方向表");
|
|
|
int rows = avoidDesignWholeDirectionMapper.insert(avoidDesignWholeDirection);
|
|
|
if (rows != 1) {
|
|
|
String message = "数据插入回避设计总体方向表失败,新增回避设计方案失败(数据已回滚),服务器忙请稍后再次尝试";
|
|
@@ -78,21 +78,24 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
//遍历集合取出每个权要的特征数据插入特征表,插入后取出每个特征的特征featureId和回避设计方向littleDirection存入回避设计方向表
|
|
|
List<AvoidFeatures> avoidFeatures = new ArrayList<>();
|
|
|
for (AvoidDesignLittleDirectionDTO avoidDesignLittleDirectionDTO : avoidDesignLittleDirectionDTOs) {
|
|
|
- avoidFeatures.addAll(avoidDesignLittleDirectionDTO.getFeatures());
|
|
|
- }
|
|
|
- //获取特征拆分人ID(即获取当前登陆人的id)
|
|
|
- //PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
- //Integer partnerId = personnelVO.getId();
|
|
|
- //遍历清空特征集合中前端传来的初始特征id
|
|
|
- for (AvoidFeatures avoidFeature : avoidFeatures) {
|
|
|
- avoidFeature.setId(null);
|
|
|
+ List<AvoidFeaturesDTO> featuresDTOS = avoidDesignLittleDirectionDTO.getFeatures();
|
|
|
+ //avoidFeatures.addAll(features);
|
|
|
+ for (AvoidFeaturesDTO featuresDTO : featuresDTOS) {
|
|
|
+ AvoidFeatures avoidFeature = new AvoidFeatures();
|
|
|
+ BeanUtils.copyProperties(featuresDTO, avoidFeature);
|
|
|
+ avoidFeatures.add(avoidFeature);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//先根据报告id删除原有特征表数据
|
|
|
- log.info("先根据报告id删除原有特征表数据");
|
|
|
+ log.info("删除原有特征表数据");
|
|
|
avoidFeatureMapper.deleteByReportId(reportId);
|
|
|
+ //遍历清空特征集合中前端传来的初始特征id
|
|
|
+ //for (AvoidFeatures avoidFeature : avoidFeatures) {
|
|
|
+ // avoidFeature.setId(null);
|
|
|
+ //}
|
|
|
//批量插入特征数据,插入特征表后再遍历取出特征featureId和回避设计方向littleDirection,存入回避设计方向表实体类对象集合
|
|
|
- log.info("将数据插入特征表,特征数据量:{}个", avoidFeatures.size());
|
|
|
+ log.info("新增数据插入特征表");
|
|
|
rows = avoidFeatureMapper.insertBatch(avoidFeatures);
|
|
|
if (rows != avoidFeatures.size()) {
|
|
|
String message = "数据插入特征表失败,新增回避设计方案失败(数据已回滚),服务器忙请稍后再次尝试";
|
|
@@ -103,18 +106,20 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
List<AvoidDesignLittleDirection> avoidDesignLittleDirections = new ArrayList<>();
|
|
|
for (AvoidFeatures avoidFeature : avoidFeatures) {
|
|
|
Integer featureId = avoidFeature.getId();
|
|
|
+ Integer rightId = avoidFeature.getRightId();
|
|
|
String littleDirection = avoidFeature.getLittleDirection();
|
|
|
AvoidDesignLittleDirection avoidDesignLittleDirection = new AvoidDesignLittleDirection()
|
|
|
.setReportId(reportId)
|
|
|
.setFeatureId(featureId)
|
|
|
+ .setRightId(rightId)
|
|
|
.setLittleDirection(littleDirection);
|
|
|
avoidDesignLittleDirections.add(avoidDesignLittleDirection);
|
|
|
}
|
|
|
//先根据报告id删除原有回避设计方向表数据
|
|
|
- log.info("先根据报告id删除原有回避设计方向表数据");
|
|
|
+ log.info("删除原有回避设计方向表数据");
|
|
|
avoidDesignLittleDirectionMapper.deleteByReportId(reportId);
|
|
|
//将数据插入回避设计方向表
|
|
|
- log.info("将数据插入回避设计方向表");
|
|
|
+ log.info("新增数据插入回避设计方向表");
|
|
|
rows = avoidDesignLittleDirectionMapper.insertBatch(avoidDesignLittleDirections);
|
|
|
if (rows != avoidDesignLittleDirections.size()) {
|
|
|
String message = "数据插入回避设计方向表失败,新增回避设计方案失败(数据已回滚),服务器忙请稍后再次尝试";
|
|
@@ -139,10 +144,10 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
assoAvoidDesignWholeLittleDirections.add(assoAvoidDesignWholeLittleDirection);
|
|
|
}
|
|
|
//先根据报告id删除原有回避设计总体方向和回避设计方向关联表数据
|
|
|
- log.info("先根据报告id删除原有回避设计总体方向和回避设计方向关联表数据");
|
|
|
+ log.info("删除原有回避设计总体方向和回避设计方向关联表数据");
|
|
|
assoAvoidDesignWholeLittleDirectionMapper.deleteByReportId(reportId);
|
|
|
//将数据插入回避设计总体方向和回避设计方向关联表
|
|
|
- log.info("将数据插入回避设计总体方向和回避设计方向关联表");
|
|
|
+ log.info("新增数据插入回避设计总体方向和回避设计方向关联表");
|
|
|
rows = assoAvoidDesignWholeLittleDirectionMapper.insertBatch(assoAvoidDesignWholeLittleDirections);
|
|
|
if (rows != assoAvoidDesignWholeLittleDirections.size()) {
|
|
|
String message = "数据插入回避设计总体方向和回避设计方向关联表失败,新增回避设计方案失败(数据已回滚),服务器忙请稍后再次尝试";
|
|
@@ -155,16 +160,42 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<AvoidDesignDirectionVO> getAvoidDesignDirection(Integer reportId) {
|
|
|
+ public AvoidDesignWholeVO getAvoidDesignDirection(Integer reportId) {
|
|
|
log.info("开始处理【查询回避设计方案】的业务,参数为:{}", reportId);
|
|
|
- List<AvoidDesignDirectionVO> queryResults = avoidDesignLittleDirectionMapper.selectWholeByReportId(reportId);
|
|
|
-// 从pas获得权要信息
|
|
|
-// String resBody = null;
|
|
|
-// resBody = outInterfaceService.getPatentRightFromPAS(patentNo);
|
|
|
-// JSONObject jsonObject = JSONObject.parseObject(resBody);
|
|
|
-// 解析jason获得标的专利的权要
|
|
|
-// List<PatentRight> patentRightsOrgin = JSON.parseArray(jsonObject.getString("data"), PatentRight.class);
|
|
|
- return queryResults;
|
|
|
+ String signPatentNo = avoidDesignLittleDirectionMapper.selectSignPatentNoByReportId(reportId);
|
|
|
+ //从pas获得权要信息
|
|
|
+ String resBody = null;
|
|
|
+ try {
|
|
|
+ resBody = outInterfaceService.getPatentRightFromPAS(signPatentNo);
|
|
|
+ } catch (IOException e) {
|
|
|
+ //e.printStackTrace();
|
|
|
+ log.info("根据专利号查询权要列表时发生IO异常");
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(resBody);
|
|
|
+ //解析jason获得标的专利的权要
|
|
|
+ List<PatentRight> patentRightsOrgin = JSON.parseArray(jsonObject.getString("data"), PatentRight.class);
|
|
|
+ //给权要进行格式更改
|
|
|
+ List<PatentRight> patentRights = featureService.FormatPatentRights(patentRightsOrgin);
|
|
|
+
|
|
|
+ ArrayList<AvoidDesignRightVO> rights = new ArrayList<>();
|
|
|
+ for (PatentRight patentRight : patentRights) {
|
|
|
+ Integer rightId = patentRight.getSort();
|
|
|
+ //根据当前权要id和报告id关联查询当前权要的所有特征和特征对应的回避设计方向
|
|
|
+ List<AvoidFeaturesVO> features = avoidDesignLittleDirectionMapper.selectWholeByRightIdAndReportId(rightId, reportId);
|
|
|
+ AvoidDesignRightVO right = new AvoidDesignRightVO()
|
|
|
+ .setFeatures(features)
|
|
|
+ .setSort(rightId)
|
|
|
+ .setRightName(patentRight.getRightName())
|
|
|
+ .setContent(patentRight.getContent())
|
|
|
+ .setContentOut(patentRight.getContentOut())
|
|
|
+ .setPatentId(patentRight.getPatentId())
|
|
|
+ .setType(patentRight.getType());
|
|
|
+ rights.add(right);
|
|
|
+ }
|
|
|
+ AvoidDesignWholeVO avoidDesignWholeVO = new AvoidDesignWholeVO().setRights(rights);
|
|
|
+ String wholeDirection = avoidDesignWholeDirectionMapper.selectWholeDirectionByReportId(reportId);
|
|
|
+ avoidDesignWholeVO.setWholeDirection(wholeDirection);
|
|
|
+ return avoidDesignWholeVO;
|
|
|
}
|
|
|
|
|
|
@Override
|