Commit 3b2ee9c0 by guojuxing

管理员编辑受审组编辑调整:同步

parent 93ca7a71
...@@ -90,4 +90,12 @@ public interface AuditedGroupUserRelService { ...@@ -90,4 +90,12 @@ public interface AuditedGroupUserRelService {
* @throws * @throws
*/ */
void deleteByUserId(Integer userId); void deleteByUserId(Integer userId);
/**
* 管理员入口编辑受审组
* @param userId
* @param enterpriseId
* @param auditedGroupId
*/
void setUserAuditedGroup(Integer userId, Integer enterpriseId, List<Integer> auditedGroupId);
} }
...@@ -6,8 +6,10 @@ import com.gic.auth.dto.AuditedGroupDTO; ...@@ -6,8 +6,10 @@ import com.gic.auth.dto.AuditedGroupDTO;
import com.gic.auth.dto.AuditedGroupUserRelDTO; import com.gic.auth.dto.AuditedGroupUserRelDTO;
import com.gic.auth.entity.TabAuditedGroupUserRel; import com.gic.auth.entity.TabAuditedGroupUserRel;
import com.gic.auth.service.AuditedGroupUserRelService; import com.gic.auth.service.AuditedGroupUserRelService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -83,4 +85,26 @@ public class AuditedGroupUserRelServiceImpl implements AuditedGroupUserRelServic ...@@ -83,4 +85,26 @@ public class AuditedGroupUserRelServiceImpl implements AuditedGroupUserRelServic
public void deleteByUserId(Integer userId) { public void deleteByUserId(Integer userId) {
tabAuditedGroupUserRelMapper.deleteByUserId(userId); tabAuditedGroupUserRelMapper.deleteByUserId(userId);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void setUserAuditedGroup(Integer userId, Integer enterpriseId, List<Integer> auditedGroupId) {
if (CollectionUtils.isEmpty(auditedGroupId)) {
return ;
}
//删除该用户的所有关联
deleteByUserId(userId);
//建立关联
Date now = new Date();
for (Integer auditedGroupIdTemp : auditedGroupId) {
TabAuditedGroupUserRel record = new TabAuditedGroupUserRel();
record.setDeleteFlag(DeleteFlagConstants.NORMAL_STATUS);
record.setAuditedGroupId(auditedGroupIdTemp);
record.setCreateTime(now);
record.setUpdateTime(now);
record.setUserId(userId);
record.setEnterpriseId(enterpriseId);
tabAuditedGroupUserRelMapper.insert(record);
}
}
} }
...@@ -128,7 +128,7 @@ public class UserApiServiceImpl implements UserApiService { ...@@ -128,7 +128,7 @@ public class UserApiServiceImpl implements UserApiService {
} }
ServiceResponse<Integer> response = saveRole(userId, userDTO.getEnterpriseId(), userDTO.getUserRoleIds(), ServiceResponse<Integer> response = saveRole(userId, userDTO.getEnterpriseId(), userDTO.getUserRoleIds(),
userDTO.getUserResourceIds(), userDTO.getAccountGroupIds()); userDTO.getUserResourceIds(), userDTO.getAccountGroupIds(), userDTO.getUserGroupIds());
if (response.isSuccess()) { if (response.isSuccess()) {
return response; return response;
} else { } else {
...@@ -259,7 +259,7 @@ public class UserApiServiceImpl implements UserApiService { ...@@ -259,7 +259,7 @@ public class UserApiServiceImpl implements UserApiService {
auditorApiService.syncModifyNameOrPhone(userDTO.getUserId(), tabUser.getEnterpriseId(), userDTO.getPhoneNumber(), userDTO.getUserName(), null); auditorApiService.syncModifyNameOrPhone(userDTO.getUserId(), tabUser.getEnterpriseId(), userDTO.getPhoneNumber(), userDTO.getUserName(), null);
ServiceResponse response = saveRole(userDTO.getUserId(), userDTO.getEnterpriseId(), userDTO.getUserRoleIds(), ServiceResponse response = saveRole(userDTO.getUserId(), userDTO.getEnterpriseId(), userDTO.getUserRoleIds(),
userDTO.getUserResourceIds(), userDTO.getAccountGroupIds()); userDTO.getUserResourceIds(), userDTO.getAccountGroupIds(), userDTO.getUserGroupIds());
if (response.isSuccess()) { if (response.isSuccess()) {
return response; return response;
} else { } else {
...@@ -846,7 +846,7 @@ public class UserApiServiceImpl implements UserApiService { ...@@ -846,7 +846,7 @@ public class UserApiServiceImpl implements UserApiService {
} }
/** /**
* 保存关联数据,角色关联、资源关联 * 保存关联数据,角色关联、资源关联、受审组
* @Title: saveRole
 * @Title: saveRole

* @Description: * @Description:

 * @author guojuxing 
 * @author guojuxing
...@@ -857,10 +857,25 @@ public class UserApiServiceImpl implements UserApiService { ...@@ -857,10 +857,25 @@ public class UserApiServiceImpl implements UserApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
 * @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>


 */ 
 */
private ServiceResponse<Integer> saveRole(Integer userId, Integer enterpriseId, String userRoleIds, private ServiceResponse<Integer> saveRole(Integer userId, Integer enterpriseId, String userRoleIds,
String userResourceIds, String accountGroupIds) { String userResourceIds, String accountGroupIds, String userGroupIds) {
String[] userRoleIdArr; String[] userRoleIdArr;
String[] userResourceIdArr; String[] userResourceIdArr;
String[] accountGroupIdArr; String[] accountGroupIdArr;
String[] userGroupIdArr;
ServiceResponse<String[]> userGroupIdValid = ValidSplitUtils.validStr(userRoleIds);
if (userGroupIdValid.isSuccess()) {
userGroupIdArr = userGroupIdValid.getResult();
//受审组同步
auditedGroupUserRelService.setUserAuditedGroup(userId, enterpriseId,
Arrays.stream(userGroupIdArr).filter(e -> StringUtils.isNotBlank(e) && StringUtils.isNumeric(e))
.mapToInt(e -> Integer.valueOf(e))
.boxed()
.collect(Collectors.toList()));
} else {
return ServiceResponse.failure(userGroupIdValid.getCode(), userGroupIdValid.getMessage());
}
ServiceResponse<String[]> userRoleValid = ValidSplitUtils.validStr(userRoleIds); ServiceResponse<String[]> userRoleValid = ValidSplitUtils.validStr(userRoleIds);
if (userRoleValid.isSuccess()) { if (userRoleValid.isSuccess()) {
userRoleIdArr = userRoleValid.getResult(); userRoleIdArr = userRoleValid.getResult();
......
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