|
@@ -3,22 +3,18 @@ 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.PatentRightVo;
|
|
|
+import cn.cslg.report.common.model.vo.AvoidDesignDirectionVO;
|
|
|
import cn.cslg.report.entity.AssoAvoidDesignWholeLittleDirection;
|
|
|
import cn.cslg.report.entity.AvoidDesignLittleDirection;
|
|
|
import cn.cslg.report.entity.AvoidDesignWholeDirection;
|
|
|
-import cn.cslg.report.entity.Features;
|
|
|
import cn.cslg.report.exception.XiaoShiException;
|
|
|
import cn.cslg.report.mapper.AssoAvoidDesignWholeLittleDirectionMapper;
|
|
|
import cn.cslg.report.mapper.AvoidDesignLittleDirectionMapper;
|
|
|
import cn.cslg.report.mapper.AvoidDesignWholeDirectionMapper;
|
|
|
import cn.cslg.report.mapper.AvoidFeatureMapper;
|
|
|
import cn.cslg.report.service.IAvoidDesignDirectionService;
|
|
|
-import cn.cslg.report.service.business.FeatureService;
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -38,6 +34,8 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
private final AvoidDesignLittleDirectionMapper avoidDesignLittleDirectionMapper; //回避设计方向表的Mapper层接口装配
|
|
|
private final AssoAvoidDesignWholeLittleDirectionMapper assoAvoidDesignWholeLittleDirectionMapper; //回避设计总体方向和方向关联表的Mapper层接口装配
|
|
|
private final AvoidFeatureMapper avoidFeatureMapper; //特征标的Mapper层接口装配
|
|
|
+ //private final CacheUtils cacheUtils;
|
|
|
+ //private final LoginUtils loginUtils;
|
|
|
|
|
|
/**
|
|
|
* 新增回避设计方案
|
|
@@ -55,7 +53,11 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
AvoidDesignWholeDirection avoidDesignWholeDirection = new AvoidDesignWholeDirection()
|
|
|
.setReportId(reportId)
|
|
|
.setWholeDirection(wholeDirection);
|
|
|
- log.info("将数据插入回避设计总体方向表,数据为:{}", avoidDesignWholeDirection);
|
|
|
+ //先根据报告id删除原有回避设计总体方向表数据
|
|
|
+ log.info("先根据报告id删除原有回避设计总体方向表数据");
|
|
|
+ avoidDesignWholeDirectionMapper.deleteByReportId(reportId);
|
|
|
+ //将数据插入回避设计总体方向表
|
|
|
+ log.info("将数据插入回避设计总体方向表");
|
|
|
int rows = avoidDesignWholeDirectionMapper.insert(avoidDesignWholeDirection);
|
|
|
if (rows != 1) {
|
|
|
String message = "数据插入回避设计总体方向表失败,新增回避设计方案失败(数据已回滚),服务器忙请稍后再次尝试";
|
|
@@ -63,36 +65,47 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
throw new XiaoShiException(message);
|
|
|
}
|
|
|
|
|
|
- //2.从回避设计方案中取出权要特征解释和回避设计方向littleDirection等数据的对象的集合avoidDesignLittleDirectionDTOs,后把相应数据分别插入相应表中
|
|
|
+ //2.从回避设计方案中取出权要特征解释等和回避设计方向littleDirection等数据的对象的集合avoidDesignLittleDirectionDTOs,处理后把数据分别插入各自表中
|
|
|
List<AvoidDesignLittleDirectionDTO> avoidDesignLittleDirectionDTOs = avoidDesignDirectionDTO.getAvoidDesignLittleDirectionDTOs();
|
|
|
-
|
|
|
- //先根据报告id把原来的权要特征通通删除
|
|
|
- log.info("先根据报告id把原来的权要特征通通删除");
|
|
|
- avoidFeatureMapper.deleteByReportId(reportId);
|
|
|
-
|
|
|
- //遍历取出每个权要的特征数据插入特征表,插入后取出每个特征的特征featureId和回避设计方向littleDirection存入回避设计方向表
|
|
|
+ //遍历集合取出每个权要的特征数据插入特征表,插入后取出每个特征的特征featureId和回避设计方向littleDirection存入回避设计方向表
|
|
|
List<AvoidDesignLittleDirection> avoidDesignLittleDirections = new ArrayList<>();
|
|
|
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);
|
|
|
}
|
|
|
- //批量插入特征,插入表中后再遍历取出特征featureId和回避设计方向littleDirection,存入回避设计方向表实体类对象集合
|
|
|
+
|
|
|
+ //先根据报告id删除原有特征表数据
|
|
|
+ log.info("先根据报告id删除原有特征表数据");
|
|
|
+ avoidFeatureMapper.deleteByReportId(reportId);
|
|
|
+ //批量插入特征数据,插入特征表后再遍历取出特征featureId和回避设计方向littleDirection,存入回避设计方向表实体类对象集合
|
|
|
log.info("将数据插入特征表,特征数据量:{}个", avoidFeatures.size());
|
|
|
- avoidFeatureMapper.insertBatch(avoidFeatures);
|
|
|
+ rows = avoidFeatureMapper.insertBatch(avoidFeatures);
|
|
|
+ if (rows != avoidFeatures.size()) {
|
|
|
+ String message = "数据插入特征表失败,新增回避设计方案失败(数据已回滚),服务器忙请稍后再次尝试";
|
|
|
+ log.info("{}", message);
|
|
|
+ throw new XiaoShiException(message);
|
|
|
+ }
|
|
|
for (AvoidFeatures avoidFeature : avoidFeatures) {
|
|
|
Integer featureId = avoidFeature.getId();
|
|
|
String littleDirection = avoidFeature.getLittleDirection();
|
|
|
AvoidDesignLittleDirection avoidDesignLittleDirection = new AvoidDesignLittleDirection()
|
|
|
+ .setReportId(reportId)
|
|
|
.setFeatureId(featureId)
|
|
|
.setLittleDirection(littleDirection);
|
|
|
avoidDesignLittleDirections.add(avoidDesignLittleDirection);
|
|
|
}
|
|
|
+ //先根据报告id删除原有回避设计方向表数据
|
|
|
+ log.info("先根据报告id删除原有回避设计方向表数据");
|
|
|
+ avoidDesignLittleDirectionMapper.deleteByReportId(reportId);
|
|
|
//将数据插入回避设计方向表
|
|
|
- log.info("将数据插入回避设计方向表,数据为:{}", avoidDesignLittleDirections);
|
|
|
+ log.info("将数据插入回避设计方向表");
|
|
|
rows = avoidDesignLittleDirectionMapper.insertBatch(avoidDesignLittleDirections);
|
|
|
if (rows != avoidDesignLittleDirections.size()) {
|
|
|
String message = "数据插入回避设计方向表失败,新增回避设计方案失败(数据已回滚),服务器忙请稍后再次尝试";
|
|
@@ -111,11 +124,16 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
ArrayList<AssoAvoidDesignWholeLittleDirection> assoAvoidDesignWholeLittleDirections = new ArrayList<>();
|
|
|
for (Integer avoidDesignLittleDirectionId : avoidDesignLittleDirectionIds) {
|
|
|
AssoAvoidDesignWholeLittleDirection assoAvoidDesignWholeLittleDirection = new AssoAvoidDesignWholeLittleDirection()
|
|
|
+ .setReportId(reportId)
|
|
|
.setAvoidDesignWholeDirectionId(avoidDesignWholeDirectionId)
|
|
|
.setAvoidDesignLittleDirectionId(avoidDesignLittleDirectionId);
|
|
|
assoAvoidDesignWholeLittleDirections.add(assoAvoidDesignWholeLittleDirection);
|
|
|
}
|
|
|
- log.info("将数据插入回避设计总体方向和回避设计方向关联表,数据为:{}", assoAvoidDesignWholeLittleDirections);
|
|
|
+ //先根据报告id删除原有回避设计总体方向和回避设计方向关联表数据
|
|
|
+ log.info("先根据报告id删除原有回避设计总体方向和回避设计方向关联表数据");
|
|
|
+ assoAvoidDesignWholeLittleDirectionMapper.deleteByReportId(reportId);
|
|
|
+ //将数据插入回避设计总体方向和回避设计方向关联表
|
|
|
+ log.info("将数据插入回避设计总体方向和回避设计方向关联表");
|
|
|
rows = assoAvoidDesignWholeLittleDirectionMapper.insertBatch(assoAvoidDesignWholeLittleDirections);
|
|
|
if (rows != assoAvoidDesignWholeLittleDirections.size()) {
|
|
|
String message = "数据插入回避设计总体方向和回避设计方向关联表失败,新增回避设计方案失败(数据已回滚),服务器忙请稍后再次尝试";
|
|
@@ -127,4 +145,22 @@ public class AvoidDesignDirectionServiceImpl implements IAvoidDesignDirectionSer
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public AvoidDesignDirectionVO getAvoidDesignDirection(Integer reportId) {
|
|
|
+ log.info("开始处理【查询回避设计方案】的业务,参数为:{}", reportId);
|
|
|
+ AvoidDesignDirectionVO queryResult = avoidDesignLittleDirectionMapper.selectWholeByReportId(reportId);
|
|
|
+ return queryResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteAvoidDesignDirection(Integer reportId) {
|
|
|
+ log.info("开始处理【删除回避设计方案】的业务,参数为:{}", reportId);
|
|
|
+ avoidFeatureMapper.deleteByReportId(reportId);
|
|
|
+ avoidDesignWholeDirectionMapper.deleteByReportId(reportId);
|
|
|
+ avoidDesignLittleDirectionMapper.deleteByReportId(reportId);
|
|
|
+ assoAvoidDesignWholeLittleDirectionMapper.deleteByReportId(reportId);
|
|
|
+ log.info("删除回避设计方案完成");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|