Commit e9d105582268aad72b8e38416c0c979f467218bc
1 parent
b5e606fe45
Exists in
master
and in
1 other branch
platform permission
fix bug
Showing 4 changed files with 105 additions and 3 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CommunityConfigService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/CommunityConfig.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityConfigController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CommunityConfigRequest.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CommunityConfigService.java
View file @
e9d1055
... | ... | @@ -67,6 +67,29 @@ |
67 | 67 | return communityConfigDao.queryArea(mongoQuery); |
68 | 68 | } |
69 | 69 | |
70 | + //查询小区 | |
71 | + public List<CommunityConfig> queryCommunity(String keyword, Integer page, Integer limit) { | |
72 | + MongoCondition mongoCondition = MongoCondition.newInstance(); | |
73 | + if(null != keyword) { | |
74 | + mongoCondition.orCondition(new MongoCondition[]{new MongoCondition("name", keyword, MongoOper.LIKE), new MongoCondition("gxxq", keyword, MongoOper.LIKE)}); | |
75 | + } | |
76 | + mongoCondition.andCondition(new MongoCondition("yn", YnEnums.YES.getId(), MongoOper.IS).and("type", 1, MongoOper.IS)); | |
77 | + | |
78 | + | |
79 | + MongoQuery mongoQuery = mongoCondition.toMongoQuery(); | |
80 | + BaseQuery baseQuery = new BaseQuery(); | |
81 | + | |
82 | + if(null != page && null != limit) { | |
83 | + baseQuery.setPage(page); | |
84 | + baseQuery.setLimit(limit); | |
85 | + baseQuery.mysqlBuild((int) communityConfigDao.queryCount(mongoQuery)); | |
86 | + mongoQuery.start(baseQuery.getOffset()).end(baseQuery.getLimit()); | |
87 | + } | |
88 | + | |
89 | + return communityConfigDao.queryArea(mongoQuery); | |
90 | + } | |
91 | + | |
92 | + | |
70 | 93 | //查询区域根据PID |
71 | 94 | public List<CommunityConfig> queryAreaByParentId(String pid) { |
72 | 95 | if(null == pid) return null; |
platform-dal/src/main/java/com/lyms/platform/pojo/CommunityConfig.java
View file @
e9d1055
... | ... | @@ -15,7 +15,15 @@ |
15 | 15 | private Integer type; //1 地名, 2 小区 |
16 | 16 | private CommunityConfig parent; |
17 | 17 | private List<CommunityConfig> nodes; |
18 | + private String gxxq; //管辖小区 | |
18 | 19 | |
20 | + public String getGxxq() { | |
21 | + return gxxq; | |
22 | + } | |
23 | + | |
24 | + public void setGxxq(String gxxq) { | |
25 | + this.gxxq = gxxq; | |
26 | + } | |
19 | 27 | |
20 | 28 | public List<CommunityConfig> getNodes() { |
21 | 29 | return nodes; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityConfigController.java
View file @
e9d1055
... | ... | @@ -30,19 +30,81 @@ |
30 | 30 | private CommunityConfigService communityConfigService; |
31 | 31 | |
32 | 32 | |
33 | +// //新增小区 | |
34 | +// @RequestMapping(value = "addCommunity", method = RequestMethod.POST) | |
35 | +// @ResponseBody | |
36 | +// public BaseResponse addCommunity(@RequestBody @Valid CommunityConfigRequest communityConfigRequest) { | |
37 | +// CommunityConfig communityConfig = null; | |
38 | +// for(String tmp : communityConfigRequest.getNames()) { | |
39 | +// communityConfig = new CommunityConfig(communityConfigRequest.getParentId(), tmp); | |
40 | +// communityConfigService.appendCommunity(communityConfig); | |
41 | +// } | |
42 | +// return new BaseResponse() | |
43 | +// .setErrorcode(ErrorCodeConstants.SUCCESS) | |
44 | +// .setErrormsg("添加成功!"); | |
45 | +// } | |
46 | + | |
47 | + | |
33 | 48 | //新增小区 |
34 | 49 | @RequestMapping(value = "addCommunity", method = RequestMethod.POST) |
35 | 50 | @ResponseBody |
36 | 51 | public BaseResponse addCommunity(@RequestBody @Valid CommunityConfigRequest communityConfigRequest) { |
37 | - CommunityConfig communityConfig = null; | |
52 | + String names = ""; | |
38 | 53 | for(String tmp : communityConfigRequest.getNames()) { |
39 | - communityConfig = new CommunityConfig(communityConfigRequest.getParentId(), tmp); | |
40 | - communityConfigService.appendCommunity(communityConfig); | |
54 | + names += ", " + tmp; | |
41 | 55 | } |
56 | + CommunityConfig communityConfig = new CommunityConfig(); | |
57 | + communityConfig.setId(communityConfigRequest.getId()); | |
58 | + communityConfig.setGxxq(names.substring(1, names.length())); | |
59 | + | |
60 | + communityConfigService.updateArea(communityConfig); | |
61 | + | |
42 | 62 | return new BaseResponse() |
43 | 63 | .setErrorcode(ErrorCodeConstants.SUCCESS) |
44 | 64 | .setErrormsg("添加成功!"); |
45 | 65 | } |
66 | + | |
67 | + | |
68 | + //删除小区 | |
69 | + @RequestMapping(value = "delCommunity/{id}", method = RequestMethod.DELETE) | |
70 | + @ResponseBody | |
71 | + public BaseResponse addCommunity(@PathVariable String id) { | |
72 | + CommunityConfig communityConfig = new CommunityConfig(); | |
73 | + communityConfig.setId(id); | |
74 | + communityConfig.setGxxq(""); | |
75 | + | |
76 | + communityConfigService.updateArea(communityConfig); | |
77 | + | |
78 | + return new BaseResponse() | |
79 | + .setErrorcode(ErrorCodeConstants.SUCCESS) | |
80 | + .setErrormsg("添加成功!"); | |
81 | + } | |
82 | + | |
83 | + | |
84 | + //查询区域 | |
85 | + @RequestMapping(value = "queryCommunity", method = RequestMethod.GET) | |
86 | + @ResponseBody | |
87 | + public BaseListResponse queryCommunity(String keyword, Integer page, Integer limit ) { | |
88 | + List<CommunityConfig> communityConfigList = communityConfigService.queryCommunity(keyword, page, limit); | |
89 | + | |
90 | + if(null != communityConfigList) { | |
91 | + for(CommunityConfig communityConfig : communityConfigList) { | |
92 | + communityConfig.setNodes(communityConfigService.queryAreaByParentId(communityConfig.getId())); | |
93 | + if(null != communityConfig.getParentId()) { | |
94 | + communityConfig.setParent(communityConfigService.queryAreaById(communityConfig.getParentId())); | |
95 | + } else { | |
96 | + communityConfig.setParent(new CommunityConfig("0", "root")); | |
97 | + } | |
98 | + } | |
99 | + return new BaseListResponse().setData(communityConfigList) | |
100 | + .setErrorcode(ErrorCodeConstants.SUCCESS) | |
101 | + .setErrormsg("查询成功!"); | |
102 | + } | |
103 | + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR) | |
104 | + .setErrormsg("没有数据"); | |
105 | + | |
106 | + } | |
107 | + | |
46 | 108 | |
47 | 109 | |
48 | 110 | //新增区域 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CommunityConfigRequest.java
View file @
e9d1055
... | ... | @@ -13,6 +13,15 @@ |
13 | 13 | private String parentId; |
14 | 14 | @NotNull(message = "添加内容不能为空") |
15 | 15 | private String[] names; |
16 | + private String id; | |
17 | + | |
18 | + public String getId() { | |
19 | + return id; | |
20 | + } | |
21 | + | |
22 | + public void setId(String id) { | |
23 | + this.id = id; | |
24 | + } | |
16 | 25 | |
17 | 26 | public String getParentId() { |
18 | 27 | return parentId; |