Commit 676e111d by zhiwj

Merge remote-tracking branch 'origin/developer' into developer

parents 618fcbb4 b293d6dc
......@@ -73,6 +73,11 @@ public class CollaboratorDTO implements Serializable{
private String creator;
/**
* 资源组ids,可以多选,_隔开,类似_1_2_'
*/
private String resourceIds;
/**
* 子应用ids,可以多选,用_隔开_2_3_
*/
private String subAppIds;
......@@ -96,6 +101,8 @@ public class CollaboratorDTO implements Serializable{
private List<Integer> menuIdList;
private List<Integer> resourceIdList;
public Integer getCollaboratorId() {
return collaboratorId;
}
......@@ -215,4 +222,20 @@ public class CollaboratorDTO implements Serializable{
public void setCollaborationEnterpriseName(String collaborationEnterpriseName) {
this.collaborationEnterpriseName = collaborationEnterpriseName;
}
public String getResourceIds() {
return resourceIds;
}
public void setResourceIds(String resourceIds) {
this.resourceIds = resourceIds;
}
public List<Integer> getResourceIdList() {
return resourceIdList;
}
public void setResourceIdList(List<Integer> resourceIdList) {
this.resourceIdList = resourceIdList;
}
}
......@@ -76,10 +76,11 @@ public interface CollaboratorApiService {

 * @author guojuxing
* @param subAppIds 子应用ID,英文逗号隔开
* @param menuIds
 操作权限ID,英文逗号隔开
* @param resourcesIds 资源组ID,英文逗号隔开
* @param collaboratorId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> auth(String subAppIds, String menuIds, Integer collaboratorId);
ServiceResponse<Void> auth(String subAppIds, String menuIds, String resourcesIds, Integer collaboratorId);
/**
* 取消
......
......@@ -47,6 +47,11 @@ public class TabSysCollaborator {
private String creator;
/**
* 资源组ids,可以多选,_隔开,类似_1_2_'
*/
private String resourceIds;
/**
* 子应用ids,可以多选,用_隔开_2_3_
*/
private String subAppIds;
......@@ -161,4 +166,12 @@ public class TabSysCollaborator {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getResourceIds() {
return resourceIds;
}
public void setResourceIds(String resourceIds) {
this.resourceIds = resourceIds;
}
}
\ No newline at end of file
......@@ -143,12 +143,10 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
result.setMenuIdList(menuIdList);
}
if (StringUtils.isNotBlank(result.getSubAppIds())) {
String[] subAppArr = result.getSubAppIds().split(SignConstants.UNDERLINE);
List<String> subAppList = new ArrayList<>(subAppArr.length);
for (String subApp : subAppArr) {
subAppList.add(subApp);
}
result.setSubAppIdList(subAppList);
result.setSubAppIdList(strToList(result.getSubAppIds()));
}
if (StringUtils.isNotBlank(result.getResourceIds())) {
result.setResourceIdList(strToListOfInteger(result.getResourceIds()));
}
ServiceResponse<EnterpriseDTO> enterpriseResult = enterpriseApiService
.getEnterpriseById(record.getCollaborationEnterpriseId());
......@@ -160,23 +158,21 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
@Transactional(rollbackFor = Exception.class)
@Override
public ServiceResponse<Void> auth(String subAppIds, String menuIds, Integer collaboratorId) {
public ServiceResponse<Void> auth(String subAppIds, String menuIds, String resourcesIds, Integer collaboratorId) {
TabSysCollaborator record = collaboratorService.getById(collaboratorId);
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "协作人ID有误,查无数据");
}
CollaboratorDTO dto = new CollaboratorDTO();
//更新资源权限
if (StringUtils.isNotBlank(subAppIds)) {
String[] subAppArr = subAppIds.split(SignConstants.COMMA);
StringBuilder sb = new StringBuilder(SignConstants.UNDERLINE);
for (String str : subAppArr) {
sb.append(str).append(SignConstants.UNDERLINE);
}
CollaboratorDTO dto = new CollaboratorDTO();
dto.setCollaboratorId(collaboratorId);
dto.setSubAppIds(sb.toString());
collaboratorService.update(dto);
dto.setSubAppIds(commaToUnderline(subAppIds));
}
if (StringUtils.isNotBlank(resourcesIds)) {
dto.setResourceIds(commaToUnderline(resourcesIds));
}
dto.setCollaboratorId(collaboratorId);
collaboratorService.update(dto);
//更新操作权限
if (StringUtils.isNotBlank(menuIds)) {
String[] menuIdArr = menuIds.split(SignConstants.COMMA);
......@@ -209,4 +205,35 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
collaboratorService.update(dto);
return ServiceResponse.success();
}
/**
* 英文逗号隔开的字符串转为下划线隔开
* @param string
* @return
*/
private static String commaToUnderline(String string) {
String[] strArr = string.split(SignConstants.COMMA);
StringBuilder sb = new StringBuilder(SignConstants.UNDERLINE);
for (String str : strArr) {
sb.append(str).append(SignConstants.UNDERLINE);
}
return sb.toString();
}
private static List<String> strToList(String string) {
String[] strArr = string.split(SignConstants.UNDERLINE);
List<String> list = new ArrayList<>(strArr.length);
for (String str : strArr) {
list.add(str);
}
return list;
}
private static List<Integer> strToListOfInteger(String string) {
String[] strArr = string.split(SignConstants.UNDERLINE);
List<Integer> list = new ArrayList<>(strArr.length);
for (String str : strArr) {
list.add(Integer.parseInt(str));
}
return list;
}
}
......@@ -10,6 +10,7 @@
<result column="app_id" jdbcType="VARCHAR" property="appId" />
<result column="app_name" jdbcType="VARCHAR" property="appName" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="resource_ids" jdbcType="VARCHAR" property="resourceIds" />
<result column="sub_app_ids" jdbcType="VARCHAR" property="subAppIds" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
......@@ -17,7 +18,7 @@
</resultMap>
<sql id="Base_Column_List">
collaborator_id, collaborator_name, enterprise_id, collaboration_enterprise_id, phone,
app_id, app_name, creator, sub_app_ids, status, create_time, update_time
app_id, app_name, creator, resource_ids, sub_app_ids, status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -33,12 +34,12 @@
insert into tab_sys_collaborator (collaborator_id, collaborator_name,
enterprise_id, collaboration_enterprise_id,
phone, app_id, app_name,
creator, sub_app_ids, status,
creator, resource_ids, sub_app_ids, status,
create_time, update_time)
values (#{collaboratorId,jdbcType=INTEGER}, #{collaboratorName,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=INTEGER}, #{collaborationEnterpriseId,jdbcType=INTEGER},
#{phone,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR}, #{appName,jdbcType=VARCHAR},
#{creator,jdbcType=VARCHAR}, #{subAppIds,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{creator,jdbcType=VARCHAR}, #{resourceIds,jdbcType=VARCHAR}, #{subAppIds,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabSysCollaborator" useGeneratedKeys="true" keyProperty="collaboratorId">
......@@ -68,6 +69,9 @@
<if test="creator != null">
creator,
</if>
<if test="resourceIds != null">
resource_ids,
</if>
<if test="subAppIds != null">
sub_app_ids,
</if>
......@@ -106,6 +110,9 @@
<if test="creator != null">
#{creator,jdbcType=VARCHAR},
</if>
<if test="resourceIds != null">
#{resourceIds,jdbcType=VARCHAR},
</if>
<if test="subAppIds != null">
#{subAppIds,jdbcType=VARCHAR},
</if>
......@@ -144,6 +151,9 @@
<if test="creator != null">
creator = #{creator,jdbcType=VARCHAR},
</if>
<if test="resourceIds != null">
resource_ids = #{resourceIds,jdbcType=VARCHAR},
</if>
<if test="subAppIds != null">
sub_app_ids = #{subAppIds,jdbcType=VARCHAR},
</if>
......@@ -168,6 +178,7 @@
app_id = #{appId,jdbcType=VARCHAR},
app_name = #{appName,jdbcType=VARCHAR},
creator = #{creator,jdbcType=VARCHAR},
resource_ids = #{resourceIds,jdbcType=VARCHAR},
sub_app_ids = #{subAppIds,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
......
......@@ -120,9 +120,9 @@ public class CollaboratorController extends DownloadUtils{
* @return com.gic.commons.webapi.reponse.RestResponse


 */
@RequestMapping("/auth")
public RestResponse auth(String subAppIds, String menuIds, Integer collaboratorId) {
public RestResponse auth(String subAppIds, String menuIds, String resourceIds, Integer collaboratorId) {
return ResultControllerUtils.commonResult(
collaboratorApiService.auth(subAppIds, menuIds, collaboratorId));
collaboratorApiService.auth(subAppIds, menuIds, resourceIds, collaboratorId));
}
@RequestMapping("/app-menu-tree")
......
......@@ -32,6 +32,8 @@ public class CollaboratorDetailVO implements Serializable{
private List<Integer> menuIdList;
private List<Integer> resourceIdList;
public Integer getCollaboratorId() {
return collaboratorId;
}
......@@ -95,4 +97,12 @@ public class CollaboratorDetailVO implements Serializable{
public void setAppId(String appId) {
this.appId = appId;
}
public List<Integer> getResourceIdList() {
return resourceIdList;
}
public void setResourceIdList(List<Integer> resourceIdList) {
this.resourceIdList = resourceIdList;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment