|
@@ -8,6 +8,7 @@ import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
|
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.vo.EditInventionPointVO;
|
|
|
import cn.cslg.pas.common.vo.QueryInventionPointVO;
|
|
|
import cn.cslg.pas.common.vo.TechnicalCaseVO;
|
|
|
import cn.cslg.pas.domain.BaseEntity;
|
|
@@ -118,13 +119,15 @@ public class TechnicalCaseService extends ServiceImpl<TechnicalCaseMapper, Techn
|
|
|
caseIdDTO.setProjectId(technicalCase.getProjectId());
|
|
|
|
|
|
//保存es
|
|
|
- String technicalCasePatentId = this.selectTechnicalCasePatent(technicalCase.getProjectId());
|
|
|
- TechnicalCasePatent casePatent = new TechnicalCasePatent();
|
|
|
- casePatent.setProjectId(vo.getProjectId());
|
|
|
- casePatent.setInventionPoint(technicalCase.getInventionPoint());
|
|
|
- Integer count = this.updateTechnicalCasePatent(casePatent, technicalCasePatentId);
|
|
|
- if (count > 0) {
|
|
|
- throw new XiaoShiException("发明点更新Es失败");
|
|
|
+ EditInventionPointVO pointVO = this.selectTechnicalCasePatent(technicalCase.getProjectId());
|
|
|
+ if (!pointVO.getInventionPoint().equals(vo.getInventionPoint())) {
|
|
|
+ TechnicalCasePatent casePatent = new TechnicalCasePatent();
|
|
|
+// casePatent.setProjectId(vo.getProjectId());
|
|
|
+ casePatent.setInventionPoint(vo.getInventionPoint());
|
|
|
+ Integer count = this.updateTechnicalCasePatent(casePatent, pointVO.getPatentId());
|
|
|
+ if (count > 0) {
|
|
|
+ throw new XiaoShiException("发明点更新Es失败");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -233,7 +236,8 @@ public class TechnicalCaseService extends ServiceImpl<TechnicalCaseMapper, Techn
|
|
|
}
|
|
|
|
|
|
//查询TechnicalCasePatent
|
|
|
- public String selectTechnicalCasePatent(Integer projectId) throws Exception {
|
|
|
+ public EditInventionPointVO selectTechnicalCasePatent(Integer projectId) throws Exception {
|
|
|
+ EditInventionPointVO pointVO = new EditInventionPointVO();
|
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
|
//设置查询索引
|
|
|
builder.index("technical_case_patent");
|
|
@@ -241,7 +245,14 @@ public class TechnicalCaseService extends ServiceImpl<TechnicalCaseMapper, Techn
|
|
|
builder.query(query);
|
|
|
SearchResponse<TechnicalCasePatent> response = client.search(builder.build(), TechnicalCasePatent.class);
|
|
|
List<Hit<TechnicalCasePatent>> hits = response.hits().hits();
|
|
|
- return hits.get(0).id();
|
|
|
+ for (Hit<TechnicalCasePatent> hit : hits) {
|
|
|
+ pointVO.setPatentId(hit.id());
|
|
|
+ TechnicalCasePatent patent = hit.source();
|
|
|
+ pointVO.setProjectId(patent.getProjectId());
|
|
|
+ pointVO.setInventionPoint(patent.getInventionPoint());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return pointVO;
|
|
|
}
|
|
|
|
|
|
//添加TechnicalCasePatent
|