Commit f43969cc774554cd7655cefde1752f841763b548
1 parent
c9848703bf
Exists in
master
and in
8 other branches
增加年龄单位枚举
Showing 17 changed files with 664 additions and 69 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IDataPermissionDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/DataPermissionDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/DataPermissionService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/Permissions.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/Roles.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/Users.java
- platform-common/src/main/java/com/lyms/platform/common/base/ExceptionHandlerController.java
- platform-common/src/main/java/com/lyms/platform/common/enums/PermissionTypeEnums.java
- platform-common/src/main/java/com/lyms/platform/common/utils/Assert.java
- platform-dal/src/main/java/com/lyms/platform/pojo/DataPermissionsModel.java
- platform-dal/src/main/java/com/lyms/platform/query/DataPermissionsModelQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PermissionsController.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/facade/AccessPermissionFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AccessPermissionAddRequest.java
- platform-operate-api/src/main/resources/spring/spring-mongodb.xml
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
View file @
f43969c
| 1 | 1 | package com.lyms.platform.biz; |
| 2 | 2 | |
| 3 | 3 | import java.text.SimpleDateFormat; |
| 4 | -import java.util.Date; | |
| 4 | +import java.util.*; | |
| 5 | 5 | |
| 6 | +import com.lyms.platform.pojo.DataPermissionsModel; | |
| 6 | 7 | import org.springframework.context.ApplicationContext; |
| 7 | 8 | import org.springframework.context.support.ClassPathXmlApplicationContext; |
| 8 | 9 | |
| ... | ... | @@ -13,6 +14,7 @@ |
| 13 | 14 | import com.lyms.platform.pojo.PuerperaModel; |
| 14 | 15 | import com.lyms.platform.pojo.VisitModel; |
| 15 | 16 | import com.lyms.platform.query.PuerperaModelQuery; |
| 17 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 16 | 18 | |
| 17 | 19 | public class BasicConfigServiceTest { |
| 18 | 20 | public static void main(String[] args) throws Exception { |
| 19 | 21 | |
| ... | ... | @@ -67,9 +69,44 @@ |
| 67 | 69 | for (PuerperaModel users2 : users) { |
| 68 | 70 | System.out.println(users2.toString()); |
| 69 | 71 | }*/ |
| 70 | - addBaby(applicationContext); | |
| 72 | + addDataPermission(applicationContext); | |
| 71 | 73 | } |
| 72 | - | |
| 74 | + | |
| 75 | + public static void addDataPermission(ApplicationContext applicationContext){ | |
| 76 | + MongoTemplate mongoTemplate | |
| 77 | + =(MongoTemplate)applicationContext.getBean("mongoTemplate"); | |
| 78 | + DataPermissionsModel DataPermissionsModel | |
| 79 | + =new DataPermissionsModel(); | |
| 80 | + DataPermissionsModel.setId("1"); | |
| 81 | + com.lyms.platform.pojo.DataPermissionsModel.SimplePermission SimplePermission =new DataPermissionsModel.SimplePermission(); | |
| 82 | + SimplePermission.setType(1); | |
| 83 | + | |
| 84 | + | |
| 85 | + com.lyms.platform.pojo.DataPermissionsModel.SimplePermission SimplePermission1 =new DataPermissionsModel.SimplePermission(); | |
| 86 | + List<String> dept=new ArrayList<>(); | |
| 87 | + dept.add("xxxx1"); | |
| 88 | + dept.add("xxxx2"); | |
| 89 | + SimplePermission1.setDeptid(dept); | |
| 90 | + SimplePermission1.setType(2); | |
| 91 | + | |
| 92 | + com.lyms.platform.pojo.DataPermissionsModel.SimplePermission SimplePermission2 =new DataPermissionsModel.SimplePermission(); | |
| 93 | + List<String> dept1=new ArrayList<>(); | |
| 94 | + dept1.add("xxxx1"); | |
| 95 | + dept1.add("xxxx2"); | |
| 96 | + SimplePermission2.setType(1); | |
| 97 | + | |
| 98 | + com.lyms.platform.pojo.DataPermissionsModel.SimplePermission SimplePermission3 =new DataPermissionsModel.SimplePermission(); | |
| 99 | + SimplePermission3.setType(1); | |
| 100 | + | |
| 101 | + Map<String, com.lyms.platform.pojo.DataPermissionsModel.SimplePermission> date= new HashMap<>(); | |
| 102 | + date.put("xxxxxx",SimplePermission); | |
| 103 | + date.put("xxxxxx1",SimplePermission1); | |
| 104 | + date.put("xxxxxx2",SimplePermission2); | |
| 105 | + date.put("xxxxxx3",SimplePermission3); | |
| 106 | + DataPermissionsModel.setData(date); | |
| 107 | + mongoTemplate.save(DataPermissionsModel); | |
| 108 | + } | |
| 109 | + | |
| 73 | 110 | public static void addVisit(ApplicationContext applicationContext){ |
| 74 | 111 | VisitModel visitModel = new VisitModel(); |
| 75 | 112 |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IDataPermissionDao.java
View file @
f43969c
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.common.dao.operator.Page; | |
| 5 | +import com.lyms.platform.pojo.DataPermissionsModel; | |
| 6 | +import com.lyms.platform.pojo.VisitModel; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +public interface IDataPermissionDao { | |
| 11 | + | |
| 12 | + public DataPermissionsModel addPermission(DataPermissionsModel obj); | |
| 13 | + | |
| 14 | + public void updatePermission(DataPermissionsModel obj, String id); | |
| 15 | + | |
| 16 | + public void deletePermission(String id); | |
| 17 | + | |
| 18 | + public DataPermissionsModel getPermission(String id); | |
| 19 | + | |
| 20 | + public List<DataPermissionsModel> queryPermission(MongoQuery query); | |
| 21 | + | |
| 22 | + public Page<DataPermissionsModel> findPage(MongoQuery query); | |
| 23 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/DataPermissionDaoImpl.java
View file @
f43969c
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IDataPermissionDao; | |
| 4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.common.dao.operator.Page; | |
| 9 | +import com.lyms.platform.pojo.DataPermissionsModel; | |
| 10 | +import org.springframework.stereotype.Repository; | |
| 11 | + | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Created by Administrator on 2016/3/29 0029. | |
| 16 | + */ | |
| 17 | +@Repository("dataPermissionDao") | |
| 18 | +public class DataPermissionDaoImpl extends BaseMongoDAOImpl<DataPermissionsModel> implements IDataPermissionDao { | |
| 19 | + public DataPermissionsModel addPermission(DataPermissionsModel obj){ | |
| 20 | + return save(obj); | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void updatePermission(DataPermissionsModel obj, String id){ | |
| 24 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void deletePermission(String id){ | |
| 28 | + delete(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery()); | |
| 29 | + } | |
| 30 | + | |
| 31 | + public DataPermissionsModel getPermission(String id){ | |
| 32 | + return findById(id); | |
| 33 | + } | |
| 34 | + | |
| 35 | + public List<DataPermissionsModel> queryPermission(MongoQuery query){ | |
| 36 | + return find(query.convertToMongoQuery()); | |
| 37 | + } | |
| 38 | + | |
| 39 | + public Page<DataPermissionsModel> findPage(MongoQuery query){ | |
| 40 | + return findPage(query.convertToMongoQuery()); | |
| 41 | + } | |
| 42 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/DataPermissionService.java
View file @
f43969c
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IDataPermissionDao; | |
| 4 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 5 | +import com.lyms.platform.pojo.DataPermissionsModel; | |
| 6 | +import com.lyms.platform.query.DataPermissionsModelQuery; | |
| 7 | +import org.apache.commons.lang.StringUtils; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.data.domain.Sort; | |
| 10 | +import org.springframework.stereotype.Service; | |
| 11 | + | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * | |
| 16 | + * 数据访问权限模型 | |
| 17 | + * | |
| 18 | + * Created by Administrator on 2016/3/29 0029. | |
| 19 | + */ | |
| 20 | +@Service | |
| 21 | +public class DataPermissionService { | |
| 22 | + @Autowired | |
| 23 | + private IDataPermissionDao iDataPermissionDao; | |
| 24 | + | |
| 25 | + | |
| 26 | + public void addPermission(DataPermissionsModel obj) { | |
| 27 | + iDataPermissionDao.addPermission(obj); | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void updatePermission(DataPermissionsModel obj) { | |
| 31 | + iDataPermissionDao.updatePermission(obj, obj.getId() + ""); | |
| 32 | + } | |
| 33 | + | |
| 34 | + public List<DataPermissionsModel> queryPermission(DataPermissionsModelQuery visitQuery) { | |
| 35 | + MongoQuery query = visitQuery.convertToQuery(); | |
| 36 | + | |
| 37 | + return iDataPermissionDao.queryPermission(query.addOrder(Sort.Direction.ASC, "id")); | |
| 38 | + } | |
| 39 | + public void addOrUpdatePermission(DataPermissionsModel obj){ | |
| 40 | + if(StringUtils.isEmpty(obj.getId())){ | |
| 41 | + addPermission(obj); | |
| 42 | + }else { | |
| 43 | + updatePermission(obj); | |
| 44 | + } | |
| 45 | + } | |
| 46 | +} |
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Permissions.java
View file @
f43969c
| ... | ... | @@ -19,6 +19,15 @@ |
| 19 | 19 | private Date modified; |
| 20 | 20 | private Date created; |
| 21 | 21 | private Integer ismenu; |
| 22 | + private int weight; | |
| 23 | + | |
| 24 | + public int getWeight() { | |
| 25 | + return weight; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setWeight(int weight) { | |
| 29 | + this.weight = weight; | |
| 30 | + } | |
| 22 | 31 | |
| 23 | 32 | public Integer getId() { |
| 24 | 33 | return id; |
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Roles.java
View file @
f43969c
| ... | ... | @@ -2,122 +2,148 @@ |
| 2 | 2 | |
| 3 | 3 | import java.util.Date; |
| 4 | 4 | |
| 5 | -public class Roles {private Integer id;private Integer type;private String name;private Integer publishId;private String publishName;private Integer yn;private Integer enable;private Date modified;private Date created;private String remarks;private String shortCode; | |
| 5 | +public class Roles { | |
| 6 | + private Integer id; | |
| 7 | + private Integer type; | |
| 8 | + private String name; | |
| 9 | + private Integer publishId; | |
| 10 | + private String publishName; | |
| 11 | + private Integer yn; | |
| 12 | + private Integer enable; | |
| 13 | + private Date modified; | |
| 14 | + private Date created; | |
| 15 | + private String remarks; | |
| 16 | + private String shortCode; | |
| 17 | + private String hospitalid; | |
| 18 | + private Integer permissiontype; | |
| 6 | 19 | |
| 7 | -public Integer getId() { | |
| 8 | - return id; | |
| 20 | + public String getHospitalid() { | |
| 21 | + return hospitalid; | |
| 9 | 22 | } |
| 10 | 23 | |
| 24 | + public void setHospitalid(String hospitalid) { | |
| 25 | + this.hospitalid = hospitalid; | |
| 26 | + } | |
| 11 | 27 | |
| 28 | + public Integer getPermissiontype() { | |
| 29 | + return permissiontype; | |
| 30 | + } | |
| 12 | 31 | |
| 32 | + public void setPermissiontype(Integer permissiontype) { | |
| 33 | + this.permissiontype = permissiontype; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public String getShortCode() { | |
| 37 | + return shortCode; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setShortCode(String shortCode) { | |
| 41 | + this.shortCode = shortCode; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public Integer getId() { | |
| 45 | + return id; | |
| 46 | + } | |
| 47 | + | |
| 48 | + | |
| 13 | 49 | public void setId(Integer id) { |
| 14 | 50 | this.id = id; |
| 15 | 51 | |
| 16 | 52 | } |
| 17 | 53 | |
| 18 | -public Integer getType() { | |
| 54 | + public Integer getType() { | |
| 19 | 55 | return type; |
| 20 | 56 | } |
| 21 | 57 | |
| 22 | 58 | |
| 23 | - | |
| 24 | 59 | public void setType(Integer type) { |
| 25 | 60 | this.type = type; |
| 26 | 61 | |
| 27 | 62 | } |
| 28 | 63 | |
| 29 | -public String getName() { | |
| 64 | + public String getName() { | |
| 30 | 65 | return name; |
| 31 | 66 | } |
| 32 | 67 | |
| 33 | 68 | |
| 34 | - | |
| 35 | 69 | public void setName(String name) { |
| 36 | 70 | this.name = name; |
| 37 | 71 | |
| 38 | 72 | } |
| 39 | 73 | |
| 40 | -public Integer getPublishId() { | |
| 74 | + public Integer getPublishId() { | |
| 41 | 75 | return publishId; |
| 42 | 76 | } |
| 43 | 77 | |
| 44 | 78 | |
| 45 | - | |
| 46 | 79 | public void setPublishId(Integer publishId) { |
| 47 | 80 | this.publishId = publishId; |
| 48 | 81 | |
| 49 | 82 | } |
| 50 | 83 | |
| 51 | -public String getPublishName() { | |
| 84 | + public String getPublishName() { | |
| 52 | 85 | return publishName; |
| 53 | 86 | } |
| 54 | 87 | |
| 55 | 88 | |
| 56 | - | |
| 57 | 89 | public void setPublishName(String publishName) { |
| 58 | 90 | this.publishName = publishName; |
| 59 | 91 | |
| 60 | 92 | } |
| 61 | 93 | |
| 62 | -public Integer getYn() { | |
| 94 | + public Integer getYn() { | |
| 63 | 95 | return yn; |
| 64 | 96 | } |
| 65 | 97 | |
| 66 | 98 | |
| 67 | - | |
| 68 | 99 | public void setYn(Integer yn) { |
| 69 | 100 | this.yn = yn; |
| 70 | 101 | |
| 71 | 102 | } |
| 72 | 103 | |
| 73 | -public Integer getEnable() { | |
| 104 | + public Integer getEnable() { | |
| 74 | 105 | return enable; |
| 75 | 106 | } |
| 76 | 107 | |
| 77 | 108 | |
| 78 | - | |
| 79 | 109 | public void setEnable(Integer enable) { |
| 80 | 110 | this.enable = enable; |
| 81 | 111 | |
| 82 | 112 | } |
| 83 | 113 | |
| 84 | -public Date getModified() { | |
| 114 | + public Date getModified() { | |
| 85 | 115 | return modified; |
| 86 | 116 | } |
| 87 | 117 | |
| 88 | 118 | |
| 89 | - | |
| 90 | 119 | public void setModified(Date modified) { |
| 91 | 120 | this.modified = modified; |
| 92 | 121 | |
| 93 | 122 | } |
| 94 | 123 | |
| 95 | -public Date getCreated() { | |
| 124 | + public Date getCreated() { | |
| 96 | 125 | return created; |
| 97 | 126 | } |
| 98 | 127 | |
| 99 | 128 | |
| 100 | - | |
| 101 | 129 | public void setCreated(Date created) { |
| 102 | 130 | this.created = created; |
| 103 | 131 | |
| 104 | 132 | } |
| 105 | 133 | |
| 106 | -public String getRemarks() { | |
| 134 | + public String getRemarks() { | |
| 107 | 135 | return remarks; |
| 108 | 136 | } |
| 109 | 137 | |
| 110 | 138 | |
| 111 | - | |
| 112 | 139 | public void setRemarks(String remarks) { |
| 113 | 140 | this.remarks = remarks; |
| 114 | 141 | |
| 115 | 142 | } |
| 116 | 143 | |
| 117 | -public String getShortcode() { | |
| 144 | + public String getShortcode() { | |
| 118 | 145 | return shortCode; |
| 119 | 146 | } |
| 120 | - | |
| 121 | 147 | |
| 122 | 148 | |
| 123 | 149 | public void setShortcode(String shortCode) { |
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Users.java
View file @
f43969c
| ... | ... | @@ -2,188 +2,188 @@ |
| 2 | 2 | |
| 3 | 3 | import java.util.Date; |
| 4 | 4 | |
| 5 | -public class Users {private Integer id;private Integer logincenterId;private Integer type;private Integer orgId;private Integer deptId;private String name;private String account;private String pwd;private String phone;private Integer publishId;private String publishName;private Integer yn;private Integer enable;private Date modified;private Date created;private String remarks;private Date lastLoginTime; | |
| 5 | +public class Users { | |
| 6 | + private Integer id; | |
| 7 | + private Integer logincenterId; | |
| 8 | + private Integer type; | |
| 9 | + private Integer orgId; | |
| 10 | + private Integer deptId; | |
| 11 | + private String name; | |
| 12 | + private String account; | |
| 13 | + private String pwd; | |
| 14 | + private String phone; | |
| 15 | + private Integer publishId; | |
| 16 | + private String publishName; | |
| 17 | + private Integer yn; | |
| 18 | + private Integer enable; | |
| 19 | + private Date modified; | |
| 20 | + private Date created; | |
| 21 | + private String remarks; | |
| 22 | + private Date lastLoginTime; | |
| 6 | 23 | |
| 7 | -public Integer getId() { | |
| 24 | + public Integer getId() { | |
| 8 | 25 | return id; |
| 9 | 26 | } |
| 10 | 27 | |
| 11 | 28 | |
| 12 | - | |
| 13 | 29 | public void setId(Integer id) { |
| 14 | 30 | this.id = id; |
| 15 | 31 | |
| 16 | 32 | } |
| 17 | 33 | |
| 18 | -public Integer getLogincenterId() { | |
| 34 | + public Integer getLogincenterId() { | |
| 19 | 35 | return logincenterId; |
| 20 | 36 | } |
| 21 | 37 | |
| 22 | 38 | |
| 23 | - | |
| 24 | 39 | public void setLogincenterId(Integer logincenterId) { |
| 25 | 40 | this.logincenterId = logincenterId; |
| 26 | 41 | |
| 27 | 42 | } |
| 28 | 43 | |
| 29 | -public Integer getType() { | |
| 44 | + public Integer getType() { | |
| 30 | 45 | return type; |
| 31 | 46 | } |
| 32 | 47 | |
| 33 | 48 | |
| 34 | - | |
| 35 | 49 | public void setType(Integer type) { |
| 36 | 50 | this.type = type; |
| 37 | 51 | |
| 38 | 52 | } |
| 39 | 53 | |
| 40 | -public Integer getOrgId() { | |
| 54 | + public Integer getOrgId() { | |
| 41 | 55 | return orgId; |
| 42 | 56 | } |
| 43 | 57 | |
| 44 | 58 | |
| 45 | - | |
| 46 | 59 | public void setOrgId(Integer orgId) { |
| 47 | 60 | this.orgId = orgId; |
| 48 | 61 | |
| 49 | 62 | } |
| 50 | 63 | |
| 51 | -public Integer getDeptId() { | |
| 64 | + public Integer getDeptId() { | |
| 52 | 65 | return deptId; |
| 53 | 66 | } |
| 54 | 67 | |
| 55 | 68 | |
| 56 | - | |
| 57 | 69 | public void setDeptId(Integer deptId) { |
| 58 | 70 | this.deptId = deptId; |
| 59 | 71 | |
| 60 | 72 | } |
| 61 | 73 | |
| 62 | -public String getName() { | |
| 74 | + public String getName() { | |
| 63 | 75 | return name; |
| 64 | 76 | } |
| 65 | 77 | |
| 66 | 78 | |
| 67 | - | |
| 68 | 79 | public void setName(String name) { |
| 69 | 80 | this.name = name; |
| 70 | 81 | |
| 71 | 82 | } |
| 72 | 83 | |
| 73 | -public String getAccount() { | |
| 84 | + public String getAccount() { | |
| 74 | 85 | return account; |
| 75 | 86 | } |
| 76 | 87 | |
| 77 | 88 | |
| 78 | - | |
| 79 | 89 | public void setAccount(String account) { |
| 80 | 90 | this.account = account; |
| 81 | 91 | |
| 82 | 92 | } |
| 83 | 93 | |
| 84 | -public String getPwd() { | |
| 94 | + public String getPwd() { | |
| 85 | 95 | return pwd; |
| 86 | 96 | } |
| 87 | 97 | |
| 88 | 98 | |
| 89 | - | |
| 90 | 99 | public void setPwd(String pwd) { |
| 91 | 100 | this.pwd = pwd; |
| 92 | 101 | |
| 93 | 102 | } |
| 94 | 103 | |
| 95 | -public String getPhone() { | |
| 104 | + public String getPhone() { | |
| 96 | 105 | return phone; |
| 97 | 106 | } |
| 98 | 107 | |
| 99 | 108 | |
| 100 | - | |
| 101 | 109 | public void setPhone(String phone) { |
| 102 | 110 | this.phone = phone; |
| 103 | 111 | |
| 104 | 112 | } |
| 105 | 113 | |
| 106 | -public Integer getPublishId() { | |
| 114 | + public Integer getPublishId() { | |
| 107 | 115 | return publishId; |
| 108 | 116 | } |
| 109 | 117 | |
| 110 | 118 | |
| 111 | - | |
| 112 | 119 | public void setPublishId(Integer publishId) { |
| 113 | 120 | this.publishId = publishId; |
| 114 | 121 | |
| 115 | 122 | } |
| 116 | 123 | |
| 117 | -public String getPublishName() { | |
| 124 | + public String getPublishName() { | |
| 118 | 125 | return publishName; |
| 119 | 126 | } |
| 120 | 127 | |
| 121 | 128 | |
| 122 | - | |
| 123 | 129 | public void setPublishName(String publishName) { |
| 124 | 130 | this.publishName = publishName; |
| 125 | 131 | |
| 126 | 132 | } |
| 127 | 133 | |
| 128 | -public Integer getYn() { | |
| 134 | + public Integer getYn() { | |
| 129 | 135 | return yn; |
| 130 | 136 | } |
| 131 | 137 | |
| 132 | 138 | |
| 133 | - | |
| 134 | 139 | public void setYn(Integer yn) { |
| 135 | 140 | this.yn = yn; |
| 136 | 141 | |
| 137 | 142 | } |
| 138 | 143 | |
| 139 | -public Integer getEnable() { | |
| 144 | + public Integer getEnable() { | |
| 140 | 145 | return enable; |
| 141 | 146 | } |
| 142 | 147 | |
| 143 | 148 | |
| 144 | - | |
| 145 | 149 | public void setEnable(Integer enable) { |
| 146 | 150 | this.enable = enable; |
| 147 | 151 | |
| 148 | 152 | } |
| 149 | 153 | |
| 150 | -public Date getModified() { | |
| 154 | + public Date getModified() { | |
| 151 | 155 | return modified; |
| 152 | 156 | } |
| 153 | 157 | |
| 154 | 158 | |
| 155 | - | |
| 156 | 159 | public void setModified(Date modified) { |
| 157 | 160 | this.modified = modified; |
| 158 | 161 | |
| 159 | 162 | } |
| 160 | 163 | |
| 161 | -public Date getCreated() { | |
| 164 | + public Date getCreated() { | |
| 162 | 165 | return created; |
| 163 | 166 | } |
| 164 | 167 | |
| 165 | 168 | |
| 166 | - | |
| 167 | 169 | public void setCreated(Date created) { |
| 168 | 170 | this.created = created; |
| 169 | 171 | |
| 170 | 172 | } |
| 171 | 173 | |
| 172 | -public String getRemarks() { | |
| 174 | + public String getRemarks() { | |
| 173 | 175 | return remarks; |
| 174 | 176 | } |
| 175 | 177 | |
| 176 | 178 | |
| 177 | - | |
| 178 | 179 | public void setRemarks(String remarks) { |
| 179 | 180 | this.remarks = remarks; |
| 180 | 181 | |
| 181 | 182 | } |
| 182 | 183 | |
| 183 | -public Date getLastLoginTime() { | |
| 184 | + public Date getLastLoginTime() { | |
| 184 | 185 | return lastLoginTime; |
| 185 | 186 | } |
| 186 | - | |
| 187 | 187 | |
| 188 | 188 | |
| 189 | 189 | public void setLastLoginTime(Date lastLoginTime) { |
platform-common/src/main/java/com/lyms/platform/common/base/ExceptionHandlerController.java
View file @
f43969c
| ... | ... | @@ -130,7 +130,8 @@ |
| 130 | 130 | Map<String, Object> map = new HashMap<String, Object>(); |
| 131 | 131 | List<org.springframework.validation.FieldError> fieldErrors = bindingResult.getFieldErrors(); |
| 132 | 132 | for (org.springframework.validation.FieldError fieldError : fieldErrors) { |
| 133 | - map.put("errorcode", fieldError); | |
| 133 | + map.put("errorcode", ErrorCodeConstants.PARAMETER_ERROR); | |
| 134 | + map.put("errormsg",fieldError.getDefaultMessage()); | |
| 134 | 135 | break; |
| 135 | 136 | } |
| 136 | 137 | return map; |
platform-common/src/main/java/com/lyms/platform/common/enums/PermissionTypeEnums.java
View file @
f43969c
| 1 | +package com.lyms.platform.common.enums; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * 权限类型枚举定义 | |
| 6 | + * | |
| 7 | + * Created by Administrator on 2016/3/29 0029. | |
| 8 | + */ | |
| 9 | +public enum PermissionTypeEnums { | |
| 10 | + | |
| 11 | + ONLY_SELF("仅自己",1),THEIR_DEPARTMENT("查看本科室患者数据",2),ALL_DEPARTMENT("全科室患者数据",3),ALL_HOSPITAL("全院患者数据",4); | |
| 12 | + | |
| 13 | + public static enum Type{ | |
| 14 | + ADMIN(1),USER(2); | |
| 15 | + private Type(int id){ | |
| 16 | + this.id=id; | |
| 17 | + } | |
| 18 | + private int id; | |
| 19 | + | |
| 20 | + public int getId() { | |
| 21 | + return id; | |
| 22 | + } | |
| 23 | + } | |
| 24 | + | |
| 25 | + | |
| 26 | + private PermissionTypeEnums(String title,int id){ | |
| 27 | + this.id=id; | |
| 28 | + this.title=title; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public static PermissionTypeEnums getEnumsById(int id){ | |
| 32 | + for(PermissionTypeEnums permissionTypeEnums:values()){ | |
| 33 | + if(id==permissionTypeEnums.getId()){ | |
| 34 | + return permissionTypeEnums; | |
| 35 | + } | |
| 36 | + } | |
| 37 | + return null; | |
| 38 | + } | |
| 39 | + | |
| 40 | + private int id; | |
| 41 | + private String title; | |
| 42 | + | |
| 43 | + public int getId() { | |
| 44 | + return id; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public String getTitle() { | |
| 48 | + return title; | |
| 49 | + } | |
| 50 | +} |
platform-common/src/main/java/com/lyms/platform/common/utils/Assert.java
View file @
f43969c
| 1 | 1 | package com.lyms.platform.common.utils; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 3 | 4 | import com.lyms.platform.common.exception.BusinessException; |
| 4 | 5 | |
| 5 | 6 | /** |
| ... | ... | @@ -20,7 +21,7 @@ |
| 20 | 21 | |
| 21 | 22 | public static void notNull(Object object, String message) { |
| 22 | 23 | if (object == null) { |
| 23 | - throw new BusinessException(); | |
| 24 | + throw new BusinessException(ErrorCodeConstants.BUSINESS_ERROR+"",message); | |
| 24 | 25 | } |
| 25 | 26 | } |
| 26 | 27 | } |
platform-dal/src/main/java/com/lyms/platform/pojo/DataPermissionsModel.java
View file @
f43969c
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.enums.PermissionTypeEnums; | |
| 4 | +import com.lyms.platform.common.exception.BusinessException; | |
| 5 | +import com.lyms.platform.common.result.BaseModel; | |
| 6 | +import org.springframework.data.annotation.Id; | |
| 7 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 8 | + | |
| 9 | +import java.util.HashMap; | |
| 10 | +import java.util.List; | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * | |
| 15 | + * 数据权限存储模型 | |
| 16 | + * | |
| 17 | + * Created by Administrator on 2016/3/29 0029. | |
| 18 | + */ | |
| 19 | +@Document(collection = "lyms_data_permission") | |
| 20 | +public class DataPermissionsModel extends BaseModel { | |
| 21 | + // | |
| 22 | + @Id | |
| 23 | + private String id; | |
| 24 | + | |
| 25 | + private Integer userId; | |
| 26 | + | |
| 27 | + private Map<String,SimplePermission> data=new HashMap<String,SimplePermission>(); | |
| 28 | + | |
| 29 | + public Integer getUserId() { | |
| 30 | + return userId; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setUserId(Integer userId) { | |
| 34 | + this.userId = userId; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public Map getData() { | |
| 38 | + return data; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setData(Map data) { | |
| 42 | + this.data = data; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public String getId() { | |
| 46 | + return id; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setId(String id) { | |
| 50 | + this.id = id; | |
| 51 | + } | |
| 52 | + | |
| 53 | + //增加一条医院的权限 | |
| 54 | + public void addOnePer(String orgId,SimplePermission permission){ | |
| 55 | + data.put(orgId,permission); | |
| 56 | + } | |
| 57 | + | |
| 58 | + public static class SimplePermission { | |
| 59 | + //1 自己 2 自己科室 3 全部科室 4 | |
| 60 | + private int type=PermissionTypeEnums.ONLY_SELF.getId(); | |
| 61 | + | |
| 62 | + public int getType() { | |
| 63 | + return type; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setType(int type) { | |
| 67 | + this.type = type; | |
| 68 | + } | |
| 69 | + private List<String> deptid; | |
| 70 | + | |
| 71 | + public List<String> getDeptid() { | |
| 72 | + return deptid; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public void setDeptid(List<String> deptid) { | |
| 76 | + if(PermissionTypeEnums.ONLY_SELF.getId() ==type){ | |
| 77 | + return; | |
| 78 | + } | |
| 79 | + this.deptid = deptid; | |
| 80 | + } | |
| 81 | + } | |
| 82 | +} |
platform-dal/src/main/java/com/lyms/platform/query/DataPermissionsModelQuery.java
View file @
f43969c
| 1 | +package com.lyms.platform.query; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
| 4 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.common.enums.PermissionTypeEnums; | |
| 9 | +import com.lyms.platform.common.result.BaseModel; | |
| 10 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 11 | + | |
| 12 | +import java.util.HashMap; | |
| 13 | +import java.util.List; | |
| 14 | +import java.util.Map; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * | |
| 18 | + * 数据权限存储模型 | |
| 19 | + * | |
| 20 | + * Created by Administrator on 2016/3/29 0029. | |
| 21 | + */ | |
| 22 | +public class DataPermissionsModelQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 23 | + // | |
| 24 | + private String id; | |
| 25 | + | |
| 26 | + private Integer userId; | |
| 27 | + | |
| 28 | + | |
| 29 | + public String getId() { | |
| 30 | + return id; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setId(String id) { | |
| 34 | + this.id = id; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public Integer getUserId() { | |
| 38 | + return userId; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setUserId(Integer userId) { | |
| 42 | + this.userId = userId; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public MongoQuery convertToQuery() { | |
| 46 | + | |
| 47 | + MongoCondition condition =MongoCondition.newInstance(); | |
| 48 | + if(null!=id){ | |
| 49 | + condition=MongoCondition.newInstance("id",id, MongoOper.IS); | |
| 50 | + } | |
| 51 | + if(null!=userId){ | |
| 52 | + condition=condition.and("userId",userId,MongoOper.IS); | |
| 53 | + } | |
| 54 | + return condition.toMongoQuery(); | |
| 55 | + } | |
| 56 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PermissionsController.java
View file @
f43969c
| ... | ... | @@ -4,21 +4,26 @@ |
| 4 | 4 | import com.lyms.platform.common.annotation.TokenRequired; |
| 5 | 5 | import com.lyms.platform.common.base.BaseController; |
| 6 | 6 | import com.lyms.platform.common.base.ContextHolder; |
| 7 | +import com.lyms.platform.common.enums.PermissionTypeEnums; | |
| 7 | 8 | import com.lyms.platform.common.enums.YnEnums; |
| 8 | 9 | import com.lyms.platform.common.exception.BusinessException; |
| 10 | +import com.lyms.platform.common.result.BaseResponse; | |
| 11 | +import com.lyms.platform.common.utils.Assert; | |
| 9 | 12 | import com.lyms.platform.common.utils.JsonUtil; |
| 10 | 13 | import com.lyms.platform.common.utils.ResultUtils; |
| 14 | +import com.lyms.platform.operate.web.facade.AccessPermissionFacade; | |
| 15 | +import com.lyms.platform.operate.web.request.AccessPermissionAddRequest; | |
| 11 | 16 | import com.lyms.platform.permission.model.*; |
| 12 | 17 | import com.lyms.platform.permission.service.*; |
| 18 | +import com.lyms.platform.pojo.DataPermissionsModel; | |
| 13 | 19 | import org.apache.commons.lang.StringUtils; |
| 20 | +import org.apache.commons.lang.math.NumberUtils; | |
| 14 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 22 | import org.springframework.stereotype.Controller; |
| 16 | -import org.springframework.web.bind.annotation.PathVariable; | |
| 17 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 18 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 19 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 23 | +import org.springframework.web.bind.annotation.*; | |
| 20 | 24 | |
| 21 | 25 | import javax.servlet.http.HttpServletResponse; |
| 26 | +import javax.validation.Valid; | |
| 22 | 27 | import java.util.*; |
| 23 | 28 | |
| 24 | 29 | /** |
| 25 | 30 | |
| ... | ... | @@ -32,7 +37,10 @@ |
| 32 | 37 | private PermissionsService permissionsService; |
| 33 | 38 | @Autowired |
| 34 | 39 | private UsersService usersService; |
| 40 | + | |
| 35 | 41 | @Autowired |
| 42 | + private DepartmentsService departmentsService; | |
| 43 | + @Autowired | |
| 36 | 44 | private TokenService tokenService; |
| 37 | 45 | @Autowired |
| 38 | 46 | private UserRoleMapsService userRoleMapsService; |
| ... | ... | @@ -43,6 +51,8 @@ |
| 43 | 51 | private static String CHECK="check"; |
| 44 | 52 | |
| 45 | 53 | private Integer TYPE = 1; |
| 54 | + @Autowired | |
| 55 | + private AccessPermissionFacade accessPermissionFacade; | |
| 46 | 56 | |
| 47 | 57 | |
| 48 | 58 | /** |
| 49 | 59 | |
| 50 | 60 | |
| ... | ... | @@ -58,7 +68,25 @@ |
| 58 | 68 | ResultUtils.buildSuccessResultAndWrite(response, permissionses); |
| 59 | 69 | } |
| 60 | 70 | |
| 71 | + @TokenRequired | |
| 72 | + @RequestMapping(value = "/accesspermissions", method = RequestMethod.GET) | |
| 73 | + public void getAccessPermission(HttpServletResponse response){ | |
| 61 | 74 | |
| 75 | + List<Map<String,Object>> list = new ArrayList<>(); | |
| 76 | + for(PermissionTypeEnums permissionTypeEnums:PermissionTypeEnums.values()){ | |
| 77 | + Map<String,Object> data = new HashMap<String,Object>(); | |
| 78 | + data.put("id",permissionTypeEnums.getId()); | |
| 79 | + data.put("title",permissionTypeEnums.getTitle()); | |
| 80 | + list.add(data); | |
| 81 | + } | |
| 82 | + ResultUtils.buildSuccessResultAndWrite(response,list); | |
| 83 | + } | |
| 62 | 84 | |
| 85 | +// @TokenRequired | |
| 86 | + @RequestMapping(value = "/accesspermissions", method = RequestMethod.POST) | |
| 87 | + @ResponseBody | |
| 88 | + public BaseResponse addDataAccessPermission(@Valid AccessPermissionAddRequest accessPermissionAddRequest){ | |
| 89 | + return accessPermissionFacade.addAccessPermission(accessPermissionAddRequest); | |
| 90 | + } | |
| 63 | 91 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RolesController.java
View file @
f43969c
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | import com.lyms.platform.common.base.LoginContext; |
| 7 | 7 | import com.lyms.platform.common.enums.YnEnums; |
| 8 | 8 | import com.lyms.platform.common.exception.BusinessException; |
| 9 | +import com.lyms.platform.common.utils.Assert; | |
| 9 | 10 | import com.lyms.platform.common.utils.ResultUtils; |
| 10 | 11 | import com.lyms.platform.permission.model.*; |
| 11 | 12 | import com.lyms.platform.permission.service.*; |
| ... | ... | @@ -90,6 +91,26 @@ |
| 90 | 91 | |
| 91 | 92 | |
| 92 | 93 | |
| 94 | + | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * 角色绑定访问权限 | |
| 98 | + */ | |
| 99 | + @RequestMapping(value = "/roles/permissionv2", method = RequestMethod.POST) | |
| 100 | + @TokenRequired | |
| 101 | + public void updateUserPermission(HttpServletResponse response, | |
| 102 | + @RequestParam(value = "id") Integer id, | |
| 103 | + @RequestParam(value = "type") String accessPermType) { | |
| 104 | + Roles roles = rolesService.getRoles(id); | |
| 105 | + | |
| 106 | + Assert.notNull(roles,"角色为空."); | |
| 107 | + | |
| 108 | + roles.setPermissiontype(Integer.valueOf(accessPermType)); | |
| 109 | + | |
| 110 | + rolesService.updateRoles(roles); | |
| 111 | + ResultUtils.buildSuccessResultAndWrite(response); | |
| 112 | + | |
| 113 | + } | |
| 93 | 114 | /** |
| 94 | 115 | * 创建角色 |
| 95 | 116 | * @param response |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AccessPermissionFacade.java
View file @
f43969c
| 1 | +package com.lyms.platform.operate.web.facade; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.DataPermissionService; | |
| 4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 5 | +import com.lyms.platform.common.enums.PermissionTypeEnums; | |
| 6 | +import com.lyms.platform.common.result.BaseResponse; | |
| 7 | +import com.lyms.platform.common.utils.Assert; | |
| 8 | +import com.lyms.platform.operate.web.request.AccessPermissionAddRequest; | |
| 9 | +import com.lyms.platform.permission.model.Roles; | |
| 10 | +import com.lyms.platform.permission.model.Users; | |
| 11 | +import com.lyms.platform.permission.service.RolesService; | |
| 12 | +import com.lyms.platform.permission.service.UserRoleMapsService; | |
| 13 | +import com.lyms.platform.permission.service.UsersService; | |
| 14 | +import com.lyms.platform.pojo.DataPermissionsModel; | |
| 15 | +import com.lyms.platform.query.DataPermissionsModelQuery; | |
| 16 | +import com.sun.xml.internal.rngom.parse.host.Base; | |
| 17 | +import org.apache.commons.collections.CollectionUtils; | |
| 18 | +import org.apache.commons.lang.StringUtils; | |
| 19 | +import org.apache.commons.lang.math.NumberUtils; | |
| 20 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 21 | +import org.springframework.stereotype.Component; | |
| 22 | + | |
| 23 | +import java.util.ArrayList; | |
| 24 | +import java.util.HashMap; | |
| 25 | +import java.util.List; | |
| 26 | +import java.util.Map; | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * | |
| 30 | + * 数据访问权限的门面 | |
| 31 | + * | |
| 32 | + * Created by Administrator on 2016/3/30 0030. | |
| 33 | + */ | |
| 34 | +@Component | |
| 35 | +public class AccessPermissionFacade { | |
| 36 | + | |
| 37 | + @Autowired | |
| 38 | + private UsersService usersService; | |
| 39 | + @Autowired | |
| 40 | + private RolesService rolesService; | |
| 41 | + @Autowired | |
| 42 | + private UserRoleMapsService userRoleMapsService; | |
| 43 | + @Autowired | |
| 44 | + private DataPermissionService dataPermissionService; | |
| 45 | + | |
| 46 | + //修改访问权限 | |
| 47 | + public BaseResponse updateAccessPermission(){ | |
| 48 | + return new BaseResponse(); | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * | |
| 53 | + * 增加访问权限 | |
| 54 | + * | |
| 55 | + * @param accessPermissionAddRequest | |
| 56 | + * @return | |
| 57 | + */ | |
| 58 | + public BaseResponse addAccessPermission(AccessPermissionAddRequest accessPermissionAddRequest){ | |
| 59 | + | |
| 60 | + Users users =usersService.getUsers(NumberUtils.toInt(accessPermissionAddRequest.getUserId())); | |
| 61 | + | |
| 62 | + Assert.notNull(users, "用户信息不存在."); | |
| 63 | + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
| 64 | + dataPermissionsModelQuery.setUserId(Integer.valueOf(accessPermissionAddRequest.getUserId())); | |
| 65 | + List<DataPermissionsModel> data =dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
| 66 | + DataPermissionsModel dataPermissionsModel =null; | |
| 67 | + DataPermissionsModel.SimplePermission permission = new DataPermissionsModel.SimplePermission();; | |
| 68 | + if(CollectionUtils.isNotEmpty(data)){ | |
| 69 | + dataPermissionsModel=data.get(0); | |
| 70 | + }else{ | |
| 71 | + dataPermissionsModel=new DataPermissionsModel(); | |
| 72 | + } | |
| 73 | + | |
| 74 | + //如果院内权限 | |
| 75 | + if(PermissionTypeEnums.Type.USER.getId()==NumberUtils.toInt(accessPermissionAddRequest.getType())){ | |
| 76 | + //根据角色id拿对应的访问权限 | |
| 77 | + Roles roles = rolesService.getRoles(Integer.valueOf(accessPermissionAddRequest.getBizId())); | |
| 78 | + //角色没有绑定访问权限的情况 | |
| 79 | + if(null==roles.getPermissiontype()){ | |
| 80 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("角色没有绑定权限."); | |
| 81 | + } | |
| 82 | + | |
| 83 | + PermissionTypeEnums permissionTypeEnums = PermissionTypeEnums.getEnumsById(roles.getPermissiontype()); | |
| 84 | + | |
| 85 | + Assert.notNull(permissionTypeEnums, "权限类型不存在."); | |
| 86 | + | |
| 87 | + permission.setType(permissionTypeEnums.getId()); | |
| 88 | + dataPermissionsModel.addOnePer( roles.getHospitalid(), permission); | |
| 89 | + }else if(PermissionTypeEnums.Type.ADMIN.getId()==NumberUtils.toInt(accessPermissionAddRequest.getType())){ | |
| 90 | + //如果是院外的权限,就只需要设置医院的id | |
| 91 | + permission.setType(PermissionTypeEnums.ALL_HOSPITAL.getId()); | |
| 92 | + if(StringUtils.isNotEmpty(accessPermissionAddRequest.getBizId())){ | |
| 93 | + String[] hospitalIds= accessPermissionAddRequest.getBizId().split(","); | |
| 94 | + for(String id:hospitalIds){ | |
| 95 | + dataPermissionsModel.addOnePer(id, permission); | |
| 96 | + } | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + dataPermissionsModel.setUserId(Integer.valueOf(accessPermissionAddRequest.getUserId())); | |
| 101 | + dataPermissionService.addOrUpdatePermission(dataPermissionsModel); | |
| 102 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功."); | |
| 103 | + } | |
| 104 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AccessPermissionAddRequest.java
View file @
f43969c
| 1 | +package com.lyms.platform.operate.web.request; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.IBasicRequestConvert; | |
| 4 | +import com.lyms.platform.common.core.annotation.form.Form; | |
| 5 | +import com.lyms.platform.common.core.annotation.form.FormParam; | |
| 6 | +import com.lyms.platform.pojo.DataPermissionsModel; | |
| 7 | +import org.hibernate.validator.constraints.NotEmpty; | |
| 8 | + | |
| 9 | +import javax.validation.constraints.Pattern; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Created by Administrator on 2016/3/29 0029. | |
| 13 | + */ | |
| 14 | +@Form | |
| 15 | +public class AccessPermissionAddRequest { | |
| 16 | + //1、管理员权限 2、用户权限 | |
| 17 | + @FormParam | |
| 18 | + @Pattern(regexp = "^[1|2]$",message = "type must 1/2.") | |
| 19 | + private String type; | |
| 20 | + //角色id或者医院id | |
| 21 | + @FormParam("bizid") | |
| 22 | + @NotEmpty | |
| 23 | + private String bizId; | |
| 24 | + //用户id/角色id | |
| 25 | + @FormParam("userid") | |
| 26 | + private String userId; | |
| 27 | + | |
| 28 | + | |
| 29 | + public String getBizId() { | |
| 30 | + return bizId; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setBizId(String bizId) { | |
| 34 | + this.bizId = bizId; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public String getType() { | |
| 38 | + return type; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setType(String type) { | |
| 42 | + this.type = type; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public String getUserId() { | |
| 46 | + return userId; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setUserId(String userId) { | |
| 50 | + this.userId = userId; | |
| 51 | + } | |
| 52 | +} |
platform-operate-api/src/main/resources/spring/spring-mongodb.xml
View file @
f43969c
| ... | ... | @@ -12,6 +12,23 @@ |
| 12 | 12 | <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> |
| 13 | 13 | <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" /> |
| 14 | 14 | <!-- <constructor-arg name="userCredentials" ref="userCredentials"/> --> |
| 15 | + <constructor-arg name="mongoConverter" ref="mappingMongoConverter" /> | |
| 16 | + </bean> | |
| 17 | + | |
| 18 | + <mongo:mapping-converter base-package="com.lyms.platform.pojo" /> | |
| 19 | + <bean id="mappingContext" class="org.springframework.data.mongodb.core.mapping.MongoMappingContext" /> | |
| 20 | + <!-- 配置mongodb映射类型 --> | |
| 21 | + <bean id="mappingMongoConverter" class="org.springframework.data.mongodb.core.convert.MappingMongoConverter"> | |
| 22 | + <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" /> | |
| 23 | + <constructor-arg name="mappingContext" ref="mappingContext" /> | |
| 24 | + <property name="typeMapper" ref="defaultMongoTypeMapper" /> | |
| 25 | + </bean> | |
| 26 | + | |
| 27 | + <!-- 默认Mongodb类型映射 --> | |
| 28 | + <bean id="defaultMongoTypeMapper" class="org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper"> | |
| 29 | + <constructor-arg name="typeKey"> | |
| 30 | + <null /><!-- 这里设置为空,可以把 spring data mongodb 多余保存的_class字段去掉 --> | |
| 31 | + </constructor-arg> | |
| 15 | 32 | </bean> |
| 16 | 33 | <!-- |
| 17 | 34 | <bean id="userCredentials" class="org.springframework.data.authentication.UserCredentials"> |