Showing
2 changed files
with
23 additions
and
4 deletions
| ... | ... | @@ -79,7 +79,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram |
| 79 | 79 | QueryContractFrameworkVo vo1 = new QueryContractFrameworkVo(); |
| 80 | 80 | vo1.setCustomerId(vo.getCustomerId()); |
| 81 | 81 | vo1.setCompany(vo.getCompany()); |
| 82 | - vo1.setMaterialTypeId(vo.getMaterialTypeId()); | |
| 82 | + vo1.setMaterialTypeId(normalizeMaterialTypeIds(vo.getMaterialTypeId())); | |
| 83 | 83 | List<ContractFramework> query = this.query(vo1); |
| 84 | 84 | if (CollectionUtils.isNotEmpty(query)) { |
| 85 | 85 | // 过滤掉当前 ID 的记录,看是否还有其他记录 |
| ... | ... | @@ -96,7 +96,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram |
| 96 | 96 | .set(ContractFramework::getCompany, vo.getCompany()) |
| 97 | 97 | .set(ContractFramework::getHasFrameworkAgreement, vo.getHasFrameworkAgreement()) |
| 98 | 98 | .set(ContractFramework::getValidityTime, vo.getValidityTime()) |
| 99 | - .set(ContractFramework::getMaterialTypeId, vo.getMaterialTypeId()) | |
| 99 | + .set(ContractFramework::getMaterialTypeId, normalizeMaterialTypeIds(vo.getMaterialTypeId())) | |
| 100 | 100 | .eq(ContractFramework::getId, vo.getId()); |
| 101 | 101 | |
| 102 | 102 | getBaseMapper().update(updateWrapper); |
| ... | ... | @@ -112,7 +112,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram |
| 112 | 112 | QueryContractFrameworkVo vo1 = new QueryContractFrameworkVo(); |
| 113 | 113 | vo1.setCustomerId(vo.getCustomerId()); |
| 114 | 114 | vo1.setCompany(vo.getCompany()); |
| 115 | - vo1.setMaterialTypeId(vo.getMaterialTypeId()); | |
| 115 | + vo1.setMaterialTypeId(normalizeMaterialTypeIds(vo.getMaterialTypeId())); | |
| 116 | 116 | List<ContractFramework> query = this.query(vo1); |
| 117 | 117 | if (CollectionUtils.isNotEmpty(query)) { |
| 118 | 118 | throw new DefaultClientException("已经存在相同的框架合同!"); |
| ... | ... | @@ -124,7 +124,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram |
| 124 | 124 | data.setCompany(vo.getCompany()); |
| 125 | 125 | data.setHasFrameworkAgreement(vo.getHasFrameworkAgreement()); |
| 126 | 126 | data.setValidityTime(vo.getValidityTime()); |
| 127 | - data.setMaterialTypeId(vo.getMaterialTypeId()); | |
| 127 | + data.setMaterialTypeId(normalizeMaterialTypeIds(vo.getMaterialTypeId())); | |
| 128 | 128 | |
| 129 | 129 | getBaseMapper().insert(data); |
| 130 | 130 | |
| ... | ... | @@ -173,4 +173,15 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram |
| 173 | 173 | public void cleanCacheByKey(Serializable key) { |
| 174 | 174 | |
| 175 | 175 | } |
| 176 | + | |
| 177 | + public static String normalizeMaterialTypeIds(String materialTypeIds) { | |
| 178 | + if (StringUtils.isBlank(materialTypeIds)) { | |
| 179 | + return ""; | |
| 180 | + } | |
| 181 | + return Arrays.stream(materialTypeIds.split(",")) | |
| 182 | + .map(String::trim) | |
| 183 | + .filter(s -> !s.isEmpty()) | |
| 184 | + .sorted() // 关键:排序 | |
| 185 | + .collect(Collectors.joining(",")); | |
| 186 | + } | |
| 176 | 187 | } | ... | ... |