完善基础代码(组织部门)
This commit is contained in:
parent
ef5eae3aa0
commit
9817f9b84b
@ -0,0 +1,14 @@
|
||||
package ink.wgink.interfaces.department;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IDepartmentCheckService
|
||||
* @Description: 组织部门检查
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/12 8:44 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IDepartmentCheckService {
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
package ink.wgink.interfaces.department;
|
||||
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -29,4 +33,14 @@ public interface IDepartmentUserBaseService {
|
||||
* @return
|
||||
*/
|
||||
List<String> listUserIdByDepartmentIds(List<String> departmentIds);
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
*
|
||||
* @param departmentId 部门ID
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<DepartmentUserDTO>> listPage(String departmentId, ListPage page);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ink.wgink.interfaces.user;
|
||||
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
@ -67,4 +68,21 @@ public interface IUserBaseService {
|
||||
*/
|
||||
SuccessResultList<List<UserDTO>> listPage(ListPage page);
|
||||
|
||||
/**
|
||||
* 用户分页列表
|
||||
*
|
||||
* @param userIds 用户ID列表
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<UserDTO>> listPageByIds(List<String> userIds, ListPage page);
|
||||
|
||||
/**
|
||||
* 用户ID分页列表
|
||||
*
|
||||
* @param excludeUserIds 不包含的用户ID
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<UserDTO>> listPageByExcludeUserIds(List<String> excludeUserIds, ListPage page);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package ink.wgink.pojo.dtos.department;
|
||||
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@ -13,38 +15,43 @@ public class DepartmentUserDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2899875759045646539L;
|
||||
private String userId;
|
||||
private String departmentId;
|
||||
private String userUsername;
|
||||
private String userName;
|
||||
private String userPhone;
|
||||
private String userEmail;
|
||||
private String userUKey;
|
||||
private String userUKeyElectronicSecretKey;
|
||||
private Integer loginType;
|
||||
private String departmentName;
|
||||
private Integer userType;
|
||||
private Integer userState;
|
||||
private String userAvatar;
|
||||
private String departmentId;
|
||||
private String departmentName;
|
||||
private String userSort;
|
||||
|
||||
public DepartmentUserDTO() {
|
||||
}
|
||||
|
||||
public DepartmentUserDTO(UserDTO userDTO) {
|
||||
this.userId = userDTO.getUserId();
|
||||
this.userUsername = userDTO.getUserUsername();
|
||||
this.userName = userDTO.getUserName();
|
||||
this.userPhone = userDTO.getUserPhone();
|
||||
this.userEmail = userDTO.getUserEmail();
|
||||
this.loginType = userDTO.getLoginType();
|
||||
this.userType = userDTO.getUserType();
|
||||
this.userState = userDTO.getUserState();
|
||||
this.userAvatar = userDTO.getUserAvatar();
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
return userId == null ? "" : userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getDepartmentId() {
|
||||
return departmentId == null ? "" : departmentId.trim();
|
||||
}
|
||||
|
||||
public void setDepartmentId(String departmentId) {
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
public String getUserUsername() {
|
||||
return userUsername == null ? "" : userUsername.trim();
|
||||
return userUsername == null ? "" : userUsername;
|
||||
}
|
||||
|
||||
public void setUserUsername(String userUsername) {
|
||||
@ -52,7 +59,7 @@ public class DepartmentUserDTO implements Serializable {
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName == null ? "" : userName.trim();
|
||||
return userName == null ? "" : userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
@ -60,7 +67,7 @@ public class DepartmentUserDTO implements Serializable {
|
||||
}
|
||||
|
||||
public String getUserPhone() {
|
||||
return userPhone == null ? "" : userPhone.trim();
|
||||
return userPhone == null ? "" : userPhone;
|
||||
}
|
||||
|
||||
public void setUserPhone(String userPhone) {
|
||||
@ -68,47 +75,23 @@ public class DepartmentUserDTO implements Serializable {
|
||||
}
|
||||
|
||||
public String getUserEmail() {
|
||||
return userEmail == null ? "" : userEmail.trim();
|
||||
return userEmail == null ? "" : userEmail;
|
||||
}
|
||||
|
||||
public void setUserEmail(String userEmail) {
|
||||
this.userEmail = userEmail;
|
||||
}
|
||||
|
||||
public String getUserUKey() {
|
||||
return userUKey == null ? "" : userUKey;
|
||||
}
|
||||
|
||||
public void setUserUKey(String userUKey) {
|
||||
this.userUKey = userUKey;
|
||||
}
|
||||
|
||||
public String getUserUKeyElectronicSecretKey() {
|
||||
return userUKeyElectronicSecretKey == null ? "" : userUKeyElectronicSecretKey.trim();
|
||||
}
|
||||
|
||||
public void setUserUKeyElectronicSecretKey(String userUKeyElectronicSecretKey) {
|
||||
this.userUKeyElectronicSecretKey = userUKeyElectronicSecretKey;
|
||||
}
|
||||
|
||||
public Integer getLoginType() {
|
||||
return loginType;
|
||||
return loginType == null ? 0 : loginType;
|
||||
}
|
||||
|
||||
public void setLoginType(Integer loginType) {
|
||||
this.loginType = loginType;
|
||||
}
|
||||
|
||||
public String getDepartmentName() {
|
||||
return departmentName == null ? "" : departmentName.trim();
|
||||
}
|
||||
|
||||
public void setDepartmentName(String departmentName) {
|
||||
this.departmentName = departmentName;
|
||||
}
|
||||
|
||||
public Integer getUserType() {
|
||||
return userType;
|
||||
return userType == null ? 0 : userType;
|
||||
}
|
||||
|
||||
public void setUserType(Integer userType) {
|
||||
@ -116,7 +99,7 @@ public class DepartmentUserDTO implements Serializable {
|
||||
}
|
||||
|
||||
public Integer getUserState() {
|
||||
return userState;
|
||||
return userState == null ? 0 : userState;
|
||||
}
|
||||
|
||||
public void setUserState(Integer userState) {
|
||||
@ -124,15 +107,31 @@ public class DepartmentUserDTO implements Serializable {
|
||||
}
|
||||
|
||||
public String getUserAvatar() {
|
||||
return userAvatar == null ? "" : userAvatar.trim();
|
||||
return userAvatar == null ? "" : userAvatar;
|
||||
}
|
||||
|
||||
public void setUserAvatar(String userAvatar) {
|
||||
this.userAvatar = userAvatar;
|
||||
}
|
||||
|
||||
public String getDepartmentId() {
|
||||
return departmentId == null ? "" : departmentId;
|
||||
}
|
||||
|
||||
public void setDepartmentId(String departmentId) {
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
public String getDepartmentName() {
|
||||
return departmentName == null ? "" : departmentName;
|
||||
}
|
||||
|
||||
public void setDepartmentName(String departmentName) {
|
||||
this.departmentName = departmentName;
|
||||
}
|
||||
|
||||
public String getUserSort() {
|
||||
return userSort == null ? "" : userSort.trim();
|
||||
return userSort == null ? "" : userSort;
|
||||
}
|
||||
|
||||
public void setUserSort(String userSort) {
|
||||
@ -142,34 +141,30 @@ public class DepartmentUserDTO implements Serializable {
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"userId\":")
|
||||
.append("\"").append(userId).append("\"");
|
||||
sb.append(",\"departmentId\":")
|
||||
.append("\"").append(departmentId).append("\"");
|
||||
sb.append(",\"userUsername\":")
|
||||
.append("\"").append(userUsername).append("\"");
|
||||
sb.append(",\"userName\":")
|
||||
.append("\"").append(userName).append("\"");
|
||||
sb.append(",\"userPhone\":")
|
||||
.append("\"").append(userPhone).append("\"");
|
||||
sb.append(",\"userEmail\":")
|
||||
.append("\"").append(userEmail).append("\"");
|
||||
sb.append(",\"userUKey\":")
|
||||
.append("\"").append(userUKey).append("\"");
|
||||
sb.append(",\"userUKeyElectronicSecretKey\":")
|
||||
.append("\"").append(userUKeyElectronicSecretKey).append("\"");
|
||||
sb.append("\"userId\":\"")
|
||||
.append(userId).append('\"');
|
||||
sb.append(",\"userUsername\":\"")
|
||||
.append(userUsername).append('\"');
|
||||
sb.append(",\"userName\":\"")
|
||||
.append(userName).append('\"');
|
||||
sb.append(",\"userPhone\":\"")
|
||||
.append(userPhone).append('\"');
|
||||
sb.append(",\"userEmail\":\"")
|
||||
.append(userEmail).append('\"');
|
||||
sb.append(",\"loginType\":")
|
||||
.append(loginType);
|
||||
sb.append(",\"departmentName\":")
|
||||
.append("\"").append(departmentName).append("\"");
|
||||
sb.append(",\"userType\":")
|
||||
.append(userType);
|
||||
sb.append(",\"userState\":")
|
||||
.append(userState);
|
||||
sb.append(",\"userAvatar\":")
|
||||
.append("\"").append(userAvatar).append("\"");
|
||||
sb.append(",\"userSort\":")
|
||||
.append("\"").append(userSort).append("\"");
|
||||
sb.append(",\"userAvatar\":\"")
|
||||
.append(userAvatar).append('\"');
|
||||
sb.append(",\"departmentId\":\"")
|
||||
.append(departmentId).append('\"');
|
||||
sb.append(",\"departmentName\":\"")
|
||||
.append(departmentName).append('\"');
|
||||
sb.append(",\"userSort\":\"")
|
||||
.append(userSort).append('\"');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
41
basic-pojo/src/main/java/ink/wgink/pojo/vos/IdsVO.java
Normal file
41
basic-pojo/src/main/java/ink/wgink/pojo/vos/IdsVO.java
Normal file
@ -0,0 +1,41 @@
|
||||
package ink.wgink.pojo.vos;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IdsVO
|
||||
* @Description: Id列表VO
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/14 10:17 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@ApiModel
|
||||
public class IdsVO {
|
||||
|
||||
@ApiModelProperty(name = "ids", value = "ID列表")
|
||||
private List<String> ids;
|
||||
|
||||
public List<String> getIds() {
|
||||
return ids == null ? new ArrayList() : ids;
|
||||
}
|
||||
|
||||
public void setIds(List<String> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"ids\":")
|
||||
.append(ids);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -55,6 +55,12 @@ public class SecurityComponent {
|
||||
if (user instanceof UserInfoBO) {
|
||||
userInfoBO = (UserInfoBO) user;
|
||||
}
|
||||
if (userInfoBO == null) {
|
||||
userInfoBO = new UserInfoBO();
|
||||
userInfoBO.setUserId("1");
|
||||
userInfoBO.setUserName("admin");
|
||||
userInfoBO.setUserUsername("admin");
|
||||
}
|
||||
return userInfoBO;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md2">
|
||||
<div class="layui-col-md2 layui-col-sm2 layui-col-xs2">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body left-tree-wrap">
|
||||
<div id="leftTreeWrap">
|
||||
@ -24,7 +24,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md10">
|
||||
<div class="layui-col-md10 layui-col-sm10 layui-col-xs10">
|
||||
<div class="layui-card">
|
||||
<div id="listContentWrap" class="layui-card-body">
|
||||
<iframe id="listContent" frameborder="0" class="layadmin-iframe"></iframe>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md2">
|
||||
<div class="layui-col-md2 layui-col-sm2 layui-col-xs2">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body left-tree-wrap">
|
||||
<div id="leftTreeWrap">
|
||||
@ -24,7 +24,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md10">
|
||||
<div class="layui-col-md10 layui-col-sm10 layui-col-xs10">
|
||||
<div class="layui-card">
|
||||
<div id="listContentWrap" class="layui-card-body">
|
||||
<iframe id="listContent" frameborder="0" class="layadmin-iframe"></iframe>
|
||||
|
@ -1,25 +0,0 @@
|
||||
package ink.wgink.module.department.controller.api;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: DepartmentUserController
|
||||
* @Description: 组织部门用户
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/1/28 4:19 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "组织部门用户")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/department/user")
|
||||
public class DepartmentUserController {
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,18 +1,19 @@
|
||||
package ink.wgink.module.department.controller.api;
|
||||
package ink.wgink.service.department.controller.api;
|
||||
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.interfaces.consts.IFileConstant;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
import ink.wgink.pojo.result.*;
|
||||
import ink.wgink.module.department.pojo.vos.DepartmentVO;
|
||||
import ink.wgink.module.department.pojo.vos.MergeDepartmentInfoVO;
|
||||
import ink.wgink.module.department.pojo.vos.MergeNewDepartmentInfoVO;
|
||||
import ink.wgink.module.department.pojo.vos.SplitDepartmentVO;
|
||||
import ink.wgink.module.department.service.IDepartmentService;
|
||||
import ink.wgink.service.department.pojo.vos.DepartmentVO;
|
||||
import ink.wgink.service.department.pojo.vos.MergeDepartmentInfoVO;
|
||||
import ink.wgink.service.department.pojo.vos.MergeNewDepartmentInfoVO;
|
||||
import ink.wgink.service.department.pojo.vos.SplitDepartmentVO;
|
||||
import ink.wgink.service.department.service.IDepartmentService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -74,7 +75,7 @@ public class DepartmentController extends DefaultBaseController {
|
||||
|
||||
@ApiOperation(value = "重置组织部门编码", notes = "重置组织部门编码接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("restcode")
|
||||
@PutMapping("resetcode")
|
||||
public SuccessResult resetCode() {
|
||||
departmentService.resetCode();
|
||||
return new SuccessResult();
|
||||
@ -111,6 +112,23 @@ public class DepartmentController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入Excel", notes = "导入Excel")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "excel", value = "文件名称", paramType = "query"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("importexcel")
|
||||
public UploadExcelResultDTO importExcel(MultipartFile excel) throws Exception {
|
||||
if (Objects.isNull(excel)) {
|
||||
throw new ParamsException("Excel不能为空");
|
||||
}
|
||||
if (!excel.getOriginalFilename().endsWith(IFileConstant.EXCEL_SUFFIX_XLS) &&
|
||||
!excel.getOriginalFilename().endsWith(IFileConstant.EXCEL_SUFFIX_XLSX)) {
|
||||
throw new ParamsException("文件格式为Excel");
|
||||
}
|
||||
return departmentService.importExcel(excel);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "组织部门列表", notes = "组织部门列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentParentId", value = "组织部门上级ID", paramType = "path")
|
||||
@ -158,31 +176,16 @@ public class DepartmentController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpagedepartment")
|
||||
public SuccessResultList<List<DepartmentDTO>> listPageDepartment(ListPage page) {
|
||||
@GetMapping("listpage")
|
||||
public SuccessResultList<List<DepartmentDTO>> listPage(ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
String departmentParentId = "0";
|
||||
if (!StringUtils.isBlank(params.get("parentId") == null ? null : params.get("parentId").toString())) {
|
||||
departmentParentId = params.get("parentId").toString();
|
||||
}
|
||||
params.put("departmentParentId", departmentParentId);
|
||||
page.setParams(params);
|
||||
return departmentService.listPageByParentId(departmentParentId, page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存部门Excel(文件上传)", notes = "保存部门Excel接口(文件上传)")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "excel", value = "文件名称", paramType = "query"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("uploadexcel")
|
||||
public UploadExcelResultDTO uploadExcel(MultipartFile excel) throws IOException {
|
||||
if (Objects.isNull(excel)) {
|
||||
throw new ParamsException("Excel不能为空");
|
||||
}
|
||||
if (!excel.getOriginalFilename().endsWith(".xls") && !excel.getOriginalFilename().endsWith(".xlsx")) {
|
||||
throw new ParamsException("文件格式为Excel");
|
||||
}
|
||||
return departmentService.uploadExcel(excel);
|
||||
return departmentService.listPage(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获得同一级部门数量(按部门名称)", notes = "获得同一级部门数量(按部门名称)接口")
|
@ -0,0 +1,88 @@
|
||||
package ink.wgink.service.department.controller.api;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.vos.IdsVO;
|
||||
import ink.wgink.service.department.service.IDepartmentUserService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: DepartmentUserController
|
||||
* @Description: 组织部门用户
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/1/28 4:19 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "组织部门用户")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/department/user")
|
||||
public class DepartmentUserController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentUserService departmentUserService;
|
||||
|
||||
@ApiOperation(value = "更新组织部门人员列表", notes = "更新组织部门人员列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update/{departmentId}")
|
||||
public synchronized SuccessResult update(@PathVariable("departmentId") String departmentId,
|
||||
@RequestBody IdsVO idsVO) {
|
||||
departmentUserService.updateByDepartmentIdAndUserIds(departmentId, idsVO.getIds());
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "组织部门人员删除", notes = "组织部门人员删除接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "ids", value = "人员ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@DeleteMapping("remove/{departmentId}/{ids}")
|
||||
public synchronized SuccessResult remove(@PathVariable("departmentId") String departmentId,
|
||||
@PathVariable("ids") String ids) {
|
||||
departmentUserService.deleteByDepartmentIdAndUserIds(departmentId, null, Arrays.asList(ids.split("_")));
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "人员列表", notes = "人员列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage/{departmentId}")
|
||||
public SuccessResultList<List<DepartmentUserDTO>> listPage(@PathVariable("departmentId") String departmentId, ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return departmentUserService.listPage(departmentId, page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "人员ID列表", notes = "人员ID列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listuseridbydepartmentid/{departmentId}")
|
||||
public List<String> listUserIdByDepartmentId(@PathVariable("departmentId") String departmentId) {
|
||||
return departmentUserService.listUserIdByDepartmentId(departmentId);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,20 @@
|
||||
package ink.wgink.module.department.controller.route;
|
||||
package ink.wgink.service.department.controller.route;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.interfaces.dictionary.IDictionaryCheckService;
|
||||
import ink.wgink.util.ResourceUtil;
|
||||
import ink.wgink.util.request.RequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
@ -22,9 +30,14 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/department")
|
||||
public class DepartmentRouteController {
|
||||
|
||||
@Autowired(required = false)
|
||||
private IDictionaryCheckService dictionaryCheckService;
|
||||
|
||||
@GetMapping("save")
|
||||
public ModelAndView save() {
|
||||
return new ModelAndView("department/save");
|
||||
ModelAndView mv = new ModelAndView("department/save");
|
||||
mv.addObject("hasArea", dictionaryCheckService == null ? false : true);
|
||||
return mv;
|
||||
}
|
||||
|
||||
@GetMapping("save-merge")
|
||||
@ -39,7 +52,9 @@ public class DepartmentRouteController {
|
||||
|
||||
@GetMapping("update")
|
||||
public ModelAndView update() {
|
||||
return new ModelAndView("department/update");
|
||||
ModelAndView mv = new ModelAndView("department/update");
|
||||
mv.addObject("hasArea", dictionaryCheckService == null ? false : true);
|
||||
return mv;
|
||||
}
|
||||
|
||||
@GetMapping("update-split")
|
||||
@ -82,4 +97,10 @@ public class DepartmentRouteController {
|
||||
return new ModelAndView("department/upload/upload-excel");
|
||||
}
|
||||
|
||||
@GetMapping("upload/upload-excel-template")
|
||||
public void excelTemplate(HttpServletResponse response) throws IOException {
|
||||
File template = ResourceUtil.getResourceFile("templates/department/upload/upload-excel-template.xls");
|
||||
RequestUtil.download(response, template, "组织部门导入模板.xls");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package ink.wgink.service.department.controller.route;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: DepartmentUserRouteController
|
||||
* @Description: 组织部门用户
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/13 12:03 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "组织部门接口")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/department/user")
|
||||
public class DepartmentUserRouteController {
|
||||
|
||||
@GetMapping("list")
|
||||
public ModelAndView list() {
|
||||
return new ModelAndView("department/user/list");
|
||||
}
|
||||
|
||||
@GetMapping("select-user")
|
||||
public ModelAndView selectUser() {
|
||||
return new ModelAndView("department/user/select-user");
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package ink.wgink.module.department.dao;
|
||||
package ink.wgink.service.department.dao;
|
||||
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Map;
|
||||
@ -17,6 +18,14 @@ import java.util.Map;
|
||||
*/
|
||||
@Repository
|
||||
public interface IDepartmentAdjustmentDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
*
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 新增部门调整
|
||||
*
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.dao;
|
||||
package ink.wgink.service.department.dao;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
@ -25,6 +25,12 @@ import java.util.Map;
|
||||
@Repository
|
||||
public interface IDepartmentDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 新增组织部门
|
||||
*
|
@ -1,6 +1,7 @@
|
||||
package ink.wgink.module.department.dao;
|
||||
package ink.wgink.service.department.dao;
|
||||
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Map;
|
||||
@ -17,6 +18,14 @@ import java.util.Map;
|
||||
*/
|
||||
@Repository
|
||||
public interface IDepartmentUserAdjustmentDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
*
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 保存部门用户调整
|
||||
*
|
@ -1,8 +1,9 @@
|
||||
package ink.wgink.module.department.dao;
|
||||
package ink.wgink.service.department.dao;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@ -21,6 +22,13 @@ import java.util.Map;
|
||||
@Repository
|
||||
public interface IDepartmentUserDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
*
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 新增组织用户
|
||||
*
|
||||
@ -44,4 +52,12 @@ public interface IDepartmentUserDao {
|
||||
* @return
|
||||
*/
|
||||
List<String> listUserId(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 用户ID列表
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<String> listGroupUserId(Map<String, Object> params) throws SearchException;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.enmus;
|
||||
package ink.wgink.service.department.enmus;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.listener.excel;
|
||||
package ink.wgink.service.department.listener.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.listener.excel;
|
||||
package ink.wgink.service.department.listener.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.listener.excel;
|
||||
package ink.wgink.service.department.listener.excel;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.pojo.vos;
|
||||
package ink.wgink.service.department.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import ink.wgink.annotation.CheckNumberAnnotation;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.pojo.vos;
|
||||
package ink.wgink.service.department.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.pojo.vos;
|
||||
package ink.wgink.service.department.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.pojo.vos;
|
||||
package ink.wgink.service.department.pojo.vos;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.pojo.vos;
|
||||
package ink.wgink.service.department.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckListAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
@ -1,6 +1,6 @@
|
||||
package ink.wgink.module.department.service;
|
||||
package ink.wgink.service.department.service;
|
||||
|
||||
import ink.wgink.module.department.enmus.DepartmentAdjustmentTypeEnum;
|
||||
import ink.wgink.service.department.enmus.DepartmentAdjustmentTypeEnum;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ink.wgink.module.department.service;
|
||||
package ink.wgink.service.department.service;
|
||||
|
||||
import ink.wgink.interfaces.department.IDepartmentBaseService;
|
||||
import ink.wgink.interfaces.department.IDepartmentCheckService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.bos.DepartmentBO;
|
||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||
@ -8,10 +9,10 @@ import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentSimpleDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.result.UploadExcelResultDTO;
|
||||
import ink.wgink.module.department.pojo.vos.DepartmentVO;
|
||||
import ink.wgink.module.department.pojo.vos.MergeDepartmentInfoVO;
|
||||
import ink.wgink.module.department.pojo.vos.MergeNewDepartmentInfoVO;
|
||||
import ink.wgink.module.department.pojo.vos.SplitDepartmentVO;
|
||||
import ink.wgink.service.department.pojo.vos.DepartmentVO;
|
||||
import ink.wgink.service.department.pojo.vos.MergeDepartmentInfoVO;
|
||||
import ink.wgink.service.department.pojo.vos.MergeNewDepartmentInfoVO;
|
||||
import ink.wgink.service.department.pojo.vos.SplitDepartmentVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -28,7 +29,7 @@ import java.util.Map;
|
||||
* @Date: 2021/1/27 11:27 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IDepartmentService extends IDepartmentBaseService {
|
||||
public interface IDepartmentService extends IDepartmentBaseService, IDepartmentCheckService {
|
||||
|
||||
/**
|
||||
* 新增组织部门
|
||||
@ -91,6 +92,14 @@ public interface IDepartmentService extends IDepartmentBaseService {
|
||||
*/
|
||||
void updateSplit(String departmentId, SplitDepartmentVO splitDepartmentVO);
|
||||
|
||||
/**
|
||||
* 保存部门Excel
|
||||
*
|
||||
* @param excel
|
||||
* @return
|
||||
*/
|
||||
UploadExcelResultDTO importExcel(MultipartFile excel) throws IOException;
|
||||
|
||||
/**
|
||||
* 重置组织部门编码
|
||||
*
|
||||
@ -181,14 +190,6 @@ public interface IDepartmentService extends IDepartmentBaseService {
|
||||
*/
|
||||
DepartmentBO getHigherLevel(DepartmentBO departmentBO1, DepartmentBO departmentBO2);
|
||||
|
||||
/**
|
||||
* 保存部门Excel
|
||||
*
|
||||
* @param excel
|
||||
* @return
|
||||
*/
|
||||
UploadExcelResultDTO uploadExcel(MultipartFile excel) throws IOException;
|
||||
|
||||
/**
|
||||
* 获得同一级部门数量(按部门名称)
|
||||
*
|
||||
@ -238,5 +239,4 @@ public interface IDepartmentService extends IDepartmentBaseService {
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentSimpleDTO> listSimpleByParentIdAndUpdateDate(String departmentParentId, String updateDate);
|
||||
|
||||
}
|
@ -1,4 +1,7 @@
|
||||
package ink.wgink.module.department.service;
|
||||
package ink.wgink.service.department.service;
|
||||
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -18,6 +21,7 @@ public interface IDepartmentUserAdjustmentService {
|
||||
* 新增部门用户调整
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params);
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.service;
|
||||
package ink.wgink.service.department.service;
|
||||
|
||||
import ink.wgink.interfaces.department.IDepartmentUserBaseService;
|
||||
|
||||
@ -41,7 +41,7 @@ public interface IDepartmentUserService extends IDepartmentUserBaseService {
|
||||
* @param departmentName 部门名称
|
||||
* @param userIds 用户ID列表
|
||||
*/
|
||||
void deleteUserByDepartmentIdAndUserIds(String departmentId, String departmentName, List<String> userIds);
|
||||
void deleteByDepartmentIdAndUserIds(String departmentId, String departmentName, List<String> userIds);
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
@ -56,7 +56,5 @@ public interface IDepartmentUserService extends IDepartmentUserBaseService {
|
||||
* @param departmentId 部门ID
|
||||
* @param userIds 用户ID
|
||||
*/
|
||||
void updateUserByDepartmentIdAndUserIds(String departmentId, List<String> userIds);
|
||||
|
||||
|
||||
void updateByDepartmentIdAndUserIds(String departmentId, List<String> userIds);
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package ink.wgink.module.department.service.impl;
|
||||
package ink.wgink.service.department.service.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.module.department.dao.IDepartmentAdjustmentDao;
|
||||
import ink.wgink.module.department.enmus.DepartmentAdjustmentTypeEnum;
|
||||
import ink.wgink.module.department.service.IDepartmentAdjustmentService;
|
||||
import ink.wgink.module.department.service.IDepartmentUserAdjustmentService;
|
||||
import ink.wgink.module.user.service.IUserService;
|
||||
import ink.wgink.service.department.dao.IDepartmentAdjustmentDao;
|
||||
import ink.wgink.service.department.enmus.DepartmentAdjustmentTypeEnum;
|
||||
import ink.wgink.service.department.service.IDepartmentAdjustmentService;
|
||||
import ink.wgink.service.department.service.IDepartmentUserAdjustmentService;
|
||||
import ink.wgink.service.user.service.IUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.department.service.impl;
|
||||
package ink.wgink.service.department.service.impl;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@ -20,15 +20,15 @@ import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentSimpleDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.result.UploadExcelResultDTO;
|
||||
import ink.wgink.module.department.dao.IDepartmentDao;
|
||||
import ink.wgink.module.department.enmus.DepartmentAdjustmentTypeEnum;
|
||||
import ink.wgink.module.department.listener.excel.DepartmentExcel;
|
||||
import ink.wgink.module.department.listener.excel.DepartmentExcelError;
|
||||
import ink.wgink.module.department.listener.excel.DepartmentExcelListener;
|
||||
import ink.wgink.module.department.pojo.vos.*;
|
||||
import ink.wgink.module.department.service.IDepartmentAdjustmentService;
|
||||
import ink.wgink.module.department.service.IDepartmentService;
|
||||
import ink.wgink.module.department.service.IDepartmentUserService;
|
||||
import ink.wgink.service.department.dao.IDepartmentDao;
|
||||
import ink.wgink.service.department.enmus.DepartmentAdjustmentTypeEnum;
|
||||
import ink.wgink.service.department.listener.excel.DepartmentExcel;
|
||||
import ink.wgink.service.department.listener.excel.DepartmentExcelError;
|
||||
import ink.wgink.service.department.listener.excel.DepartmentExcelListener;
|
||||
import ink.wgink.service.department.pojo.vos.*;
|
||||
import ink.wgink.service.department.service.IDepartmentAdjustmentService;
|
||||
import ink.wgink.service.department.service.IDepartmentService;
|
||||
import ink.wgink.service.department.service.IDepartmentUserService;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -150,18 +150,42 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
|
||||
String newDepartmentId = saveReturnId(splitDepartmentInfoVO);
|
||||
departmentAdjustmentService.save(departmentId, departmentDTO.getDepartmentName(), newDepartmentId, splitDepartmentInfoVO.getDepartmentName(), DepartmentAdjustmentTypeEnum.SPLIT);
|
||||
if (!StringUtils.isBlank(userIds)) {
|
||||
departmentUserService.updateUserByDepartmentIdAndUserIds(newDepartmentId, Arrays.asList(userIds.split("_")));
|
||||
departmentUserService.updateByDepartmentIdAndUserIds(newDepartmentId, Arrays.asList(userIds.split("_")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UploadExcelResultDTO importExcel(MultipartFile excel) throws IOException {
|
||||
// 错误列表
|
||||
List<DepartmentExcelError> departmentExcelErrors = new ArrayList<>(0);
|
||||
long startTime = System.currentTimeMillis();
|
||||
EasyExcel.read(excel.getInputStream(), DepartmentExcel.class, new DepartmentExcelListener() {
|
||||
@Override
|
||||
public void listDepartmentExcel(List<DepartmentExcel> departmentExcels) throws Exception {
|
||||
JSONArray listTreeDepartmentExcelJsonArray = listTreeExcelJsonArray(0, departmentExcels, departmentExcelErrors);
|
||||
saveExcel("0", null, listTreeDepartmentExcelJsonArray, departmentExcelErrors);
|
||||
}
|
||||
}).headRowNumber(2).sheet().doRead();
|
||||
long endTime = System.currentTimeMillis();
|
||||
String excelFileId = null;
|
||||
if (departmentExcelErrors.size() > 0) {
|
||||
excelFileId = new AbstractErrorExcelHandler<DepartmentExcelError>(fileService) {
|
||||
@Override
|
||||
public List<List<String>> excelHeaderNames() {
|
||||
return simpleExcelHeader(new String[]{"ID", "组织名称", "上级ID", "组织说明", "组织电话", "类型", "错误原因"});
|
||||
}
|
||||
}.saveErrorExcel(departmentExcelErrors);
|
||||
}
|
||||
return new UploadExcelResultDTO(departmentExcelErrors.size(), endTime - startTime, excelFileId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetCode() {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
resetCode("0", "", params);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DepartmentDTO> list(Map<String, Object> params) {
|
||||
return departmentDao.list(params);
|
||||
@ -285,31 +309,6 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UploadExcelResultDTO uploadExcel(MultipartFile excel) throws IOException {
|
||||
// 错误列表
|
||||
List<DepartmentExcelError> departmentExcelErrors = new ArrayList<>(0);
|
||||
long startTime = System.currentTimeMillis();
|
||||
EasyExcel.read(excel.getInputStream(), DepartmentExcel.class, new DepartmentExcelListener() {
|
||||
@Override
|
||||
public void listDepartmentExcel(List<DepartmentExcel> departmentExcels) throws Exception {
|
||||
JSONArray listTreeDepartmentExcelJsonArray = listTreeExcelJsonArray(0, departmentExcels, departmentExcelErrors);
|
||||
saveExcel("0", null, listTreeDepartmentExcelJsonArray, departmentExcelErrors);
|
||||
}
|
||||
}).headRowNumber(2).sheet().doRead();
|
||||
long endTime = System.currentTimeMillis();
|
||||
String excelFileId = null;
|
||||
if (departmentExcelErrors.size() > 0) {
|
||||
excelFileId = new AbstractErrorExcelHandler<DepartmentExcelError>(fileService) {
|
||||
@Override
|
||||
public List<List<String>> excelHeaderNames() {
|
||||
return simpleExcelHeader(new String[]{"ID", "组织名称", "上级ID", "组织说明", "组织电话", "类型", "错误原因"});
|
||||
}
|
||||
}.saveErrorExcel(departmentExcelErrors);
|
||||
}
|
||||
return new UploadExcelResultDTO(departmentExcelErrors.size(), endTime - startTime, excelFileId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer count(Map<String, Object> params) {
|
||||
Integer count = departmentDao.count(params);
|
||||
@ -452,7 +451,7 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
|
||||
// 获取用户ID
|
||||
List<String> userIds = departmentUserService.listUserIdByDepartmentId(departmentId);
|
||||
// 删除组织用户
|
||||
departmentUserService.deleteUserByDepartmentIdAndUserIds(departmentId, departmentName, userIds);
|
||||
departmentUserService.deleteByDepartmentIdAndUserIds(departmentId, departmentName, userIds);
|
||||
// 删除组织
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("departmentIds", Arrays.asList(departmentId));
|
@ -1,8 +1,8 @@
|
||||
package ink.wgink.module.department.service.impl;
|
||||
package ink.wgink.service.department.service.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.module.department.dao.IDepartmentUserAdjustmentDao;
|
||||
import ink.wgink.module.department.service.IDepartmentUserAdjustmentService;
|
||||
import ink.wgink.service.department.dao.IDepartmentUserAdjustmentDao;
|
||||
import ink.wgink.service.department.service.IDepartmentUserAdjustmentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -1,17 +1,24 @@
|
||||
package ink.wgink.module.department.service.impl;
|
||||
package ink.wgink.service.department.service.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.interfaces.user.IUserBaseService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentSimpleDTO;
|
||||
import ink.wgink.module.department.dao.IDepartmentUserDao;
|
||||
import ink.wgink.module.department.service.IDepartmentAdjustmentService;
|
||||
import ink.wgink.module.department.service.IDepartmentService;
|
||||
import ink.wgink.module.department.service.IDepartmentUserService;
|
||||
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.department.dao.IDepartmentUserDao;
|
||||
import ink.wgink.service.department.service.IDepartmentAdjustmentService;
|
||||
import ink.wgink.service.department.service.IDepartmentService;
|
||||
import ink.wgink.service.department.service.IDepartmentUserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -34,6 +41,8 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
||||
private IDepartmentService departmentService;
|
||||
@Autowired
|
||||
private IDepartmentAdjustmentService departmentAdjustmentService;
|
||||
@Autowired
|
||||
private IUserBaseService userBaseService;
|
||||
|
||||
@Override
|
||||
public void saveUserIdByDepartmentId(String departmentId, String departmentName, List<String> departmentUserIds) {
|
||||
@ -47,7 +56,7 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUserByDepartmentIdAndUserIds(String departmentId, String departmentName, List<String> userIds) {
|
||||
public void deleteByDepartmentIdAndUserIds(String departmentId, String departmentName, List<String> userIds) {
|
||||
String adjustmentDepartmentName = departmentName;
|
||||
if (StringUtils.isBlank(departmentName)) {
|
||||
DepartmentSimpleDTO departmentSimpleDTO = departmentService.getSimple(departmentId);
|
||||
@ -71,11 +80,14 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("departmentId", departmentId);
|
||||
List<String> userIds = departmentUserDao.listUserId(params);
|
||||
deleteUserByDepartmentIdAndUserIds(departmentId, null, userIds);
|
||||
deleteByDepartmentIdAndUserIds(departmentId, null, userIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserByDepartmentIdAndUserIds(String departmentId, List<String> userIds) {
|
||||
public void updateByDepartmentIdAndUserIds(String departmentId, List<String> userIds) {
|
||||
if (userIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
DepartmentSimpleDTO departmentSimpleDTO = departmentService.getSimple(departmentId);
|
||||
if (departmentSimpleDTO == null) {
|
||||
throw new SearchException("部门不存在");
|
||||
@ -114,4 +126,52 @@ public class DepartmentUserServiceImpl extends DefaultBaseService implements IDe
|
||||
params.put("departmentIds", departmentIds);
|
||||
return departmentUserDao.listUserId(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<DepartmentUserDTO>> listPage(String departmentId, ListPage page) {
|
||||
SuccessResultList<List<UserDTO>> successResultList;
|
||||
if (StringUtils.equals(departmentId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||
successResultList = listPageUserDTOByExcludeDepartmentId(page);
|
||||
} else {
|
||||
successResultList = listPageUserDTOByDepartmentId(departmentId, page);
|
||||
}
|
||||
List<UserDTO> userDTOs = successResultList.getRows();
|
||||
List<DepartmentUserDTO> departmentUserDTOs = new ArrayList<>();
|
||||
for (UserDTO userDTO : userDTOs) {
|
||||
DepartmentUserDTO departmentUserDTO = new DepartmentUserDTO(userDTO);
|
||||
departmentUserDTO.setDepartmentId(departmentId);
|
||||
departmentUserDTOs.add(departmentUserDTO);
|
||||
}
|
||||
return new SuccessResultList<>(departmentUserDTOs, successResultList.getPage(), successResultList.getTotal());
|
||||
}
|
||||
|
||||
private List<String> listGroupUserId(Map<String, Object> params) {
|
||||
return departmentUserDao.listGroupUserId(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 没有组织机构的用户分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<UserDTO>> listPageUserDTOByExcludeDepartmentId(ListPage page) {
|
||||
List<String> hasDepartmentIdUserIds = listGroupUserId(new HashMap<>(0));
|
||||
return userBaseService.listPageByExcludeUserIds(hasDepartmentIdUserIds, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 组织机构的用户分页列表
|
||||
*
|
||||
* @param departmentId 组织机构ID
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<UserDTO>> listPageUserDTOByDepartmentId(String departmentId, ListPage page) {
|
||||
List<String> userIds = listUserIdByDepartmentId(departmentId);
|
||||
if (userIds.isEmpty()) {
|
||||
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
||||
}
|
||||
return userBaseService.listPageByIds(userIds, page);
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package ink.wgink.service.department.startup;
|
||||
|
||||
import ink.wgink.service.department.dao.IDepartmentAdjustmentDao;
|
||||
import ink.wgink.service.department.dao.IDepartmentDao;
|
||||
import ink.wgink.service.department.dao.IDepartmentUserAdjustmentDao;
|
||||
import ink.wgink.service.department.dao.IDepartmentUserDao;
|
||||
import ink.wgink.service.department.service.IDepartmentUserAdjustmentService;
|
||||
import ink.wgink.service.department.service.IDepartmentUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: ServiceDepartmentStartUp
|
||||
* @Description: 组织机构业务
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/12 8:39 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class ServiceDepartmentStartUp implements ApplicationRunner {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ServiceDepartmentStartUp.class);
|
||||
|
||||
@Autowired
|
||||
private IDepartmentDao departmentDao;
|
||||
@Autowired
|
||||
private IDepartmentAdjustmentDao departmentAdjustmentDao;
|
||||
@Autowired
|
||||
private IDepartmentUserDao departmentUserDao;
|
||||
@Autowired
|
||||
private IDepartmentUserAdjustmentDao departmentUserAdjustmentDao;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
initTable();
|
||||
}
|
||||
|
||||
private void initTable() {
|
||||
LOG.debug("创建 sys_department 表");
|
||||
departmentDao.createTable();
|
||||
|
||||
LOG.debug("创建 sys_department_adjustment 表");
|
||||
departmentAdjustmentDao.createTable();
|
||||
|
||||
LOG.debug("创建 sys_department_user 表");
|
||||
departmentUserDao.createTable();
|
||||
|
||||
LOG.debug("创建 sys_department_user_adjustment 表");
|
||||
departmentUserAdjustmentDao.createTable();
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.module.department.dao.IDepartmentAdjustmentDao">
|
||||
<mapper namespace="ink.wgink.service.department.dao.IDepartmentAdjustmentDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_department_adjustment` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`old_department_id` char(36) NOT NULL,
|
||||
`old_department_name` varchar(255) NOT NULL COMMENT '旧部门名称',
|
||||
`new_department_id` char(36) NOT NULL,
|
||||
`new_department_name` varchar(255) NOT NULL COMMENT '新部门名称',
|
||||
`adjustment_type` varchar(10) NOT NULL,
|
||||
`gmt_create` datetime DEFAULT NULL,
|
||||
`creator` char(36) DEFAULT NULL,
|
||||
`creator_name` varchar(255) DEFAULT NULL COMMENT '创建人',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='部门调整';
|
||||
</update>
|
||||
|
||||
<!-- 新增部门调整 -->
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
INSERT INTO sys_department_adjustment(
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.module.department.dao.IDepartmentDao">
|
||||
<mapper namespace="ink.wgink.service.department.dao.IDepartmentDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
@ -91,6 +91,54 @@
|
||||
<result property="name" column="department_name"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_department` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`department_id` char(36) NOT NULL,
|
||||
`department_parent_id` char(36) NOT NULL COMMENT '上级部门',
|
||||
`department_name` varchar(255) DEFAULT NULL COMMENT '机构名称',
|
||||
`department_name_en` varchar(255) DEFAULT NULL COMMENT '部门名称(英文)',
|
||||
`department_name_other` varchar(255) DEFAULT NULL COMMENT '部门名称(其他)',
|
||||
`department_summary` varchar(255) DEFAULT NULL COMMENT '部门简介',
|
||||
`department_code` varchar(255) DEFAULT NULL COMMENT '部门编码',
|
||||
`department_logo` char(36) DEFAULT NULL COMMENT '部门logo',
|
||||
`department_logo_hover` char(36) DEFAULT NULL COMMENT '部门logo:hover',
|
||||
`department_type` int(2) DEFAULT '1' COMMENT '部门类别,1:机构,2:部门',
|
||||
`department_state` int(2) DEFAULT '1' COMMENT '部门状态,1:正常,2:锁定,3:冻结',
|
||||
`department_fax` varchar(20) DEFAULT NULL COMMENT '部门传真',
|
||||
`department_tel` varchar(20) DEFAULT NULL COMMENT '部门电话',
|
||||
`department_address` varchar(255) DEFAULT NULL COMMENT '部门地址',
|
||||
`department_master` char(36) DEFAULT '0' COMMENT '部门负责人',
|
||||
`department_duty` varchar(255) DEFAULT NULL COMMENT '部门职责',
|
||||
`department_longitude` varchar(255) DEFAULT '0' COMMENT '部门经度',
|
||||
`department_latitude` varchar(255) DEFAULT '0' COMMENT '部门纬度',
|
||||
`department_order` int(11) DEFAULT '0' COMMENT '部门排序',
|
||||
`department_area1_id` bigint(20) DEFAULT NULL COMMENT '1级区域ID',
|
||||
`department_area1_code` varchar(255) DEFAULT NULL COMMENT '1级区域编码',
|
||||
`department_area1_name` varchar(255) DEFAULT NULL COMMENT '1级区域名称',
|
||||
`department_area2_id` bigint(20) DEFAULT NULL COMMENT '2级区域ID',
|
||||
`department_area2_code` varchar(255) DEFAULT NULL COMMENT '2级区域编码',
|
||||
`department_area2_name` varchar(255) DEFAULT NULL COMMENT '2级区域名称',
|
||||
`department_area3_id` bigint(20) DEFAULT NULL COMMENT '3级区域ID',
|
||||
`department_area3_code` varchar(255) DEFAULT NULL COMMENT '3级区域编码',
|
||||
`department_area3_name` varchar(255) DEFAULT NULL COMMENT '3级区域名称',
|
||||
`department_area4_id` bigint(20) DEFAULT NULL COMMENT '4级区域ID',
|
||||
`department_area4_code` varchar(255) DEFAULT NULL COMMENT '4级区域编码',
|
||||
`department_area4_name` varchar(255) DEFAULT NULL COMMENT '4级区域名称',
|
||||
`department_area5_id` bigint(20) DEFAULT NULL COMMENT '5级区域ID',
|
||||
`department_area5_code` varchar(255) DEFAULT NULL COMMENT '5级区域编码',
|
||||
`department_area5_name` varchar(255) DEFAULT NULL COMMENT '5级区域名称',
|
||||
`creator` char(36) DEFAULT NULL,
|
||||
`gmt_create` datetime DEFAULT NULL,
|
||||
`modifier` char(36) DEFAULT NULL,
|
||||
`gmt_modified` datetime DEFAULT NULL,
|
||||
`is_delete` int(2) DEFAULT '0',
|
||||
PRIMARY KEY (`id`,`department_id`),
|
||||
KEY `department_id_idx` (`department_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
</update>
|
||||
|
||||
<!-- 新增组织部门 -->
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
INSERT INTO sys_department(
|
||||
|
@ -1,12 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.module.department.dao.IDepartmentUserAdjustmentDao">
|
||||
<mapper namespace="ink.wgink.service.department.dao.IDepartmentUserAdjustmentDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_department_user_adjustment` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_id` char(36) NOT NULL COMMENT '用户',
|
||||
`user_name` varchar(255) NOT NULL COMMENT '用户名称',
|
||||
`department_id` char(36) NOT NULL COMMENT '部门',
|
||||
`department_name` varchar(255) NOT NULL COMMENT '部门名称',
|
||||
`adjustment_type` varchar(255) NOT NULL COMMENT '调整类别',
|
||||
`gmt_create` datetime NOT NULL COMMENT '创建时间',
|
||||
`creator` char(36) NOT NULL COMMENT '创建人',
|
||||
`creator_name` varchar(255) NOT NULL COMMENT '创建人名称',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
</update>
|
||||
|
||||
<!-- 保存部门用户调整 -->
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
INSERT INTO sys_user_department_adjustment (
|
||||
INSERT INTO sys_department_user_adjustment (
|
||||
user_id,
|
||||
user_name,
|
||||
department_id,
|
||||
|
@ -1,9 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.module.department.dao.IDepartmentUserDao">
|
||||
<mapper namespace="ink.wgink.service.department.dao.IDepartmentUserDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_department_user` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`department_id` char(36) NOT NULL,
|
||||
`user_id` char(36) NOT NULL,
|
||||
`user_sort` varchar(255) DEFAULT 'ZZZ-000',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `user_id_idx` (`user_id`) USING BTREE,
|
||||
KEY `department_id_idx` (`department_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
</update>
|
||||
|
||||
<!-- 新增组织用户 -->
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
INSERT INTO sys_department_user(
|
||||
@ -64,4 +77,16 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 用户ID列表 -->
|
||||
<select id="listGroupUserId" parameterType="map" resultType="java.lang.String">
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
sys_department_user
|
||||
WHERE
|
||||
1 = 1
|
||||
GROUP BY
|
||||
user_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -15,7 +15,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;overflow: hidden; height: 100%;">
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0; height: 100%;">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
@ -101,7 +101,7 @@
|
||||
<label class="layui-form-label">负责人</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="departmentMaster" type="hidden" class="layui-input" name="departmentMaster" readonly>
|
||||
<input id="departmentMasterName" type="text" class="layui-input" name="departmentMasterName" placeholder="请选择组织负责人" readonly style="cursor: pointer;" readonly>
|
||||
<input id="departmentMasterName" type="text" class="layui-input" name="departmentMasterName" placeholder="请选择组织负责人" style="cursor: pointer;" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -265,7 +265,7 @@
|
||||
|
||||
// 初始化1级区域下拉选择
|
||||
function initDepartmentArea1CodeSelect(selectValue) {
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/0', []), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/0', []), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea1IdSelectTemplate', 'departmentArea1IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea1Id'] = selectValue;
|
||||
@ -286,7 +286,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea2IdSelectTemplate', 'departmentArea2IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea2Id'] = selectValue;
|
||||
@ -307,7 +307,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea3IdSelectTemplate', 'departmentArea3IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea3Id'] = selectValue;
|
||||
@ -328,7 +328,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea4IdSelectTemplate', 'departmentArea4IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea4Id'] = selectValue;
|
||||
@ -349,7 +349,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea5IdSelectTemplate', 'departmentArea5IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea5Id'] = selectValue;
|
||||
@ -363,7 +363,7 @@
|
||||
// 初始化
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/department/getdepartment/{departmentId}', [departmentId]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/department/get/{departmentId}', [departmentId]), {}, null, function(code, data) {
|
||||
form.val('dataForm', {
|
||||
departmentParentName: data.departmentParentName == '' ? '根节点' : data.departmentParentName,
|
||||
departmentParentId: data.departmentParentId,
|
||||
@ -404,30 +404,6 @@
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验部门是否存在
|
||||
var checkDepartmentNameTimeout;
|
||||
$(document).on('keydown', '#departmentName', function() {
|
||||
var self = this;
|
||||
if(checkDepartmentNameTimeout) {
|
||||
clearTimeout(checkDepartmentNameTimeout);
|
||||
}
|
||||
checkDepartmentNameTimeout = setTimeout(function() {
|
||||
if(!self.value) {
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/department/countdepartmentbyparentidandname/{departmentParentId}/{departmentName}', [$('#departmentParentId').val(), encodeURI(self.value)]), {
|
||||
noDepartmentId: departmentId
|
||||
}, null, function(code, data) {
|
||||
if(data.data > 0) {
|
||||
top.dialog.msg('【'+ self.value +'】在本级已经存在');
|
||||
self.value = '';
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -120,7 +120,7 @@
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/system/department/save-split.html?departmentParentId={departmentParentId}', [departmentParentId]),
|
||||
content: top.restAjax.path('route/department/save-split?departmentParentId={departmentParentId}', [departmentParentId]),
|
||||
end: function() {
|
||||
initTable();
|
||||
}
|
||||
@ -136,7 +136,7 @@
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/system/department/update-split.html?departmentId={departmentId}&departmentParentId={departmentParentId}', [departmentId, departmentParentId]),
|
||||
content: top.restAjax.path('route/department/update-split?departmentId={departmentId}&departmentParentId={departmentParentId}', [departmentId, departmentParentId]),
|
||||
end: function() {
|
||||
initTable();
|
||||
}
|
||||
@ -204,7 +204,7 @@
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var layerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/department/updatesplitdepartment/{departmentId}', [departmentId]), {
|
||||
top.restAjax.put(top.restAjax.path('api/department/updatesplit/{departmentId}', [departmentId]), {
|
||||
splitDepartments: splitDepartmentArray
|
||||
}, null, function(code, data) {
|
||||
top.dialog.msg('拆分成功');
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
// 初始化IFrame
|
||||
function initIFrame() {
|
||||
$('#listContent').attr('src', top.restAjax.path('route/system/department/list.html?parentId={parentId}', [parentId]));
|
||||
$('#listContent').attr('src', top.restAjax.path('route/department/list?parentId={parentId}', [parentId]));
|
||||
}
|
||||
// 初始化大小
|
||||
function initSize() {
|
||||
@ -68,7 +68,7 @@
|
||||
enable: true,
|
||||
autoLoad: false,
|
||||
type: 'get',
|
||||
url: top.restAjax.path('api/department/listztreedepartment', []),
|
||||
url: top.restAjax.path('api/department/listztree', []),
|
||||
autoParam: ['id'],
|
||||
otherParam: {},
|
||||
dataFilter: function (treeId, parentNode, childNodes) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -20,15 +20,17 @@
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="uploadExcel">
|
||||
<i class="fa fa-lg fa-cloud-upload"></i> 导入数据
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="restCode">
|
||||
<i class="fa fa-lg fa-recycle"></i> 重置编码
|
||||
</button>
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="uploadExcel">
|
||||
<i class="fa fa-lg fa-cloud-upload"></i> 导入数据
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="restCode">
|
||||
<i class="fa fa-lg fa-recycle"></i> 重置编码
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
@ -66,13 +68,14 @@
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var parentId = top.restAjax.params(window.location.href).parentId;
|
||||
var tableUrl = 'api/department/listpage?parentId={parentId}';
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path('api/department/listpagedepartment?parentId={parentId}', [parentId]),
|
||||
url: top.restAjax.path(tableUrl, [parentId]),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 60,
|
||||
limit: 20,
|
||||
@ -82,62 +85,64 @@
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field:'users', width:100, title: '人员列表', align:'center',
|
||||
templet: function(item) {
|
||||
return '<button type="button" class="layui-btn layui-btn-xs" lay-event="userEvent"><i class="fa fa-users"></i> 查看</button>';
|
||||
}
|
||||
},
|
||||
{field:'departmentName', width:180, title: '组织名称', align:'center',},
|
||||
{field:'departmentNameEn', width:140, title: '名称(英文)', align:'center',},
|
||||
{field:'departmentSummary', width:180, title: '组织说明', align:'center',},
|
||||
{field:'departmentCode', width:100, title: '组织编码', align:'center',},
|
||||
{field:'departmentType', width:100, title: '组织类型', align:'center',
|
||||
templet: function(item) {
|
||||
var value;
|
||||
switch (item.departmentType) {
|
||||
case 1:
|
||||
value = '机构';
|
||||
break;
|
||||
case 2:
|
||||
value = '部门';
|
||||
break;
|
||||
default:
|
||||
value = '无';
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field:'users', width:100, title: '人员列表', align:'center',
|
||||
templet: function(item) {
|
||||
return '<button type="button" class="layui-btn layui-btn-xs" lay-event="userEvent"><i class="fa fa-users"></i> 查看</button>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{field:'departmentState', width:100, title: '组织状态', align:'center',
|
||||
templet: function(item) {
|
||||
var value;
|
||||
switch (item.departmentState) {
|
||||
case 1:
|
||||
value = '<span class="layui-badge layui-bg-green">正常</span>';
|
||||
break;
|
||||
case 2:
|
||||
value = '<span class="layui-badge layui-bg-black">异常</span>';
|
||||
break;
|
||||
case 3:
|
||||
value = '<span class="layui-badge">停用</span>';
|
||||
break;
|
||||
default:
|
||||
value = '错误'
|
||||
},
|
||||
{field:'departmentName', width:180, title: '组织名称', align:'center',},
|
||||
{field:'departmentNameEn', width:140, title: '名称(英文)', align:'center',},
|
||||
{field:'departmentSummary', width:180, title: '组织说明', align:'center',},
|
||||
{field:'departmentCode', width:100, title: '组织编码', align:'center',},
|
||||
{field:'departmentType', width:100, title: '组织类型', align:'center',
|
||||
templet: function(item) {
|
||||
var value;
|
||||
switch (item.departmentType) {
|
||||
case 1:
|
||||
value = '机构';
|
||||
break;
|
||||
case 2:
|
||||
value = '部门';
|
||||
break;
|
||||
default:
|
||||
value = '无';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{field:'departmentState', width:100, title: '组织状态', align:'center',
|
||||
templet: function(item) {
|
||||
var value;
|
||||
switch (item.departmentState) {
|
||||
case 1:
|
||||
value = '<span class="layui-badge layui-bg-green">正常</span>';
|
||||
break;
|
||||
case 2:
|
||||
value = '<span class="layui-badge layui-bg-black">异常</span>';
|
||||
break;
|
||||
case 3:
|
||||
value = '<span class="layui-badge">停用</span>';
|
||||
break;
|
||||
default:
|
||||
value = '错误'
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{field:'operation', width:100, title: '操作', fixed: 'right', align:'center',
|
||||
templet: function(item) {
|
||||
return '<div class="layui-btn-group">' +
|
||||
'<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event="splitEvent">拆分</button>' +
|
||||
'<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="getEvent">查看</button>' +
|
||||
'</div>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{field:'operation', width:120, title: '操作', fixed: 'right', align:'center',
|
||||
templet: function(item) {
|
||||
return '<div class="layui-btn-group">' +
|
||||
'<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event="splitEvent">拆分</button>' +
|
||||
'<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="getEvent">查看</button>' +
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
]],
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
@ -152,7 +157,7 @@
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path('api/department/listpagedepartment?parentId={parentId}', [parentId]),
|
||||
url: top.restAjax.path(tableUrl, [parentId]),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
},
|
||||
@ -177,10 +182,9 @@
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/department/removedepartment/{ids}', [ids]), {}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000}, function () {
|
||||
refreshTable();
|
||||
});
|
||||
top.restAjax.delete(top.restAjax.path('api/department/remove/{ids}', [ids]), {}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
|
||||
refreshTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
@ -204,7 +208,7 @@
|
||||
});
|
||||
$(document).on('click', '#uploadExcel', function() {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/department/upload/save-upload-excel.html', []),
|
||||
url: top.restAjax.path('route/department/upload/upload-excel', []),
|
||||
title: '导入部门数据',
|
||||
width: '300px',
|
||||
height: '196px',
|
||||
@ -221,10 +225,9 @@
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/department/updateresetdepartmentcode', []), {}, null, function (code, data) {
|
||||
top.dialog.msg('重置成功', {time: 1000}, function () {
|
||||
refreshTable();
|
||||
});
|
||||
top.restAjax.put(top.restAjax.path('api/department/resetcode', []), {}, null, function (code, data) {
|
||||
top.dialog.msg('重置成功', {time: 1000});
|
||||
refreshTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
@ -248,9 +251,9 @@
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/system/department/save.html?departmentParentId={parentId}', [parentId]),
|
||||
content: top.restAjax.path('route/department/save?departmentParentId={parentId}', [parentId]),
|
||||
end: function() {
|
||||
refreshTable();
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'update') {
|
||||
@ -266,9 +269,9 @@
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/system/department/update.html?departmentId={departmentId}', [checkDatas[0].departmentId]),
|
||||
content: top.restAjax.path('route/department/update?departmentId={departmentId}', [checkDatas[0].departmentId]),
|
||||
end: function() {
|
||||
refreshTable();
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -298,7 +301,7 @@
|
||||
}
|
||||
top.dialog.dialogData.mergeDepartmentIds = departmentIds;
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/department/get-merge.html', []),
|
||||
url: top.restAjax.path('route/department/get-merge', []),
|
||||
title: '合并选项',
|
||||
width: '300px',
|
||||
height: '180px',
|
||||
@ -309,7 +312,7 @@
|
||||
var mergeType = top.dialog.dialogData.mergeType;
|
||||
if(mergeType === 'newDepartment') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/department/save-merge.html?departmentParentId={parentId}', [parentId]),
|
||||
url: top.restAjax.path('route/department/save-merge?departmentParentId={parentId}', [parentId]),
|
||||
title: '新建组织',
|
||||
width: '800px',
|
||||
height: '500px',
|
||||
@ -320,7 +323,7 @@
|
||||
} else if(mergeType === 'selectDepartment') {
|
||||
top.dialog.tree({
|
||||
title: '选择树',
|
||||
apiUri: top.restAjax.path('api/department/listztreedepartment', []),
|
||||
apiUri: top.restAjax.path('api/department/listztree', []),
|
||||
width: '200px',
|
||||
height: '400px',
|
||||
onClose: function() {
|
||||
@ -336,7 +339,7 @@
|
||||
top.dialog.confirm('确定合并到该组织吗?操作不可撤销!', function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/department/updatemergedepartment/{departmentId}', [selectNodes[0].id]), {
|
||||
top.restAjax.put(top.restAjax.path('api/department/updatemerge/{departmentId}', [selectNodes[0].id]), {
|
||||
mergeDepartmentIds: top.dialog.dialogData.mergeDepartmentIds
|
||||
}, null, function(code, data) {
|
||||
top.dialog.msg('合并成功');
|
||||
@ -363,7 +366,7 @@
|
||||
var layEvent = obj.event;
|
||||
if(layEvent === 'userEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/user/list-department-user.html?departmentId={departmentId}', [data.departmentId]),
|
||||
url: top.restAjax.path('route/department/user/list?departmentId={departmentId}', [data.departmentId]),
|
||||
title: '组织用户列表',
|
||||
width: '800px',
|
||||
height: '500px',
|
||||
@ -371,7 +374,7 @@
|
||||
});
|
||||
} else if(layEvent === 'splitEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/department/list-split.html?departmentId={departmentId}&departmentParentId={departmentParentId}', [data.departmentId, data.departmentParentId]),
|
||||
url: top.restAjax.path('route/department/list-split?departmentId={departmentId}&departmentParentId={departmentParentId}', [data.departmentId, data.departmentParentId]),
|
||||
title: '拆分组织',
|
||||
width: '800px',
|
||||
height: '500px',
|
||||
@ -387,7 +390,7 @@
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/system/department/get.html?departmentId={departmentId}', [data.departmentId]),
|
||||
content: top.restAjax.path('route/department/get?departmentId={departmentId}', [data.departmentId]),
|
||||
end: function() {}
|
||||
});
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -251,7 +251,7 @@
|
||||
|
||||
// 初始化1级区域下拉选择
|
||||
function initDepartmentArea1CodeSelect() {
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/0', []), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/0', []), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea1IdSelectTemplate', 'departmentArea1IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -264,7 +264,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea2IdSelectTemplate', 'departmentArea2IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea2IdSelectTemplate', 'departmentArea2IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -277,7 +277,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea3IdSelectTemplate', 'departmentArea3IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea3IdSelectTemplate', 'departmentArea3IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -290,7 +290,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea4IdSelectTemplate', 'departmentArea4IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea4IdSelectTemplate', 'departmentArea4IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -303,7 +303,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea5IdSelectTemplate', 'departmentArea5IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea5IdSelectTemplate', 'departmentArea5IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -350,7 +350,7 @@
|
||||
var loadLayerIndex;
|
||||
formData.field.departmentParentId = departmentParentId;
|
||||
formData.field.mergeDepartmentIds = top.dialog.dialogData.mergeDepartmentIds;
|
||||
top.restAjax.put(top.restAjax.path('api/department/updatemergenewdepartment', []), formData.field, null, function(code, data) {
|
||||
top.restAjax.put(top.restAjax.path('api/department/updatemergenew', []), formData.field, null, function(code, data) {
|
||||
top.dialog.msg('合并成功');
|
||||
closeBox();
|
||||
}, function(code, data) {
|
||||
@ -401,7 +401,7 @@
|
||||
if(!self.value) {
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/department/countdepartmentbyparentidandname/{departmentParentId}/{departmentName}', [departmentParentId, encodeURI(self.value)]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/department/countbyparentidandname/{departmentParentId}/{departmentName}', [departmentParentId, encodeURI(self.value)]), {}, null, function(code, data) {
|
||||
if(data.data > 0) {
|
||||
top.dialog.msg('【'+ self.value +'】在本级已经存在');
|
||||
self.value = '';
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -257,7 +257,7 @@
|
||||
|
||||
// 初始化1级区域下拉选择
|
||||
function initDepartmentArea1CodeSelect() {
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/0', []), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/0', []), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea1IdSelectTemplate', 'departmentArea1IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -270,7 +270,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea2IdSelectTemplate', 'departmentArea2IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea2IdSelectTemplate', 'departmentArea2IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -283,7 +283,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea3IdSelectTemplate', 'departmentArea3IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea3IdSelectTemplate', 'departmentArea3IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -296,7 +296,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea4IdSelectTemplate', 'departmentArea4IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea4IdSelectTemplate', 'departmentArea4IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -309,7 +309,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea5IdSelectTemplate', 'departmentArea5IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea5IdSelectTemplate', 'departmentArea5IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -398,7 +398,7 @@
|
||||
if(!self.value) {
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/department/countdepartmentbyparentidandname/{departmentParentId}/{departmentName}', [departmentParentId, encodeURI(self.value)]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/department/countbyparentidandname/{departmentParentId}/{departmentName}', [departmentParentId, encodeURI(self.value)]), {}, null, function(code, data) {
|
||||
if(data.data > 0) {
|
||||
top.dialog.msg('【'+ self.value +'】在本级已经存在');
|
||||
self.value = '';
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -15,7 +15,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;overflow: hidden; height: 100%;">
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0; height: 100%;">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
@ -171,7 +171,6 @@
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-col-xs12">
|
||||
@ -227,7 +226,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
@ -239,6 +237,7 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<input id="hasArea" th:if="${hasArea}">
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
@ -268,7 +267,7 @@
|
||||
|
||||
// 初始化1级区域下拉选择
|
||||
function initDepartmentArea1CodeSelect() {
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/0', []), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/0', []), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea1IdSelectTemplate', 'departmentArea1IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -281,7 +280,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea2IdSelectTemplate', 'departmentArea2IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea2IdSelectTemplate', 'departmentArea2IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -294,7 +293,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea3IdSelectTemplate', 'departmentArea3IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea3IdSelectTemplate', 'departmentArea3IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -307,7 +306,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea4IdSelectTemplate', 'departmentArea4IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea4IdSelectTemplate', 'departmentArea4IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -320,7 +319,7 @@
|
||||
initSelectRadioCheckboxTemplate('departmentArea5IdSelectTemplate', 'departmentArea5IdSelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea5IdSelectTemplate', 'departmentArea5IdSelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
@ -340,7 +339,7 @@
|
||||
return;
|
||||
}
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/department/getdepartment/{departmentParentId}', [departmentParentId]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/department/get/{departmentParentId}', [departmentParentId]), {}, null, function(code, data) {
|
||||
form.val('dataForm', {
|
||||
departmentParentName: data.departmentName
|
||||
});
|
||||
@ -359,6 +358,7 @@
|
||||
initDepartmentArea3CodeSelect();
|
||||
initDepartmentArea4CodeSelect();
|
||||
initDepartmentArea5CodeSelect();
|
||||
|
||||
// 选择负责人
|
||||
$(document).on('click', '#departmentMasterName', function() {
|
||||
top.dialog.dialogData.selectedUserIds = $('#departmentMaster').val();
|
||||
@ -389,7 +389,8 @@
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/department/savedepartment', []), formData.field, null, function(code, data) {
|
||||
top.restAjax.post(top.restAjax.path('api/department/save', []), formData.field, null, function(code, data) {
|
||||
parent.parent.common.refreshTree('leftTree');
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
@ -450,7 +451,7 @@
|
||||
if(!self.value) {
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/department/countdepartmentbyparentidandname/{departmentParentId}/{departmentName}', [departmentParentId, encodeURI(self.value)]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/department/countbyparentidandname/{departmentParentId}/{departmentName}', [departmentParentId, encodeURI(self.value)]), {}, null, function(code, data) {
|
||||
if(data.data > 0) {
|
||||
top.dialog.msg('【'+ self.value +'】在本级已经存在');
|
||||
self.value = '';
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -259,7 +259,7 @@
|
||||
|
||||
// 初始化1级区域下拉选择
|
||||
function initDepartmentArea1CodeSelect(selectValue) {
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/0', []), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/0', []), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea1IdSelectTemplate', 'departmentArea1IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea1Id'] = selectValue;
|
||||
@ -280,7 +280,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea2IdSelectTemplate', 'departmentArea2IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea2Id'] = selectValue;
|
||||
@ -301,7 +301,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea3IdSelectTemplate', 'departmentArea3IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea3Id'] = selectValue;
|
||||
@ -322,7 +322,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea4IdSelectTemplate', 'departmentArea4IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea4Id'] = selectValue;
|
||||
@ -343,7 +343,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea5IdSelectTemplate', 'departmentArea5IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea5Id'] = selectValue;
|
||||
@ -471,7 +471,7 @@
|
||||
if(!self.value) {
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/department/countdepartmentbyparentidandname/{departmentParentId}/{departmentName}', [departmentParentId, encodeURI(self.value)]), {
|
||||
top.restAjax.get(top.restAjax.path('api/department/countbyparentidandname/{departmentParentId}/{departmentName}', [departmentParentId, encodeURI(self.value)]), {
|
||||
noDepartmentId: departmentId
|
||||
}, null, function(code, data) {
|
||||
if(data.data > 0) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -15,7 +15,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;overflow: hidden; height: 100%;">
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0; height: 100%;">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
@ -217,7 +217,7 @@
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-col-xs12">
|
||||
<div th:class="${hasArea ? 'layui-col-md6 layui-col-sm6 layui-col-xs12' : 'layui-col-md12 layui-col-sm12 layui-col-xs12'}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">组织地址</label>
|
||||
<div class="layui-input-block">
|
||||
@ -266,7 +266,7 @@
|
||||
|
||||
// 初始化1级区域下拉选择
|
||||
function initDepartmentArea1CodeSelect(selectValue) {
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/0', []), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/0', []), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea1IdSelectTemplate', 'departmentArea1IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea1Id'] = selectValue;
|
||||
@ -287,7 +287,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area1}', [area1]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea2IdSelectTemplate', 'departmentArea2IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea2Id'] = selectValue;
|
||||
@ -308,7 +308,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area2}', [area2]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea3IdSelectTemplate', 'departmentArea3IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea3Id'] = selectValue;
|
||||
@ -329,7 +329,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area3}', [area3]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea4IdSelectTemplate', 'departmentArea4IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea4Id'] = selectValue;
|
||||
@ -350,7 +350,7 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/dataarea/listareabyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
top.restAjax.get(top.restAjax.path('api/area/listbyparentid/{area4}', [area4]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('departmentArea5IdSelectTemplate', 'departmentArea5IdSelectTemplateBox', data, function() {
|
||||
var selectObj = {};
|
||||
selectObj['departmentArea5Id'] = selectValue;
|
||||
@ -364,7 +364,7 @@
|
||||
// 初始化
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/department/getdepartment/{departmentId}', [departmentId]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/department/get/{departmentId}', [departmentId]), {}, null, function(code, data) {
|
||||
form.val('dataForm', {
|
||||
departmentParentName: data.departmentParentName == '' ? '根节点' : data.departmentParentName,
|
||||
departmentParentId: data.departmentParentId,
|
||||
@ -386,14 +386,13 @@
|
||||
departmentAddress: data.departmentAddress,
|
||||
});
|
||||
form.render(null, 'dataForm');
|
||||
|
||||
initDepartmentArea1CodeSelect(data['departmentArea1Id']);
|
||||
initDepartmentArea2CodeSelect(data['departmentArea1Id'], data['departmentArea2Id']);
|
||||
initDepartmentArea3CodeSelect(data['departmentArea2Id'], data['departmentArea3Id']);
|
||||
initDepartmentArea4CodeSelect(data['departmentArea3Id'], data['departmentArea4Id']);
|
||||
initDepartmentArea5CodeSelect(data['departmentArea4Id'], data['departmentArea5Id']);
|
||||
}, function(code, data) {
|
||||
top.DialogBox.msg(data.msg);
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
@ -405,7 +404,7 @@
|
||||
$(document).on('click', '#departmentMasterName', function() {
|
||||
top.dialog.dialogData.selectedUserIds = $('#departmentMaster').val();
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/user/select-department-user.html', []),
|
||||
url: top.restAjax.path('route/user/select-department-user.html', []),
|
||||
title: '选择组织部门人员',
|
||||
width: '500px',
|
||||
height: '500px',
|
||||
@ -430,7 +429,8 @@
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/department/updatedepartment/{departmentId}', [departmentId]), formData.field, null, function(code, data) {
|
||||
top.restAjax.put(top.restAjax.path('api/department/update/{departmentId}', [departmentId]), formData.field, null, function(code, data) {
|
||||
parent.parent.common.refreshTree('leftTree');
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
@ -491,7 +491,7 @@
|
||||
if(!self.value) {
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/department/countdepartmentbyparentidandname/{departmentParentId}/{departmentName}', [$('#departmentParentId').val(), encodeURI(self.value)]), {
|
||||
top.restAjax.get(top.restAjax.path('api/department/countbyparentidandname/{departmentParentId}/{departmentName}', [$('#departmentParentId').val(), encodeURI(self.value)]), {
|
||||
noDepartmentId: departmentId
|
||||
}, null, function(code, data) {
|
||||
if(data.data > 0) {
|
||||
|
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -15,7 +15,7 @@
|
||||
<div class="layui-card" style="text-align: center;">
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<blockquote class="layui-elem-quote">下载“下载模板”整理数据,点击“导入数据”上传,格式为xls或xlsx</blockquote>
|
||||
<button type="button" class="layui-btn layui-btn" onclick="window.open('assets/template/departmentexcel-template.xls')">
|
||||
<button id="downloadFile" type="button" class="layui-btn layui-btn">
|
||||
<i class="fa fa-lg fa-cloud-download"></i> 下载模板
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn" id="uploadExcel">
|
||||
@ -30,9 +30,18 @@
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'upload'], function(){
|
||||
}).use(['index', 'upload', 'common'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var common = layui.common;
|
||||
|
||||
$('#downloadFile').click(function() {
|
||||
common.download('route/department/upload/upload-excel-template')
|
||||
})
|
||||
|
||||
$(document).on('click', '.error-excel', function() {
|
||||
common.download('route/file/download/false/'+ this.dataset.errorId);
|
||||
})
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
@ -44,7 +53,7 @@
|
||||
var uploadLoading;
|
||||
layui.upload.render({
|
||||
elem: '#uploadExcel',
|
||||
url: 'api/department/saveuploadexcel',
|
||||
url: 'api/department/importexcel',
|
||||
accept: 'file',
|
||||
exts: 'xls|xlsx',
|
||||
field: 'excel',
|
||||
@ -62,7 +71,7 @@
|
||||
skin: '',
|
||||
content: '<div style="padding: 15px;">' +
|
||||
'<div>失败数量:'+ data.failedCount +'</div><br/>' +
|
||||
'<div><a href="javascript:void(0);" onclick="window.open(\'route/file/downloadfile/false/'+ data.errorExcel +'\');">点击下载错误信息</a></div>' +
|
||||
'<div><a class="error-excel" href="javascript:void(0);" data-error-id="'+ data.errorExcel +'");">点击下载错误信息</a></div>' +
|
||||
'</div>'
|
||||
});
|
||||
} else {
|
||||
|
@ -0,0 +1,274 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-plus"></i> 新增
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||
<i class="fa fa-lg fa-trash"></i> 删除
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input id="selectedUserIds" type="hidden"/>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var common = layui.common;
|
||||
var departmentId = top.restAjax.params(window.location.href).departmentId;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/department/user/listpage/{departmentId}';
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, [departmentId]),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 60,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
toolbar: '#headerToolBar',
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field:'userUsername', width:140, title: '用户名', align:'center'},
|
||||
{field:'userName', width:140, title: '昵称', align:'center'},
|
||||
{field:'userPhone', width:140, title: '手机', align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.userPhone) {
|
||||
return '-';
|
||||
}
|
||||
return item.userPhone;
|
||||
}
|
||||
},
|
||||
{field:'userEmail', width: 160, title: '邮箱', align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.userEmail) {
|
||||
return '-';
|
||||
}
|
||||
return item.userEmail;
|
||||
}
|
||||
},
|
||||
{field:'userState', width:80, title: '状态', align:'center',
|
||||
templet: function(item) {
|
||||
var value;
|
||||
switch (item.userState) {
|
||||
case 1:
|
||||
value = '冻结';
|
||||
break;
|
||||
case 2:
|
||||
value = '锁定';
|
||||
break;
|
||||
default:
|
||||
value = '正常';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{field:'departmentName', width:200, title: '机构', align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.departmentName) {
|
||||
return '-';
|
||||
}
|
||||
return item.departmentName;
|
||||
}
|
||||
},
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, [departmentId]),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 60,
|
||||
});
|
||||
}
|
||||
// 删除
|
||||
function removeData(ids) {
|
||||
top.dialog.msg(top.dataMessage.delete, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/department/user/remove/{departmentId}/{ids}', [departmentId, ids]), {}, null, function(code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess);
|
||||
var deleteUserIds = ids.split('_');
|
||||
var selectedUserIds = $('#selectedUserIds').val().split('_');
|
||||
var tempIds = common.resultIdsOfDeleteIds(deleteUserIds, selectedUserIds);
|
||||
$('#selectedUserIds').val(tempIds);
|
||||
reloadTable();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 初始化角色用户ID列表
|
||||
function initSelectUserIds() {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/department/user/listuseridbydepartmentid/{departmentId}', [departmentId]), {}, null, function(code, data) {
|
||||
var selectedUserIds = '';
|
||||
for(var i = 0, item; item = data[i++]; ) {
|
||||
if('' != selectedUserIds) {
|
||||
selectedUserIds += '_';
|
||||
}
|
||||
selectedUserIds += item.userId;
|
||||
}
|
||||
$('#selectedUserIds').val(selectedUserIds);
|
||||
initTable();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
layIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
initSelectUserIds();
|
||||
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
// 事件 - 增删
|
||||
table.on('toolbar(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var checkStatus = table.checkStatus('dataTable');
|
||||
var checkDatas = checkStatus.data;
|
||||
if(layEvent === 'saveEvent') {
|
||||
top.dialog.dialogData.selectedUserIds = $('#selectedUserIds').val();
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/department/user/select-user', []),
|
||||
title: '选择组织部门人员',
|
||||
width: '500px',
|
||||
height: '500px',
|
||||
onClose: function() {
|
||||
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
|
||||
if(selectedUsers != null && selectedUsers.length > 0) {
|
||||
var selectedUserIds = [];
|
||||
for (var i = 0, item; item = selectedUsers[i++];) {
|
||||
selectedUserIds.push(item.userId);
|
||||
}
|
||||
top.dialog.msg(top.dataMessage.update, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/department/user/update/{departmentId}', [departmentId]), {
|
||||
ids: selectedUserIds
|
||||
}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.updated);
|
||||
$('#selectedUserIds').val(selectedUserIds);
|
||||
reloadTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.updating, {
|
||||
icon: 16,
|
||||
time: 0,
|
||||
shade: 0.3
|
||||
});
|
||||
}, function () {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if(layEvent === 'removeEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectDelete);
|
||||
} else {
|
||||
var ids = '';
|
||||
for(var i = 0, item; item = checkDatas[i++];) {
|
||||
if(i > 1) {
|
||||
ids += '_';
|
||||
}
|
||||
ids += item.userId;
|
||||
}
|
||||
removeData(ids);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,344 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/zTree3/css/metroStyle/metroStyle.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<style>
|
||||
.user-search {width: 188px !important; display: inline;}
|
||||
.user-selected {border-left: 2px solid #009688 !important;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="padding: 0px;">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-xs12">
|
||||
<div id="selectUsers" class="layui-btn-container selector-title-wrapper"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-xs5">
|
||||
<div class="selector-tree-wrapper">
|
||||
<ul id="leftTree" class="ztree"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs7">
|
||||
<div class="selector-body-wrapper">
|
||||
<div class="selector-body-search">
|
||||
<input type="text" id="searchUser" class="layui-input user-search" placeholder="快捷检索当前列表"/>
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-click-select-all-user>全选</button>
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-click-clear-all-user>清空</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="users" class="selector-body-content list-group">
|
||||
<div id="userWrapper"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn confirm">确认</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'flow', 'ztree', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var common = layui.common;
|
||||
var flow = layui.flow;
|
||||
var selectedUserIds = top.dialog.dialogData.selectedUserIds;
|
||||
var selectDepartmentUserOldArray = [];
|
||||
var selectDepartmentUserArray = [];
|
||||
var selectedParentId = 0;
|
||||
var searchTimeout;
|
||||
top.dialog.dialogData.selectedDepartmentUsers = [];
|
||||
|
||||
function closeBox() {
|
||||
top.dialog.closeBox();
|
||||
}
|
||||
function initFrame() {
|
||||
var height = $win.height() - 160;
|
||||
$('.selector-tree-wrapper').css({
|
||||
height: height +'px',
|
||||
border: '1px dotted silver'
|
||||
});
|
||||
$('.selector-body-wrapper').css({
|
||||
height: (height - 10) +'px',
|
||||
border: '1px dotted silver'
|
||||
});
|
||||
$('.selector-body-content').css({
|
||||
height: ($('.selector-body-wrapper').height() - 30) +'px'
|
||||
});
|
||||
}
|
||||
// 初始化树
|
||||
function initThree() {
|
||||
var setting = {
|
||||
async: {
|
||||
enable: true,
|
||||
autoLoad: false,
|
||||
type: 'get',
|
||||
url: top.restAjax.path('api/department/listztree', []),
|
||||
autoParam:['id'],
|
||||
otherParam:{},
|
||||
dataFilter: function(treeId, parentNode, childNodes) {
|
||||
if (!childNodes) return null;
|
||||
for (var i=0, l=childNodes.length; i<l; i++) {
|
||||
childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
|
||||
}
|
||||
return childNodes;
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: function(event, treeId, treeNode) {
|
||||
if(treeNode.id == 0) {
|
||||
return;
|
||||
} else if(treeNode.id == 1) {
|
||||
parentId = 0;
|
||||
} else {
|
||||
parentId = treeNode.id;
|
||||
}
|
||||
$('#searchUser').val('');
|
||||
initUsers(parentId);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
view: {
|
||||
fontCss: {'color': 'black'}
|
||||
}
|
||||
};
|
||||
var zTree = $.fn.zTree.init($('#leftTree'), setting);
|
||||
zTree.addNodes(null, {id: '1', pId: '-1', name: '自由用户', url: 'javascript:void(0);', isParent: 'false'});
|
||||
zTree.addNodes(null, {id: '0', pId: '-1', name: '组织部门', url: 'javascript:void(0);', isParent: 'true'});
|
||||
common.refreshTree('leftTree');
|
||||
}
|
||||
// 添加人员dom
|
||||
function addUserDom(data) {
|
||||
var userDom = '';
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
var avatarDom;
|
||||
if(null == item.userAvatar || '' == item.userAvatar) {
|
||||
avatarDom = '<img class="user-avatar" src="assets/images/profile-photo.jpg"/> '
|
||||
} else {
|
||||
avatarDom = '<img class="user-avatar" src="route/file/downloadfile/false/'+ item.userAvatar +'"/> ';
|
||||
}
|
||||
userDom += '<a id="user_'+ item.userId +'" href="javascript:void(0);" class="users list-group-item '+ (isUserSelected(item.userId) ? 'user-selected' : '') +'" lay-click-user data-userid="'+ item.userId +'" data-username="'+ item.userName +'">'+ avatarDom + item.userName +' ['+ item.userUsername +']</a>';
|
||||
}
|
||||
$('#userWrapper').append(userDom);
|
||||
}
|
||||
function addSearchUserDom(data) {
|
||||
if(data.length < 1) {
|
||||
return;
|
||||
}
|
||||
var users = $('.users');
|
||||
for(var i = 0; i < data.length; i++) {
|
||||
var user = data[i];
|
||||
for(var j = 0, userItem; userItem = users[j++];) {
|
||||
if(user.userId === userItem.dataset.userid) {
|
||||
data.splice(i, 1);
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var userDom = '';
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
var avatarDom;
|
||||
if(null == item.userAvatar || '' == item.userAvatar) {
|
||||
avatarDom = '<img class="user-avatar" src="assets/images/profile-photo.jpg"/> '
|
||||
} else {
|
||||
avatarDom = '<img class="user-avatar" src="route/file/downloadfile/false/'+ item.userAvatar +'"/> ';
|
||||
}
|
||||
userDom += '<a id="user_'+ item.userId +'" href="javascript:void(0);" class="users search-users list-group-item '+ (isUserSelected(item.userId) ? 'user-selected' : '') +'" lay-click-user data-userid="'+ item.userId +'" data-username="'+ item.userName +'">'+ avatarDom + item.userName +' ['+ item.userUsername +']</a>';
|
||||
}
|
||||
$('#userWrapper').append(userDom);
|
||||
}
|
||||
// 初始化懒加载
|
||||
function initUserFlowLoad() {
|
||||
flow.load({
|
||||
elem: '#users',
|
||||
scrollElem: '#users',
|
||||
isAuto: false,
|
||||
done: function(page, next) {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/department/user/listpage/{department}', [selectedParentId]), {
|
||||
page: page,
|
||||
rows: 20
|
||||
}, null, function(code, data) {
|
||||
next(addUserDom(data.rows), page < (parseInt(data.total / 20) + 1));
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function listSearchUser(searchUser) {
|
||||
if(!searchUser) {
|
||||
return;
|
||||
}
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/department/user/listpage/{department}', [selectedParentId]), {
|
||||
keywords: searchUser
|
||||
}, null, function(code, data) {
|
||||
addSearchUserDom(data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
// 初始化人员列表
|
||||
function initUsers(parentId) {
|
||||
selectedParentId = parentId;
|
||||
$('#userWrapper').empty();
|
||||
$('.layui-flow-more').remove();
|
||||
initUserFlowLoad();
|
||||
}
|
||||
// 初始化选择的人员
|
||||
function initSelectedUsers(callback) {
|
||||
if(!selectedUserIds) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/user/listbyids', []), {
|
||||
ids: selectedUserIds.split('\_')
|
||||
}, null, function(code, data) {
|
||||
for(var i = 0, item; item = data[i++]; ) {
|
||||
selectUser(item.userId, item.userName);
|
||||
selectDepartmentUserOldArray.push({
|
||||
userId: item.userId,
|
||||
userName: item.userName
|
||||
});
|
||||
}
|
||||
callback();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initFrame();
|
||||
initThree();
|
||||
initSelectedUsers(function() {
|
||||
initUsers(0);
|
||||
});
|
||||
$('#searchUser').on('keyup', function() {
|
||||
var value = $(this).val();
|
||||
if(value) {
|
||||
$('.layui-flow-more').hide();
|
||||
} else {
|
||||
$('.layui-flow-more').show();
|
||||
}
|
||||
$('.users').hide().filter(":contains('" + value + "')").show();
|
||||
$('.search-users').remove();
|
||||
if(searchTimeout) {
|
||||
clearTimeout(searchTimeout);
|
||||
}
|
||||
searchTimeout = setTimeout(function() {
|
||||
listSearchUser(value);
|
||||
}, 1000);
|
||||
});
|
||||
// 人员是否已经选择
|
||||
function isUserSelected(userId) {
|
||||
var isSelected = false;
|
||||
for(var i = 0, item; item = selectDepartmentUserArray[i]; i++) {
|
||||
if(item.userId == userId) {
|
||||
isSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isSelected;
|
||||
}
|
||||
// 删除已经选择的人员
|
||||
function removeSelectedUser(userId) {
|
||||
for(var i = 0, item; item = selectDepartmentUserArray[i]; i++) {
|
||||
if(item.userId == userId) {
|
||||
selectDepartmentUserArray.splice(i, 1);
|
||||
var selectedUserDom = $('#selected_user_'+ userId);
|
||||
selectedUserDom.focus();
|
||||
selectedUserDom.remove();
|
||||
$('#user_'+ userId).removeClass('user-selected');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 选择人员
|
||||
function selectUser(userId, userName, isOnlySelect) {
|
||||
if(!isUserSelected(userId)) {
|
||||
$('#user_'+ userId).addClass('user-selected');
|
||||
selectDepartmentUserArray.push({
|
||||
userId: userId,
|
||||
userName: userName
|
||||
});
|
||||
$('#selectUsers').append('<a id="selected_user_'+ userId +'" href="javascript:void(0);" class="layui-btn layui-btn-xs">'+ userName +' <i class="fa fa-close" lay-click-removeuser data-userid="'+ userId +'"></i></a>');
|
||||
$('#selected_user_'+ userId).focus();
|
||||
} else {
|
||||
if(!isOnlySelect) {
|
||||
removeSelectedUser(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
$(document.body).on('click', '*[lay-click-user]', null, function() {
|
||||
var data = this.dataset;
|
||||
selectUser(data.userid, data.username);
|
||||
});
|
||||
$(document.body).on('click', '*[lay-click-removeuser]', null, function() {
|
||||
var data = this.dataset;
|
||||
removeSelectedUser(data.userid);
|
||||
});
|
||||
$(document.body).on('click', '*[lay-click-select-all-user]', null, function() {
|
||||
$('#userWrapper').children().each(function() {
|
||||
var data = this.dataset;
|
||||
selectUser(data.userid, data.username, true);
|
||||
});
|
||||
});
|
||||
$(document.body).on('click', '*[lay-click-clear-all-user]', null, function() {
|
||||
$('#userWrapper').children().each(function() {
|
||||
var data = this.dataset;
|
||||
removeSelectedUser(data.userid);
|
||||
});
|
||||
});
|
||||
$('.close').on('click', function() {
|
||||
// 关闭按钮返回之前的数据
|
||||
top.dialog.dialogData.selectedDepartmentUsers = selectDepartmentUserOldArray;
|
||||
top.dialog.dialogData.selectedUserIds = null;
|
||||
closeBox();
|
||||
});
|
||||
$('.confirm').on('click', function() {
|
||||
top.dialog.dialogData.selectedDepartmentUsers = selectDepartmentUserArray;
|
||||
top.dialog.dialogData.selectedUserIds = null;
|
||||
closeBox();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,5 +1,6 @@
|
||||
package ink.wgink.module.menu.startup;
|
||||
|
||||
import ink.wgink.interfaces.department.IDepartmentCheckService;
|
||||
import ink.wgink.interfaces.dictionary.IDictionaryCheckService;
|
||||
import ink.wgink.interfaces.menu.IMenuBaseService;
|
||||
import ink.wgink.interfaces.user.IUserCheckService;
|
||||
@ -33,9 +34,11 @@ public class ServiceMenuStartUp implements ApplicationRunner {
|
||||
@Autowired
|
||||
private IMenuDao menuDao;
|
||||
@Autowired(required = false)
|
||||
private IDictionaryCheckService dictionaryCheckService;
|
||||
@Autowired(required = false)
|
||||
private IUserCheckService userCheckService;
|
||||
@Autowired(required = false)
|
||||
private IDictionaryCheckService dictionaryCheckService;
|
||||
private IDepartmentCheckService departmentCheckService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
@ -220,6 +223,7 @@ public class ServiceMenuStartUp implements ApplicationRunner {
|
||||
menuId = menuDTO.getMenuId();
|
||||
}
|
||||
initUserManage(params, menuId);
|
||||
initMenuDepartment(params, menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,18 +256,37 @@ public class ServiceMenuStartUp implements ApplicationRunner {
|
||||
}
|
||||
}
|
||||
|
||||
private void initMenuDepartment() {
|
||||
private void initMenuDepartment(Map<String, Object> params, String menuParentId) {
|
||||
LOG.debug("初始化菜单:组织机构管理");
|
||||
if (departmentCheckService == null) {
|
||||
return;
|
||||
}
|
||||
params.remove("menuId");
|
||||
params.put("menuCode", "000100020002");
|
||||
MenuDTO menuDTO = menuDao.getSimple(params);
|
||||
String menuId = UUIDUtil.getUUID();
|
||||
if (menuDTO == null) {
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "机构管理");
|
||||
params.put("menuSummary", "机构管理");
|
||||
params.put("menuUrl", "/route/department/list-tree");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-bank");
|
||||
params.put("menuOrder", "2");
|
||||
params.put("menuStatus", "0");
|
||||
params.put("openType", "1");
|
||||
menuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
private void initMenuGroup() {
|
||||
LOG.debug("初始化菜单:用户组管理");
|
||||
LOG.debug("初始化菜单:职位管理");
|
||||
LOG.debug("初始化菜单:权限管理");
|
||||
LOG.debug("初始化菜单:角色管理");
|
||||
}
|
||||
|
||||
private void initMenuGroup() {
|
||||
|
||||
}
|
||||
|
||||
private void initMenuPosition() {
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.module.menu.dao.IMenuDao">
|
||||
<cache/>
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<resultMap id="menuDTO" type="ink.wgink.pojo.dtos.menu.MenuDTO">
|
||||
<id property="menuId" column="menu_id"/>
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.controller.api;
|
||||
package ink.wgink.service.role.controller.api;
|
||||
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
@ -11,10 +11,10 @@ import ink.wgink.pojo.dtos.role.RoleDataAuthorityTypeDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.module.role.pojo.vos.RoleDataAuthorityVO;
|
||||
import ink.wgink.module.role.pojo.vos.RoleUserAuthorizationVO;
|
||||
import ink.wgink.module.role.pojo.vos.RoleVO;
|
||||
import ink.wgink.module.role.service.IRoleService;
|
||||
import ink.wgink.service.role.pojo.vos.RoleDataAuthorityVO;
|
||||
import ink.wgink.service.role.pojo.vos.RoleUserAuthorizationVO;
|
||||
import ink.wgink.service.role.pojo.vos.RoleVO;
|
||||
import ink.wgink.service.role.service.IRoleService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.controller.api;
|
||||
package ink.wgink.service.role.controller.api;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
@ -1,10 +1,10 @@
|
||||
package ink.wgink.module.role.dao;
|
||||
package ink.wgink.service.role.dao;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.module.role.pojo.pos.RolePO;
|
||||
import ink.wgink.service.role.pojo.pos.RolePO;
|
||||
import ink.wgink.pojo.bos.RoleBO;
|
||||
import ink.wgink.pojo.bos.RoleMenuBO;
|
||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.dao;
|
||||
package ink.wgink.service.role.dao;
|
||||
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import org.springframework.stereotype.Repository;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.dao;
|
||||
package ink.wgink.service.role.dao;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.dao;
|
||||
package ink.wgink.service.role.dao;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.pojo.pos;
|
||||
package ink.wgink.service.role.pojo.pos;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.pojo.vos;
|
||||
package ink.wgink.service.role.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.pojo.vos;
|
||||
package ink.wgink.service.role.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckBooleanAnnotation;
|
||||
import ink.wgink.annotation.CheckListAnnotation;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.pojo.vos;
|
||||
package ink.wgink.service.role.pojo.vos;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.pojo.vos;
|
||||
package ink.wgink.service.role.pojo.vos;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.pojo.vos;
|
||||
package ink.wgink.service.role.pojo.vos;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.service;
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.service;
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
@ -1,9 +1,9 @@
|
||||
package ink.wgink.module.role.service;
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.pojo.dtos.role.RolePermissionDTO;
|
||||
import ink.wgink.module.role.pojo.vos.RolePermissionVO;
|
||||
import ink.wgink.service.role.pojo.vos.RolePermissionVO;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.service;
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
@ -16,7 +16,7 @@ import ink.wgink.pojo.dtos.role.RoleDataAuthorityDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleDataAuthorityTypeDTO;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.module.role.pojo.vos.RoleDataAuthorityVO;
|
||||
import ink.wgink.service.role.pojo.vos.RoleDataAuthorityVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.service.impl;
|
||||
package ink.wgink.service.role.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package ink.wgink.module.role.service.impl;
|
||||
package ink.wgink.service.role.service.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.module.role.service.IRoleMenuService;
|
||||
import ink.wgink.service.role.service.IRoleMenuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
@ -1,12 +1,12 @@
|
||||
package ink.wgink.module.role.service.impl;
|
||||
package ink.wgink.service.role.service.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.pojo.dtos.permission.PermissionDTO;
|
||||
import ink.wgink.pojo.dtos.role.RolePermissionDTO;
|
||||
import ink.wgink.module.permission.service.IPermissionService;
|
||||
import ink.wgink.module.role.dao.IRolePermissionDao;
|
||||
import ink.wgink.module.role.pojo.vos.RolePermissionVO;
|
||||
import ink.wgink.module.role.service.IRolePermissionService;
|
||||
import ink.wgink.service.role.dao.IRolePermissionDao;
|
||||
import ink.wgink.service.role.pojo.vos.RolePermissionVO;
|
||||
import ink.wgink.service.role.service.IRolePermissionService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.role.service.impl;
|
||||
package ink.wgink.service.role.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
@ -17,15 +17,15 @@ import ink.wgink.pojo.dtos.role.RoleDataAuthorityTypeDTO;
|
||||
import ink.wgink.pojo.dtos.role.RolePermissionDTO;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.module.department.service.IDepartmentUserService;
|
||||
import ink.wgink.service.department.service.IDepartmentUserService;
|
||||
import ink.wgink.module.permission.enums.PermissionTypeEnum;
|
||||
import ink.wgink.module.permission.service.IPermissionService;
|
||||
import ink.wgink.module.role.dao.IRoleDao;
|
||||
import ink.wgink.module.role.pojo.vos.RoleDataAuthorityVO;
|
||||
import ink.wgink.module.role.pojo.vos.RoleUserAuthorityVO;
|
||||
import ink.wgink.module.role.service.IRolePermissionService;
|
||||
import ink.wgink.module.role.service.IRoleService;
|
||||
import ink.wgink.module.user.service.IUserService;
|
||||
import ink.wgink.service.role.dao.IRoleDao;
|
||||
import ink.wgink.service.role.pojo.vos.RoleDataAuthorityVO;
|
||||
import ink.wgink.service.role.pojo.vos.RoleUserAuthorityVO;
|
||||
import ink.wgink.service.role.service.IRolePermissionService;
|
||||
import ink.wgink.service.role.service.IRoleService;
|
||||
import ink.wgink.service.user.service.IUserService;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.module.role.dao.IRolePermissionDao">
|
||||
<mapper namespace="ink.wgink.service.role.dao.IRolePermissionDao">
|
||||
|
||||
<resultMap id="rolePermissionDTO" type="ink.wgink.pojo.dtos.role.RolePermissionDTO">
|
||||
<id column="permission_id" property="permissionId"/>
|
||||
|
@ -1,19 +1,20 @@
|
||||
package ink.wgink.module.user.controller.api;
|
||||
package ink.wgink.service.user.controller.api;
|
||||
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.interfaces.consts.IFileConstant;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.module.user.pojo.vos.RestPasswordVO;
|
||||
import ink.wgink.module.user.pojo.vos.UpdateUsernameVO;
|
||||
import ink.wgink.pojo.vos.IdsVO;
|
||||
import ink.wgink.service.user.pojo.vos.RestPasswordVO;
|
||||
import ink.wgink.service.user.pojo.vos.UpdateUsernameVO;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.module.user.pojo.vos.UserVO;
|
||||
import ink.wgink.module.user.service.IUserService;
|
||||
import ink.wgink.service.user.pojo.vos.UserVO;
|
||||
import ink.wgink.service.user.service.IUserService;
|
||||
import ink.wgink.pojo.result.UploadExcelResultDTO;
|
||||
import ink.wgink.util.RegexUtil;
|
||||
import io.swagger.annotations.*;
|
||||
@ -162,4 +163,14 @@ public class UserController extends DefaultBaseController {
|
||||
return userService.get(userId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过ID列表获取用户列表", notes = "通过ID列表获取用户列表接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("listbyids")
|
||||
public List<UserDTO> listByIds(@RequestBody IdsVO idsVO) {
|
||||
if (idsVO.getIds().isEmpty()) {
|
||||
throw new ParamsException("id列表不能为空");
|
||||
}
|
||||
return userService.listByUserIds(idsVO.getIds());
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.user.controller.route;
|
||||
package ink.wgink.service.user.controller.route;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.util.ResourceUtil;
|
@ -0,0 +1,49 @@
|
||||
package ink.wgink.service.user.dao;
|
||||
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.service.user.pojo.dtos.UserLogDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IUserAdjustmentDao
|
||||
* @Description: 用户调整
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/12 3:51 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface IUserAdjustmentDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
*
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 新增用户调整
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 用户调整列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<UserLogDTO> list(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package ink.wgink.module.user.dao;
|
||||
package ink.wgink.service.user.dao;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.module.user.pojo.pos.UserPO;
|
||||
import ink.wgink.service.user.pojo.pos.UserPO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
@ -0,0 +1,27 @@
|
||||
package ink.wgink.service.user.enums;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: UserAdjustmentEnum
|
||||
* @Description: 用户调整枚举
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/5/21 11:04 下午
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public enum UserUpdateTypeEnum {
|
||||
REST_PASSWORD("restPassword"),
|
||||
PASSWORD("password"),
|
||||
USERNAME("username");
|
||||
|
||||
private String value;
|
||||
|
||||
private UserUpdateTypeEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.user.excel;
|
||||
package ink.wgink.service.user.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.user.excel;
|
||||
package ink.wgink.service.user.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.user.excel;
|
||||
package ink.wgink.service.user.excel;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
@ -0,0 +1,121 @@
|
||||
package ink.wgink.service.user.pojo.bos;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: UserAdjustmentBO
|
||||
* @Description: 用户调整业务实体类
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/5/21 11:03 下午
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public class UserAdjustmentBO {
|
||||
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String updateType;
|
||||
private String oldValue;
|
||||
private String newValue;
|
||||
private String updateReason;
|
||||
private String creator;
|
||||
private String creatorName;
|
||||
private String gmtCreate;
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName == null ? "" : userName.trim();
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUpdateType() {
|
||||
return updateType == null ? "" : updateType.trim();
|
||||
}
|
||||
|
||||
public void setUpdateType(String updateType) {
|
||||
this.updateType = updateType;
|
||||
}
|
||||
|
||||
public String getOldValue() {
|
||||
return oldValue == null ? "" : oldValue.trim();
|
||||
}
|
||||
|
||||
public void setOldValue(String oldValue) {
|
||||
this.oldValue = oldValue;
|
||||
}
|
||||
|
||||
public String getNewValue() {
|
||||
return newValue == null ? "" : newValue.trim();
|
||||
}
|
||||
|
||||
public void setNewValue(String newValue) {
|
||||
this.newValue = newValue;
|
||||
}
|
||||
|
||||
public String getUpdateReason() {
|
||||
return updateReason == null ? "" : updateReason.trim();
|
||||
}
|
||||
|
||||
public void setUpdateReason(String updateReason) {
|
||||
this.updateReason = updateReason;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator == null ? "" : creator.trim();
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName == null ? "" : creatorName.trim();
|
||||
}
|
||||
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate == null ? "" : gmtCreate.trim();
|
||||
}
|
||||
|
||||
public void setGmtCreate(String gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"userId\":")
|
||||
.append("\"").append(userId).append("\"");
|
||||
sb.append(",\"userName\":")
|
||||
.append("\"").append(userName).append("\"");
|
||||
sb.append(",\"updateType\":")
|
||||
.append("\"").append(updateType).append("\"");
|
||||
sb.append(",\"oldValue\":")
|
||||
.append("\"").append(oldValue).append("\"");
|
||||
sb.append(",\"newValue\":")
|
||||
.append("\"").append(newValue).append("\"");
|
||||
sb.append(",\"updateReason\":")
|
||||
.append("\"").append(updateReason).append("\"");
|
||||
sb.append(",\"creator\":")
|
||||
.append("\"").append(creator).append("\"");
|
||||
sb.append(",\"creatorName\":")
|
||||
.append("\"").append(creatorName).append("\"");
|
||||
sb.append(",\"gmtCreate\":")
|
||||
.append("\"").append(gmtCreate).append("\"");
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
package ink.wgink.service.user.pojo.dtos;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: UserLogDTO
|
||||
* @Description: 用户日志
|
||||
* @Author: WangGeng
|
||||
* @Date: 2020/7/21 17:17
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class UserLogDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2880126413411212743L;
|
||||
@ApiModelProperty(name = "userName", value = "修改用户")
|
||||
private String userName;
|
||||
@ApiModelProperty(name = "updateType", value = "修改类型")
|
||||
private String updateType;
|
||||
@ApiModelProperty(name = "oldValue", value = "旧值")
|
||||
private String oldValue;
|
||||
@ApiModelProperty(name = "newValue", value = "新值")
|
||||
private String newValue;
|
||||
@ApiModelProperty(name = "updateReason", value = "修改原因")
|
||||
private String updateReason;
|
||||
@ApiModelProperty(name = "creatorName", value = "创建人")
|
||||
private String creatorName;
|
||||
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
|
||||
private String gmtCreate;
|
||||
|
||||
public String getUserName() {
|
||||
return userName == null ? "" : userName.trim();
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUpdateType() {
|
||||
return updateType == null ? "" : updateType.trim();
|
||||
}
|
||||
|
||||
public void setUpdateType(String updateType) {
|
||||
this.updateType = updateType;
|
||||
}
|
||||
|
||||
public String getOldValue() {
|
||||
return oldValue == null ? "" : oldValue.trim();
|
||||
}
|
||||
|
||||
public void setOldValue(String oldValue) {
|
||||
this.oldValue = oldValue;
|
||||
}
|
||||
|
||||
public String getNewValue() {
|
||||
return newValue == null ? "" : newValue.trim();
|
||||
}
|
||||
|
||||
public void setNewValue(String newValue) {
|
||||
this.newValue = newValue;
|
||||
}
|
||||
|
||||
public String getUpdateReason() {
|
||||
return updateReason == null ? "" : updateReason.trim();
|
||||
}
|
||||
|
||||
public void setUpdateReason(String updateReason) {
|
||||
this.updateReason = updateReason;
|
||||
}
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName == null ? "" : creatorName.trim();
|
||||
}
|
||||
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate == null ? "" : gmtCreate.trim();
|
||||
}
|
||||
|
||||
public void setGmtCreate(String gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"userName\":")
|
||||
.append("\"").append(userName).append("\"");
|
||||
sb.append(",\"updateType\":")
|
||||
.append("\"").append(updateType).append("\"");
|
||||
sb.append(",\"oldValue\":")
|
||||
.append("\"").append(oldValue).append("\"");
|
||||
sb.append(",\"newValue\":")
|
||||
.append("\"").append(newValue).append("\"");
|
||||
sb.append(",\"updateReason\":")
|
||||
.append("\"").append(updateReason).append("\"");
|
||||
sb.append(",\"creatorName\":")
|
||||
.append("\"").append(creatorName).append("\"");
|
||||
sb.append(",\"gmtCreate\":")
|
||||
.append("\"").append(gmtCreate).append("\"");
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.user.pojo.pos;
|
||||
package ink.wgink.service.user.pojo.pos;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.user.pojo.vos;
|
||||
package ink.wgink.service.user.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.user.pojo.vos;
|
||||
package ink.wgink.service.user.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.user.pojo.vos;
|
||||
package ink.wgink.service.user.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import ink.wgink.annotation.CheckNumberAnnotation;
|
@ -0,0 +1,37 @@
|
||||
package ink.wgink.service.user.service;
|
||||
|
||||
import ink.wgink.service.user.pojo.bos.UserAdjustmentBO;
|
||||
import ink.wgink.service.user.pojo.dtos.UserLogDTO;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IUserAdjustment
|
||||
* @Description: 用户调整
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/12 3:34 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IUserAdjustmentService {
|
||||
|
||||
/**
|
||||
* 新增修改记录
|
||||
*
|
||||
* @param userAdjustmentBO
|
||||
*/
|
||||
void save(UserAdjustmentBO userAdjustmentBO);
|
||||
|
||||
/**
|
||||
* 用户调整分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<UserLogDTO>> listPage(ListPage page);
|
||||
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package ink.wgink.module.user.service;
|
||||
package ink.wgink.service.user.service;
|
||||
|
||||
import ink.wgink.interfaces.user.IUserBaseService;
|
||||
import ink.wgink.interfaces.user.IUserCheckService;
|
||||
import ink.wgink.module.user.pojo.vos.RestPasswordVO;
|
||||
import ink.wgink.module.user.pojo.vos.UpdateUsernameVO;
|
||||
import ink.wgink.module.user.pojo.vos.UserVO;
|
||||
import ink.wgink.service.user.pojo.vos.RestPasswordVO;
|
||||
import ink.wgink.service.user.pojo.vos.UpdateUsernameVO;
|
||||
import ink.wgink.service.user.pojo.vos.UserVO;
|
||||
import ink.wgink.pojo.result.UploadExcelResultDTO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -0,0 +1,48 @@
|
||||
package ink.wgink.service.user.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.service.user.dao.IUserAdjustmentDao;
|
||||
import ink.wgink.service.user.pojo.bos.UserAdjustmentBO;
|
||||
import ink.wgink.service.user.pojo.dtos.UserLogDTO;
|
||||
import ink.wgink.service.user.service.IUserAdjustmentService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: UserAdjustmentServiceImpl
|
||||
* @Description: 用户调整
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/12 3:39 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service
|
||||
public class UserAdjustmentServiceImpl extends DefaultBaseService implements IUserAdjustmentService {
|
||||
|
||||
@Autowired
|
||||
private IUserAdjustmentDao userAdjustmentDao;
|
||||
|
||||
@Override
|
||||
public void save(UserAdjustmentBO userAdjustmentBO) {
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(userAdjustmentBO);
|
||||
userAdjustmentDao.save(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserLogDTO>> listPage(ListPage page) {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<UserLogDTO> userLogDTOs = userAdjustmentDao.list(page.getParams());
|
||||
PageInfo<UserLogDTO> pageInfo = new PageInfo<>(userLogDTOs);
|
||||
return new SuccessResultList<>(userLogDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.user.service.impl;
|
||||
package ink.wgink.service.user.service.impl;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@ -7,19 +7,23 @@ import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.module.file.excel.error.AbstractErrorExcelHandler;
|
||||
import ink.wgink.module.file.service.IFileService;
|
||||
import ink.wgink.module.user.dao.IUserDao;
|
||||
import ink.wgink.module.user.excel.UserExcel;
|
||||
import ink.wgink.module.user.excel.UserExcelError;
|
||||
import ink.wgink.module.user.excel.UserExcelListener;
|
||||
import ink.wgink.module.user.pojo.vos.RestPasswordVO;
|
||||
import ink.wgink.module.user.pojo.vos.UpdateUsernameVO;
|
||||
import ink.wgink.module.user.pojo.vos.UserVO;
|
||||
import ink.wgink.module.user.service.IUserService;
|
||||
import ink.wgink.service.user.dao.IUserDao;
|
||||
import ink.wgink.service.user.enums.UserUpdateTypeEnum;
|
||||
import ink.wgink.service.user.excel.UserExcel;
|
||||
import ink.wgink.service.user.excel.UserExcelError;
|
||||
import ink.wgink.service.user.excel.UserExcelListener;
|
||||
import ink.wgink.service.user.pojo.bos.UserAdjustmentBO;
|
||||
import ink.wgink.service.user.pojo.vos.RestPasswordVO;
|
||||
import ink.wgink.service.user.pojo.vos.UpdateUsernameVO;
|
||||
import ink.wgink.service.user.pojo.vos.UserVO;
|
||||
import ink.wgink.service.user.service.IUserAdjustmentService;
|
||||
import ink.wgink.service.user.service.IUserService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.result.UploadExcelResultDTO;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import ink.wgink.util.date.DateUtil;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -50,6 +54,8 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
@Autowired
|
||||
private IUserDao userDao;
|
||||
@Autowired
|
||||
private IUserAdjustmentService userAdjustmentService;
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@Value("${user.default-password:88888888}")
|
||||
private String defaultPassword;
|
||||
@ -118,6 +124,18 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
params.put("userId", userId);
|
||||
params.put("userPassword", passwordEncoder.encode(DigestUtils.md5Hex(DigestUtils.md5Hex(DigestUtils.md5Hex(defaultPassword)))));
|
||||
userDao.updatePassword(params);
|
||||
|
||||
// 记录日志
|
||||
UserAdjustmentBO userAdjustmentBO = new UserAdjustmentBO();
|
||||
userAdjustmentBO.setUserId(userId);
|
||||
userAdjustmentBO.setUserName(userDTO.getUserName());
|
||||
userAdjustmentBO.setUpdateType(UserUpdateTypeEnum.REST_PASSWORD.getValue());
|
||||
userAdjustmentBO.setCreator(securityComponent.getCurrentUser().getUserId());
|
||||
userAdjustmentBO.setCreatorName(securityComponent.getCurrentUsername());
|
||||
userAdjustmentBO.setNewValue(defaultPassword);
|
||||
userAdjustmentBO.setGmtCreate(DateUtil.getTime());
|
||||
userAdjustmentBO.setUpdateReason(restPasswordVO.getUpdateReason());
|
||||
userAdjustmentService.save(userAdjustmentBO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -134,6 +152,8 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
}
|
||||
params.put("userId", userId);
|
||||
userDao.updateUsername(params);
|
||||
|
||||
updateUsernameAdjustment(userId, oldUserDTO.getUserUsername(), updateUsernameVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -227,6 +247,18 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
return new SuccessResultList<>(userDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserDTO>> listPageByIds(List<String> userIds, ListPage page) {
|
||||
page.getParams().put("userIds", userIds);
|
||||
return listPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserDTO>> listPageByExcludeUserIds(List<String> excludeUserIds, ListPage page) {
|
||||
page.getParams().put("excludeUserIds", excludeUserIds);
|
||||
return listPage(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel导入错误对象
|
||||
*
|
||||
@ -244,4 +276,39 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
return userExcelError;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户名记录
|
||||
*
|
||||
* @param userId
|
||||
* @param oldUsername
|
||||
* @param updateUsernameVO
|
||||
*/
|
||||
private void updateUsernameAdjustment(String userId, String oldUsername, UpdateUsernameVO updateUsernameVO) {
|
||||
Map<String, Object> params = getHashMap(1);
|
||||
UserDTO updateUserDTO = get(userId);
|
||||
if (updateUserDTO == null) {
|
||||
throw new SearchException("修改用户不存在");
|
||||
}
|
||||
UserDTO userDTO = getByUsername(updateUsernameVO.getUsername());
|
||||
if (userDTO != null && !StringUtils.equals(userId, userDTO.getUserId())) {
|
||||
throw new SearchException("新用户名已经存在");
|
||||
}
|
||||
params.put("userId", userId);
|
||||
params.put("userUsername", updateUsernameVO.getUsername());
|
||||
userDao.updateUsername(params);
|
||||
|
||||
// 日志
|
||||
UserAdjustmentBO userAdjustmentBO = new UserAdjustmentBO();
|
||||
userAdjustmentBO.setUserId(userId);
|
||||
userAdjustmentBO.setUserName(updateUserDTO.getUserName());
|
||||
userAdjustmentBO.setUpdateType(UserUpdateTypeEnum.USERNAME.getValue());
|
||||
userAdjustmentBO.setOldValue(oldUsername);
|
||||
userAdjustmentBO.setNewValue(updateUsernameVO.getUsername());
|
||||
userAdjustmentBO.setUpdateReason(updateUsernameVO.getUpdateReason());
|
||||
userAdjustmentBO.setCreator(securityComponent.getCurrentUser().getUserId());
|
||||
userAdjustmentBO.setCreatorName(securityComponent.getCurrentUser().getUserName());
|
||||
userAdjustmentBO.setGmtCreate(DateUtil.getTime());
|
||||
userAdjustmentService.save(userAdjustmentBO);
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package ink.wgink.module.user.startup;
|
||||
package ink.wgink.service.user.startup;
|
||||
|
||||
import ink.wgink.module.user.dao.IUserDao;
|
||||
import ink.wgink.service.user.dao.IUserAdjustmentDao;
|
||||
import ink.wgink.service.user.dao.IUserDao;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.util.date.DateUtil;
|
||||
import org.slf4j.Logger;
|
||||
@ -29,6 +30,8 @@ public class ServiceUserStartUp implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
private IUserDao userDao;
|
||||
@Autowired
|
||||
private IUserAdjustmentDao userAdjustmentDao;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
@ -58,5 +61,8 @@ public class ServiceUserStartUp implements ApplicationRunner {
|
||||
params.put("isDelete", 0);
|
||||
userDao.save(params);
|
||||
}
|
||||
|
||||
LOG.debug("创建 sys_user_adjustment 表");
|
||||
userAdjustmentDao.createTable();
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.service.user.dao.IUserAdjustmentDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<resultMap id="userLogDTO" type="ink.wgink.service.user.pojo.dtos.UserLogDTO">
|
||||
<result column="user_name" property="userName"/>
|
||||
<result column="update_type" property="updateType"/>
|
||||
<result column="old_value" property="oldValue"/>
|
||||
<result column="new_value" property="newValue"/>
|
||||
<result column="update_reason" property="updateReason"/>
|
||||
<result column="creator_name" property="creatorName"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_user_adjustment` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_id` char(36) DEFAULT NULL COMMENT '用户ID',
|
||||
`user_name` varchar(255) DEFAULT NULL COMMENT '用户名称',
|
||||
`update_type` varchar(255) DEFAULT NULL COMMENT '类型:password,修改密码;username,修改用户名',
|
||||
`old_value` varchar(255) DEFAULT NULL COMMENT '旧值',
|
||||
`new_value` varchar(255) DEFAULT NULL COMMENT '新值',
|
||||
`update_reason` varchar(255) DEFAULT NULL COMMENT '原因',
|
||||
`creator` char(36) DEFAULT NULL,
|
||||
`creator_name` varchar(255) DEFAULT NULL,
|
||||
`gmt_create` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户调整记录表';
|
||||
</update>
|
||||
|
||||
<!-- 新增修改日志 -->
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
INSERT INTO sys_user_adjustment(
|
||||
user_id,
|
||||
user_name,
|
||||
update_type,
|
||||
old_value,
|
||||
new_value,
|
||||
update_reason,
|
||||
creator,
|
||||
creator_name,
|
||||
gmt_create
|
||||
) VALUES(
|
||||
#{userId},
|
||||
#{userName},
|
||||
#{updateType},
|
||||
#{oldValue},
|
||||
#{newValue},
|
||||
#{updateReason},
|
||||
#{creator},
|
||||
#{creatorName},
|
||||
#{gmtCreate}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 用户调整列表 -->
|
||||
<select id="list" parameterType="map" resultMap="userLogDTO" useCache="true">
|
||||
SELECT
|
||||
user_id,
|
||||
user_name,
|
||||
update_type,
|
||||
old_value,
|
||||
new_value,
|
||||
update_reason,
|
||||
creator,
|
||||
creator_name,
|
||||
LEFT(gmt_create, 19) gmt_create
|
||||
FROM
|
||||
sys_user_adjustment
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="updateType != null and updateType != ''">
|
||||
AND
|
||||
update_type = #{updateType}
|
||||
</if>
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
old_value LIKE CONCAT('%', #{keywords}, '%')
|
||||
OR
|
||||
new_value LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND
|
||||
LEFT(gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND
|
||||
LEFT(gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
ORDER BY
|
||||
gmt_create DESC, id DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.module.user.dao.IUserDao">
|
||||
<cache/>
|
||||
<mapper namespace="ink.wgink.service.user.dao.IUserDao">
|
||||
|
||||
<resultMap id="userPO" type="ink.wgink.module.user.pojo.pos.UserPO">
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<resultMap id="userPO" type="ink.wgink.service.user.pojo.pos.UserPO">
|
||||
<id property="userId" column="user_id"/>
|
||||
<result property="userUsername" column="user_username"/>
|
||||
<result property="userPassword" column="user_password"/>
|
||||
@ -317,6 +318,13 @@
|
||||
#{userIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="excludeUserIds != null and excludeUserIds.size > 0">
|
||||
AND
|
||||
user_id NOT IN
|
||||
<foreach collection="excludeUserIds" index="index" open="(" separator="," close=")">
|
||||
#{excludeUserIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
user_username LIKE CONCAT('%', #{keywords}, '%')
|
||||
|
@ -27,12 +27,14 @@
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="uploadExcel" style="margin-left: 0;">
|
||||
<i class="fa fa-lg fa-cloud-upload"></i> 导入数据
|
||||
</button>
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="uploadExcel">
|
||||
<i class="fa fa-lg fa-cloud-upload"></i> 导入数据
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
@ -97,7 +99,7 @@
|
||||
}
|
||||
},
|
||||
{field:'userName', width:140, title: '昵称', sort: true, align:'center'},
|
||||
{field:'userType', width:100, title: '类型', sort: true, align:'center',
|
||||
{field:'userType', width:90, title: '类型', sort: true, align:'center',
|
||||
templet: function(item) {
|
||||
if(item.userType == 1) {
|
||||
return '<span class="layui-badge layui-bg-green">系统用户</span>';
|
||||
@ -163,9 +165,9 @@
|
||||
return item.gmtCreate;
|
||||
}
|
||||
},
|
||||
{field:'opition', width:120, title: '操作', fixed:'right', align:'center',
|
||||
{field:'opition', width:110, title: '操作', fixed:'right', align:'center',
|
||||
templet: function(item) {
|
||||
return '<button type="button" class="layui-btn layui-btn-sm" lay-event="resetPasswordEvent">' +
|
||||
return '<button type="button" class="layui-btn layui-btn-xs" lay-event="resetPasswordEvent">' +
|
||||
'<i class="fa fa-key"></i> 重置密码' +
|
||||
'</button>';
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<div class="layui-card" style="text-align: center;">
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<blockquote class="layui-elem-quote">下载“下载模板”整理数据,点击“导入数据”上传,格式为xls或xlsx</blockquote>
|
||||
<button type="button" class="layui-btn layui-btn" onclick="window.open('route/user/upload/upload-excel-template')">
|
||||
<button id="downloadFile" type="button" class="layui-btn layui-btn">
|
||||
<i class="fa fa-lg fa-cloud-download"></i> 下载模板
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn" id="uploadExcel">
|
||||
@ -30,9 +30,18 @@
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'upload'], function(){
|
||||
}).use(['index', 'upload', 'common'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var common = layui.common;
|
||||
|
||||
$('#downloadFile').click(function() {
|
||||
common.download('route/user/upload/upload-excel-template')
|
||||
})
|
||||
|
||||
$(document).on('click', '.error-excel', function() {
|
||||
common.download('route/file/download/false/'+ this.dataset.errorId);
|
||||
})
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
@ -62,7 +71,7 @@
|
||||
skin: '',
|
||||
content: '<div style="padding: 15px;">' +
|
||||
'<div>失败数量:'+ data.failedCount +'</div><br/>' +
|
||||
'<div><a href="javascript:void(0);" onclick="window.open(\'route/file/download/false/'+ data.errorExcel +'\');">点击下载错误信息</a></div>' +
|
||||
'<div><a class="error-excel" href="javascript:void(0);" data-error-id="'+ data.errorExcel +'">点击下载错误信息</a></div>' +
|
||||
'</div>'
|
||||
});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user