调整人员管理模块

This commit is contained in:
wanggeng888 2021-06-17 18:13:05 +08:00
parent 5322f8d174
commit 7b22636da0
6 changed files with 92 additions and 228 deletions

View File

@ -50,7 +50,7 @@ public class CheckApp2Controller extends AbstractController {
@ApiImplicitParam(name = "checkId", value = "原检查ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save")
@PostMapping("save-re")
@CheckRequestBodyAnnotation
public SuccessResult saveRe(@RequestHeader("token") String token,
@PathVariable("checkId") String checkId,

View File

@ -26,10 +26,6 @@ public class GridPersonnelDTO implements Serializable {
private String userId;
@ApiModelProperty(name = "userName", value = "用户名称")
private String userName;
@ApiModelProperty(name = "departmentId", value = "部门ID")
private String departmentId;
@ApiModelProperty(name = "departmentName", value = "部门名称")
private String departmentName;
@ApiModelProperty(name = "area1", value = "1级区域")
private String area1;
@ApiModelProperty(name = "area1Name", value = "1级区域名称")
@ -54,10 +50,6 @@ public class GridPersonnelDTO implements Serializable {
private String leaderUserId;
@ApiModelProperty(name = "leaderUserName", value = "领导用户昵称")
private String leaderUserName;
@ApiModelProperty(name = "leaderDepartmentId", value = "领导部门ID")
private String leaderDepartmentId;
@ApiModelProperty(name = "leaderDepartmentName", value = "领导部门名称")
private String leaderDepartmentName;
@ApiModelProperty(name = "personType", value = "人员类型")
private String personType;
@ApiModelProperty(name = "gridType", value = "网格类型")

View File

@ -29,10 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @ClassName: GridPersonnelServiceImpl
@ -203,7 +200,9 @@ public class GridPersonnelServiceImpl extends BaseService implements IGridPerson
@Override
public List<GridPersonnelDTO> list(Map<String, Object> params) throws SearchException {
return gridPersonnelDao.listGridPersonnel(params);
List<GridPersonnelDTO> gridPersonnelDTOs = gridPersonnelDao.listGridPersonnel(params);
setGridPersonnelUserInfo(gridPersonnelDTOs);
return gridPersonnelDTOs;
}
@Override
@ -222,9 +221,8 @@ public class GridPersonnelServiceImpl extends BaseService implements IGridPerson
}
page.getParams().put("userIds", userIds);
}
List<GridPersonnelDTO> gridPersonnelDTOs = gridPersonnelDao.listGridPersonnel(page.getParams());
List<GridPersonnelDTO> gridPersonnelDTOs = list(page.getParams());
PageInfo<GridPersonnelDTO> pageInfo = new PageInfo<>(gridPersonnelDTOs);
setGridPersonnelUserInfo(gridPersonnelDTOs);
return new SuccessResultList<>(gridPersonnelDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@ -350,50 +348,24 @@ public class GridPersonnelServiceImpl extends BaseService implements IGridPerson
* @param gridPersonnelDTOs
*/
private void setGridPersonnelUserInfo(List<GridPersonnelDTO> gridPersonnelDTOs) {
List<String> userIds = new ArrayList<>();
StringBuilder userIdsSB = new StringBuilder();
for (GridPersonnelDTO gridPersonnelDTO : gridPersonnelDTOs) {
if (userIdsSB.length() > 0) {
userIdsSB.append("_");
}
String userId = gridPersonnelDTO.getUserId();
userIdsSB.append(userId);
userIds.add(userId);
}
if (userIds.isEmpty()) {
if (gridPersonnelDTOs.isEmpty()) {
return;
}
// 账号信息
Map<String, Object> params = getHashMap(2);
params.put("userIds", userIdsSB.toString());
JSONArray userJSONArray = userService.listUserByIds(params);
// 动态个人信息
JSONArray userInfoJSONArray = userService.listDynamicUserInfoByIds(userIds);
Set<String> userIdSet = new HashSet<>();
for (GridPersonnelDTO gridPersonnelDTO : gridPersonnelDTOs) {
String userId = gridPersonnelDTO.getUserId();
// 设置账号
if (!userJSONArray.isEmpty()) {
for (int i = 0; i < userJSONArray.size(); i++) {
JSONObject userJSONObject = userJSONArray.getJSONObject(i);
if (!StringUtils.equals(userId, userJSONObject.getString("userId"))) {
continue;
}
gridPersonnelDTO.setUserPhone(userJSONObject.getString("userPhone"));
break;
userIdSet.add(gridPersonnelDTO.getUserId());
userIdSet.add(gridPersonnelDTO.getLeaderUserId());
}
// 账号信息
List<UserResourceBO> userResourceBOs = userService.listUserResourceByIds(new ArrayList<>(userIdSet));
for (GridPersonnelDTO gridPersonnelDTO : gridPersonnelDTOs) {
for (UserResourceBO userResourceBO : userResourceBOs) {
if (StringUtils.equals(gridPersonnelDTO.getUserId(), userResourceBO.getUserId())) {
gridPersonnelDTO.setUserName(userResourceBO.getUserName());
gridPersonnelDTO.setUserPhone(userResourceBO.getUserPhone());
}
}
// 个人信息
if (!userInfoJSONArray.isEmpty()) {
for (int i = 0; i < userInfoJSONArray.size(); i++) {
JSONObject userInfoJSONObject = userInfoJSONArray.getJSONObject(i);
if (!StringUtils.equals(userId, userInfoJSONObject.getString("userId"))) {
continue;
}
gridPersonnelDTO.setUserSex(userInfoJSONObject.getString("userSex"));
gridPersonnelDTO.setUserBirth(userInfoJSONObject.getString("userBirth"));
gridPersonnelDTO.setUserExplain(userInfoJSONObject.getString("userExplain"));
gridPersonnelDTO.setUserNation(userInfoJSONObject.getString("userNation"));
break;
if (StringUtils.equals(gridPersonnelDTO.getLeaderUserId(), userResourceBO.getUserId())) {
gridPersonnelDTO.setLeaderUserName(userResourceBO.getUserName());
}
}
}

View File

@ -8,8 +8,6 @@
<id column="grid_personnel_id" property="gridPersonnelId"/>
<result column="user_id" property="userId"/>
<result column="user_name" property="userName"/>
<result column="department_id" property="departmentId"/>
<result column="department_name" property="departmentName"/>
<result column="area1" property="area1"/>
<result column="area1_name" property="area1Name"/>
<result column="area2" property="area2"/>
@ -21,9 +19,6 @@
<result column="area5" property="area5"/>
<result column="area5_name" property="area5Name"/>
<result column="leader_user_id" property="leaderUserId"/>
<result column="leader_department_id" property="leaderDepartmentId"/>
<result column="leader_user_name" property="leaderUserName"/>
<result column="leader_department_name" property="leaderDepartmentName"/>
<result column="level" property="level"/>
<result column="person_type" property="personType"/>
<result column="grid_type" property="gridType"/>
@ -35,18 +30,12 @@
INSERT INTO gen_grid_personnel(
grid_personnel_id,
user_id,
user_name,
department_id,
department_name,
area1,
area2,
area3,
area4,
area5,
leader_user_id,
leader_user_name,
leader_department_id,
leader_department_name,
person_type,
grid_type,
level,
@ -58,18 +47,12 @@
) VALUES(
#{gridPersonnelId},
#{userId},
#{userName},
#{departmentId},
#{departmentName},
#{area1},
#{area2},
#{area3},
#{area4},
#{area5},
#{leaderUserId},
#{leaderUserName},
#{leaderDepartmentId},
#{leaderDepartmentName},
#{personType},
#{gridType},
#{level},
@ -104,15 +87,6 @@
<if test="userId != null and userId != ''">
user_id = #{userId},
</if>
<if test="userName != null and userName != ''">
user_name = #{userName},
</if>
<if test="departmentId != null and departmentId != ''">
department_id = #{departmentId},
</if>
<if test="departmentName != null and departmentName != ''">
department_name = #{departmentName},
</if>
<if test="area1 != null">
area1 = #{area1},
</if>
@ -131,15 +105,6 @@
<if test="leaderUserId != null and leaderUserId != ''">
leader_user_id = #{leaderUserId},
</if>
<if test="leaderUserName != null and leaderUserName != ''">
leader_user_name = #{leaderUserName},
</if>
<if test="leaderDepartmentId != null and leaderDepartmentId != ''">
leader_department_id = #{leaderDepartmentId},
</if>
<if test="leaderDepartmentName != null and leaderDepartmentName != ''">
leader_department_name = #{leaderDepartmentName},
</if>
<if test="personType != null and personType != ''">
person_type = #{personType},
</if>
@ -159,18 +124,12 @@
<select id="getGridPersonnel" parameterType="map" resultMap="gridPersonnelDTO" useCache="false">
SELECT
t1.user_id,
t1.user_name,
t1.department_id,
t1.department_name,
t1.area1,
t1.area2,
t1.area3,
t1.area4,
t1.area5,
t1.leader_user_id,
t1.leader_user_name,
t1.leader_department_id,
t1.leader_department_name,
t1.person_type,
t1.grid_type,
t1.level,
@ -193,9 +152,6 @@
<select id="listGridPersonnel" parameterType="map" resultMap="gridPersonnelDTO" useCache="true">
SELECT
t1.user_id,
t1.user_name,
t1.department_id,
t1.department_name,
t1.area1,
dt1.dictionary_name area1_name,
t1.area2,
@ -207,9 +163,6 @@
t1.area5,
dt5.dictionary_name area5_name,
t1.leader_user_id,
t1.leader_user_name,
t1.leader_department_id,
t1.leader_department_name,
t1.person_type,
t1.grid_type,
t1.level,
@ -338,18 +291,12 @@
<select id="listGridPersonnelSimple" parameterType="map" resultMap="gridPersonnelDTO" useCache="true">
SELECT
t1.user_id,
t1.user_name,
t1.department_id,
t1.department_name,
t1.area1,
t1.area2,
t1.area3,
t1.area4,
t1.area5,
t1.leader_user_id,
t1.leader_user_name,
t1.leader_department_id,
t1.leader_department_name,
t1.person_type,
t1.grid_type,
t1.level,

View File

@ -22,17 +22,11 @@
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<input type="hidden" id="leaderUserId" name="leaderUserId"/>
<input type="hidden" id="leaderUserName" name="leaderUserName"/>
<input type="hidden" id="leaderDepartmentId" name="leaderDepartmentId"/>
<input type="hidden" id="leaderDepartmentName" name="leaderDepartmentName"/>
<div class="layui-form-item">
<label class="layui-form-label">用户</label>
<div class="layui-input-block">
<input type="hidden" id="userId" name="userId" value="">
<input type="hidden" id="userName" name="userName" value="">
<input type="hidden" id="departmentId" name="departmentId" value="">
<input type="hidden" id="departmentName" name="departmentName" value="">
<input type="text" id="userIdSelectUser" class="layui-input" placeholder="请选择用户" data-name="userId" readonly style="cursor:pointer;">
<input type="text" class="layui-input" id="userName" name="userName" placeholder="请选择用户" readonly style="cursor:pointer;">
</div>
</div>
<div class="layui-form-item">
@ -67,7 +61,7 @@
<select name="area2leaderUserId" lay-filter="area2leaderUserId">
<option value="">选择上级领导</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.userId}}|{{item.userName}}|{{item.departmentId}}|{{item.departmentName}}">{{item.userName}}</option>
<option value="{{item.userId}}">{{item.userName}}</option>
{{# } }}
</select>
</script>
@ -94,7 +88,7 @@
<select name="area3leaderUserId" lay-filter="area3leaderUserId">
<option value="">选择上级领导</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.userId}}|{{item.userName}}|{{item.departmentId}}|{{item.departmentName}}">{{item.userName}}</option>
<option value="{{item.userId}}">{{item.userName}}</option>
{{# } }}
</select>
</script>
@ -121,7 +115,7 @@
<select name="area4leaderUserId" lay-filter="area4leaderUserId">
<option value="">选择上级领导</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.userId}}|{{item.userName}}|{{item.departmentId}}|{{item.departmentName}}">{{item.userName}}</option>
<option value="{{item.userId}}">{{item.userName}}</option>
{{# } }}
</select>
</script>
@ -148,7 +142,7 @@
<select name="area5leaderUserId" lay-filter="area5leaderUserId">
<option value="">选择上级领导</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.userId}}|{{item.userName}}|{{item.departmentId}}|{{item.departmentName}}">{{item.userName}}</option>
<option value="{{item.userId}}">{{item.userName}}</option>
{{# } }}
</select>
</script>
@ -227,52 +221,6 @@
form.render('radio', 'dataForm');
}
// 初始化用户ID选择人员
function initUserIdSelectUser() {
$(document.body).on('click', '#userIdSelectUser', function() {
top.dialog.dialogData.selectedUsers = [{
userId: $('#userId').val(),
departmentId: $('#departmentId').val()
}];
top.dialog.open({
url: top.restAjax.path('route/tree/treeuser', []),
title: '选择组织部门人员',
width: '500px',
height: '500px',
onClose: function() {
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
if(selectedUsers != null && selectedUsers.length == 1) {
var selectedUsersId = '';
var selectedUserName = '';
var selectedDepartmentId = '';
var selectedDepartmentName = '';
var showSelectedUsersVal = '';
for(var j = 0, selectUser = selectedUsers[j]; selectUser = selectedUsers[j++];) {
selectedUsersId = selectUser.userId;
selectedUserName = selectUser.userName;
selectedDepartmentId = selectUser.departmentId;
selectedDepartmentName = selectUser.userTitle.split('】')[0].substr(1);
showSelectedUsersVal = selectUser.userTitle;
}
$('#userId').val(selectedUsersId);
$('#userName').val(selectedUserName);
$('#departmentId').val(selectedDepartmentId);
$('#departmentName').val(selectedDepartmentName);
$('#userIdSelectUser').val(showSelectedUsersVal);
} else if(selectedUsers != null && selectedUsers.length > 1) {
top.dialog.msg('只能选择一位人员');
} else {
$('#userId').val('');
$('#userName').val('');
$('#departmentId').val('');
$('#departmentName').val('');
$('#userIdSelectUser').val('');
}
}
});
});
}
// 初始化选择框、单选、复选模板
function initSelectRadioCheckboxTemplate(templateId, templateBoxId, data, callback) {
laytpl(document.getElementById(templateId).innerHTML).render(data, function(html) {
@ -389,7 +337,6 @@
// 初始化内容
function initData() {
initUserIdSelectUser();
initArea1Select();
initArea2Select();
if(level > 1) {
@ -445,6 +392,37 @@
return false;
});
$(document).on('click', '#userName', function() {
top.dialog.dialogData.selectedUserIds = $('#userId').val();
top.dialog.user({
url: top.restAjax.path('route/system/user/select-department-user.html', []),
title: '选择组织部门人员',
width: '500px',
height: '500px',
onClose: function () {
var userIds = '';
var userNames = '';
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
if(selectedUsers != null && selectedUsers.length > 0) {
if(selectedUsers.length > 1) {
top.dialog.msg('最多选择一名人员,请重新选择');
return false;
}
for (var i = 0, item; item = selectedUsers[i++];) {
if(userIds.length > 0) {
userIds += ',';
userNames += ',';
}
userIds += item.userId;
userNames += item.userName;
}
}
$('#userId').val(userIds);
$('#userName').val(userNames);
}
});
});
$('.close').on('click', function() {
closeBox();
});

View File

@ -22,17 +22,11 @@
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<input type="hidden" id="leaderUserId" name="leaderUserId"/>
<input type="hidden" id="leaderUserName" name="leaderUserName"/>
<input type="hidden" id="leaderDepartmentId" name="leaderDepartmentId"/>
<input type="hidden" id="leaderDepartmentName" name="leaderDepartmentName"/>
<div class="layui-form-item">
<label class="layui-form-label">用户</label>
<div class="layui-input-block">
<input type="hidden" id="userId" name="userId" value="">
<input type="hidden" id="userName" name="userName" value="">
<input type="hidden" id="departmentId" name="departmentId" value="">
<input type="hidden" id="departmentName" name="departmentName" value="">
<input type="text" id="userIdSelectUser" class="layui-input" placeholder="请选择用户" data-name="userId" readonly style="cursor:pointer;">
<input type="text" class="layui-input" id="userName" name="userName" placeholder="请选择用户" readonly style="cursor:pointer;">
</div>
</div>
<div class="layui-form-item">
@ -67,7 +61,7 @@
<select name="area2leaderUserId" lay-filter="area2leaderUserId">
<option value="">选择上级领导</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.userId}}|{{item.userName}}|{{item.departmentId}}|{{item.departmentName}}">{{item.userName}}</option>
<option value="{{item.userId}}">{{item.userName}}</option>
{{# } }}
</select>
</script>
@ -94,7 +88,7 @@
<select name="area3leaderUserId" lay-filter="area3leaderUserId">
<option value="">选择上级领导</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.userId}}|{{item.userName}}|{{item.departmentId}}|{{item.departmentName}}">{{item.userName}}</option>
<option value="{{item.userId}}">{{item.userName}}</option>
{{# } }}
</select>
</script>
@ -121,7 +115,7 @@
<select name="area4leaderUserId" lay-filter="area4leaderUserId">
<option value="">选择上级领导</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.userId}}|{{item.userName}}|{{item.departmentId}}|{{item.departmentName}}">{{item.userName}}</option>
<option value="{{item.userId}}">{{item.userName}}</option>
{{# } }}
</select>
</script>
@ -148,7 +142,7 @@
<select name="area5leaderUserId" lay-filter="area5leaderUserId">
<option value="">选择上级领导</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.userId}}|{{item.userName}}|{{item.departmentId}}|{{item.departmentName}}">{{item.userName}}</option>
<option value="{{item.userId}}">{{item.userName}}</option>
{{# } }}
</select>
</script>
@ -229,54 +223,6 @@
form.render('radio', 'dataForm');
}
// 初始化用户ID选择人员
function initUserIdSelectUser() {
$('#userIdSelectUser').val('【'+ $('#departmentName').val() +'】'+ $('#userName').val());
$(document.body).on('click', '#userIdSelectUser', function() {
top.dialog.dialogData.selectedUsers = [{
userId: $('#userId').val(),
departmentId: $('#departmentId').val()
}];
top.dialog.open({
url: top.restAjax.path('route/tree/treeuser', []),
title: '选择组织部门人员',
width: '500px',
height: '500px',
onClose: function() {
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
if(selectedUsers != null && selectedUsers.length == 1) {
var selectedUsersId = '';
var selectedUserName = '';
var selectedDepartmentId = '';
var selectedDepartmentName = '';
var showSelectedUsersVal = '';
for(var j = 0, selectUser = selectedUsers[j]; selectUser = selectedUsers[j++];) {
selectedUsersId = selectUser.userId;
selectedUserName = selectUser.userName;
selectedDepartmentId = selectUser.departmentId;
selectedDepartmentName = selectUser.userTitle.split('】')[0].substr(1);
showSelectedUsersVal = selectUser.userTitle;
}
$('#userId').val(selectedUsersId);
$('#userName').val(selectedUserName);
$('#departmentId').val(selectedDepartmentId);
$('#departmentName').val(selectedDepartmentName);
$('#userIdSelectUser').val(showSelectedUsersVal);
} else if(selectedUsers != null && selectedUsers.length > 1) {
top.dialog.msg('只能选择一位人员');
} else {
$('#userId').val('');
$('#userName').val('');
$('#departmentId').val('');
$('#departmentName').val('');
$('#userIdSelectUser').val('');
}
}
});
});
}
// 初始化选择框、单选、复选模板
function initSelectRadioCheckboxTemplate(templateId, templateBoxId, data, callback) {
laytpl(document.getElementById(templateId).innerHTML).render(data, function(html) {
@ -492,8 +438,6 @@
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initUserIdSelectUser();
initArea1Select(data['area1'], function() {
var leader = data['leaderUserId'] +'|'+ data['leaderUserName'] +'|'+ data['leaderDepartmentId']+'|'+ data['leaderDepartmentName'];
initArea2Select(data['area1'], data['area2'], function() {
@ -571,6 +515,37 @@
return false;
});
$(document).on('click', '#userName', function() {
top.dialog.dialogData.selectedUserIds = $('#userId').val();
top.dialog.user({
url: top.restAjax.path('route/system/user/select-department-user.html', []),
title: '选择组织部门人员',
width: '500px',
height: '500px',
onClose: function () {
var userIds = '';
var userNames = '';
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
if(selectedUsers != null && selectedUsers.length > 0) {
if(selectedUsers.length > 1) {
top.dialog.msg('最多选择一名人员,请重新选择');
return false;
}
for (var i = 0, item; item = selectedUsers[i++];) {
if(userIds.length > 0) {
userIds += ',';
userNames += ',';
}
userIds += item.userId;
userNames += item.userName;
}
}
$('#userId').val(userIds);
$('#userName').val(userNames);
}
});
});
$('.close').on('click', function() {
closeBox();
});