Commit dd2a6eacd93aa7a76139a121a097409012afec80
1 parent
9a08545c60
Exists in
master
and in
6 other branches
区分常用
Showing 4 changed files with 79 additions and 18 deletions
- platform-dal/src/main/java/com/lyms/platform/query/BasicConfigQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/EnumsController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BasicConfigFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BasicConfigResult.java
platform-dal/src/main/java/com/lyms/platform/query/BasicConfigQuery.java
View file @
dd2a6ea
... | ... | @@ -30,7 +30,17 @@ |
30 | 30 | private Integer enable; |
31 | 31 | |
32 | 32 | private String typeId; |
33 | + // | |
34 | + private Boolean existweight; | |
33 | 35 | |
36 | + public Boolean getExistweight() { | |
37 | + return existweight; | |
38 | + } | |
39 | + | |
40 | + public void setExistweight(Boolean existweight) { | |
41 | + this.existweight = existweight; | |
42 | + } | |
43 | + | |
34 | 44 | public Integer getEnable() { |
35 | 45 | return enable; |
36 | 46 | } |
... | ... | @@ -76,7 +86,9 @@ |
76 | 86 | if(null!=enable){ |
77 | 87 | condition = condition.and("enable", enable, MongoOper.IS); |
78 | 88 | } |
79 | - | |
89 | + if(null!=existweight){ | |
90 | + condition = condition.and("weight", existweight, MongoOper.EXISTS); | |
91 | + } | |
80 | 92 | |
81 | 93 | if (null != keyword) { |
82 | 94 | MongoCondition con1= MongoCondition.newInstance("code", keyword, MongoOper.LIKE); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/EnumsController.java
View file @
dd2a6ea
... | ... | @@ -3,10 +3,13 @@ |
3 | 3 | import com.lyms.platform.common.enums.*; |
4 | 4 | import com.lyms.platform.common.utils.ExceptionUtils; |
5 | 5 | import com.lyms.platform.common.utils.JsonUtil; |
6 | +import com.lyms.platform.common.utils.StringUtils; | |
6 | 7 | import com.lyms.platform.common.utils.SystemConfig; |
7 | 8 | import com.lyms.platform.operate.web.facade.BasicConfigFacade; |
8 | 9 | import com.lyms.platform.operate.web.result.BasicConfigResult; |
9 | 10 | import com.lyms.platform.permission.model.Organization; |
11 | +import com.lyms.platform.pojo.BasicConfig; | |
12 | +import org.apache.commons.collections.CollectionUtils; | |
10 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
11 | 14 | import org.springframework.stereotype.Controller; |
12 | 15 | import org.springframework.web.bind.annotation.PathVariable; |
... | ... | @@ -366,8 +369,19 @@ |
366 | 369 | @RequestMapping(value = "/getjws", method = RequestMethod.GET) |
367 | 370 | public void geJws(HttpServletResponse response) { |
368 | 371 | int cacheTime =30000; |
369 | - String json = JsonUtil.array2JsonString(basicConfigFacade.getBaseicConfigByParentId(SystemConfig.JIWANGSHI_ID)); | |
370 | - writeJsonWithCache(response,json,cacheTime); | |
372 | + List<BasicConfigResult> data = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.JIWANGSHI_ID); | |
373 | + | |
374 | + | |
375 | + if (CollectionUtils.isNotEmpty(data)) { | |
376 | + for (BasicConfigResult basicConfig :data){ | |
377 | + //常用 | |
378 | + basicConfig.setChildConfigs(basicConfigFacade.getBaseicConfigByParentIdWithWight(basicConfig.getId(),true)); | |
379 | + | |
380 | + basicConfig.setLeastUse(basicConfigFacade.getBaseicConfigByParentIdWithWight(basicConfig.getId(),false)); | |
381 | + } | |
382 | + } | |
383 | + String json = JsonUtil.array2JsonString(data); | |
384 | + writeJsonWithCache(response, json, cacheTime); | |
371 | 385 | } |
372 | 386 | |
373 | 387 | public void writeJsonWithCache(HttpServletResponse response, String json,int cacheTime) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BasicConfigFacade.java
View file @
dd2a6ea
... | ... | @@ -158,7 +158,6 @@ |
158 | 158 | */ |
159 | 159 | public List<BasicConfigResult> getBaseicConfigByParentId(String parentId) { |
160 | 160 | BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); |
161 | -// basicConfigQuery.setNeed("1"); | |
162 | 161 | basicConfigQuery.setYn(YnEnums.YES.getId()); |
163 | 162 | basicConfigQuery.setParentId(parentId); |
164 | 163 | List<BasicConfig> datas = basicConfigService.queryBasicConfig(basicConfigQuery); |
165 | 164 | |
166 | 165 | |
167 | 166 | |
... | ... | @@ -172,15 +171,44 @@ |
172 | 171 | br.setName(data.getName()); |
173 | 172 | br.setParentId(data.getParentId()); |
174 | 173 | br.setWeight(data.getWeight()); |
174 | + | |
175 | 175 | configResults.add(br); |
176 | 176 | } |
177 | 177 | } |
178 | 178 | return configResults; |
179 | 179 | } |
180 | + /** | |
181 | + * 查询基础数据通过parentId | |
182 | + * | |
183 | + * @param parentId | |
184 | + * @return | |
185 | + */ | |
186 | + public List<BasicConfigResult> getBaseicConfigByParentIdWithWight(String parentId,boolean wight) { | |
187 | + BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); | |
188 | + basicConfigQuery.setYn(YnEnums.YES.getId()); | |
189 | + basicConfigQuery.setParentId(parentId); | |
190 | + basicConfigQuery.setExistweight(wight); | |
191 | + List<BasicConfig> datas = basicConfigService.queryBasicConfig(basicConfigQuery); | |
192 | + List<BasicConfigResult> configResults = new ArrayList<>(); | |
193 | + if (datas != null) { | |
194 | + for (BasicConfig data : datas) { | |
195 | + BasicConfigResult br = new BasicConfigResult(); | |
196 | + br.setId(data.getId()); | |
197 | + br.setCode(data.getCode()); | |
198 | + br.setEnable(data.getEnable()); | |
199 | + br.setName(data.getName()); | |
200 | + br.setParentId(data.getParentId()); | |
201 | + br.setWeight(data.getWeight()); | |
180 | 202 | |
203 | + configResults.add(br); | |
204 | + } | |
205 | + } | |
206 | + return configResults; | |
207 | + } | |
181 | 208 | /** |
182 | 209 | * 根据类型查询响应的 基础数据 |
183 | - *[[ycs],[jws]] | |
210 | + * [[ycs],[jws]] | |
211 | + * | |
184 | 212 | * @param type |
185 | 213 | * @return |
186 | 214 | */ |
187 | 215 | |
... | ... | @@ -195,14 +223,11 @@ |
195 | 223 | if (!StringUtils.isEmpty(parentId)) { |
196 | 224 | results = getBaseicConfigByParentId(parentId); |
197 | 225 | |
198 | - if ("jws".equals(ConfigTypeEnums.JWS.getType())) | |
199 | - { | |
226 | + if ("jws".equals(ConfigTypeEnums.JWS.getType())) { | |
200 | 227 | |
201 | - for(BasicConfigResult result : results) | |
202 | - { | |
203 | - if (results != null && StringUtils.isNotEmpty(result.getId())) | |
204 | - { | |
205 | - List<BasicConfigResult> childConfigs = getBaseicConfigByParentId(result.getId()); | |
228 | + for (BasicConfigResult result : results) { | |
229 | + if (results != null && StringUtils.isNotEmpty(result.getId())) { | |
230 | + List<BasicConfigResult> childConfigs = getBaseicConfigByParentId(result.getId()); | |
206 | 231 | result.setChildConfigs(childConfigs); |
207 | 232 | } |
208 | 233 | } |
209 | 234 | |
... | ... | @@ -226,14 +251,14 @@ |
226 | 251 | basicConfigQuery.setParentId(basicConfig.getId()); |
227 | 252 | List<BasicConfig> basicConfigs2 = basicConfigService.queryBasicConfig(basicConfigQuery); |
228 | 253 | if (CollectionUtils.isNotEmpty(basicConfigs2)) { |
229 | - for (BasicConfig bc:basicConfigs2) { | |
230 | - bc.setColor("risk_"+ RiskDefaultTypeEnum.getColor(basicConfig.getName())); | |
254 | + for (BasicConfig bc : basicConfigs2) { | |
255 | + bc.setColor("risk_" + RiskDefaultTypeEnum.getColor(basicConfig.getName())); | |
231 | 256 | } |
232 | 257 | basicConfigs1.addAll(basicConfigs2); |
233 | 258 | } |
234 | 259 | } |
235 | 260 | } |
236 | - return basicConfigs1; | |
261 | + return basicConfigs1; | |
237 | 262 | } |
238 | 263 | |
239 | 264 | |
240 | 265 | |
... | ... | @@ -249,14 +274,14 @@ |
249 | 274 | basicConfigQuery.setParentId(basicConfig.getId()); |
250 | 275 | List<BasicConfig> basicConfigs2 = basicConfigService.queryBasicConfig(basicConfigQuery); |
251 | 276 | if (CollectionUtils.isNotEmpty(basicConfigs2)) { |
252 | - for (BasicConfig bc:basicConfigs2) { | |
253 | - bc.setColor("risk_"+ RiskDefaultTypeEnum.getColor(basicConfig.getName())); | |
277 | + for (BasicConfig bc : basicConfigs2) { | |
278 | + bc.setColor("risk_" + RiskDefaultTypeEnum.getColor(basicConfig.getName())); | |
254 | 279 | } |
255 | 280 | basicConfigs1.addAll(basicConfigs2); |
256 | 281 | } |
257 | 282 | } |
258 | 283 | } |
259 | - return basicConfigs1; | |
284 | + return basicConfigs1; | |
260 | 285 | } |
261 | 286 | |
262 | 287 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BasicConfigResult.java
View file @
dd2a6ea
... | ... | @@ -15,6 +15,16 @@ |
15 | 15 | //权重 |
16 | 16 | private Integer weight; |
17 | 17 | |
18 | + private List leastUse; | |
19 | + | |
20 | + public List getLeastUse() { | |
21 | + return leastUse; | |
22 | + } | |
23 | + | |
24 | + public void setLeastUse(List leastUse) { | |
25 | + this.leastUse = leastUse; | |
26 | + } | |
27 | + | |
18 | 28 | public Integer getWeight() { |
19 | 29 | return weight; |
20 | 30 | } |