Commit 76a55c51d2a7b9c210dfcd1e7dc2f730dd381f67
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
Showing 10 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CommunityConfigService.java
- platform-common/src/main/java/com/lyms/platform/common/constants/ErrorCodeConstants.java
- platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.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/controller/UsersController.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/request/BasicConfigQueryRequest.java
- platform-operate-api/src/main/webapp/WEB-INF/web.xml
- platform-operate-api/src/main/webapp/WEB-INF/web.xml_
- platform-operate-api/src/main/webapp/clientaccesspolicy.xml
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CommunityConfigService.java
View file @
76a55c5
| ... | ... | @@ -66,7 +66,7 @@ |
| 66 | 66 | public List<CommunityConfig> queryCommunity(CommunityQuery communityQuery) { |
| 67 | 67 | MongoCondition mongoCondition = MongoCondition.newInstance(); |
| 68 | 68 | if(null != communityQuery.getKeyword()) { |
| 69 | - mongoCondition.orCondition(new MongoCondition[]{new MongoCondition("name", communityQuery.getKeyword(), MongoOper.LIKE), new MongoCondition("gxxq", communityQuery.getKeyword(), MongoOper.LIKE)}); | |
| 69 | + mongoCondition.orCondition(new MongoCondition[]{new MongoCondition("name", communityQuery.getKeyword(), MongoOper.LIKE), new MongoCondition("gxxq", communityQuery.getKeyword(), MongoOper.LIKE), new MongoCondition("parentId", communityQuery.getKeyword(), MongoOper.IS), new MongoCondition("id", communityQuery.getKeyword(), MongoOper.IS)}); | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | if(null == communityQuery.getId()) { |
platform-common/src/main/java/com/lyms/platform/common/constants/ErrorCodeConstants.java
View file @
76a55c5
platform-common/src/main/java/com/lyms/platform/common/utils/LoginUtil.java
View file @
76a55c5
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | |
| 12 | 12 | public class LoginUtil { |
| 13 | 13 | |
| 14 | - public static Integer register(String phone, String token, String typeId) { | |
| 14 | + public static LoginContext register(String phone, String token, String typeId) { | |
| 15 | 15 | HttpClient client = new HttpClient(); |
| 16 | 16 | PostMethod post = new MessageUtil.UTF8PostMethod("http://passport.healthbaby.com.cn/v1/register.action"); |
| 17 | 17 | NameValuePair[] data = { |
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | post.releaseConnection(); |
| 28 | 28 | if(200 == statusCode) { |
| 29 | 29 | LoginContext loginState = JsonUtil.str2Obj(result, LoginContext.class); |
| 30 | - return loginState.getId(); | |
| 30 | + return loginState; | |
| 31 | 31 | } |
| 32 | 32 | } catch (Exception e) { |
| 33 | 33 | e.printStackTrace(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityConfigController.java
View file @
76a55c5
| ... | ... | @@ -5,8 +5,13 @@ |
| 5 | 5 | import javax.validation.Valid; |
| 6 | 6 | |
| 7 | 7 | import com.lyms.platform.biz.param.CommunityQuery; |
| 8 | +import com.lyms.platform.biz.service.PatientsService; | |
| 8 | 9 | import com.lyms.platform.common.annotation.TokenRequired; |
| 10 | +import com.lyms.platform.operate.web.facade.PuerperaManagerFacade; | |
| 11 | +import com.lyms.platform.operate.web.request.PuerperaManagerQueryRequest; | |
| 9 | 12 | import com.lyms.platform.operate.web.result.FrontEndResult; |
| 13 | +import com.lyms.platform.pojo.Patients; | |
| 14 | +import com.lyms.platform.query.PatientsQuery; | |
| 10 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 16 | import org.springframework.stereotype.Controller; |
| 12 | 17 | import org.springframework.web.bind.annotation.PathVariable; |
| 13 | 18 | |
| ... | ... | @@ -31,8 +36,9 @@ |
| 31 | 36 | public class CommunityConfigController extends RestController { |
| 32 | 37 | @Autowired |
| 33 | 38 | private CommunityConfigService communityConfigService; |
| 39 | + @Autowired | |
| 40 | + private PatientsService patientsService; | |
| 34 | 41 | |
| 35 | - | |
| 36 | 42 | // //新增小区 |
| 37 | 43 | // @RequestMapping(value = "addCommunity", method = RequestMethod.POST) |
| 38 | 44 | // @ResponseBody |
| ... | ... | @@ -81,7 +87,6 @@ |
| 81 | 87 | CommunityConfig communityConfig = new CommunityConfig(); |
| 82 | 88 | communityConfig.setId(id); |
| 83 | 89 | communityConfig.setGxxq(""); |
| 84 | - | |
| 85 | 90 | communityConfigService.updateArea(communityConfig); |
| 86 | 91 | |
| 87 | 92 | return new BaseResponse() |
| ... | ... | @@ -134,6 +139,13 @@ |
| 134 | 139 | @ResponseBody |
| 135 | 140 | @TokenRequired |
| 136 | 141 | public BaseResponse deleteArea(@PathVariable String id) { |
| 142 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 143 | + patientsQuery.setCommunityId(id); | |
| 144 | + List<Patients > q = patientsService.queryPatient(patientsQuery); | |
| 145 | + if(0 < q.size()) { | |
| 146 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.DONT_DELETE).setErrormsg("该社区下有产妇数据不能删除!"); | |
| 147 | + } | |
| 148 | + | |
| 137 | 149 | CommunityConfig communityConfig = new CommunityConfig(); |
| 138 | 150 | communityConfig.setId(id); |
| 139 | 151 | communityConfigService.deleteArea(communityConfig); |
| ... | ... | @@ -170,7 +182,7 @@ |
| 170 | 182 | if(null != communityConfig.getParentId()) { |
| 171 | 183 | communityConfig.setParent(communityConfigService.queryAreaById(communityConfig.getParentId())); |
| 172 | 184 | } else { |
| 173 | - communityConfig.setParent(new CommunityConfig("0", "root")); | |
| 185 | +// communityConfig.setParent(new CommunityConfig("0", "root")); | |
| 174 | 186 | } |
| 175 | 187 | } |
| 176 | 188 | return FrontEndResult.ini().setData(communityConfigList).setPageInfo(communityQuery.getPageInfo()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
76a55c5
| ... | ... | @@ -84,7 +84,7 @@ |
| 84 | 84 | //设置用户角色信息 |
| 85 | 85 | for(Users user : users) { |
| 86 | 86 | user.setRoles(this.getUserRoles(user.getId())); |
| 87 | - user.setOrganization(organizationService.getOrganization(user.getId())); | |
| 87 | + user.setOrganization(organizationService.getOrganization(user.getOrgId())); | |
| 88 | 88 | user.setDepartmentses(departmentsService.getDepartments(user.getDeptId())); |
| 89 | 89 | } |
| 90 | 90 | |
| ... | ... | @@ -133,7 +133,7 @@ |
| 133 | 133 | //设置用户角色信息 |
| 134 | 134 | for(Users user : users) { |
| 135 | 135 | user.setRoles(this.getUserRoles(user.getId())); |
| 136 | - user.setOrganization(organizationService.getOrganization(user.getId())); | |
| 136 | + user.setOrganization(organizationService.getOrganization(user.getOrgId())); | |
| 137 | 137 | user.setDepartmentses(departmentsService.getDepartments(user.getDeptId())); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | |
| ... | ... | @@ -423,13 +423,14 @@ |
| 423 | 423 | // users.setPwd(LoginUtil.md5(NumberUtils.getRandomString(6))); |
| 424 | 424 | |
| 425 | 425 | //关联登录中心ID |
| 426 | - Integer loginCenterId = LoginUtil.register(phone, token, typeId); | |
| 427 | - if(null == loginCenterId) { | |
| 428 | - ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.SYSTEM_ERROR, "服务器内部错误"); | |
| 426 | + LoginContext loginContext = LoginUtil.register(phone, token, typeId); | |
| 427 | + if(!loginContext.getErrorcode().equals(0)) { | |
| 428 | + ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.SYSTEM_ERROR, loginContext.getErrormsg()); | |
| 429 | 429 | return; |
| 430 | 430 | } |
| 431 | - users.setLogincenterId(loginCenterId); | |
| 431 | + users.setLogincenterId(loginContext.getId()); | |
| 432 | 432 | |
| 433 | + | |
| 433 | 434 | usersService.addUsers(users); |
| 434 | 435 | |
| 435 | 436 | |
| ... | ... | @@ -504,7 +505,7 @@ |
| 504 | 505 | |
| 505 | 506 | //准备添加数据 |
| 506 | 507 | Users users = new Users(); |
| 507 | - users.setType(1); //1管理员 | |
| 508 | + users.setType(1); //1普通用户 | |
| 508 | 509 | users.setDeptId(deptId); |
| 509 | 510 | users.setOrgId(orgId); |
| 510 | 511 | users.setName(name); |
| 511 | 512 | |
| ... | ... | @@ -522,12 +523,12 @@ |
| 522 | 523 | // users.setPwd(LoginUtil.md5(NumberUtils.getRandomString(6))); |
| 523 | 524 | |
| 524 | 525 | //关联登录中心ID |
| 525 | - Integer loginCenterId = LoginUtil.register(phone, token, typeId); | |
| 526 | - if(null == loginCenterId) { | |
| 527 | - ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.SYSTEM_ERROR, "服务器内部错误"); | |
| 526 | + LoginContext loginContext = LoginUtil.register(phone, token, typeId); | |
| 527 | + if(!loginContext.getErrorcode().equals(0)) { | |
| 528 | + ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.SYSTEM_ERROR, loginContext.getErrormsg()); | |
| 528 | 529 | return; |
| 529 | 530 | } |
| 530 | - users.setLogincenterId(loginCenterId); | |
| 531 | + users.setLogincenterId(loginContext.getId()); | |
| 531 | 532 | |
| 532 | 533 | usersService.addUsers(users); |
| 533 | 534 | |
| ... | ... | @@ -665,7 +666,9 @@ |
| 665 | 666 | @RequestParam(value = "phone",required = false) String phone, |
| 666 | 667 | @RequestParam(value = "enable",required = false) Integer enable, |
| 667 | 668 | @RequestParam(value = "remarks",required = false) String remarks, |
| 668 | - @RequestParam(value = "roleIds",required = false) String roleIds) { | |
| 669 | + @RequestParam(value = "roleIds",required = false) String roleIds, | |
| 670 | + @RequestParam(value = "orgId",required = false) Integer orgId, | |
| 671 | + @RequestParam(value = "deptId",required = false) Integer deptId) { | |
| 669 | 672 | |
| 670 | 673 | |
| 671 | 674 | |
| ... | ... | @@ -695,6 +698,8 @@ |
| 695 | 698 | users.setEnable(enable); |
| 696 | 699 | users.setRemarks(remarks); |
| 697 | 700 | users.setModified(new Date()); |
| 701 | + users.setDeptId(deptId); | |
| 702 | + users.setOrgId(orgId); | |
| 698 | 703 | // users.setPwd(LoginUtil.md5(NumberUtils.getRandomString(6))); |
| 699 | 704 | usersService.updateUsers(users); |
| 700 | 705 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BasicConfigFacade.java
View file @
76a55c5
| ... | ... | @@ -35,6 +35,8 @@ |
| 35 | 35 | |
| 36 | 36 | BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); |
| 37 | 37 | basicConfigQuery.setNeed("1"); |
| 38 | + basicConfigQuery.setId(basicConfigQueryRequest.getId()); | |
| 39 | + basicConfigQuery.setParentId(basicConfigQueryRequest.getParentId()); | |
| 38 | 40 | basicConfigQuery.setPage(basicConfigQueryRequest.getPage()); |
| 39 | 41 | basicConfigQuery.setLimit(basicConfigQueryRequest.getLimit()); |
| 40 | 42 | basicConfigQuery.setYn(YnEnums.YES.getId()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BasicConfigQueryRequest.java
View file @
76a55c5
| ... | ... | @@ -19,15 +19,27 @@ |
| 19 | 19 | |
| 20 | 20 | @FormParam |
| 21 | 21 | private String keywords; |
| 22 | - @FormParam | |
| 23 | 22 | private String id; |
| 23 | + private String parentId; | |
| 24 | 24 | |
| 25 | + public static long getSerialVersionUID() { | |
| 26 | + return serialVersionUID; | |
| 27 | + } | |
| 28 | + | |
| 25 | 29 | public String getId() { |
| 26 | 30 | return id; |
| 27 | 31 | } |
| 28 | 32 | |
| 29 | 33 | public void setId(String id) { |
| 30 | 34 | this.id = id; |
| 35 | + } | |
| 36 | + | |
| 37 | + public String getParentId() { | |
| 38 | + return parentId; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setParentId(String parentId) { | |
| 42 | + this.parentId = parentId; | |
| 31 | 43 | } |
| 32 | 44 | |
| 33 | 45 | public String getKeywords() { |
platform-operate-api/src/main/webapp/WEB-INF/web.xml
View file @
76a55c5
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | version="2.5" |
| 14 | 14 | xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> |
| 15 | 15 | |
| 16 | -<!-- | |
| 16 | + | |
| 17 | 17 | <filter> |
| 18 | 18 | <filter-name>CorsFilter</filter-name> |
| 19 | 19 | <filter-class>org.apache.catalina.filters.CorsFilter</filter-class> |
| ... | ... | @@ -47,7 +47,7 @@ |
| 47 | 47 | <url-pattern>/*</url-pattern> |
| 48 | 48 | </filter-mapping> |
| 49 | 49 | |
| 50 | - --> | |
| 50 | + | |
| 51 | 51 | <servlet-mapping> |
| 52 | 52 | <servlet-name>default</servlet-name> |
| 53 | 53 | <url-pattern>*.xml</url-pattern> |
platform-operate-api/src/main/webapp/WEB-INF/web.xml_
View file @
76a55c5
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor | |
| 3 | + license agreements. See the NOTICE file distributed with this work for additional | |
| 4 | + information regarding copyright ownership. The ASF licenses this file to | |
| 5 | + you under the Apache License, Version 2.0 (the "License"); you may not use | |
| 6 | + this file except in compliance with the License. You may obtain a copy of | |
| 7 | + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required | |
| 8 | + by applicable law or agreed to in writing, software distributed under the | |
| 9 | + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | |
| 10 | + OF ANY KIND, either express or implied. See the License for the specific | |
| 11 | + language governing permissions and limitations under the License. --> | |
| 12 | +<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 13 | + version="2.5" | |
| 14 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> | |
| 15 | + | |
| 16 | +<!-- | |
| 17 | +<filter> | |
| 18 | + <filter-name>CorsFilter</filter-name> | |
| 19 | + <filter-class>org.apache.catalina.filters.CorsFilter</filter-class> | |
| 20 | + <init-param> | |
| 21 | + <param-name>cors.allowed.origins</param-name> | |
| 22 | + <param-value>*</param-value> | |
| 23 | + </init-param> | |
| 24 | + <init-param> | |
| 25 | + <param-name>cors.allowed.methods</param-name> | |
| 26 | + <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value> | |
| 27 | + </init-param> | |
| 28 | + <init-param> | |
| 29 | + <param-name>cors.allowed.headers</param-name> | |
| 30 | + <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,authorization</param-value> | |
| 31 | + </init-param> | |
| 32 | + <init-param> | |
| 33 | + <param-name>cors.exposed.headers</param-name> | |
| 34 | + <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value> | |
| 35 | + </init-param> | |
| 36 | + <init-param> | |
| 37 | + <param-name>cors.support.credentials</param-name> | |
| 38 | + <param-value>true</param-value> | |
| 39 | + </init-param> | |
| 40 | + <init-param> | |
| 41 | + <param-name>cors.preflight.maxage</param-name> | |
| 42 | + <param-value>10</param-value> | |
| 43 | + </init-param> | |
| 44 | +</filter> | |
| 45 | +<filter-mapping> | |
| 46 | + <filter-name>CorsFilter</filter-name> | |
| 47 | + <url-pattern>/*</url-pattern> | |
| 48 | +</filter-mapping> | |
| 49 | + | |
| 50 | + --> | |
| 51 | +<servlet-mapping> | |
| 52 | + <servlet-name>default</servlet-name> | |
| 53 | + <url-pattern>*.xml</url-pattern> | |
| 54 | + </servlet-mapping> | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + <context-param> | |
| 59 | + <param-name>contextConfigLocation</param-name> | |
| 60 | + <param-value> | |
| 61 | + classpath*:/spring/applicationContext.xml | |
| 62 | + </param-value> | |
| 63 | + </context-param> | |
| 64 | + | |
| 65 | + <session-config> | |
| 66 | + <session-timeout>60</session-timeout> | |
| 67 | + </session-config> | |
| 68 | + <context-param> | |
| 69 | + <param-name>log4jConfigLocation</param-name> | |
| 70 | + <param-value>classpath:log4j_config.xml</param-value> | |
| 71 | + </context-param> | |
| 72 | + <context-param> | |
| 73 | + <param-name>log4jRefreshInterval</param-name> | |
| 74 | + <param-value>60000</param-value> | |
| 75 | + </context-param> | |
| 76 | + <servlet> | |
| 77 | + <servlet-name>dispatcher</servlet-name> | |
| 78 | + <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> | |
| 79 | + <init-param> | |
| 80 | + <param-name>contextConfigLocation</param-name> | |
| 81 | + <param-value>classpath*:/spring/applicationContext-mvc.xml</param-value> | |
| 82 | + </init-param> | |
| 83 | + <load-on-startup>1</load-on-startup> | |
| 84 | + </servlet> | |
| 85 | + <servlet-mapping> | |
| 86 | + <servlet-name>dispatcher</servlet-name> | |
| 87 | + <url-pattern>/</url-pattern> | |
| 88 | + </servlet-mapping> | |
| 89 | + <filter> | |
| 90 | + <filter-name>HttpMethodFilter</filter-name> | |
| 91 | + <filter-class>org.springframework.web.filter.HttpPutFormContentFilter</filter-class> | |
| 92 | + </filter> | |
| 93 | + <filter-mapping> | |
| 94 | + <filter-name>HttpMethodFilter</filter-name> | |
| 95 | + <url-pattern>/*</url-pattern> | |
| 96 | + </filter-mapping> | |
| 97 | + <filter> | |
| 98 | + <filter-name>encodingFilter</filter-name> | |
| 99 | + <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> | |
| 100 | + <init-param> | |
| 101 | + <param-name>encoding</param-name> | |
| 102 | + <param-value>UTF-8</param-value> | |
| 103 | + </init-param> | |
| 104 | + </filter> | |
| 105 | + | |
| 106 | + <filter-mapping> | |
| 107 | + <filter-name>encodingFilter</filter-name> | |
| 108 | + <url-pattern>/*</url-pattern> | |
| 109 | + </filter-mapping> | |
| 110 | + <listener> | |
| 111 | + <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> | |
| 112 | + </listener> | |
| 113 | + <listener> | |
| 114 | + <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> | |
| 115 | + </listener> | |
| 116 | +</web-app> |
platform-operate-api/src/main/webapp/clientaccesspolicy.xml
View file @
76a55c5
| 1 | + <?xml version="1.0" encoding="utf-8" ?> | |
| 2 | + <access-policy> | |
| 3 | + <cross-domain-access> | |
| 4 | + <policy> | |
| 5 | + <allow-from http-request-headers="*"> | |
| 6 | + <domain uri="*"/> | |
| 7 | + </allow-from> | |
| 8 | + <grant-to> | |
| 9 | + <resource path="/" include-subpaths="true"/> | |
| 10 | + </grant-to> | |
| 11 | + </policy> | |
| 12 | + </cross-domain-access> | |
| 13 | + </access-policy> |