Commit cc3ca6b97b267357f670dfd98e3cef18311ac390
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 14 changed files
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/OrganizationMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/Users.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/UsersQuery.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/OrganizationService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/OrganizationServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/Organization.xml
- platform-biz-service/src/main/resources/mainOrm/Users.xml
- 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/OrganizationController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReferConfigController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RegionController.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-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/OrganizationMapper.java
View file @
cc3ca6b
... | ... | @@ -5,7 +5,18 @@ |
5 | 5 | |
6 | 6 | import java.util.List; |
7 | 7 | |
8 | -public interface OrganizationMapper {public void addOrganization(Organization obj);public void updateOrganization(Organization obj);public void deleteOrganization(Integer id);public Organization getOrganization(Integer id);public int queryOrganizationCount(OrganizationQuery query);public List<Organization> queryOrganization(OrganizationQuery query); | |
8 | +public interface OrganizationMapper { | |
9 | + public Integer addOrganization(Organization obj); | |
10 | + | |
11 | + public void updateOrganization(Organization obj); | |
12 | + | |
13 | + public void deleteOrganization(Integer id); | |
14 | + | |
15 | + public Organization getOrganization(Integer id); | |
16 | + | |
17 | + public int queryOrganizationCount(OrganizationQuery query); | |
18 | + | |
19 | + public List<Organization> queryOrganization(OrganizationQuery query); | |
9 | 20 | |
10 | 21 | } |
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Users.java
View file @
cc3ca6b
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | public class Users { |
7 | 7 | private Integer id; |
8 | 8 | private Integer logincenterId; |
9 | - private Integer type; //0 管理员 1 用户 | |
9 | + private Integer type; //0 管理员 1 用户 2超级管理员 | |
10 | 10 | private Integer orgId; //机构ID |
11 | 11 | private Integer deptId; //部门ID |
12 | 12 | private Integer ksId; //科室ID |
platform-biz-service/src/main/java/com/lyms/platform/permission/model/UsersQuery.java
View file @
cc3ca6b
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | import com.lyms.platform.common.dao.BaseQuery; |
5 | 5 | |
6 | 6 | import java.util.Date; |
7 | +import java.util.List; | |
7 | 8 | |
8 | 9 | |
9 | 10 | public class UsersQuery extends BaseQuery { |
... | ... | @@ -32,6 +33,17 @@ |
32 | 33 | private Integer otherAccount; //第三方帐号, 1医院帐号 |
33 | 34 | public Integer getOtherAccount() { |
34 | 35 | return otherAccount; |
36 | + } | |
37 | + | |
38 | + | |
39 | + public List<Integer> orgIds; //这些机构下的用户 | |
40 | + | |
41 | + public List<Integer> getOrgIds() { | |
42 | + return orgIds; | |
43 | + } | |
44 | + | |
45 | + public void setOrgIds(List<Integer> orgIds) { | |
46 | + this.orgIds = orgIds; | |
35 | 47 | } |
36 | 48 | |
37 | 49 | public void setOtherAccount(Integer otherAccount) { |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/OrganizationService.java
View file @
cc3ca6b
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/OrganizationServiceImpl.java
View file @
cc3ca6b
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | private OrganizationMapper organizationMapper; |
18 | 18 | |
19 | 19 | @Override |
20 | -public void addOrganization(Organization obj){organizationMapper.addOrganization(obj);} | |
20 | +public Integer addOrganization(Organization obj){ return organizationMapper.addOrganization(obj);} | |
21 | 21 | @Override |
22 | 22 | public void updateOrganization(Organization obj){organizationMapper.updateOrganization(obj);} |
23 | 23 | @Override |
platform-biz-service/src/main/resources/mainOrm/Organization.xml
View file @
cc3ca6b
platform-biz-service/src/main/resources/mainOrm/Users.xml
View file @
cc3ca6b
... | ... | @@ -211,8 +211,11 @@ |
211 | 211 | <if test="ksId != null"> |
212 | 212 | and u.ks_id = #{ksId,jdbcType=INTEGER} |
213 | 213 | </if> |
214 | - <if test="orgId != null"> | |
215 | - and u.org_id = #{orgId,jdbcType=INTEGER} | |
214 | + <if test="orgIds != null"> | |
215 | + and u.org_id in | |
216 | + <foreach collection="orgIds" index="index" item="item" open="(" separator="," close=")"> | |
217 | + #{item} | |
218 | + </foreach> | |
216 | 219 | </if> |
217 | 220 | <if test="deptId != null"> |
218 | 221 | and u.dept_id = #{deptId,jdbcType=INTEGER} |
... | ... | @@ -245,8 +248,11 @@ |
245 | 248 | <if test="ksId != null and ksId != ''"> |
246 | 249 | and u.ks_id = #{ksId,jdbcType=INTEGER} |
247 | 250 | </if> |
248 | - <if test="orgId != null and orgId != ''"> | |
249 | - and u.org_id = #{orgId,jdbcType=INTEGER} | |
251 | + <if test="orgIds != null"> | |
252 | + and u.org_id in | |
253 | + <foreach collection="orgIds" index="index" item="item" open="(" separator="," close=")"> | |
254 | + #{item} | |
255 | + </foreach> | |
250 | 256 | </if> |
251 | 257 | <if test="deptId != null and deptId != ''"> |
252 | 258 | and u.dept_id = #{deptId,jdbcType=INTEGER} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/DepartmentsController.java
View file @
cc3ca6b
... | ... | @@ -93,8 +93,16 @@ |
93 | 93 | ResultUtils.buildParameterErrorResultAndWrite(response,"该部门不存在"); |
94 | 94 | return; |
95 | 95 | } |
96 | + if(!departments.getName().equals(name)) { | |
97 | + DepartmentsQuery departmentsQuery = new DepartmentsQuery(); | |
98 | + departments.setYn(YnEnums.YES.getId()); | |
99 | + departmentsQuery.setName(name); | |
100 | + if(0 < departmentsService.queryDepartmentsCount(departmentsQuery)) { | |
101 | + ResultUtils.buildParameterErrorResultAndWrite(response,"该部门已存在"); | |
102 | + return; | |
103 | + } | |
104 | + } | |
96 | 105 | |
97 | - | |
98 | 106 | pid = pid == null ? 0 : pid; |
99 | 107 | departments.setParentId(pid); |
100 | 108 | departments.setName(name); |
... | ... | @@ -137,6 +145,7 @@ |
137 | 145 | } |
138 | 146 | DepartmentsQuery departmentsQuery = new DepartmentsQuery(); |
139 | 147 | departmentsQuery.setName(name); |
148 | + departmentsQuery.setYn(YnEnums.YES.getId()); | |
140 | 149 | if(0 < departmentsService.queryDepartmentsCount(departmentsQuery)) { |
141 | 150 | ResultUtils.buildParameterErrorResultAndWrite(response,"该部门已存在"); |
142 | 151 | return; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
View file @
cc3ca6b
... | ... | @@ -9,11 +9,13 @@ |
9 | 9 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
10 | 10 | import com.lyms.platform.common.enums.OrganizationLevelEnum; |
11 | 11 | import com.lyms.platform.common.enums.OrganizationTypeEnum; |
12 | +import com.lyms.platform.common.enums.PermissionTypeEnums; | |
12 | 13 | import com.lyms.platform.common.enums.YnEnums; |
13 | 14 | import com.lyms.platform.common.utils.ResultUtils; |
14 | 15 | import com.lyms.platform.common.utils.SystemConfig; |
15 | 16 | import com.lyms.platform.operate.web.facade.AccessPermissionFacade; |
16 | 17 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
18 | +import com.lyms.platform.operate.web.request.AccessPermissionAddRequest; | |
17 | 19 | import com.lyms.platform.operate.web.result.FrontEndResult; |
18 | 20 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
19 | 21 | import com.lyms.platform.permission.model.*; |
... | ... | @@ -52,6 +54,7 @@ |
52 | 54 | private AccessPermissionFacade accessPermissionFacade; |
53 | 55 | |
54 | 56 | |
57 | + | |
55 | 58 | /** |
56 | 59 | * 删除机构 |
57 | 60 | */ |
58 | 61 | |
... | ... | @@ -124,10 +127,21 @@ |
124 | 127 | //判断ID是否存在 |
125 | 128 | Organization organization = organizationService.getOrganization(id); |
126 | 129 | if (null == organization) { |
127 | - ResultUtils.buildParameterErrorResultAndWrite(response, "id不存在!"); | |
130 | + ResultUtils.buildParameterErrorResultAndWrite(response, "机构不存在!"); | |
128 | 131 | return; |
129 | 132 | } |
130 | 133 | |
134 | + if(!organization.getName().equals(name)) { | |
135 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
136 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
137 | + organizationQuery.setName(name); | |
138 | + if (0 < organizationService.queryOrganizationCount(organizationQuery)) { | |
139 | + ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.NAME_EXIST, "机构名称已存在!"); | |
140 | + return; | |
141 | + } | |
142 | + } | |
143 | + | |
144 | + | |
131 | 145 | organization.setName(name); |
132 | 146 | organization.setType(type); |
133 | 147 | organization.setLevel(level); |
... | ... | @@ -199,8 +213,12 @@ |
199 | 213 | organization.setModified(new Date()); |
200 | 214 | organization.setPublishName(users.getName()); |
201 | 215 | organization.setPublishId(users.getId()); |
202 | - organizationService.addOrganization(organization); | |
203 | - | |
216 | + Integer id= organizationService.addOrganization(organization); | |
217 | + AccessPermissionAddRequest accessPermissionAddRequest = new AccessPermissionAddRequest(); | |
218 | + accessPermissionAddRequest.setUserId(loginState.getId()+""); | |
219 | + accessPermissionAddRequest.setBizId(id + ""); | |
220 | + accessPermissionAddRequest.setType(PermissionTypeEnums.Type.ADMIN.getId()+""); | |
221 | + accessPermissionFacade.addAccessPermission(accessPermissionAddRequest); | |
204 | 222 | ResultUtils.buildSuccessResultAndWrite(response); |
205 | 223 | } |
206 | 224 | |
207 | 225 | |
208 | 226 | |
209 | 227 | |
210 | 228 | |
211 | 229 | |
212 | 230 | |
213 | 231 | |
... | ... | @@ -210,46 +228,121 @@ |
210 | 228 | @RequestMapping(value = "/organization1", method = RequestMethod.GET) |
211 | 229 | @ResponseBody |
212 | 230 | @TokenRequired |
213 | - public FrontEndResult getOrganization(HttpServletRequest request) { | |
231 | + public FrontEndResult getOrganization(HttpServletRequest request, @RequestParam(value = "page", required = false) Integer page, | |
232 | + @RequestParam(value = "limit", required = false) Integer limit, | |
233 | + @RequestParam(value = "keyword", required = false) String keyword, | |
234 | + @RequestParam(value = "areaId", required = false) String aId) { | |
214 | 235 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
215 | 236 | |
216 | 237 | List<Integer> areaId = autoMatchFacade.matchOrgId(loginState.getId()); |
217 | - List<Map> data = new ArrayList<>(); | |
238 | + List<Object> data = new ArrayList<>(); | |
218 | 239 | List<Organization> organizations; |
219 | 240 | PageInfo pageInfo =null; |
220 | 241 | if (CollectionUtils.isNotEmpty(areaId)) { |
221 | 242 | OrganizationQuery organizationQuery = new OrganizationQuery(); |
222 | - organizationQuery.setIdList(areaId); | |
223 | - List<Integer> list = new ArrayList<>(); | |
224 | - list.add(3); | |
225 | - list.add(4); | |
243 | + if(null != page && limit != page) { | |
244 | + organizationQuery.setNeed("true"); | |
245 | + organizationQuery.setPage(page); | |
246 | + organizationQuery.setLimit(limit); | |
247 | + organizationQuery.setSort("province_id desc,city_id desc,area_id desc"); | |
248 | + } | |
249 | + | |
250 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(aId); | |
251 | + if(null != basicConfig) { | |
252 | + if (SystemConfig.CHINA_BASIC_ID.equals(basicConfig.getParentId())) { | |
253 | + organizationQuery.setProvinceId(aId); | |
254 | + } else { | |
255 | + BasicConfig p1 = basicConfigService.getOneBasicConfigById(basicConfig.getParentId()); | |
256 | + if (p1 != null && SystemConfig.CHINA_BASIC_ID.equals(p1.getParentId())) { | |
257 | + organizationQuery.setCityId(aId); | |
258 | + } else { | |
259 | + BasicConfig p2 = basicConfigService.getOneBasicConfigById(p1.getParentId()); | |
260 | + if (p2 != null && SystemConfig.CHINA_BASIC_ID.equals(p2.getParentId())) { | |
261 | + organizationQuery.setAreaId(aId); | |
262 | + } else { | |
263 | +// BasicConfig p3 = basicConfigService.getOneBasicConfigById(p1.getParentId()); | |
264 | +// if (p2 != null && SystemConfig.CHINA_BASIC_ID.equals(p3.getParentId())) { | |
265 | + organizationQuery.setStreetId(aId); | |
266 | +// } | |
267 | + } | |
268 | + } | |
269 | + } | |
270 | + } | |
271 | + | |
272 | + | |
226 | 273 | organizationQuery.setYn(YnEnums.YES.getId()); |
274 | + organizationQuery.setIdList(areaId); | |
275 | + organizationQuery.setKeyword(keyword); | |
276 | +// List<Integer> list = new ArrayList<>(); | |
277 | +// list.add(3); | |
278 | +// list.add(4); | |
279 | +// organizationQuery.setYn(YnEnums.YES.getId()); | |
227 | 280 | // organizationQuery.setTypeList(list); |
228 | - pageInfo=organizationQuery.getPageInfo(); | |
229 | 281 | organizations = organizationService.queryOrganization(organizationQuery); |
282 | + pageInfo=organizationQuery.getPageInfo(); | |
230 | 283 | |
231 | 284 | } else { |
232 | - UserOrganizationMapsQuery userOrganizationMapsQuery = new UserOrganizationMapsQuery(); | |
233 | - userOrganizationMapsQuery.setYn(YnEnums.YES.getId()); | |
234 | - userOrganizationMapsQuery.setUserId(loginState.getId()); | |
235 | - organizations = accessPermissionFacade.findAccessPerminssionByUserId(loginState.getId()); | |
236 | - userOrganizationMapsQuery.mysqlBuild(organizations.size()); | |
237 | - pageInfo=userOrganizationMapsQuery.getPageInfo(); | |
285 | +// UserOrganizationMapsQuery userOrganizationMapsQuery = new UserOrganizationMapsQuery(); | |
286 | +// userOrganizationMapsQuery.setYn(YnEnums.YES.getId()); | |
287 | +// userOrganizationMapsQuery.setUserId(loginState.getId()); | |
288 | +// organizations = accessPermissionFacade.findAccessPerminssionByUserId(loginState.getId()); | |
289 | +// userOrganizationMapsQuery.mysqlBuild(organizations.size()); | |
290 | +// pageInfo=userOrganizationMapsQuery.getPageInfo(); | |
291 | + | |
292 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
293 | + organizationQuery.setKeyword(keyword); | |
294 | + if(null != page && limit != page) { | |
295 | + organizationQuery.setNeed("true"); | |
296 | + organizationQuery.setPage(page); | |
297 | + organizationQuery.setLimit(limit); | |
298 | + organizationQuery.setSort("province_id desc,city_id desc,area_id desc"); | |
299 | + } | |
300 | + | |
301 | + | |
302 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(aId); | |
303 | + if(null != basicConfig) { | |
304 | + if (SystemConfig.CHINA_BASIC_ID.equals(basicConfig.getParentId())) { | |
305 | + organizationQuery.setProvinceId(aId); | |
306 | + } else { | |
307 | + BasicConfig p1 = basicConfigService.getOneBasicConfigById(basicConfig.getParentId()); | |
308 | + if (p1 != null && SystemConfig.CHINA_BASIC_ID.equals(p1.getParentId())) { | |
309 | + organizationQuery.setCityId(aId); | |
310 | + } else { | |
311 | + BasicConfig p2 = basicConfigService.getOneBasicConfigById(p1.getParentId()); | |
312 | + if (p2 != null && SystemConfig.CHINA_BASIC_ID.equals(p2.getParentId())) { | |
313 | + organizationQuery.setAreaId(aId); | |
314 | + } else { | |
315 | +// BasicConfig p3 = basicConfigService.getOneBasicConfigById(p1.getParentId()); | |
316 | +// if (p2 != null && SystemConfig.CHINA_BASIC_ID.equals(p3.getParentId())) { | |
317 | + organizationQuery.setStreetId(aId); | |
318 | +// } | |
319 | + } | |
320 | + } | |
321 | + } | |
322 | + } | |
323 | + | |
324 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
325 | + organizations = organizationService.queryOrganization(organizationQuery); | |
326 | + pageInfo = organizationQuery.getPageInfo(); | |
238 | 327 | } |
239 | 328 | if (CollectionUtils.isNotEmpty(organizations)) { |
240 | 329 | for (Organization organization : organizations) { |
241 | - Map<String, Object> map = new HashMap<>(); | |
242 | - map.put("id", organization.getId()); | |
243 | - map.put("name", organization.getName()); | |
244 | - map.put("areaId", organization.getAreaId()); | |
245 | - map.put("area", organization.getArea()); | |
246 | - map.put("city", organization.getCity()); | |
247 | - map.put("cityId", organization.getCityId()); | |
248 | - map.put("province", organization.getProvince()); | |
249 | - map.put("provinceId", organization.getProvinceId()); | |
250 | - map.put("foreignId", organization.getForeignId()); | |
251 | - map.put("code", organization.getShortCode()); | |
252 | - data.add(map); | |
330 | + organization.setLevelObj(OrganizationLevelEnum.getById(organization.getLevel())); | |
331 | + organization.setTypeObj(OrganizationTypeEnum.getById(organization.getType())); | |
332 | + if (null != organization.getProvinceId()) { | |
333 | + organization.setProvince(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getProvinceId()), true)); | |
334 | + } | |
335 | + if (null != organization.getCityId()) { | |
336 | + organization.setCity(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getCityId()), true)); | |
337 | + } | |
338 | + if (null != organization.getAreaId()) { | |
339 | + organization.setArea(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getAreaId()), true)); | |
340 | + } | |
341 | + if (null != organization.getStreetId()) { | |
342 | + organization.setStreet(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getStreetId()), true)); | |
343 | + } | |
344 | + | |
345 | + data.add(organization); | |
253 | 346 | } |
254 | 347 | } |
255 | 348 | return new FrontEndResult().setData(data).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setPageInfo(pageInfo); |
... | ... | @@ -323,8 +416,8 @@ |
323 | 416 | boolean falg = StringUtils.isNotEmpty(f); |
324 | 417 | for (Organization organization : organizations) { |
325 | 418 | |
326 | - organization.setTypeObj(OrganizationLevelEnum.getById(organization.getLevel())); | |
327 | - organization.setLevelObj(OrganizationTypeEnum.getById(organization.getType())); | |
419 | + organization.setLevelObj(OrganizationLevelEnum.getById(organization.getLevel())); | |
420 | + organization.setTypeObj(OrganizationTypeEnum.getById(organization.getType())); | |
328 | 421 | if (null != organization.getProvinceId()) { |
329 | 422 | organization.setProvince(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getProvinceId()), falg)); |
330 | 423 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReferConfigController.java
View file @
cc3ca6b
... | ... | @@ -7,6 +7,8 @@ |
7 | 7 | import com.lyms.platform.biz.param.ReferConfigQuery; |
8 | 8 | import com.lyms.platform.common.annotation.TokenRequired; |
9 | 9 | import com.lyms.platform.common.base.BaseController; |
10 | +import com.lyms.platform.common.enums.PatientsTypeEnum; | |
11 | +import com.lyms.platform.common.enums.SampleTypeEnum; | |
10 | 12 | import com.lyms.platform.common.enums.YnEnums; |
11 | 13 | import com.lyms.platform.operate.web.result.FrontEndResult; |
12 | 14 | import org.apache.commons.lang.StringUtils; |
... | ... | @@ -45,6 +47,10 @@ |
45 | 47 | public FrontEndResult queryRefer( @Valid ReferConfigQuery referConfigQuery) { |
46 | 48 | referConfigQuery.setYn(YnEnums.YES.getId()); |
47 | 49 | List<ReferValue> referValueList = referConfigService.queryRefer(referConfigQuery); |
50 | + for(ReferValue referValue : referValueList) { | |
51 | + referValue.setFeatureVal(PatientsTypeEnum.getById(referValue.getFeature()).getText()); | |
52 | + referValue.setSampleVal(SampleTypeEnum.getById(referValue.getSample()).getText()); | |
53 | + } | |
48 | 54 | return FrontEndResult.ini().setData(referValueList).setPageInfo(referConfigQuery.getPageInfo()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
49 | 55 | } |
50 | 56 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RegionController.java
View file @
cc3ca6b
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | - if (user.getType().equals(0) && ("0".equals(parentId) || StringUtils.isBlank(parentId))) { | |
90 | + if (user.getType().equals(2) || user.getType().equals(0) && ("0".equals(parentId) || StringUtils.isBlank(parentId))) { | |
91 | 91 | parentId = SystemConfig.CHINA_BASIC_ID; |
92 | 92 | query.setParentId(parentId); |
93 | 93 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RolesController.java
View file @
cc3ca6b
... | ... | @@ -235,8 +235,18 @@ |
235 | 235 | } |
236 | 236 | Roles roles = rolesService.getRoles(id); |
237 | 237 | if (roles==null){ |
238 | - new BusinessException("", "根据id获取信息不存在."); | |
238 | + new BusinessException("", "角色信息不存在."); | |
239 | 239 | return; |
240 | + } | |
241 | + | |
242 | + if(!roles.getName().equals(name)) { | |
243 | + RolesQuery rolesQuery = new RolesQuery(); | |
244 | + rolesQuery.setYn(YnEnums.YES.getId()); | |
245 | + rolesQuery.setName(name); | |
246 | + if(0 < rolesService.queryRolesCount(rolesQuery)) { | |
247 | + ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.NAME_EXIST, "角色名称已存在"); | |
248 | + return; | |
249 | + } | |
240 | 250 | } |
241 | 251 | |
242 | 252 | roles.setName(name); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
cc3ca6b
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | import com.lyms.platform.operate.web.result.FrontEndResult; |
13 | 13 | import com.lyms.platform.permission.model.*; |
14 | 14 | import com.lyms.platform.permission.service.*; |
15 | +import org.apache.commons.collections.CollectionUtils; | |
15 | 16 | import org.apache.commons.lang.StringUtils; |
16 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
17 | 18 | import org.springframework.beans.factory.annotation.Value; |
18 | 19 | |
19 | 20 | |
20 | 21 | |
21 | 22 | |
... | ... | @@ -111,24 +112,46 @@ |
111 | 112 | @TokenRequired |
112 | 113 | @ResponseBody |
113 | 114 | public FrontEndResult getPermissions(HttpServletResponse response, |
115 | + HttpServletRequest request, | |
114 | 116 | @RequestParam(value = "keyword", required = false) String keyword, |
115 | 117 | @RequestParam(value = "rolesId", required = false) Integer rolesId, |
116 | 118 | @RequestParam(value = "page", required = false) Integer page, |
117 | 119 | @RequestParam(value = "limit", required = false) Integer limit, |
118 | 120 | @RequestParam(value = "orgId", required = false) Integer orgId, |
119 | 121 | @RequestParam(value = "deptId", required = false) Integer deptId) { |
122 | + LoginContext loginContext = (LoginContext) request.getAttribute("loginContext"); | |
123 | + Users u = usersService.getUsers(loginContext.getId()); | |
120 | 124 | |
125 | + | |
126 | + List<Integer> ids = null; | |
127 | + if(u.getType().equals(1)) { | |
128 | + orgId = u.getOrgId(); | |
129 | + }else if(u.getType().equals(0)) { | |
130 | + List<Organization> organizations = accessPermissionFacade.findAccessPerminssionByUserId(u.getId()); | |
131 | + ids = new ArrayList<>(); | |
132 | + if(CollectionUtils.isNotEmpty(organizations)) { | |
133 | + for(Organization organization : organizations) { | |
134 | + ids.add(organization.getId()); | |
135 | + } | |
136 | + } | |
137 | + } | |
138 | + | |
139 | + if(null != orgId) { | |
140 | + ids = new ArrayList<>(); | |
141 | + ids.add(orgId); | |
142 | + } | |
143 | + | |
144 | + UsersQuery usersQuery = new UsersQuery(); | |
121 | 145 | limit = limit == null ? 10 : limit; |
122 | 146 | page = page == null ? 1 : page; |
123 | 147 | |
124 | - UsersQuery usersQuery = new UsersQuery(); | |
125 | 148 | usersQuery.setNeed("true"); |
126 | 149 | usersQuery.setSort("id desc"); |
127 | 150 | usersQuery.setYn(YnEnums.YES.getId()); |
128 | 151 | usersQuery.setDeptId(deptId); |
129 | 152 | usersQuery.setKeyword(keyword); |
130 | 153 | usersQuery.setType(1); |
131 | - usersQuery.setOrgId(orgId); | |
154 | + usersQuery.setOrgIds(ids); | |
132 | 155 | usersQuery.setPage(page); |
133 | 156 | usersQuery.setLimit(limit); |
134 | 157 | usersQuery.setRoleId(rolesId); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java
View file @
cc3ca6b
... | ... | @@ -69,7 +69,7 @@ |
69 | 69 | data.add(users.getOrgId()); |
70 | 70 | } |
71 | 71 | } |
72 | - } else{ | |
72 | + } else if(list.get(0).getType() == 0){ | |
73 | 73 | List<Organization> list2 =accessPermissionFacade.findAccessPerminssionByUserId(list.get(0).getId()); |
74 | 74 | if(CollectionUtils.isNotEmpty(list2)){ |
75 | 75 | for(Organization organization:list2){ |
... | ... | @@ -85,6 +85,8 @@ |
85 | 85 | data.add(userOrganizationMaps.getOrgId()); |
86 | 86 | } |
87 | 87 | }*/ |
88 | + } else if(list.get(0).getType() == 2) { | |
89 | + return null; | |
88 | 90 | } |
89 | 91 | } |
90 | 92 | return data; |