update:法规释疑库按id查询返回标准列表和条款列表
This commit is contained in:
+13
-5
@@ -1,13 +1,13 @@
|
||||
package com.jero.modules.laws.businessSupport.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import com.jero.modules.laws.businessSupport.vo.RegulationVo;
|
||||
import com.jero.modules.laws.businessSupport.vo.StandardVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -43,8 +43,8 @@ public class LawsRegulationsQuestionLibrary implements Serializable {
|
||||
@ApiModelProperty(value = "标准编号")
|
||||
private String standardNumber;
|
||||
|
||||
@ApiModelProperty(value = "标准名称")
|
||||
private String standardName;
|
||||
@ApiModelProperty(value = "标准id")
|
||||
private String standardId;
|
||||
|
||||
@ApiModelProperty(value = "条款号")
|
||||
private String regulationNumber;
|
||||
@@ -109,5 +109,13 @@ public class LawsRegulationsQuestionLibrary implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String releaseEndTime;
|
||||
|
||||
@ApiModelProperty(value = "标准列表")
|
||||
@TableField(exist = false)
|
||||
private List<StandardVo> standardList;
|
||||
|
||||
@ApiModelProperty(value = "条款列表")
|
||||
@TableField(exist = false)
|
||||
private List<RegulationVo> regulationList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+84
-5
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.laws.businessSupport.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -7,19 +8,23 @@ import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.activiti.process.standardinterpret.entity.ProcessStandardInterpretClause;
|
||||
import com.jero.modules.activiti.process.standardinterpret.service.StandardInterpretFlowService;
|
||||
import com.jero.modules.laws.businessSupport.entity.LawsRegulationsQuestionLibrary;
|
||||
import com.jero.modules.laws.businessSupport.mapper.LawsRegulationsQuestionLibraryMapper;
|
||||
import com.jero.modules.laws.businessSupport.service.ILawsRegulationsQuestionLibraryService;
|
||||
import com.jero.modules.laws.businessSupport.vo.RegulationVo;
|
||||
import com.jero.modules.laws.businessSupport.vo.StandardVo;
|
||||
import com.jero.modules.laws.common.constant.FieldCommon;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.service.ISarFileSplitInfoService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -35,7 +40,10 @@ public class LawsRegulationsQuestionLibraryServiceImpl extends ServiceImpl<LawsR
|
||||
|
||||
@Resource
|
||||
private LawsRegulationsQuestionLibraryMapper lawsRegulationsQuestionLibraryMapper;
|
||||
|
||||
@Resource
|
||||
private StandardInterpretFlowService standardInterpretFlowService;
|
||||
@Resource
|
||||
private ISarFileSplitInfoService sarFileSplitInfoService;
|
||||
|
||||
@Override
|
||||
public IPage<LawsRegulationsQuestionLibrary> queryPage(LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary, Integer pageNo, Integer pageSize) {
|
||||
@@ -122,9 +130,80 @@ public class LawsRegulationsQuestionLibraryServiceImpl extends ServiceImpl<LawsR
|
||||
if (Objects.isNull(lawsRegulationsQuestionLibrary)) {
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
// 查询标准编号列表和条款列表
|
||||
String standardNumber = lawsRegulationsQuestionLibrary.getStandardNumber();
|
||||
String standardId = lawsRegulationsQuestionLibrary.getStandardId();
|
||||
Map<String, StandardVo> standardNumberMap = new HashMap<>();
|
||||
List<StandardVo> standardList = new ArrayList<>();
|
||||
List<RegulationVo> regulationList = new ArrayList<>();
|
||||
// 按照发布稿>TBT通报文件>报批>送审稿>征求意见稿>草案顺序找拆分数据
|
||||
List<String> typeOrder = Arrays.asList("publish_of_original", "tbt_file", "draft_for_review", "draft_for_approval", "draft_for_comment", "draft", "other_file");
|
||||
if (StringUtils.isNotBlank(standardNumber) && StringUtils.isNotBlank(standardId)) {
|
||||
List<String> standardIds = Arrays.asList(standardId.split(","));
|
||||
List<String> standardNumbers = Arrays.asList(standardNumber.split(","));
|
||||
for (int i = 0; i < standardIds.size(); i++) {
|
||||
List<SarFileSplitInfoEO> splitInfoList = sarFileSplitInfoService.list(
|
||||
new LambdaQueryWrapper<SarFileSplitInfoEO>().eq(SarFileSplitInfoEO::getStandardId, standardIds.get(i))
|
||||
);
|
||||
splitInfoList.sort(Comparator.comparingInt(e -> typeOrder.indexOf(e.getFileType())));
|
||||
SarFileSplitInfoEO sarFileSplitInfoEO = splitInfoList.isEmpty() ? null : splitInfoList.get(0);
|
||||
if (!Objects.isNull(sarFileSplitInfoEO)) {
|
||||
StandardVo standardVo = new StandardVo();
|
||||
standardVo.setStandardId(standardIds.get(i));
|
||||
standardVo.setFileType(sarFileSplitInfoEO.getFileType());
|
||||
standardVo.setStandardNumber(standardNumbers.get(i));
|
||||
// 将 standardId 作为 key,jsonObject 作为 value 放入 Map
|
||||
standardNumberMap.put(standardNumbers.get(i), standardVo);
|
||||
standardList.add(standardVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
lawsRegulationsQuestionLibrary.setStandardList(standardList);
|
||||
String regulationNumber = lawsRegulationsQuestionLibrary.getRegulationNumber();
|
||||
Map<String, List<String>> keyValueMap = new HashMap<>();
|
||||
if (StringUtils.isNotBlank(regulationNumber)) {
|
||||
List<String> standardIds = Arrays.asList(regulationNumber.split(","));
|
||||
for (String s : standardIds) {
|
||||
// 找到最后一个空格的位置
|
||||
int lastSpaceIndex = s.lastIndexOf(" ");
|
||||
// 确保空格存在并且位置不在字符串的开始或结束
|
||||
if (lastSpaceIndex != -1 && lastSpaceIndex < s.length() - 1) {
|
||||
String key = s.substring(0, lastSpaceIndex); // 空格前的部分作为key
|
||||
String value = s.substring(lastSpaceIndex + 1); // 空格后的部分作为value
|
||||
// 如果key已存在,则追加value到该key的value列表中
|
||||
keyValueMap.computeIfAbsent(key, k -> new ArrayList<>()).add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, List<String>> entry : keyValueMap.entrySet()) {
|
||||
String key = entry.getKey(); // 获取key
|
||||
List<String> values = entry.getValue(); // 获取value(List<String>)
|
||||
StandardVo standardVo = standardNumberMap.get(key);
|
||||
if (!Objects.isNull(standardVo)) {
|
||||
List<ProcessStandardInterpretClause> clauseList = standardInterpretFlowService.getClauseList(standardVo.getStandardId(), standardVo.getFileType());
|
||||
// 过滤clauseList,只保留itemNum包含values中任意一个值的条目
|
||||
List<ProcessStandardInterpretClause> filteredClauseList = clauseList.stream()
|
||||
.filter(clause -> values.stream().anyMatch(value -> value.equals(clause.getItemNum()))) // 过滤条件
|
||||
.collect(Collectors.toList());
|
||||
for (ProcessStandardInterpretClause processStandardInterpretClause : filteredClauseList) {
|
||||
RegulationVo regulationVo = new RegulationVo();
|
||||
regulationVo.setStandardId(standardVo.getStandardId());
|
||||
regulationVo.setStandardNumber(standardVo.getStandardNumber());
|
||||
regulationVo.setItemNum(processStandardInterpretClause.getItemNum());
|
||||
regulationVo.setItemTitle(processStandardInterpretClause.getItemTitle());
|
||||
regulationVo.setTitleTranslation(processStandardInterpretClause.getTitleTranslation());
|
||||
regulationVo.setItemContent(processStandardInterpretClause.getItemContent());
|
||||
regulationVo.setTranslation(processStandardInterpretClause.getTranslation());
|
||||
regulationList.add(regulationVo);
|
||||
}
|
||||
}
|
||||
lawsRegulationsQuestionLibrary.setRegulationList(regulationList);
|
||||
}
|
||||
return lawsRegulationsQuestionLibrary;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void setResultData(List<LawsRegulationsQuestionLibrary> pageList) {
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
pageList.forEach(lawsRegulationsQuestionLibrary -> {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.jero.modules.laws.businessSupport.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RegulationVo {
|
||||
|
||||
@ApiModelProperty(value = "标准id")
|
||||
private String standardId;
|
||||
|
||||
@ApiModelProperty(value = "标准编号")
|
||||
private String standardNumber;
|
||||
|
||||
@ApiModelProperty(value = "条款号")
|
||||
private String itemNum;
|
||||
|
||||
@ApiModelProperty(value = "条款标题")
|
||||
private String itemTitle;
|
||||
|
||||
@ApiModelProperty(value = "译文标题")
|
||||
private String titleTranslation;
|
||||
|
||||
@ApiModelProperty(value = "条款内容")
|
||||
private String itemContent;
|
||||
|
||||
@ApiModelProperty(value = "译文")
|
||||
private String translation;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.jero.modules.laws.businessSupport.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StandardVo {
|
||||
|
||||
@ApiModelProperty(value = "标准id")
|
||||
private String standardId;
|
||||
|
||||
@ApiModelProperty(value = "文本状态")
|
||||
private String fileType;
|
||||
|
||||
@ApiModelProperty(value = "标准编号")
|
||||
private String standardNumber;
|
||||
}
|
||||
Reference in New Issue
Block a user