处理异常问题
This commit is contained in:
parent
f6953704bc
commit
1075fb2eff
@ -2,7 +2,6 @@ package ink.wgink.interfaces.role;
|
||||
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -22,7 +21,7 @@ public interface IRoleDepartmentUserBaseService {
|
||||
* @param areaCode 地区编码
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentUserDTO> listUserByRoleIdAndAreaCode(String roleId, String areaCode) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException;
|
||||
List<DepartmentUserDTO> listUserByRoleIdAndAreaCode(String roleId, String areaCode);
|
||||
|
||||
/**
|
||||
* 获取指定部门中指定角色的用户列表接口
|
||||
|
@ -1,5 +1,6 @@
|
||||
package ink.wgink.util;
|
||||
|
||||
import ink.wgink.exceptions.base.SystemException;
|
||||
import ink.wgink.util.string.WStringUtil;
|
||||
|
||||
import java.io.*;
|
||||
@ -44,12 +45,13 @@ public class ArrayListUtil {
|
||||
* @param beanClass
|
||||
* @param <T>
|
||||
* @return
|
||||
* @throws NoSuchMethodException
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public static <T> List<String> listBeanStringIdValue(List<T> beans, String propertyName, Class<T> beanClass) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||
public static <T> List<String> listBeanStringIdValue(List<T> beans, String propertyName, Class<T> beanClass) {
|
||||
if (beans.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Set<String> beanStringIdSet = new HashSet<>();
|
||||
try {
|
||||
for (Object bean : beans) {
|
||||
Method method = bean.getClass().getMethod("get" + WStringUtil.firstToUpper(propertyName));
|
||||
Object result = method.invoke(bean);
|
||||
@ -58,6 +60,9 @@ public class ArrayListUtil {
|
||||
}
|
||||
beanStringIdSet.add(result.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new SystemException(e);
|
||||
}
|
||||
return new ArrayList<>(beanStringIdSet);
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -36,7 +35,7 @@ public class RoleDepartmentUserServiceImpl extends DefaultBaseService implements
|
||||
private IDepartmentUserBaseService departmentUserBaseService;
|
||||
|
||||
@Override
|
||||
public List<DepartmentUserDTO> listUserByRoleIdAndAreaCode(String roleId, String areaCode) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
|
||||
public List<DepartmentUserDTO> listUserByRoleIdAndAreaCode(String roleId, String areaCode) {
|
||||
// 地区下所有组织机构
|
||||
List<DepartmentPO> departmentPOs = departmentBaseService.listPOByAreaCode(areaCode);
|
||||
if (departmentPOs.isEmpty()) {
|
||||
|
@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -38,7 +37,7 @@ public class RoleDepartmentUserController extends DefaultBaseController {
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list-user/{roleId}/{areaCode}")
|
||||
public List<DepartmentUserDTO> listUserByRoleIdAndAreaCode(@PathVariable("roleId") String roleId,
|
||||
@PathVariable("areaCode") String areaCode) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
|
||||
@PathVariable("areaCode") String areaCode) {
|
||||
return roleDepartmentUserService.listUserByRoleIdAndAreaCode(roleId, areaCode);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -34,7 +33,7 @@ public class RoleDepartmentUserServiceImpl extends DefaultBaseService implements
|
||||
private IDepartmentUserService departmentUserService;
|
||||
|
||||
@Override
|
||||
public List<DepartmentUserDTO> listUserByRoleIdAndAreaCode(String roleId, String areaCode) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
|
||||
public List<DepartmentUserDTO> listUserByRoleIdAndAreaCode(String roleId, String areaCode) {
|
||||
// 地区下所有组织机构
|
||||
List<DepartmentPO> departmentPOs = departmentService.listPOByAreaCode(areaCode);
|
||||
if (departmentPOs.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user