Commit a56b0feee9641ab3a1dd99549f96bde162eeff8a
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
Showing 5 changed files
- platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.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/DepartmentsController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RolesController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
a56b0fe
| ... | ... | @@ -26,6 +26,7 @@ |
| 26 | 26 | |
| 27 | 27 | private String mphone; |
| 28 | 28 | private String mname; |
| 29 | + private String communityId; | |
| 29 | 30 | |
| 30 | 31 | public String getMname() { |
| 31 | 32 | return mname; |
| ... | ... | @@ -35,6 +36,14 @@ |
| 35 | 36 | this.mname = mname; |
| 36 | 37 | } |
| 37 | 38 | |
| 39 | + public String getCommunityId() { | |
| 40 | + return communityId; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setCommunityId(String communityId) { | |
| 44 | + this.communityId = communityId; | |
| 45 | + } | |
| 46 | + | |
| 38 | 47 | public String getMphone() { |
| 39 | 48 | return mphone; |
| 40 | 49 | } |
| ... | ... | @@ -53,6 +62,7 @@ |
| 53 | 62 | this.areaId = areaId; |
| 54 | 63 | } |
| 55 | 64 | |
| 65 | + | |
| 56 | 66 | /** |
| 57 | 67 | * 母亲的id |
| 58 | 68 | */ |
| ... | ... | @@ -161,7 +171,9 @@ |
| 161 | 171 | if (null != areaId) { |
| 162 | 172 | condition = condition.and("areaId", areaId, MongoOper.IS); |
| 163 | 173 | } |
| 164 | - | |
| 174 | + if(null!=communityId){ | |
| 175 | + condition=condition.and("communityId",communityId,MongoOper.IS); | |
| 176 | + } | |
| 165 | 177 | if (null != keyword) { |
| 166 | 178 | if (null != keyword) { |
| 167 | 179 | MongoCondition con1 = MongoCondition.newInstance("mphone", "^"+keyword, MongoOper.LIKE); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityConfigController.java
View file @
a56b0fe
| 1 | 1 | package com.lyms.platform.operate.web.controller; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.param.CommunityQuery; |
| 4 | -import com.lyms.platform.biz.service.BasicConfigService; | |
| 5 | -import com.lyms.platform.biz.service.CommunityConfigService; | |
| 6 | -import com.lyms.platform.biz.service.PatientsService; | |
| 4 | +import com.lyms.platform.biz.service.*; | |
| 7 | 5 | import com.lyms.platform.common.annotation.TokenRequired; |
| 8 | 6 | import com.lyms.platform.common.base.BaseController; |
| 9 | 7 | import com.lyms.platform.common.base.LoginContext; |
| 10 | 8 | |
| ... | ... | @@ -17,7 +15,9 @@ |
| 17 | 15 | import com.lyms.platform.pojo.BasicConfig; |
| 18 | 16 | import com.lyms.platform.pojo.CommunityConfig; |
| 19 | 17 | import com.lyms.platform.pojo.Patients; |
| 18 | +import com.lyms.platform.query.BabyModelQuery; | |
| 20 | 19 | import com.lyms.platform.query.PatientsQuery; |
| 20 | +import com.lyms.platform.query.VisitQuery; | |
| 21 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | 22 | import org.springframework.stereotype.Controller; |
| 23 | 23 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -42,6 +42,8 @@ |
| 42 | 42 | private BasicConfigService basicConfigService; |
| 43 | 43 | @Autowired |
| 44 | 44 | private AutoMatchFacade autoMatchFacade; |
| 45 | + @Autowired | |
| 46 | + private BabyService babyService; | |
| 45 | 47 | |
| 46 | 48 | |
| 47 | 49 | //添加管辖区域 |
| ... | ... | @@ -171,6 +173,14 @@ |
| 171 | 173 | List<Patients> q = patientsService.queryPatient(patientsQuery); |
| 172 | 174 | if (0 < q.size()) { |
| 173 | 175 | return new BaseResponse().setErrorcode(ErrorCodeConstants.DONT_DELETE).setErrormsg("该社区下有产妇数据不能删除!"); |
| 176 | + } | |
| 177 | + | |
| 178 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 179 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
| 180 | + babyModelQuery.setCommunityId(id); | |
| 181 | + Integer count = babyService.queryBabyCount(babyModelQuery); | |
| 182 | + if (0 < count) { | |
| 183 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.DONT_DELETE).setErrormsg("该社区下有婴儿数据不能删除!"); | |
| 174 | 184 | } |
| 175 | 185 | |
| 176 | 186 | CommunityConfig communityConfig = new CommunityConfig(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/DepartmentsController.java
View file @
a56b0fe
| ... | ... | @@ -65,6 +65,15 @@ |
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | + UsersQuery usersQuery = new UsersQuery(); | |
| 69 | + usersQuery.setYn(YnEnums.YES.getId()); | |
| 70 | + usersQuery.setDeptId(id); | |
| 71 | + Integer count = usersService.queryUsersCount(usersQuery); | |
| 72 | + if(0 < count) { | |
| 73 | + ResultUtils.buildParameterErrorResultAndWrite(response, "该部门/科室下有用户数据,不能删除"); | |
| 74 | + return; | |
| 75 | + } | |
| 76 | + | |
| 68 | 77 | departments.setYn(YnEnums.NO.getId()); |
| 69 | 78 | departments.setModified(new Date()); |
| 70 | 79 | departmentsService.updateDepartments(departments); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RolesController.java
View file @
a56b0fe
| ... | ... | @@ -135,7 +135,7 @@ |
| 135 | 135 | public void addUserRoles(HttpServletResponse response, |
| 136 | 136 | HttpServletRequest request, |
| 137 | 137 | @RequestParam(value = "name") String name, |
| 138 | - @RequestParam(value = "enable") Integer enable, | |
| 138 | + @RequestParam(value = "enable", required = false) Integer enable, | |
| 139 | 139 | @RequestParam(value = "remarks", required = false) String remarks, |
| 140 | 140 | @RequestParam(value = "shortCode", required = false) String shortCode) { |
| 141 | 141 | |
| ... | ... | @@ -183,7 +183,7 @@ |
| 183 | 183 | public void addAdminRoles(HttpServletResponse response, |
| 184 | 184 | HttpServletRequest request, |
| 185 | 185 | @RequestParam(value = "name") String name, |
| 186 | - @RequestParam(value = "enable") Integer enable, | |
| 186 | + @RequestParam(value = "enable", required = false) Integer enable, | |
| 187 | 187 | @RequestParam(value = "remarks", required = false) String remarks, |
| 188 | 188 | @RequestParam(value = "shortCode", required = false) String shortCode) { |
| 189 | 189 | |
| ... | ... | @@ -272,6 +272,17 @@ |
| 272 | 272 | return; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | + //如果有数据不能删除 | |
| 276 | + UserRoleMapsQuery userRoleMapsQuery = new UserRoleMapsQuery(); | |
| 277 | + userRoleMapsQuery.setRoleId(id); | |
| 278 | + userRoleMapsQuery.setYn(YnEnums.YES.getId()); | |
| 279 | + Integer count = userRoleMapsService.queryUserRoleMapsCount(userRoleMapsQuery); | |
| 280 | + if(count > 0) { | |
| 281 | + ResultUtils.buildParameterErrorResultAndWrite(response, "该角色下有用户数据,不能删除"); | |
| 282 | + return; | |
| 283 | + } | |
| 284 | + | |
| 285 | + | |
| 275 | 286 | Roles roles = rolesService.getRoles(id); |
| 276 | 287 | if (roles == null) { |
| 277 | 288 | ResultUtils.buildIdResultData(response); |
| 278 | 289 | |
| 279 | 290 | |
| ... | ... | @@ -282,19 +293,11 @@ |
| 282 | 293 | roles.setModified(new Date()); |
| 283 | 294 | rolesService.updateRoles(roles); |
| 284 | 295 | |
| 285 | - //中间表数据处理 | |
| 286 | - UserRoleMapsQuery userRoleMapsQuery = new UserRoleMapsQuery(); | |
| 287 | - userRoleMapsQuery.setRoleId(id); | |
| 288 | - List<UserRoleMaps> userRoleMapses = userRoleMapsService.queryUserRoleMaps(userRoleMapsQuery); | |
| 289 | - if (null != userRoleMapses) { | |
| 290 | - for (UserRoleMaps userRoleMaps : userRoleMapses) { | |
| 291 | - userRoleMaps.setYn(YnEnums.NO.getId()); | |
| 292 | - userRoleMapsService.updateUserRoleMaps(userRoleMaps); | |
| 293 | - } | |
| 294 | - } | |
| 295 | 296 | |
| 297 | + //角色权限设置为无效 | |
| 296 | 298 | RolePermissionMapsQuery rolePermissionMapsQuery = new RolePermissionMapsQuery(); |
| 297 | 299 | rolePermissionMapsQuery.setRoleId(id); |
| 300 | + rolePermissionMapsQuery.setYn(YnEnums.YES.getId()); | |
| 298 | 301 | List<RolePermissionMaps> rolePermissionMapsList = rolePermissionMapsService.queryRolePermissionMaps(rolePermissionMapsQuery); |
| 299 | 302 | if (null != rolePermissionMapsList) { |
| 300 | 303 | for (RolePermissionMaps rolePermissionMaps : rolePermissionMapsList) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
a56b0fe
| ... | ... | @@ -506,7 +506,7 @@ |
| 506 | 506 | @RequestParam(value = "name", required = false) String name, |
| 507 | 507 | @RequestParam(value = "account", required = false)String account, |
| 508 | 508 | @RequestParam(value = "phone") String phone, |
| 509 | - @RequestParam(value = "enable") Integer enable, | |
| 509 | + @RequestParam(value = "enable", required = false) Integer enable, | |
| 510 | 510 | @RequestParam(value = "remarks", required = false) String remarks, |
| 511 | 511 | @RequestParam(value = "roleIds") String roleIds) { |
| 512 | 512 | |
| ... | ... | @@ -616,7 +616,7 @@ |
| 616 | 616 | @RequestParam(value = "name", required = false) String name, |
| 617 | 617 | @RequestParam(value = "account", required = false)String account, |
| 618 | 618 | @RequestParam(value = "phone") String phone, |
| 619 | - @RequestParam(value = "enable") Integer enable, | |
| 619 | + @RequestParam(value = "enable", required = false) Integer enable, | |
| 620 | 620 | @RequestParam(value = "remarks", required = false) String remarks, |
| 621 | 621 | @RequestParam(value = "roleIds") String roleIds) { |
| 622 | 622 |