perf(文档对比): 国内、海外、企业添加逻辑删除标识,优化重构文档对比查询速度,更改填充属性逻辑
This commit is contained in:
+80
-2
@@ -3,6 +3,7 @@ package com.jero.modules.compare.controller;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
@@ -39,8 +40,11 @@ import org.springframework.web.servlet.ModelAndView;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,16 +103,90 @@ public class SarFileCompareInfoController extends JeroController<SarFileCompareI
|
|||||||
queryWrapper.orderByDesc(SarFileCompareInfo::getCreateTime);
|
queryWrapper.orderByDesc(SarFileCompareInfo::getCreateTime);
|
||||||
Page<SarFileCompareInfo> page = new Page<>(pageNo, pageSize);
|
Page<SarFileCompareInfo> page = new Page<>(pageNo, pageSize);
|
||||||
IPage<SarFileCompareInfo> pageList = sarFileCompareInfoService.page(page, queryWrapper);
|
IPage<SarFileCompareInfo> pageList = sarFileCompareInfoService.page(page, queryWrapper);
|
||||||
|
|
||||||
|
// 提取 编号1、编号2
|
||||||
|
List<String> serialNumberList = new ArrayList<>();
|
||||||
|
List<String> serialNumberLeftList = pageList.getRecords().stream().map(SarFileCompareInfo::getSerialNumberLeft).collect(Collectors.toList());
|
||||||
|
List<String> serialNumberRightList = pageList.getRecords().stream().map(SarFileCompareInfo::getSerialNumberRight).collect(Collectors.toList());
|
||||||
|
serialNumberList.addAll(serialNumberLeftList);
|
||||||
|
serialNumberList.addAll(serialNumberRightList);
|
||||||
|
// 国内
|
||||||
|
List<LawsDomesticStandard> lawsDomesticStandards = new ArrayList<>();
|
||||||
|
// 海外
|
||||||
|
List<LawsOverseasStandard> lawsOverseasStandards = new ArrayList<>();
|
||||||
|
// 企业
|
||||||
|
List<LawsEnterpriseStandard> lawsEnterpriseStandards = new ArrayList<>();
|
||||||
|
// 获取编号对应的国内、海外、企业信息
|
||||||
|
if (!serialNumberList.isEmpty()){
|
||||||
|
lawsDomesticStandards = lawsDomesticStandardService.list(new QueryWrapper<LawsDomesticStandard>().lambda().in(LawsDomesticStandard::getStandardNumber, serialNumberList));
|
||||||
|
lawsOverseasStandards = lawsOverseasStandardService.list(new QueryWrapper<LawsOverseasStandard>().lambda().in(LawsOverseasStandard::getStandardNumber, serialNumberList));
|
||||||
|
lawsEnterpriseStandards = ILawsEnterpriseStandardService.list(new QueryWrapper<LawsEnterpriseStandard>().lambda().in(LawsEnterpriseStandard::getStandardNumber, serialNumberList));
|
||||||
|
}
|
||||||
|
|
||||||
for (SarFileCompareInfo info : pageList.getRecords()) {
|
for (SarFileCompareInfo info : pageList.getRecords()) {
|
||||||
info.setReleaseStateTitle(ReleaseConditionEnum.getTextByValue(info.getReleaseState(), cut));
|
info.setReleaseStateTitle(ReleaseConditionEnum.getTextByValue(info.getReleaseState(), cut));
|
||||||
info.setFileTypeLeft(getFileTypeText(info.getFileTypeLeft(), cut));
|
info.setFileTypeLeft(getFileTypeText(info.getFileTypeLeft(), cut));
|
||||||
info.setFileTypeRight(getFileTypeText(info.getFileTypeRight(), cut));
|
info.setFileTypeRight(getFileTypeText(info.getFileTypeRight(), cut));
|
||||||
//根据左右标准编号赋值标准ID、标准来源4个字段值,补充创建人
|
// 根据编号赋值标准ID、标准来源、补充创建人
|
||||||
this.assignment(info);
|
setProperty(info, lawsDomesticStandards, lawsOverseasStandards, lawsEnterpriseStandards);
|
||||||
}
|
}
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setProperty(SarFileCompareInfo info, List<LawsDomesticStandard> lawsDomesticStandards, List<LawsOverseasStandard> lawsOverseasStandards, List<LawsEnterpriseStandard> lawsEnterpriseStandards) {
|
||||||
|
// 编号1
|
||||||
|
String serialNumberLeft = info.getSerialNumberLeft();
|
||||||
|
// 编号2
|
||||||
|
String serialNumberRight = info.getSerialNumberRight();
|
||||||
|
if (StringUtils.isNotBlank(serialNumberLeft)){
|
||||||
|
judgeLeftOrRight(info, lawsDomesticStandards, lawsOverseasStandards, lawsEnterpriseStandards, serialNumberLeft, "left");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(serialNumberRight)){
|
||||||
|
judgeLeftOrRight(info, lawsDomesticStandards, lawsOverseasStandards, lawsEnterpriseStandards, serialNumberLeft, "right");
|
||||||
|
}
|
||||||
|
// 创建人
|
||||||
|
info.setCreateNameNo(sysUserService.getNameNoByUsername(info.getCreateBy()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void judgeLeftOrRight(SarFileCompareInfo info, List<LawsDomesticStandard> lawsDomesticStandards, List<LawsOverseasStandard> lawsOverseasStandards, List<LawsEnterpriseStandard> lawsEnterpriseStandards, String serialNumberLeft, String leftOrRight) {
|
||||||
|
// 国内
|
||||||
|
Optional<LawsDomesticStandard> lawsDomesticStandardOptional = lawsDomesticStandards.stream().filter(v -> serialNumberLeft.equals(v.getStandardNumber())).findFirst();
|
||||||
|
if (lawsDomesticStandardOptional.isPresent()){
|
||||||
|
if ("left".equals(leftOrRight)){
|
||||||
|
info.setStandardSourceLeft(CommonConstant.STANDARD_SOURCE_1);
|
||||||
|
info.setStandardIdLeft(lawsDomesticStandardOptional.get().getId());
|
||||||
|
}else {
|
||||||
|
info.setStandardSourceRight(CommonConstant.STANDARD_SOURCE_1);
|
||||||
|
info.setStandardIdRight(lawsDomesticStandardOptional.get().getId());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 海外
|
||||||
|
Optional<LawsOverseasStandard> lawsOverseasStandardOptional = lawsOverseasStandards.stream().filter(v -> serialNumberLeft.equals(v.getStandardNumber())).findFirst();
|
||||||
|
if (lawsOverseasStandardOptional.isPresent()){
|
||||||
|
if ("left".equals(leftOrRight)){
|
||||||
|
info.setStandardSourceLeft(CommonConstant.STANDARD_SOURCE_2);
|
||||||
|
info.setStandardIdLeft(lawsOverseasStandardOptional.get().getId());
|
||||||
|
}else {
|
||||||
|
info.setStandardSourceRight(CommonConstant.STANDARD_SOURCE_2);
|
||||||
|
info.setStandardIdRight(lawsOverseasStandardOptional.get().getId());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 企业
|
||||||
|
Optional<LawsEnterpriseStandard> lawsEnterpriseStandardOptional = lawsEnterpriseStandards.stream().filter(v -> serialNumberLeft.equals(v.getStandardNumber())).findFirst();
|
||||||
|
if (lawsEnterpriseStandardOptional.isPresent()){
|
||||||
|
if ("left".equals(leftOrRight)){
|
||||||
|
info.setStandardSourceLeft(CommonConstant.STANDARD_SOURCE_3);
|
||||||
|
info.setStandardIdLeft(lawsEnterpriseStandardOptional.get().getId());
|
||||||
|
}else {
|
||||||
|
info.setStandardSourceRight(CommonConstant.STANDARD_SOURCE_3);
|
||||||
|
info.setStandardIdRight(lawsEnterpriseStandardOptional.get().getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void assignment(SarFileCompareInfo info) {
|
private void assignment(SarFileCompareInfo info) {
|
||||||
String serialNumberLeft = info.getSerialNumberLeft();
|
String serialNumberLeft = info.getSerialNumberLeft();
|
||||||
String serialNumberRight = info.getSerialNumberRight();
|
String serialNumberRight = info.getSerialNumberRight();
|
||||||
|
|||||||
+7
-5
@@ -1,18 +1,19 @@
|
|||||||
package com.jero.modules.laws.standard.entity;
|
package com.jero.modules.laws.standard.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,6 +57,7 @@ public class LawsDomesticStandard implements Serializable {
|
|||||||
/**0表示未删除,1表示删除*/
|
/**0表示未删除,1表示删除*/
|
||||||
@Excel(name = "0表示未删除,1表示删除", width = 15)
|
@Excel(name = "0表示未删除,1表示删除", width = 15)
|
||||||
@ApiModelProperty(value = "0表示未删除,1表示删除")
|
@ApiModelProperty(value = "0表示未删除,1表示删除")
|
||||||
|
@TableLogic
|
||||||
private java.lang.Integer delFlag;
|
private java.lang.Integer delFlag;
|
||||||
/**标准性质*/
|
/**标准性质*/
|
||||||
@Excel(name = "标准性质", width = 15)
|
@Excel(name = "标准性质", width = 15)
|
||||||
|
|||||||
+5
-7
@@ -1,12 +1,6 @@
|
|||||||
package com.jero.modules.laws.standard.entity;
|
package com.jero.modules.laws.standard.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import com.jero.common.aspect.annotation.Dict;
|
import com.jero.common.aspect.annotation.Dict;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -14,6 +8,9 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业标准
|
* 企业标准
|
||||||
* @TableName laws_enterprise_standard
|
* @TableName laws_enterprise_standard
|
||||||
@@ -65,6 +62,7 @@ public class LawsEnterpriseStandard implements Serializable {
|
|||||||
* 0表示未删除,1表示删除
|
* 0表示未删除,1表示删除
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "0表示未删除,1表示删除")
|
@ApiModelProperty(value = "0表示未删除,1表示删除")
|
||||||
|
@TableLogic
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+7
-5
@@ -1,18 +1,19 @@
|
|||||||
package com.jero.modules.laws.standard.entity;
|
package com.jero.modules.laws.standard.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,6 +57,7 @@ public class LawsOverseasStandard implements Serializable {
|
|||||||
/**0表示未删除,1表示删除*/
|
/**0表示未删除,1表示删除*/
|
||||||
@Excel(name = "0表示未删除,1表示删除", width = 15)
|
@Excel(name = "0表示未删除,1表示删除", width = 15)
|
||||||
@ApiModelProperty(value = "0表示未删除,1表示删除")
|
@ApiModelProperty(value = "0表示未删除,1表示删除")
|
||||||
|
@TableLogic
|
||||||
private java.lang.Integer delFlag;
|
private java.lang.Integer delFlag;
|
||||||
/**国家/地区*/
|
/**国家/地区*/
|
||||||
@Excel(name = "国家/地区", width = 15)
|
@Excel(name = "国家/地区", width = 15)
|
||||||
|
|||||||
Reference in New Issue
Block a user