比对列表增加标准ID、标准来源字段

This commit is contained in:
caozhen
2023-09-19 14:36:51 +08:00
parent 6ba8abbeeb
commit 5eb72a937b
2 changed files with 78 additions and 1 deletions
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.CommonConstant;
import com.jero.common.constant.enums.LanguageEnum;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.vo.LoginUser;
@@ -16,10 +17,17 @@ import com.jero.modules.compare.entity.SarFileCompareDetailVO;
import com.jero.modules.compare.entity.SarFileCompareInfo;
import com.jero.modules.compare.service.ISarFileCompareInfoService;
import com.jero.modules.docTranslation.enums.ReleaseConditionEnum;
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
import com.jero.modules.laws.standard.entity.LawsOverseasStandard;
import com.jero.modules.laws.standard.service.EnterpriseStandardService;
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
import com.jero.modules.system.util.MyStringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -47,6 +55,12 @@ public class SarFileCompareInfoController extends JeroController<SarFileCompareI
private ISarFileCompareInfoService sarFileCompareInfoService;
@Autowired
private OnlCgformFieldServiceImpl onlCgformFieldService;
@Autowired
private ILawsDomesticStandardService lawsDomesticStandardService; //国内标准
@Autowired
private ILawsOverseasStandardService lawsOverseasStandardService; //海外标准
@Autowired
private EnterpriseStandardService enterpriseStandardService; //企业标准
/**
* 分页列表查询
@@ -83,10 +97,55 @@ public class SarFileCompareInfoController extends JeroController<SarFileCompareI
info.setReleaseStateTitle(ReleaseConditionEnum.getTextByValue(info.getReleaseState(), cut));
info.setFileTypeLeft(getFileTypeText(info.getFileTypeLeft(), cut));
info.setFileTypeRight(getFileTypeText(info.getFileTypeRight(), cut));
//根据左右标准编号赋值标准ID、标准来源4个字段值
this.assignment(info);
}
return Result.OK(pageList);
}
private void assignment(SarFileCompareInfo info) {
String serialNumberLeft = info.getSerialNumberLeft();
String serialNumberRight = info.getSerialNumberRight();
if (StringUtils.isNotBlank(serialNumberLeft)){
LawsDomesticStandard standard = lawsDomesticStandardService.queryByStandardNumber(serialNumberLeft);
if (standard != null){
info.setStandardSourceLeft(CommonConstant.STANDARD_SOURCE_1);
info.setStandardIdLeft(standard.getId());
}else {
LawsOverseasStandard standard1 = lawsOverseasStandardService.queryByStandardNumber(serialNumberLeft);
if (standard1 != null){
info.setStandardSourceLeft(CommonConstant.STANDARD_SOURCE_2);
info.setStandardIdLeft(standard1.getId());
}else {
LawsEnterpriseStandard standard2 = enterpriseStandardService.queryByStandardNumber(serialNumberLeft);
if (standard2 != null){
info.setStandardSourceLeft(CommonConstant.STANDARD_SOURCE_3);
info.setStandardIdLeft(standard2.getId());
}
}
}
}
if (StringUtils.isNotBlank(serialNumberRight)){
LawsDomesticStandard standard = lawsDomesticStandardService.queryByStandardNumber(serialNumberRight);
if (standard != null){
info.setStandardSourceRight(CommonConstant.STANDARD_SOURCE_1);
info.setStandardIdRight(standard.getId());
}else {
LawsOverseasStandard standard1 = lawsOverseasStandardService.queryByStandardNumber(serialNumberRight);
if (standard1 != null){
info.setStandardSourceRight(CommonConstant.STANDARD_SOURCE_2);
info.setStandardIdRight(standard1.getId());
}else {
LawsEnterpriseStandard standard2 = enterpriseStandardService.queryByStandardNumber(serialNumberRight);
if (standard2 != null){
info.setStandardSourceRight(CommonConstant.STANDARD_SOURCE_3);
info.setStandardIdRight(standard2.getId());
}
}
}
}
}
private String getFileTypeText(String fileType, String cut) {
OnlCgformField fileTypeField = this.onlCgformFieldService.queryById(fileType);
if (ObjectUtil.isNotEmpty(fileTypeField)) {
@@ -228,7 +287,11 @@ public class SarFileCompareInfoController extends JeroController<SarFileCompareI
remark = json.get("remark").toString();
}
String InfoId = sarFileCompareInfoService.fullTextComparison(leftStandard, rightStandard, remark);
return Result.OK(InfoId);
Result<String> r = new Result<>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setResult(InfoId);
return r;
} catch (Exception ex) {
log.error("发起文档对比失败:" + ex.getMessage());
return Result.OK("发起文档对比失败!");
@@ -138,4 +138,18 @@ public class SarFileCompareInfo implements Serializable {
@ApiModelProperty(value = "评论")
private String comments;
@TableField(exist = false)
@ApiModelProperty(value = "标准ID1")
private String standardIdLeft;
@TableField(exist = false)
@ApiModelProperty(value = "标准来源1")
private String standardSourceLeft;
@TableField(exist = false)
@ApiModelProperty(value = "标准ID2")
private String standardIdRight;
@TableField(exist = false)
@ApiModelProperty(value = "标准来源2")
private String standardSourceRight;
}