|
|
@@ -26,14 +26,8 @@ import com.sundot.airport.common.core.domain.entity.SysDictData;
|
|
26
|
26
|
import com.sundot.airport.common.dto.SysUserConditionDto;
|
|
27
|
27
|
import com.sundot.airport.common.dto.SysUserLeaderConditionDto;
|
|
28
|
28
|
import com.sundot.airport.common.dto.UserInfo;
|
|
29
|
|
-import com.sundot.airport.common.enums.AssessmentTeamEnum;
|
|
30
|
29
|
import com.sundot.airport.common.enums.DeptType;
|
|
31
|
|
-import com.sundot.airport.common.enums.EmploymentTypeEnum;
|
|
32
|
|
-import com.sundot.airport.common.enums.PostEnum;
|
|
33
|
30
|
import com.sundot.airport.common.enums.RoleTypeEnum;
|
|
34
|
|
-import com.sundot.airport.common.enums.SysUserPoliticalStatusEnum;
|
|
35
|
|
-import com.sundot.airport.common.enums.SysYesNoEnum;
|
|
36
|
|
-import com.sundot.airport.common.enums.WorkAreaEnum;
|
|
37
|
31
|
import com.sundot.airport.system.domain.SysLargeScreenCooperationDto;
|
|
38
|
32
|
import com.sundot.airport.system.domain.SysLargeScreenCooperationItemDto;
|
|
39
|
33
|
import com.sundot.airport.system.domain.SysLargeScreenCooperationQueryParamDto;
|
|
|
@@ -112,7 +106,75 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
112
|
106
|
@Override
|
|
113
|
107
|
@DataScope(deptAlias = "d", userAlias = "u")
|
|
114
|
108
|
public List<SysUser> selectUserList(SysUser user) {
|
|
115
|
|
- return userMapper.selectUserList(user);
|
|
|
109
|
+ List<SysUser> result = userMapper.selectUserList(user);
|
|
|
110
|
+ // 政治面貌字典数据
|
|
|
111
|
+ Map<String, String> politicalStatusDictDataMap = getDictDataKeyValueMap("sys_user_political_status");
|
|
|
112
|
+ // 考核组字典数据
|
|
|
113
|
+ Map<String, String> assessmentTeamDictDataMap = getDictDataKeyValueMap("assessment_team");
|
|
|
114
|
+ // 用工形式字典数据
|
|
|
115
|
+ Map<String, String> employmentTypeDictDataMap = getDictDataKeyValueMap("employment_type");
|
|
|
116
|
+ // 是否字典数据
|
|
|
117
|
+ Map<String, String> yesNoDictDataMap = getDictDataKeyValueMap("sys_yes_no");
|
|
|
118
|
+ // 岗位字典数据
|
|
|
119
|
+ Map<String, String> postDictDataMap = getDictDataKeyValueMap("post");
|
|
|
120
|
+ // 工作区域字典数据
|
|
|
121
|
+ Map<String, String> workAreaDictDataMap = getDictDataKeyValueMap("work_area");
|
|
|
122
|
+ // 补充字典数据
|
|
|
123
|
+ result.forEach(item -> {
|
|
|
124
|
+ // 政治面貌
|
|
|
125
|
+ if (StrUtil.isNotEmpty(item.getPoliticalStatus())) {
|
|
|
126
|
+ item.setPoliticalStatusDesc(politicalStatusDictDataMap.get(item.getPoliticalStatus()));
|
|
|
127
|
+ }
|
|
|
128
|
+ // 考核组
|
|
|
129
|
+ if (StrUtil.isNotEmpty(item.getAssessmentTeam())) {
|
|
|
130
|
+ item.setAssessmentTeamDesc(assessmentTeamDictDataMap.get(item.getAssessmentTeam()));
|
|
|
131
|
+ }
|
|
|
132
|
+ // 用工形式
|
|
|
133
|
+ if (StrUtil.isNotEmpty(item.getEmploymentType())) {
|
|
|
134
|
+ item.setEmploymentTypeDesc(employmentTypeDictDataMap.get(item.getEmploymentType()));
|
|
|
135
|
+ }
|
|
|
136
|
+ // 是否参加考核
|
|
|
137
|
+ if (StrUtil.isNotEmpty(item.getTakeAssessment())) {
|
|
|
138
|
+ item.setTakeAssessmentDesc(yesNoDictDataMap.get(item.getTakeAssessment()));
|
|
|
139
|
+ }
|
|
|
140
|
+ // 岗位
|
|
|
141
|
+ if (StrUtil.isNotEmpty(item.getPost())) {
|
|
|
142
|
+ item.setPostDesc(postDictDataMap.get(item.getPost()));
|
|
|
143
|
+ }
|
|
|
144
|
+ // 工作区域
|
|
|
145
|
+ if (StrUtil.isNotEmpty(item.getWorkArea())) {
|
|
|
146
|
+ item.setWorkAreaDesc(workAreaDictDataMap.get(item.getWorkArea()));
|
|
|
147
|
+ }
|
|
|
148
|
+ });
|
|
|
149
|
+ return result;
|
|
|
150
|
+ }
|
|
|
151
|
+
|
|
|
152
|
+ /**
|
|
|
153
|
+ * 获取字典数据
|
|
|
154
|
+ *
|
|
|
155
|
+ * @param dictType 字典类型
|
|
|
156
|
+ * @return 字典数据
|
|
|
157
|
+ */
|
|
|
158
|
+ private Map<String, String> getDictDataKeyValueMap(String dictType) {
|
|
|
159
|
+ SysDictData dictData = new SysDictData();
|
|
|
160
|
+ dictData.setDictType(dictType);
|
|
|
161
|
+ List<SysDictData> dictDataList = sysDictDataService.selectDictDataList(dictData);
|
|
|
162
|
+ Map<String, String> dictDataMap = dictDataList.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
|
|
|
163
|
+ return dictDataMap;
|
|
|
164
|
+ }
|
|
|
165
|
+
|
|
|
166
|
+ /**
|
|
|
167
|
+ * 获取字典数据
|
|
|
168
|
+ *
|
|
|
169
|
+ * @param dictType 字典类型
|
|
|
170
|
+ * @return 字典数据
|
|
|
171
|
+ */
|
|
|
172
|
+ private Map<String, String> getDictDataValueKeyMap(String dictType) {
|
|
|
173
|
+ SysDictData dictData = new SysDictData();
|
|
|
174
|
+ dictData.setDictType(dictType);
|
|
|
175
|
+ List<SysDictData> dictDataList = sysDictDataService.selectDictDataList(dictData);
|
|
|
176
|
+ Map<String, String> dictDataMap = dictDataList.stream().collect(Collectors.toMap(SysDictData::getDictLabel, SysDictData::getDictValue));
|
|
|
177
|
+ return dictDataMap;
|
|
116
|
178
|
}
|
|
117
|
179
|
|
|
118
|
180
|
/**
|
|
|
@@ -497,12 +559,76 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
497
|
559
|
if (StringUtils.isNull(userList) || userList.size() == 0) {
|
|
498
|
560
|
throw new ServiceException("导入用户数据不能为空!");
|
|
499
|
561
|
}
|
|
|
562
|
+
|
|
|
563
|
+ // 政治面貌字典数据
|
|
|
564
|
+ Map<String, String> politicalStatusDictDataMap = getDictDataValueKeyMap("sys_user_political_status");
|
|
|
565
|
+ // 考核组字典数据
|
|
|
566
|
+ Map<String, String> assessmentTeamDictDataMap = getDictDataValueKeyMap("assessment_team");
|
|
|
567
|
+ // 用工形式字典数据
|
|
|
568
|
+ Map<String, String> employmentTypeDictDataMap = getDictDataValueKeyMap("employment_type");
|
|
|
569
|
+ // 是否字典数据
|
|
|
570
|
+ Map<String, String> yesNoDictDataMap = getDictDataValueKeyMap("sys_yes_no");
|
|
|
571
|
+ // 岗位字典数据
|
|
|
572
|
+ Map<String, String> postDictDataMap = getDictDataValueKeyMap("post");
|
|
|
573
|
+ // 工作区域字典数据
|
|
|
574
|
+ Map<String, String> workAreaDictDataMap = getDictDataValueKeyMap("work_area");
|
|
|
575
|
+
|
|
500
|
576
|
int successNum = 0;
|
|
501
|
577
|
int failureNum = 0;
|
|
502
|
578
|
StringBuilder successMsg = new StringBuilder();
|
|
503
|
579
|
StringBuilder failureMsg = new StringBuilder();
|
|
504
|
580
|
for (SysUser user : userList) {
|
|
505
|
581
|
try {
|
|
|
582
|
+ // 数据校验
|
|
|
583
|
+ if (StrUtil.isNotEmpty(user.getPoliticalStatusDesc())) {
|
|
|
584
|
+ user.setPoliticalStatus(politicalStatusDictDataMap.get(user.getPoliticalStatusDesc()));
|
|
|
585
|
+ if (ObjUtil.isNull(user.getPoliticalStatus())) {
|
|
|
586
|
+ failureNum++;
|
|
|
587
|
+ failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 政治面貌字段值输入错误");
|
|
|
588
|
+ continue;
|
|
|
589
|
+ }
|
|
|
590
|
+ }
|
|
|
591
|
+ if (StrUtil.isNotEmpty(user.getAssessmentTeamDesc())) {
|
|
|
592
|
+ user.setAssessmentTeam(assessmentTeamDictDataMap.get(user.getAssessmentTeamDesc()));
|
|
|
593
|
+ if (ObjUtil.isNull(user.getAssessmentTeam())) {
|
|
|
594
|
+ failureNum++;
|
|
|
595
|
+ failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 考核组字段值输入错误");
|
|
|
596
|
+ continue;
|
|
|
597
|
+ }
|
|
|
598
|
+ }
|
|
|
599
|
+ if (StrUtil.isNotEmpty(user.getEmploymentTypeDesc())) {
|
|
|
600
|
+ user.setEmploymentType(employmentTypeDictDataMap.get(user.getEmploymentTypeDesc()));
|
|
|
601
|
+ if (ObjUtil.isNull(user.getEmploymentType())) {
|
|
|
602
|
+ failureNum++;
|
|
|
603
|
+ failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 用工形式字段值输入错误");
|
|
|
604
|
+ continue;
|
|
|
605
|
+ }
|
|
|
606
|
+ }
|
|
|
607
|
+ if (StrUtil.isNotEmpty(user.getTakeAssessmentDesc())) {
|
|
|
608
|
+ user.setTakeAssessment(yesNoDictDataMap.get(user.getTakeAssessmentDesc()));
|
|
|
609
|
+ if (ObjUtil.isNull(user.getTakeAssessment())) {
|
|
|
610
|
+ failureNum++;
|
|
|
611
|
+ failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 是否参加考核字段值输入错误");
|
|
|
612
|
+ continue;
|
|
|
613
|
+ }
|
|
|
614
|
+ }
|
|
|
615
|
+ if (StrUtil.isNotEmpty(user.getPostDesc())) {
|
|
|
616
|
+ user.setPost(postDictDataMap.get(user.getPostDesc()));
|
|
|
617
|
+ if (ObjUtil.isNull(user.getPost())) {
|
|
|
618
|
+ failureNum++;
|
|
|
619
|
+ failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 岗位字段值输入错误");
|
|
|
620
|
+ continue;
|
|
|
621
|
+ }
|
|
|
622
|
+ }
|
|
|
623
|
+ if (StrUtil.isNotEmpty(user.getWorkAreaDesc())) {
|
|
|
624
|
+ user.setWorkArea(workAreaDictDataMap.get(user.getWorkAreaDesc()));
|
|
|
625
|
+ if (ObjUtil.isNull(user.getWorkArea())) {
|
|
|
626
|
+ failureNum++;
|
|
|
627
|
+ failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 工作区域字段值输入错误");
|
|
|
628
|
+ continue;
|
|
|
629
|
+ }
|
|
|
630
|
+ }
|
|
|
631
|
+
|
|
506
|
632
|
// 验证是否存在这个用户
|
|
507
|
633
|
SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
|
508
|
634
|
if (StringUtils.isNull(u)) {
|
|
|
@@ -511,24 +637,6 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
511
|
637
|
String password = configService.selectConfigByKey("sys.user.initPassword");
|
|
512
|
638
|
user.setPassword(SecurityUtils.encryptPassword(password));
|
|
513
|
639
|
user.setCreateBy(operName);
|
|
514
|
|
- if (StringUtils.isNotEmpty(user.getPoliticalStatusDesc())) {
|
|
515
|
|
- user.setPoliticalStatus(SysUserPoliticalStatusEnum.getByDesc(user.getPoliticalStatusDesc()).getCode());
|
|
516
|
|
- }
|
|
517
|
|
- if (StringUtils.isNotEmpty(user.getAssessmentTeamDesc())) {
|
|
518
|
|
- user.setAssessmentTeam(AssessmentTeamEnum.getByDesc(user.getAssessmentTeamDesc()).getCode());
|
|
519
|
|
- }
|
|
520
|
|
- if (StringUtils.isNotEmpty(user.getEmploymentTypeDesc())) {
|
|
521
|
|
- user.setEmploymentType(EmploymentTypeEnum.getByDesc(user.getEmploymentTypeDesc()).getCode());
|
|
522
|
|
- }
|
|
523
|
|
- if (StringUtils.isNotEmpty(user.getTakeAssessmentDesc())) {
|
|
524
|
|
- user.setTakeAssessment(SysYesNoEnum.getByDesc(user.getTakeAssessmentDesc()).getCode());
|
|
525
|
|
- }
|
|
526
|
|
- if (StringUtils.isNotEmpty(user.getPostDesc())) {
|
|
527
|
|
- user.setPost(PostEnum.getByDesc(user.getPostDesc()).getCode());
|
|
528
|
|
- }
|
|
529
|
|
- if (StringUtils.isNotEmpty(user.getWorkAreaDesc())) {
|
|
530
|
|
- user.setWorkArea(WorkAreaEnum.getByDesc(user.getWorkAreaDesc()).getCode());
|
|
531
|
|
- }
|
|
532
|
640
|
userMapper.insertUser(user);
|
|
533
|
641
|
successNum++;
|
|
534
|
642
|
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
|
|
|
@@ -539,24 +647,6 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
539
|
647
|
deptService.checkDeptDataScope(user.getDeptId());
|
|
540
|
648
|
user.setUserId(u.getUserId());
|
|
541
|
649
|
user.setUpdateBy(operName);
|
|
542
|
|
- if (StringUtils.isNotEmpty(user.getPoliticalStatusDesc())) {
|
|
543
|
|
- user.setPoliticalStatus(SysUserPoliticalStatusEnum.getByDesc(user.getPoliticalStatusDesc()).getCode());
|
|
544
|
|
- }
|
|
545
|
|
- if (StringUtils.isNotEmpty(user.getAssessmentTeamDesc())) {
|
|
546
|
|
- user.setAssessmentTeam(AssessmentTeamEnum.getByDesc(user.getAssessmentTeamDesc()).getCode());
|
|
547
|
|
- }
|
|
548
|
|
- if (StringUtils.isNotEmpty(user.getEmploymentTypeDesc())) {
|
|
549
|
|
- user.setEmploymentType(EmploymentTypeEnum.getByDesc(user.getEmploymentTypeDesc()).getCode());
|
|
550
|
|
- }
|
|
551
|
|
- if (StringUtils.isNotEmpty(user.getTakeAssessmentDesc())) {
|
|
552
|
|
- user.setTakeAssessment(SysYesNoEnum.getByDesc(user.getTakeAssessmentDesc()).getCode());
|
|
553
|
|
- }
|
|
554
|
|
- if (StringUtils.isNotEmpty(user.getPostDesc())) {
|
|
555
|
|
- user.setPost(PostEnum.getByDesc(user.getPostDesc()).getCode());
|
|
556
|
|
- }
|
|
557
|
|
- if (StringUtils.isNotEmpty(user.getWorkAreaDesc())) {
|
|
558
|
|
- user.setWorkArea(WorkAreaEnum.getByDesc(user.getWorkAreaDesc()).getCode());
|
|
559
|
|
- }
|
|
560
|
650
|
userMapper.updateUser(user);
|
|
561
|
651
|
successNum++;
|
|
562
|
652
|
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
|