feat: 国内海外关联标准互通
This commit is contained in:
@@ -199,6 +199,12 @@ INSERT INTO `laws_tag` (`id`, `table_name`, `db_field_name`, `db_field_en_name`,
|
||||
-- 2024-08-12 零部件性能优化
|
||||
ALTER TABLE `laws_tag`
|
||||
ADD COLUMN `tree_first_href` varchar(255) NULL DEFAULT NULL COMMENT '懒加载树形结构一级接口' AFTER `usable_range`;
|
||||
UPDATE `laws_tag` SET `field_show_type` = '17', `tree_first_href` = '/laws/standard/partName/queryFirstList' WHERE `id` = '1696038850540003301';
|
||||
UPDATE `laws_tag` SET `field_show_type` = '17', `tree_first_href` = '/laws/standard/partName/queryFirstList' WHERE `id` = '1696038850540003330';
|
||||
UPDATE `laws_tag` SET `field_show_type` = '17', `tree_first_href` = '/laws/standard/partName/queryFirstList' WHERE `id` = '1703608885251108865';
|
||||
UPDATE `laws_tag` SET `field_show_type` = '16', `tree_first_href` = '/laws/standard/partName/queryFirstList' WHERE `id` = '1696038850540003301';
|
||||
UPDATE `laws_tag` SET `field_show_type` = '16', `tree_first_href` = '/laws/standard/partName/queryFirstList' WHERE `id` = '1696038850540003330';
|
||||
UPDATE `laws_tag` SET `field_show_type` = '16', `tree_first_href` = '/laws/standard/partName/queryFirstList' WHERE `id` = '1703608885251108865';
|
||||
|
||||
-- 2024-08-15 海外标准关联国内标准
|
||||
ALTER TABLE `laws_overseas_standard`
|
||||
ADD COLUMN `associated_domestic_standards` varchar(1) NULL COMMENT '关联国内标准';
|
||||
|
||||
INSERT INTO `laws_tag` (`id`, `table_name`, `db_field_name`, `db_field_en_name`, `db_field_txt`, `order_num`, `db_field_name_old`, `db_is_key`, `db_is_null`, `db_type`, `db_length`, `db_point_length`, `db_default_val`, `dict_field`, `dict_table`, `dict_text`, `field_show_type`, `field_href`, `field_length`, `field_valid_type`, `field_must_input`, `field_extend_json`, `field_default_value`, `is_show_form_create`, `is_query`, `is_show_form`, `is_show_list`, `is_read_only`, `query_mode`, `main_table`, `main_field`, `update_by`, `update_time`, `create_time`, `create_by`, `converter`, `query_def_val`, `query_dict_text`, `query_dict_field`, `query_dict_table`, `query_show_type`, `query_config_flag`, `query_valid_type`, `query_must_input`, `sort_flag`, `show_area`, `is_show_laws_list`, `is_show_search`, `del_flag`, `is_model`, `dict_id`, `home_search_context_order`, `home_search_file_order`, `dict_field_search`, `dict_table_search`, `dict_text_search`, `usable_range`, `tree_first_href`) VALUES ('1722802933703528452', 'laws_overseas_standard', 'associated_domestic_standards', 'Associated domestic standards', '关联国内标准', 28, 'associated_domestic_standards', 0, 1, 'String', 1, NULL, NULL, NULL, NULL, NULL, '6', NULL, NULL, NULL, '0', NULL, NULL, 1, 0, 1, 0, 1, NULL, NULL, NULL, NULL, NULL, '2023-11-10 10:26:42', 'zx-test', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '1694630711725498369', NULL, 1, 0, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
@@ -127,6 +127,10 @@ public class FieldCommon {
|
||||
|
||||
// 代替标准号
|
||||
public static final String REPLACED_STANDARD = "substitute_standard_number";
|
||||
// 关联海外标准
|
||||
public static final String ASSOCIATED_FOREIGN_STANDARDS = "associated_foreign_standards";
|
||||
// 关联国内标准
|
||||
public static final String ASSOCIATED_DOMESTIC_STANDARDS = "associated_domestic_standards";
|
||||
// 被代替标准号
|
||||
public static final String REPLACED_BY_STANDARD = "replaced_by_standard_number";
|
||||
// 引用标准
|
||||
|
||||
+107
@@ -189,6 +189,9 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
@Resource
|
||||
private EnterpriseStandardAuthDeptService authDeptService;
|
||||
|
||||
@Resource
|
||||
private ILawsStandardAssociateService standardAssociateService;
|
||||
|
||||
public static boolean ENCRYPT_ENABLE;
|
||||
public static String DECRYPT_URL;
|
||||
public static String DECRYPT_APP_CODE;
|
||||
@@ -572,6 +575,22 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
List<PartName> partNameList = partNameService.list(partNameLambdaQueryWrapper);
|
||||
resultMap.put(key, value);
|
||||
resultMap.put(key + FieldCommon._DICT_TEXT, partNameList.stream().map(PartName::getName).collect(Collectors.joining(",")));
|
||||
} else if (FieldCommon.ASSOCIATED_FOREIGN_STANDARDS.equals(key)) {
|
||||
// 如果是关联海外表标准
|
||||
LambdaQueryWrapper<LawsStandardAssociate> saWrapper = new LambdaQueryWrapper<>();
|
||||
saWrapper.eq(LawsStandardAssociate::getDomesticStandard, standardNumber);
|
||||
List<LawsStandardAssociate> list = standardAssociateService.list(saWrapper);
|
||||
resultMap.put(key, StringUtils.join(list.stream()
|
||||
.map(LawsStandardAssociate::getOverseasStandard)
|
||||
.collect(Collectors.toList()), ","));
|
||||
} else if (FieldCommon.ASSOCIATED_DOMESTIC_STANDARDS.equals(key)) {
|
||||
// 如果是关联海外表标准
|
||||
LambdaQueryWrapper<LawsStandardAssociate> saWrapper = new LambdaQueryWrapper<>();
|
||||
saWrapper.eq(LawsStandardAssociate::getOverseasStandard, standardNumber);
|
||||
List<LawsStandardAssociate> list = standardAssociateService.list(saWrapper);
|
||||
resultMap.put(key, StringUtils.join(list.stream()
|
||||
.map(LawsStandardAssociate::getDomesticStandard)
|
||||
.collect(Collectors.toList()), ","));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,6 +772,11 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
|
||||
// 处理新增和编辑时的代替标准、引用标准
|
||||
processReplaced(parameterMap, standardNumber, module);
|
||||
// 国标和海外标准的关联标准
|
||||
if (module.equals(TableNameEnum.DOMESTIC_REGULATIONS.getValue()) ||
|
||||
module.equals(TableNameEnum.FOREIGN_REGULATIONS.getValue())) {
|
||||
processAssociatedStandard(parameterMap, standardNumber, module);
|
||||
}
|
||||
|
||||
// 获取要操作的表名
|
||||
String tableName = TableNameEnum.getTableName(module);
|
||||
@@ -848,6 +872,42 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
return ResultCommon.OK;
|
||||
}
|
||||
|
||||
private void processAssociatedStandard(Map<String, Object> parameterMap, String standardNumber, String module) {
|
||||
if (module.equals(TableNameEnum.DOMESTIC_REGULATIONS.getValue())) {
|
||||
String associateStandard = (String) parameterMap.get(FieldCommon.ASSOCIATED_FOREIGN_STANDARDS);
|
||||
// 先删除已经存储的关联
|
||||
standardAssociateService.removeDomesticAssociate(standardNumber);
|
||||
if (StringUtils.isNotBlank(associateStandard)) {
|
||||
// 再添加新的关联
|
||||
List<String> associateStandardList = Arrays.asList(associateStandard.split(","));
|
||||
List<LawsStandardAssociate> standardAssociateList = associateStandardList.stream().map(s -> {
|
||||
LawsStandardAssociate associate = new LawsStandardAssociate();
|
||||
associate.setDomesticStandard(standardNumber);
|
||||
associate.setOverseasStandard(s);
|
||||
return associate;
|
||||
}).collect(Collectors.toList());
|
||||
standardAssociateService.saveBatch(standardAssociateList);
|
||||
}
|
||||
parameterMap.remove(FieldCommon.ASSOCIATED_FOREIGN_STANDARDS);
|
||||
} else if (module.equals(TableNameEnum.FOREIGN_REGULATIONS.getValue())) {
|
||||
String associateStandard = (String) parameterMap.get(FieldCommon.ASSOCIATED_DOMESTIC_STANDARDS);
|
||||
// 先删除已经存储的关联
|
||||
standardAssociateService.removeOverseasAssociate(standardNumber);
|
||||
if (StringUtils.isNotBlank(associateStandard)) {
|
||||
// 再添加新的关联
|
||||
List<String> associateStandardList = Arrays.asList(associateStandard.split(","));
|
||||
List<LawsStandardAssociate> standardAssociateList = associateStandardList.stream().map(s -> {
|
||||
LawsStandardAssociate associate = new LawsStandardAssociate();
|
||||
associate.setOverseasStandard(standardNumber);
|
||||
associate.setDomesticStandard(s);
|
||||
return associate;
|
||||
}).collect(Collectors.toList());
|
||||
standardAssociateService.saveBatch(standardAssociateList);
|
||||
}
|
||||
parameterMap.remove(FieldCommon.ASSOCIATED_DOMESTIC_STANDARDS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增编辑企标时的稽查内容
|
||||
*
|
||||
@@ -934,6 +994,11 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
|
||||
// 处理新增和编辑时的代替标准、引用标准
|
||||
processReplaced(parameterMap, standardNumber, module);
|
||||
// 国标和海外标准的关联标准
|
||||
if (module.equals(TableNameEnum.DOMESTIC_REGULATIONS.getValue()) ||
|
||||
module.equals(TableNameEnum.FOREIGN_REGULATIONS.getValue())) {
|
||||
processAssociatedStandard(parameterMap, standardNumber, module);
|
||||
}
|
||||
|
||||
// 获取数据库里没修改的数据
|
||||
Map<String, Object> oldDataMap = getByIdAndModule(id, module, "2", standardNumber);
|
||||
@@ -2310,6 +2375,22 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
selectCondition.append(sql);
|
||||
parameterMap.remove(FieldCommon.REFERENCED_STANDARD);
|
||||
}
|
||||
// 关联国内标准
|
||||
String associatedDomesticStandards = (String) parameterMap.get(FieldCommon.ASSOCIATED_DOMESTIC_STANDARDS);
|
||||
if (StrUtil.isNotBlank(associatedDomesticStandards)) {
|
||||
List<String> standardNo = Arrays.asList(associatedDomesticStandards.split(","));
|
||||
String sql = getStandardsAssociateDomesticSql(tableName, standardNo);
|
||||
selectCondition.append(sql);
|
||||
parameterMap.remove(FieldCommon.ASSOCIATED_DOMESTIC_STANDARDS);
|
||||
}
|
||||
// 关联海外标准
|
||||
String associatedForeignStandards = (String) parameterMap.get(FieldCommon.ASSOCIATED_FOREIGN_STANDARDS);
|
||||
if (StrUtil.isNotBlank(associatedForeignStandards)) {
|
||||
List<String> standardNo = Arrays.asList(associatedForeignStandards.split(","));
|
||||
String sql = getStandardsAssociateOverseasSql(tableName, standardNo);
|
||||
selectCondition.append(sql);
|
||||
parameterMap.remove(FieldCommon.ASSOCIATED_FOREIGN_STANDARDS);
|
||||
}
|
||||
// 零部件名称
|
||||
String partName = (String) parameterMap.get(FieldCommon.PART_NAME);
|
||||
if (StrUtil.isNotBlank(partName)) {
|
||||
@@ -2470,6 +2551,32 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
" and type = " + type + " and " + str + ")";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getStandardsAssociateDomesticSql(String tableName, List<String> standardNo) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
for (int i = 0; i < standardNo.size(); i++) {
|
||||
str.append("domestic_standard").append(" like '%").append(standardNo.get(i)).append("%' ");
|
||||
if (i != standardNo.size() - 1) {
|
||||
str.append(" and ");
|
||||
}
|
||||
}
|
||||
return "and exists (select id from laws_standard_associate where " + tableName + ".standard_number = overseas_standard" +
|
||||
" and " + str + ")";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getStandardsAssociateOverseasSql(String tableName, List<String> standardNo) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
for (int i = 0; i < standardNo.size(); i++) {
|
||||
str.append("overseas_standard").append(" like '%").append(standardNo.get(i)).append("%' ");
|
||||
if (i != standardNo.size() - 1) {
|
||||
str.append(" and ");
|
||||
}
|
||||
}
|
||||
return "and exists (select id from laws_standard_associate where " + tableName + ".standard_number = domestic_standard" +
|
||||
" and " + str + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/8/22 11:41
|
||||
|
||||
+3
@@ -184,4 +184,7 @@ public class LawsOverseasStandard implements Serializable {
|
||||
/**标准号*/
|
||||
@ApiModelProperty(value = "标准号")
|
||||
private java.lang.String standardNumberTemp;
|
||||
/**关联国内标准号*/
|
||||
@ApiModelProperty(value = "关联国内标准号")
|
||||
private java.lang.String associatedDomesticStandards;
|
||||
}
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.jero.modules.laws.standard.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName laws_standard_associate
|
||||
*/
|
||||
@TableName(value ="laws_standard_associate")
|
||||
@Data
|
||||
public class LawsStandardAssociate implements Serializable {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 国标id
|
||||
*/
|
||||
private String domesticStandard;
|
||||
|
||||
/**
|
||||
* 外标id
|
||||
*/
|
||||
private String overseasStandard;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
LawsStandardAssociate other = (LawsStandardAssociate) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getDomesticStandard() == null ? other.getDomesticStandard() == null : this.getDomesticStandard().equals(other.getDomesticStandard()))
|
||||
&& (this.getOverseasStandard() == null ? other.getOverseasStandard() == null : this.getOverseasStandard().equals(other.getOverseasStandard()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getDomesticStandard() == null) ? 0 : getDomesticStandard().hashCode());
|
||||
result = prime * result + ((getOverseasStandard() == null) ? 0 : getOverseasStandard().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", domesticStandard=").append(domesticStandard);
|
||||
sb.append(", overseasStandard=").append(overseasStandard);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.jero.modules.laws.standard.mapper;
|
||||
|
||||
import com.jero.modules.laws.standard.entity.LawsStandardAssociate;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【laws_standard_associate】的数据库操作Mapper
|
||||
* @createDate 2024-08-15 14:00:08
|
||||
* @Entity com.jero.modules.laws.standard.entity.LawsStandardAssociate
|
||||
*/
|
||||
public interface LawsStandardAssociateMapper extends BaseMapper<LawsStandardAssociate> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.laws.standard.mapper.LawsStandardAssociateMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.jero.modules.laws.standard.entity.LawsStandardAssociate">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="domesticStandard" column="domestic_standard" jdbcType="VARCHAR"/>
|
||||
<result property="overseasStandard" column="overseas_standard" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,domestic_standard,overseas_standard
|
||||
</sql>
|
||||
</mapper>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.jero.modules.laws.standard.service;
|
||||
|
||||
import com.jero.modules.laws.standard.entity.LawsStandardAssociate;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【laws_standard_associate】的数据库操作Service
|
||||
* @createDate 2024-08-15 14:00:08
|
||||
*/
|
||||
public interface ILawsStandardAssociateService extends IService<LawsStandardAssociate> {
|
||||
|
||||
void removeDomesticAssociate(String standardNumber);
|
||||
|
||||
void removeOverseasAssociate(String standardNumber);
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.jero.modules.laws.standard.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.laws.standard.entity.LawsStandardAssociate;
|
||||
import com.jero.modules.laws.standard.service.ILawsStandardAssociateService;
|
||||
import com.jero.modules.laws.standard.mapper.LawsStandardAssociateMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【laws_standard_associate】的数据库操作Service实现
|
||||
* @createDate 2024-08-15 14:00:08
|
||||
*/
|
||||
@Service
|
||||
public class LawsStandardAssociateServiceImpl extends ServiceImpl<LawsStandardAssociateMapper, LawsStandardAssociate>
|
||||
implements ILawsStandardAssociateService {
|
||||
|
||||
@Override
|
||||
public void removeDomesticAssociate(String standardNumber) {
|
||||
LambdaUpdateWrapper<LawsStandardAssociate> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(LawsStandardAssociate::getDomesticStandard, standardNumber);
|
||||
this.remove(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeOverseasAssociate(String standardNumber) {
|
||||
LambdaUpdateWrapper<LawsStandardAssociate> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(LawsStandardAssociate::getOverseasStandard, standardNumber);
|
||||
this.remove(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user