Showing
1 changed file
with
15 additions
and
4 deletions
| @@ -79,7 +79,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram | @@ -79,7 +79,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram | ||
| 79 | QueryContractFrameworkVo vo1 = new QueryContractFrameworkVo(); | 79 | QueryContractFrameworkVo vo1 = new QueryContractFrameworkVo(); |
| 80 | vo1.setCustomerId(vo.getCustomerId()); | 80 | vo1.setCustomerId(vo.getCustomerId()); |
| 81 | vo1.setCompany(vo.getCompany()); | 81 | vo1.setCompany(vo.getCompany()); |
| 82 | - vo1.setMaterialTypeId(vo.getMaterialTypeId()); | 82 | + vo1.setMaterialTypeId(normalizeMaterialTypeIds(vo.getMaterialTypeId())); |
| 83 | List<ContractFramework> query = this.query(vo1); | 83 | List<ContractFramework> query = this.query(vo1); |
| 84 | if (CollectionUtils.isNotEmpty(query)) { | 84 | if (CollectionUtils.isNotEmpty(query)) { |
| 85 | // 过滤掉当前 ID 的记录,看是否还有其他记录 | 85 | // 过滤掉当前 ID 的记录,看是否还有其他记录 |
| @@ -96,7 +96,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram | @@ -96,7 +96,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram | ||
| 96 | .set(ContractFramework::getCompany, vo.getCompany()) | 96 | .set(ContractFramework::getCompany, vo.getCompany()) |
| 97 | .set(ContractFramework::getHasFrameworkAgreement, vo.getHasFrameworkAgreement()) | 97 | .set(ContractFramework::getHasFrameworkAgreement, vo.getHasFrameworkAgreement()) |
| 98 | .set(ContractFramework::getValidityTime, vo.getValidityTime()) | 98 | .set(ContractFramework::getValidityTime, vo.getValidityTime()) |
| 99 | - .set(ContractFramework::getMaterialTypeId, vo.getMaterialTypeId()) | 99 | + .set(ContractFramework::getMaterialTypeId, normalizeMaterialTypeIds(vo.getMaterialTypeId())) |
| 100 | .eq(ContractFramework::getId, vo.getId()); | 100 | .eq(ContractFramework::getId, vo.getId()); |
| 101 | 101 | ||
| 102 | getBaseMapper().update(updateWrapper); | 102 | getBaseMapper().update(updateWrapper); |
| @@ -112,7 +112,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram | @@ -112,7 +112,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram | ||
| 112 | QueryContractFrameworkVo vo1 = new QueryContractFrameworkVo(); | 112 | QueryContractFrameworkVo vo1 = new QueryContractFrameworkVo(); |
| 113 | vo1.setCustomerId(vo.getCustomerId()); | 113 | vo1.setCustomerId(vo.getCustomerId()); |
| 114 | vo1.setCompany(vo.getCompany()); | 114 | vo1.setCompany(vo.getCompany()); |
| 115 | - vo1.setMaterialTypeId(vo.getMaterialTypeId()); | 115 | + vo1.setMaterialTypeId(normalizeMaterialTypeIds(vo.getMaterialTypeId())); |
| 116 | List<ContractFramework> query = this.query(vo1); | 116 | List<ContractFramework> query = this.query(vo1); |
| 117 | if (CollectionUtils.isNotEmpty(query)) { | 117 | if (CollectionUtils.isNotEmpty(query)) { |
| 118 | throw new DefaultClientException("已经存在相同的框架合同!"); | 118 | throw new DefaultClientException("已经存在相同的框架合同!"); |
| @@ -124,7 +124,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram | @@ -124,7 +124,7 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram | ||
| 124 | data.setCompany(vo.getCompany()); | 124 | data.setCompany(vo.getCompany()); |
| 125 | data.setHasFrameworkAgreement(vo.getHasFrameworkAgreement()); | 125 | data.setHasFrameworkAgreement(vo.getHasFrameworkAgreement()); |
| 126 | data.setValidityTime(vo.getValidityTime()); | 126 | data.setValidityTime(vo.getValidityTime()); |
| 127 | - data.setMaterialTypeId(vo.getMaterialTypeId()); | 127 | + data.setMaterialTypeId(normalizeMaterialTypeIds(vo.getMaterialTypeId())); |
| 128 | 128 | ||
| 129 | getBaseMapper().insert(data); | 129 | getBaseMapper().insert(data); |
| 130 | 130 | ||
| @@ -173,4 +173,15 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram | @@ -173,4 +173,15 @@ public class ContractFrameworkServiceImpl extends BaseMpServiceImpl<ContractFram | ||
| 173 | public void cleanCacheByKey(Serializable key) { | 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 | } |