|
@@ -213,6 +213,7 @@ public class ReportFieldPatentLinkService extends ServiceImpl<ReportFieldPatentL
|
|
|
case 4:
|
|
|
case 5:
|
|
|
List<ReportFieldOption> projectFieldOptionList = reportFieldOptionService.getFieldOptionListByIds(optionIds);
|
|
|
+
|
|
|
for (ReportFieldOption projectFieldOption : projectFieldOptionList) {
|
|
|
LabelDTO map = new LabelDTO();
|
|
|
map.setValue(projectFieldOption.getId());
|
|
@@ -239,64 +240,95 @@ public class ReportFieldPatentLinkService extends ServiceImpl<ReportFieldPatentL
|
|
|
* @param params
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
-// public void updatePatentIndexSetting(PatentIndexSettingVO params) {
|
|
|
-// this.delete(params.getReportId(), params.getPatentNo(), params.getFieldId());
|
|
|
-// List<Integer> optionIds = params.getSelected().stream().map(LabelDTO::getValue).distinct().collect(Collectors.toList());
|
|
|
-// List<String> texts = params.getSelected().stream().map(LabelDTO::getLabel).distinct().collect(Collectors.toList());
|
|
|
-// List<ReportFieldPatentLink> projectFieldPatentLinkList = new ArrayList<>();
|
|
|
-// switch (params.getType()) {
|
|
|
-// case 0:
|
|
|
-// case 1:
|
|
|
-// case 2:
|
|
|
+ public void updatePatentIndexSetting(PatentIndexSettingVO params) {
|
|
|
+
|
|
|
+ List<Integer> optionIds = params.getSelected().stream().map(LabelDTO::getValue).distinct().collect(Collectors.toList());
|
|
|
+ List<String> texts = params.getSelected().stream().map(LabelDTO::getLabel).distinct().collect(Collectors.toList());
|
|
|
+ List<ReportFieldPatentLink> projectFieldPatentLinkList = new ArrayList<>();
|
|
|
+ switch (params.getType()) {
|
|
|
+ case 0:
|
|
|
+ case 1:
|
|
|
+ case 2:
|
|
|
// List<ReportFieldText> tempList = reportFieldTextService.getProjectFieldTextByFieldId(params.getFieldId());
|
|
|
// for (String text : texts) {
|
|
|
// if (StringUtils.isEmpty(text)) {
|
|
|
// continue;
|
|
|
// }
|
|
|
// ReportFieldText reportFieldText = tempList.stream().filter(item -> item.getText().equals(text)).findFirst().orElse(null);
|
|
|
-// if (reportFieldText == null) {
|
|
|
-// reportFieldText = new ReportFieldText();
|
|
|
+// if (reportFieldText != null) {
|
|
|
+// reportFieldText.setFieldId(params.getFieldId());
|
|
|
+// reportFieldText.setText(text);
|
|
|
+// reportFieldText.updateById();
|
|
|
+// }
|
|
|
+// else {
|
|
|
+// reportFieldText=new ReportFieldText();
|
|
|
// reportFieldText.setFieldId(params.getFieldId());
|
|
|
// reportFieldText.setText(text);
|
|
|
// reportFieldText.insert();
|
|
|
// }
|
|
|
-// ReportFieldPatentLink projectFieldPatentLink = new ReportFieldPatentLink();
|
|
|
-// projectFieldPatentLink.setPatentNo(params.getPatentNo());
|
|
|
-// projectFieldPatentLink.setReportId(params.getReportId());
|
|
|
-// projectFieldPatentLink.setType(params.getType());
|
|
|
-// projectFieldPatentLink.setFieldId(params.getFieldId());
|
|
|
-// projectFieldPatentLink.setCreateBy(loginUtils.getId());
|
|
|
-// projectFieldPatentLink.setOptionId(reportFieldText.getId());
|
|
|
-// projectFieldPatentLinkList.add(projectFieldPatentLink);
|
|
|
-// }
|
|
|
-// break;
|
|
|
-// case 3:
|
|
|
-// case 4:
|
|
|
-// case 5:
|
|
|
-// case 6:
|
|
|
-// for (Integer optionId : optionIds) {
|
|
|
-// ReportFieldPatentLink projectFieldPatentLink = new ReportFieldPatentLink();
|
|
|
-// projectFieldPatentLink.setPatentNo(params.getPatentNo());
|
|
|
-// projectFieldPatentLink.setReportId(params.getReportId());
|
|
|
-// projectFieldPatentLink.setType(params.getType());
|
|
|
-// projectFieldPatentLink.setFieldId(params.getFieldId());
|
|
|
-// projectFieldPatentLink.setCreateBy(loginUtils.getId());
|
|
|
-// projectFieldPatentLink.setOptionId(optionId);
|
|
|
-// projectFieldPatentLinkList.add(projectFieldPatentLink);
|
|
|
-// }
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// if (projectFieldPatentLinkList.size() != 0) {
|
|
|
-// this.saveOrUpdateBatch(projectFieldPatentLinkList);
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-// public List<ReportFieldPatentLink> get(int id) throws IOException{
|
|
|
-// LambdaQueryWrapper<ReportFieldPatentLink> linkLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
-// linkLambdaQueryWrapper.eq(ReportFieldPatentLink::getReportId,id);
|
|
|
-// return this.list(linkLambdaQueryWrapper);
|
|
|
-// }
|
|
|
- public void updatePatentIndexSetting(PatentIndexSettingVO params){
|
|
|
+ LambdaQueryWrapper<ReportFieldPatentLink> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(ReportFieldPatentLink::getPatentNo, params.getPatentNo())
|
|
|
+ .eq(ReportFieldPatentLink::getReportId, params.getReportId())
|
|
|
+ .eq(ReportFieldPatentLink::getFieldId, params.getFieldId());
|
|
|
+ List<ReportFieldPatentLink> list = this.list(queryWrapper);
|
|
|
+ ReportFieldPatentLink reportFieldPatentLink;
|
|
|
+ if(list.size()!=0) {
|
|
|
+ reportFieldPatentLink=list.get(0);
|
|
|
+ Integer optionId = reportFieldPatentLink.getOptionId();
|
|
|
+ List<ReportFieldText> reportFieldTexts = reportFieldTextService.get(optionId);
|
|
|
+ ReportFieldText reportFieldText = reportFieldTexts.get(0);
|
|
|
+ reportFieldText.setText(params.getSelected().get(0).getLabel());
|
|
|
+ reportFieldText.updateById();
|
|
|
+ reportFieldPatentLink.setFieldId(reportFieldText.getFieldId());
|
|
|
+ reportFieldPatentLink.setOptionId(reportFieldText.getId());
|
|
|
+ reportFieldPatentLink.setCreateBy(loginUtils.getId());
|
|
|
+ reportFieldPatentLink.setPatentNo(params.getPatentNo());
|
|
|
+ reportFieldPatentLink.setReportId(params.getReportId());
|
|
|
+
|
|
|
+ reportFieldPatentLink.updateById();
|
|
|
+ }else {
|
|
|
+ reportFieldPatentLink=new ReportFieldPatentLink();
|
|
|
+ ReportFieldText reportFieldText=new ReportFieldText();
|
|
|
+ reportFieldText.setText(params.getSelected().get(0).getLabel());
|
|
|
+ reportFieldText.setFieldId(params.getFieldId());
|
|
|
+ reportFieldText.insert();
|
|
|
+ reportFieldPatentLink.setFieldId(reportFieldText.getFieldId());
|
|
|
+ reportFieldPatentLink.setOptionId(reportFieldText.getId());
|
|
|
+ reportFieldPatentLink.setCreateBy(loginUtils.getId());
|
|
|
+ reportFieldPatentLink.setPatentNo(params.getPatentNo());
|
|
|
+ reportFieldPatentLink.setReportId(params.getReportId());
|
|
|
+ reportFieldPatentLink.insert();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ case 4:
|
|
|
+ case 5:
|
|
|
+ case 6:
|
|
|
+ for (Integer optionId : optionIds) {
|
|
|
+ ReportFieldPatentLink projectFieldPatentLink = new ReportFieldPatentLink();
|
|
|
+ projectFieldPatentLink.setPatentNo(params.getPatentNo());
|
|
|
+ projectFieldPatentLink.setReportId(params.getReportId());
|
|
|
+ projectFieldPatentLink.setType(params.getType());
|
|
|
+ projectFieldPatentLink.setFieldId(params.getFieldId());
|
|
|
+ projectFieldPatentLink.setCreateBy(loginUtils.getId());
|
|
|
+ projectFieldPatentLink.setOptionId(optionId);
|
|
|
+ projectFieldPatentLinkList.add(projectFieldPatentLink);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (projectFieldPatentLinkList.size() != 0) {
|
|
|
+ this.saveOrUpdateBatch(projectFieldPatentLinkList);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ public List<ReportFieldPatentLink> get(int id) throws IOException{
|
|
|
+ LambdaQueryWrapper<ReportFieldPatentLink> linkLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ linkLambdaQueryWrapper.eq(ReportFieldPatentLink::getReportId,id);
|
|
|
+ return this.list(linkLambdaQueryWrapper);
|
|
|
+ }
|
|
|
+ public void updatePatentIndexSetting2(PatentIndexSettingVO params){
|
|
|
switch (params.getType()){
|
|
|
case 0:
|
|
|
case 1:
|