Commit d287c09d17e11cb840c0bd42d201770a037322d5
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
Showing 3 changed files
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Organization.java
View file @
d287c09
... | ... | @@ -29,9 +29,9 @@ |
29 | 29 | |
30 | 30 | private IdTextModel levelObj; |
31 | 31 | private IdTextModel typeObj; |
32 | - private BasicConfig province; | |
33 | - private BasicConfig city; | |
34 | - private BasicConfig area; | |
32 | + private Object province; | |
33 | + private Object city; | |
34 | + private Object area; | |
35 | 35 | private String foreignId; |
36 | 36 | |
37 | 37 | Map<String, Departments> departmentsMap = new HashMap<>(); |
38 | 38 | |
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | 42 | |
... | ... | @@ -60,27 +60,27 @@ |
60 | 60 | this.foreignId = foreignId; |
61 | 61 | } |
62 | 62 | |
63 | - public BasicConfig getProvince() { | |
63 | + public Object getProvince() { | |
64 | 64 | return province; |
65 | 65 | } |
66 | 66 | |
67 | - public void setProvince(BasicConfig province) { | |
67 | + public void setProvince(Object province) { | |
68 | 68 | this.province = province; |
69 | 69 | } |
70 | 70 | |
71 | - public BasicConfig getCity() { | |
71 | + public Object getCity() { | |
72 | 72 | return city; |
73 | 73 | } |
74 | 74 | |
75 | - public void setCity(BasicConfig city) { | |
75 | + public void setCity(Object city) { | |
76 | 76 | this.city = city; |
77 | 77 | } |
78 | 78 | |
79 | - public BasicConfig getArea() { | |
79 | + public Object getArea() { | |
80 | 80 | return area; |
81 | 81 | } |
82 | 82 | |
83 | - public void setArea(BasicConfig area) { | |
83 | + public void setArea(Object area) { | |
84 | 84 | this.area = area; |
85 | 85 | } |
86 | 86 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
View file @
d287c09
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | import com.lyms.platform.common.utils.ResultUtils; |
13 | 13 | import com.lyms.platform.common.utils.SystemConfig; |
14 | 14 | import com.lyms.platform.operate.web.result.FrontEndResult; |
15 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
15 | 16 | import com.lyms.platform.permission.model.*; |
16 | 17 | import com.lyms.platform.permission.service.*; |
17 | 18 | import com.lyms.platform.pojo.BasicConfig; |
... | ... | @@ -22,8 +23,7 @@ |
22 | 23 | |
23 | 24 | import javax.servlet.http.HttpServletRequest; |
24 | 25 | import javax.servlet.http.HttpServletResponse; |
25 | -import java.util.Date; | |
26 | -import java.util.List; | |
26 | +import java.util.*; | |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Created by zhang.rui on 2015/9/28 0028. |
30 | 30 | |
... | ... | @@ -207,12 +207,13 @@ |
207 | 207 | @RequestMapping(value = "/organization", method = RequestMethod.GET) |
208 | 208 | @ResponseBody |
209 | 209 | @TokenRequired |
210 | - public FrontEndResult getOrganization(HttpServletResponse response, | |
210 | + public FrontEndResult getOrganization( | |
211 | 211 | @RequestParam(value = "id", required = false) Integer id, |
212 | 212 | @RequestParam(value = "keyword", required = false) String keyword, |
213 | 213 | @RequestParam(value = "page", required = false) Integer page, |
214 | 214 | @RequestParam(value = "limit", required = false) Integer limit, |
215 | - @RequestParam(value = "areaId", required = false) String areaId) { | |
215 | + @RequestParam(value = "areaId", required = false) String areaId, | |
216 | + @RequestParam(value = "lite", required = false) String f) { | |
216 | 217 | |
217 | 218 | limit = limit == null ? 10 : limit; |
218 | 219 | page = page == null ? 1 : page; |
219 | 220 | |
220 | 221 | |
221 | 222 | |
222 | 223 | |
223 | 224 | |
... | ... | @@ -252,31 +253,45 @@ |
252 | 253 | } |
253 | 254 | |
254 | 255 | List<Organization> organizations = organizationService.queryOrganization(organizationQuery); |
255 | - | |
256 | + List<Object> data = new ArrayList<>(); | |
257 | + boolean falg =StringUtils.isNotEmpty(f); | |
256 | 258 | for(Organization organization : organizations) { |
257 | 259 | organization.setTypeObj(OrganizationLevelEnum.getById(organization.getLevel())); |
258 | 260 | organization.setLevelObj(OrganizationTypeEnum.getById(organization.getType())); |
259 | - if(null != organization.getProvinceId()) { | |
260 | - organization.setProvince(basicConfigService.getOneBasicConfigById(organization.getProvinceId())); | |
261 | + if(null != organization.getProvinceId()) { | |
262 | + organization.setProvince(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getProvinceId()),falg)); | |
263 | + } | |
264 | + if(null != organization.getCityId()) { | |
265 | + organization.setCity(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getCityId()),falg)); | |
266 | + } | |
267 | + if(null != organization.getAreaId()) { | |
268 | + organization.setArea(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getAreaId()),falg)); | |
269 | + } | |
270 | + Object obj = organization; | |
271 | + if(falg){ | |
272 | + obj = convert(organization); | |
261 | 273 | } |
262 | - if(null != organization.getCityId()) { | |
263 | - organization.setCity(basicConfigService.getOneBasicConfigById(organization.getCityId())); | |
264 | - } | |
265 | - if(null != organization.getAreaId()) { | |
266 | - organization.setArea(basicConfigService.getOneBasicConfigById(organization.getAreaId())); | |
267 | - } | |
274 | + data.add(obj); | |
268 | 275 | } |
269 | 276 | |
270 | 277 | FrontEndResult frontEndResult = new FrontEndResult(); |
271 | - frontEndResult.setData(organizations); | |
278 | + frontEndResult.setData(data); | |
272 | 279 | frontEndResult.setPageInfo(organizationQuery.getPageInfo()); |
273 | 280 | frontEndResult.setErrorcode(ErrorCodeConstants.SUCCESS); |
274 | 281 | |
275 | 282 | return frontEndResult; |
276 | -// ResultUtils.buildSuccessResultAndWrite(response, frontEndResult); | |
277 | 283 | } |
278 | - | |
279 | - | |
280 | - | |
284 | + private Map<String,Object> convert(Organization organization){ | |
285 | + Map<String,Object> map = new HashMap<>(); | |
286 | + map.put("id",organization.getId()); | |
287 | + map.put("name",organization.getName()); | |
288 | + map.put("areaId",organization.getAreaId()); | |
289 | + map.put("area",organization.getArea()); | |
290 | + map.put("city",organization.getCity()); | |
291 | + map.put("cityId",organization.getCityId()); | |
292 | + map.put("province",organization.getProvince()); | |
293 | + map.put("provinceId",organization.getProvinceId()); | |
294 | + return map; | |
295 | + } | |
281 | 296 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CommonsHelper.java
View file @
d287c09
... | ... | @@ -7,10 +7,28 @@ |
7 | 7 | import com.lyms.platform.pojo.BasicConfig; |
8 | 8 | import com.lyms.platform.pojo.Patients; |
9 | 9 | |
10 | +import java.util.HashMap; | |
11 | +import java.util.Map; | |
12 | + | |
10 | 13 | /** |
11 | 14 | * Created by Administrator on 2016/5/1 0001. |
12 | 15 | */ |
13 | 16 | public final class CommonsHelper { |
17 | + | |
18 | + | |
19 | + | |
20 | + | |
21 | + public static Object convterToMap(BasicConfig basicConfig,boolean sample){ | |
22 | + if(sample&&null!=basicConfig){ | |
23 | + Map<String,Object> map = new HashMap<>(); | |
24 | + map.put("id",basicConfig.getId()); | |
25 | + map.put("name",basicConfig.getName()); | |
26 | + map.put("code",basicConfig.getCode()); | |
27 | + return map; | |
28 | + } | |
29 | + return basicConfig; | |
30 | + } | |
31 | + | |
14 | 32 | /** |
15 | 33 | * 填充地址信息 |
16 | 34 | * |