Commit 29d9c748f13a257f94d59e1594f6780a2a71c5be

Authored by 房远帅
2 parents 309dd01b e487bf08

Merge branch 'master_after20' into master_cj_zq

... ... @@ -41,5 +41,13 @@
41 41 AND tb.type = #{vo.type}
42 42 </if>
43 43 </where>
  44 + ORDER BY
  45 + CASE factory_code
  46 + WHEN 'yfc' THEN 1
  47 + WHEN 'efc' THEN 2
  48 + WHEN 'sfc' THEN 3
  49 + WHEN 'ztfc' THEN 4
  50 + ELSE 999
  51 + END;
44 52 </select>
45 53 </mapper>
... ...
... ... @@ -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 }
... ...