|
|
|
@ -3,6 +3,7 @@ package cn.estsh.i3plus.core.apiservice.controller.busi;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ICoreMemTreeService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysMessageService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserInfoService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserPasswordService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserService;
|
|
|
|
@ -24,6 +25,7 @@ import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysMessage;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserDepartment;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserRole;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRole;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysUser;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysUserInfo;
|
|
|
|
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
|
|
|
@ -35,6 +37,7 @@ import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
@ -92,6 +95,9 @@ public class SysUserController extends CoreBaseController {
|
|
|
|
|
private ISysUserPasswordService userPasswordService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysRoleService roleService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EntityManager entityManager;
|
|
|
|
|
|
|
|
|
|
@Resource(name = CommonConstWords.IMPP_REDIS_RES)
|
|
|
|
@ -331,13 +337,14 @@ public class SysUserController extends CoreBaseController {
|
|
|
|
|
@GetMapping(value = "/export/ref-user-role")
|
|
|
|
|
@ApiOperation(value = "导出用户角色关系", notes = "导出用户角色关系")
|
|
|
|
|
public ResultBean exportUserRoleRef(HttpServletResponse response) {
|
|
|
|
|
File file = null;
|
|
|
|
|
try {
|
|
|
|
|
List<SysRefUserRole> list = sysUserService.findValidUserRoleRef();
|
|
|
|
|
ExcelTool excelTool = new ExcelTool(entityManager, redisRes);
|
|
|
|
|
String fileName = "user-role-ref-" + System.currentTimeMillis() + ".xls";
|
|
|
|
|
File file = new File(fileName);
|
|
|
|
|
file = new File(fileName);
|
|
|
|
|
file.createNewFile();
|
|
|
|
|
File excel = excelTool.exportData(file, list, SysRefUserRole.class
|
|
|
|
|
excelTool.exportData(file, list, SysRefUserRole.class
|
|
|
|
|
, (LinkedHashMap<String, String>) ExcelTool.getColName(SysRefUserRole.class));
|
|
|
|
|
|
|
|
|
|
response.setContentType("application/force-download"); // 设置强制下载不打开
|
|
|
|
@ -345,7 +352,7 @@ public class SysUserController extends CoreBaseController {
|
|
|
|
|
response.addHeader("Content-type", FileContentTypeTool.getContentType(StringTool.getStringFileSuffix(fileName, true)));
|
|
|
|
|
|
|
|
|
|
// 设置文件名
|
|
|
|
|
try (BufferedInputStream bis = new BufferedInputStream(new DataInputStream(new FileInputStream(excel)))) {
|
|
|
|
|
try (BufferedInputStream bis = new BufferedInputStream(new DataInputStream(new FileInputStream(file)))) {
|
|
|
|
|
OutputStream os = response.getOutputStream();
|
|
|
|
|
byte[] buffer = new byte[1024];
|
|
|
|
|
int i = bis.read(buffer);
|
|
|
|
@ -363,6 +370,10 @@ public class SysUserController extends CoreBaseController {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
} finally {
|
|
|
|
|
if (file != null) {
|
|
|
|
|
FileUtils.deleteQuietly(file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -426,6 +437,20 @@ public class SysUserController extends CoreBaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/role/list")
|
|
|
|
|
@ApiOperation(value = "查询所有角色", notes = "查询所有系统角色")
|
|
|
|
|
public ResultBean findRoleAll() {
|
|
|
|
|
try {
|
|
|
|
|
List<SysRole> list = roleService.findAll();
|
|
|
|
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(list);
|
|
|
|
|
} catch (ImppBusiException busExcep) {
|
|
|
|
|
return ResultBean.fail(busExcep);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除账号
|
|
|
|
|
*
|
|
|
|
|