Merge branch 'develop' into obf
This commit is contained in:
+6
-64
@@ -48,10 +48,7 @@ import org.jeecg.modules.system.manager.UserCacheManager;
|
||||
import org.jeecg.modules.system.service.IHealthUserEmployeeExService;
|
||||
import org.jeecg.modules.system.service.ISysUserDepartChangeApplyService;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.jeecg.modules.system.vo.ItemVo;
|
||||
import org.jeecg.modules.system.vo.NoSelfManagerUser;
|
||||
import org.jeecg.modules.system.vo.SysDepartVo;
|
||||
import org.jeecg.modules.system.vo.UserEmployeeVo;
|
||||
import org.jeecg.modules.system.vo.*;
|
||||
import org.jeecg.redis.RedisStreamKeyEnum;
|
||||
import org.jeecg.redis.RedisStreamUtil;
|
||||
import org.jeecg.util.AsyncUtils;
|
||||
@@ -114,6 +111,7 @@ public class HealthUserEmployeeExController extends JeecgController<HealthUserEm
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @param idStatus 是否需要脱敏标识 idStatus=1说明身份证号需要脱敏处理
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "员工-分页列表查询")
|
||||
@@ -122,10 +120,11 @@ public class HealthUserEmployeeExController extends JeecgController<HealthUserEm
|
||||
public Result<IPage<UserEmployee>> queryPageList(UserFilter userFilter,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) Integer idStatus,
|
||||
HttpServletRequest req) {
|
||||
|
||||
Page<UserEmployee> page = new Page<>(pageNo, pageSize);
|
||||
IPage<UserEmployee> pageList = healthUserEmployeeExService.selectHealthUserEmployeeExList(page, userFilter);
|
||||
IPage<UserEmployee> pageList = healthUserEmployeeExService.selectHealthUserEmployeeExList(page, userFilter,idStatus);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@@ -415,7 +414,7 @@ public class HealthUserEmployeeExController extends JeecgController<HealthUserEm
|
||||
exportParams.setSecondTitle("导出人:"+sysUser.getRealname()+" ["+ DateUtils.formatDateTime() +"]");
|
||||
map.put(NormalExcelConstants.PARAMS, exportParams);
|
||||
//表格对应实体
|
||||
map.put(NormalExcelConstants.CLASS, UserEmployeeVo.class);
|
||||
map.put(NormalExcelConstants.CLASS, UserEmployeeImportVo.class);
|
||||
//数据集合
|
||||
map.put(NormalExcelConstants.DATA_LIST, new ArrayList<>());
|
||||
mapList.add(map);
|
||||
@@ -439,25 +438,6 @@ public class HealthUserEmployeeExController extends JeecgController<HealthUserEm
|
||||
}
|
||||
map.put(NormalExcelConstants.DATA_LIST, itemVos);
|
||||
mapList.add(map);
|
||||
//合同
|
||||
map = Maps.newHashMap();
|
||||
exportParams = new ExportParams("合同数据查询", "合同查询范围");
|
||||
//表格对应实体
|
||||
map.put(NormalExcelConstants.PARAMS, exportParams);
|
||||
map.put(NormalExcelConstants.CLASS, ItemVo.class);
|
||||
List<DictModel> contracts = dictCacheManager.queryDictItemsByCode("contract");
|
||||
itemVos = Lists.newArrayList();
|
||||
if(!CollectionUtils.isEmpty(contracts)) {
|
||||
for (int i = 0; i < contracts.size(); i++) {
|
||||
ItemVo itemVo = new ItemVo();
|
||||
itemVo.setId(i + 1);
|
||||
itemVo.setCode(contracts.get(i).getValue());
|
||||
itemVo.setName(contracts.get(i).getText());
|
||||
itemVos.add(itemVo);
|
||||
}
|
||||
}
|
||||
map.put(NormalExcelConstants.DATA_LIST, itemVos);
|
||||
mapList.add(map);
|
||||
//职务级别
|
||||
map = Maps.newHashMap();
|
||||
exportParams = new ExportParams("职务级别数据查询", "职务级别查询范围");
|
||||
@@ -477,25 +457,6 @@ public class HealthUserEmployeeExController extends JeecgController<HealthUserEm
|
||||
}
|
||||
map.put(NormalExcelConstants.DATA_LIST, itemVos);
|
||||
mapList.add(map);
|
||||
//职业工种
|
||||
map = Maps.newHashMap();
|
||||
exportParams = new ExportParams("职业工种数据查询", "职业工种查询范围");
|
||||
//表格对应实体
|
||||
map.put(NormalExcelConstants.PARAMS, exportParams);
|
||||
map.put(NormalExcelConstants.CLASS, ItemVo.class);
|
||||
List<DictModel> workTypes = dictCacheManager.queryDictItemsByCode("work_type");
|
||||
itemVos = Lists.newArrayList();
|
||||
if(!CollectionUtils.isEmpty(workTypes)) {
|
||||
for (int i = 0; i < workTypes.size(); i++) {
|
||||
ItemVo itemVo = new ItemVo();
|
||||
itemVo.setId(i + 1);
|
||||
itemVo.setCode(workTypes.get(i).getValue());
|
||||
itemVo.setName(workTypes.get(i).getText());
|
||||
itemVos.add(itemVo);
|
||||
}
|
||||
}
|
||||
map.put(NormalExcelConstants.DATA_LIST, itemVos);
|
||||
mapList.add(map);
|
||||
//婚姻状况
|
||||
map = Maps.newHashMap();
|
||||
exportParams = new ExportParams("婚姻状况数据查询", "婚姻状况查询范围");
|
||||
@@ -534,25 +495,6 @@ public class HealthUserEmployeeExController extends JeecgController<HealthUserEm
|
||||
}
|
||||
map.put(NormalExcelConstants.DATA_LIST, itemVos);
|
||||
mapList.add(map);
|
||||
//职称
|
||||
map = Maps.newHashMap();
|
||||
exportParams = new ExportParams("职称数据查询", "职称查询范围");
|
||||
//表格对应实体
|
||||
map.put(NormalExcelConstants.PARAMS, exportParams);
|
||||
map.put(NormalExcelConstants.CLASS, ItemVo.class);
|
||||
List<DictModel> eTitles = dictCacheManager.queryDictItemsByCode("e_title");
|
||||
itemVos = Lists.newArrayList();
|
||||
if(!CollectionUtils.isEmpty(eTitles)) {
|
||||
for (int i = 0; i < eTitles.size(); i++) {
|
||||
ItemVo itemVo = new ItemVo();
|
||||
itemVo.setId(i + 1);
|
||||
itemVo.setCode(eTitles.get(i).getValue());
|
||||
itemVo.setName(eTitles.get(i).getText());
|
||||
itemVos.add(itemVo);
|
||||
}
|
||||
}
|
||||
map.put(NormalExcelConstants.DATA_LIST, itemVos);
|
||||
mapList.add(map);
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
//此处设置的filename无效 ,前端会重更新设置一下
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "员工信息导入模版");
|
||||
@@ -586,7 +528,7 @@ public class HealthUserEmployeeExController extends JeecgController<HealthUserEm
|
||||
try {
|
||||
String taskCode = SystemConstant.TASK_IMPORT_USER_EMP_INFO;
|
||||
String importTitle = "员工信息导入";
|
||||
return importsUtilService.importExcelReflectDetail(file,params, UserEmployeeVo.class,taskCode,importTitle, commonImportsOption);
|
||||
return importsUtilService.importExcelReflectDetail(file,params, UserEmployeeImportVo.class,taskCode,importTitle, commonImportsOption);
|
||||
} catch (Exception e) {
|
||||
log.error("员工信息导入失败!" + e.getMessage(), e);
|
||||
return Result.error("员工信息数据导入失败!");
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public interface IHealthUserEmployeeExService extends IService<HealthUserEmploye
|
||||
// 导出员工清单完成
|
||||
String FINISH = "8";
|
||||
|
||||
IPage<UserEmployee> selectHealthUserEmployeeExList(Page page, UserFilter filter);
|
||||
IPage<UserEmployee> selectHealthUserEmployeeExList(Page page, UserFilter filter,Integer idStatus);
|
||||
|
||||
IPage<UserEmployee> selectHealthUserEmployeeExListAll(Page page, UserFilter filter);
|
||||
|
||||
|
||||
+33
-46
@@ -3,10 +3,7 @@ package org.jeecg.modules.system.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.*;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -67,6 +64,7 @@ import org.jeecg.modules.system.mapper.*;
|
||||
import org.jeecg.modules.system.service.*;
|
||||
import org.jeecg.modules.system.vo.NoSelfManagerUser;
|
||||
import org.jeecg.modules.system.vo.SysDepartVo;
|
||||
import org.jeecg.modules.system.vo.UserEmployeeImportVo;
|
||||
import org.jeecg.modules.system.vo.UserEmployeeVo;
|
||||
import org.jeecg.redis.RedisStreamKeyEnum;
|
||||
import org.jeecg.redis.RedisStreamUtil;
|
||||
@@ -184,7 +182,7 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<UserEmployee> selectHealthUserEmployeeExList(Page page, UserFilter filter) {
|
||||
public IPage<UserEmployee> selectHealthUserEmployeeExList(Page page, UserFilter filter,Integer idStatus) {
|
||||
//四级单位判断
|
||||
if (StringUtil.isNotBlank(filter.getDeptCode())) {
|
||||
filter.setOrgCode(filter.getDeptCode());
|
||||
@@ -228,6 +226,10 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
|
||||
//根据身份证号获取年龄
|
||||
userEmployee.setAge(IdcardUtil.getAgeByIdCard(userEmployee.getIdCard()));
|
||||
}
|
||||
//新疆项目需要身份证脱敏处理
|
||||
if(null != idStatus && idStatus == 1){
|
||||
userEmployee.setIdCard(DesensitizedUtil.idCardNum(userEmployee.getIdCard(),3,3));
|
||||
}
|
||||
});
|
||||
return userEmployeeIPage;
|
||||
}
|
||||
@@ -848,7 +850,9 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
|
||||
extension.setId(userId);
|
||||
extension.setCreatedon(new Date());
|
||||
// 添加当前年龄
|
||||
extension.setCurrentAge(GlobalUtils.getAgeByIdCard(userEmployee.getIdCard()));
|
||||
if(StrUtil.isNotEmpty(userEmployee.getIdCard())){
|
||||
extension.setCurrentAge(GlobalUtils.getAgeByIdCard(userEmployee.getIdCard()));
|
||||
}
|
||||
int i = healthUserEmployeeExMapper.insert(extension);
|
||||
// 保存员工岗位信息,其他用户类型无岗位
|
||||
SysUserPost sysUserPost = new SysUserPost();
|
||||
@@ -1170,7 +1174,7 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
|
||||
}
|
||||
|
||||
StringBuilder sd = new StringBuilder();
|
||||
UserEmployeeVo userEmployeeVo = new UserEmployeeVo();
|
||||
UserEmployeeImportVo userEmployeeVo = new UserEmployeeImportVo();
|
||||
ReflectHelper reflectHelperDetail = new ReflectHelper(detail);
|
||||
ReflectHelper reflectHelperExcel = new ReflectHelper(userEmployeeVo);
|
||||
Object[] objects = ReflectHelper.getFiledName(userEmployeeVo);
|
||||
@@ -1224,47 +1228,33 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
|
||||
sd.append("上传的部门错误,上传单位不存在该部门!");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(userEmployeeVo.getIdCard())
|
||||
|| StrUtil.isBlank(userEmployeeVo.getUsername())
|
||||
if (StrUtil.isBlank(userEmployeeVo.getRealname())
|
||||
|| StrUtil.isBlank(userEmployeeVo.getEmpSysno())
|
||||
|| StrUtil.isBlank(userEmployeeVo.getSex())) {
|
||||
sd.append("上传的身份证号、登录账号、员工工号、性别不能为空!");
|
||||
sd.append("上传的员工姓名、员工工号、性别不能为空!");
|
||||
}
|
||||
if (StrUtil.isBlank(userEmployeeVo.getPhone())
|
||||
|| StrUtil.isBlank(userEmployeeVo.getEmpNation())
|
||||
|| StrUtil.isBlank(userEmployeeVo.getEmpType())
|
||||
|| StrUtil.isBlank(userEmployeeVo.getEmpJob())) {
|
||||
sd.append("上传的手机号码、民族信息、合同类型、职务级别不能为空!");
|
||||
}
|
||||
if (StrUtil.isBlank(userEmployeeVo.getEmpDegree())
|
||||
|| StrUtil.isBlank(userEmployeeVo.getMedicalWorkTypeCode())
|
||||
|| StrUtil.isBlank(userEmployeeVo.getEmpMarriage())) {
|
||||
sd.append("上传的学历、职业工种、婚姻状况不能为空!");
|
||||
}
|
||||
// if (!IdcardUtil.isValidCard(userEmployeeVo.getIdCard())) {
|
||||
// sd.append("身份证号不合法!");
|
||||
// }
|
||||
//校验上传的账号是否有存在的
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
list.add(userEmployeeVo.getUsername());
|
||||
list.add(userEmployeeVo.getEmpSysno());
|
||||
} else {
|
||||
if (list.contains(userEmployeeVo.getUsername())) {
|
||||
sd.append("上传文件的登录账号重复!");
|
||||
if (list.contains(userEmployeeVo.getEmpSysno())) {
|
||||
sd.append("上传文件中存在重复的工号!");
|
||||
} else {
|
||||
list.add(userEmployeeVo.getUsername());
|
||||
list.add(userEmployeeVo.getEmpSysno());
|
||||
}
|
||||
}
|
||||
//校验账号是否存在
|
||||
List<SysUser> users = sysUserService.lambdaQuery().eq(SysUser::getUsername, userEmployeeVo.getUsername()).list();
|
||||
if (CollectionUtil.isNotEmpty(users)) {
|
||||
sd.append("该登录账号已存在!");
|
||||
//校验账号是否存在(登录账号为非必填, 若不填使用工号作为员工登录账号)
|
||||
String userName = StrUtil.isEmpty(userEmployeeVo.getUsername())? userEmployeeVo.getEmpSysno() : userEmployeeVo.getUsername();
|
||||
boolean noExists = sysUserService.lambdaQuery().eq(SysUser::getUsername,userName).or().eq(SysUser::getWorkNo,userEmployeeVo.getEmpSysno()).exists();
|
||||
if (noExists) {
|
||||
sd.append("该登录账号或工号已存在!");
|
||||
}
|
||||
//校验身份证是否存在
|
||||
SysUser sysUser = sysUserService.queryUserByCardId(userEmployeeVo.getIdCard());
|
||||
if (Objects.nonNull(sysUser)) {
|
||||
sd.append("该身份证号已存在!");
|
||||
}
|
||||
if (validateMobilePhone(userEmployeeVo.getPhone())) {
|
||||
if (StrUtil.isNotEmpty(userEmployeeVo.getPhone()) && validateMobilePhone(userEmployeeVo.getPhone())) {
|
||||
sd.append("手机号不合规!");
|
||||
}
|
||||
//字典校验
|
||||
@@ -1283,21 +1273,11 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
|
||||
if (StrUtil.isBlank(nation)) {
|
||||
sd.append("民族信息不符合规范,参见字典说明!");
|
||||
}
|
||||
//合同类型
|
||||
String contract = dictCacheManager.queryDictTextByKey("contract", userEmployeeVo.getEmpType());
|
||||
if (StrUtil.isBlank(contract)) {
|
||||
sd.append("合同类型不符合规范,参见字典说明!");
|
||||
}
|
||||
//职务级别
|
||||
String eJob = dictCacheManager.queryDictTextByKey("e_job", userEmployeeVo.getEmpJob());
|
||||
if (StrUtil.isBlank(eJob)) {
|
||||
sd.append("职务级别不符合规范,参见字典说明!");
|
||||
}
|
||||
//工种
|
||||
String workType = dictCacheManager.queryDictTextByKey("work_type", userEmployeeVo.getMedicalWorkTypeCode());
|
||||
if (StrUtil.isBlank(workType)) {
|
||||
sd.append("职业工种符合规范,参见字典说明!");
|
||||
}
|
||||
//婚姻状态
|
||||
String mrState = dictCacheManager.queryDictTextByKey("mr_state", userEmployeeVo.getEmpMarriage());
|
||||
if (StrUtil.isBlank(mrState)) {
|
||||
@@ -1356,7 +1336,7 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
|
||||
info.setHandleMsg(statusIndex + "/" + detailList.size());
|
||||
importsController.editInfo(info);
|
||||
}
|
||||
UserEmployeeVo userEmployeeVo = new UserEmployeeVo();
|
||||
UserEmployeeImportVo userEmployeeVo = new UserEmployeeImportVo();
|
||||
ReflectHelper reflectHelperDetail = new ReflectHelper(detail);
|
||||
ReflectHelper reflectHelperExcel = new ReflectHelper(userEmployeeVo);
|
||||
Object[] objects = ReflectHelper.getFiledName(userEmployeeVo);
|
||||
@@ -1386,14 +1366,20 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
|
||||
BeanUtils.copyProperties(userEmployeeVo, userEmployee);
|
||||
BeanUtils.copyProperties(userEmployeeVo, userEmployeeEx);
|
||||
userEmployee.setExtension(userEmployeeEx);
|
||||
//如果不传登录用户名 ,使用工号作为登录用户名
|
||||
if(StrUtil.isEmpty(userEmployee.getUsername())){
|
||||
userEmployee.setUsername(userEmployeeVo.getEmpSysno());
|
||||
}
|
||||
//新增随机密码
|
||||
userEmployee.setPassword(generateDefaultPassword(userEmployeeVo.getIdCard(), userEmployeeVo.getUsername()));
|
||||
userEmployee.setPassword(userEmployee.getUsername() + "@W123456");
|
||||
//新增sex
|
||||
if (StrUtil.isNotBlank(userEmployeeVo.getSex())) {
|
||||
userEmployee.setSex(Integer.parseInt(userEmployeeVo.getSex()));
|
||||
}
|
||||
//根据身份证号获取年龄
|
||||
userEmployee.setAge(IdcardUtil.getAgeByIdCard(userEmployee.getIdCard()));
|
||||
if(StrUtil.isNotEmpty(userEmployee.getIdCard())){
|
||||
userEmployee.setAge(IdcardUtil.getAgeByIdCard(userEmployee.getIdCard()));
|
||||
}
|
||||
//调用新增service
|
||||
boolean success = saveAndUser(userEmployee);
|
||||
if (success) {
|
||||
@@ -1410,6 +1396,7 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
|
||||
} catch (Exception ex) {
|
||||
info.setImportStatus(ImportConstant.UPDATE_FAILED);
|
||||
info.setImportMsg("更新失败==" + ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
importsController.editInfo(info);
|
||||
}
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package org.jeecg.modules.system.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class UserEmployeeImportVo implements Serializable {
|
||||
|
||||
@Excel(name = "登录账号", width = 18)
|
||||
private String username;
|
||||
@Excel(name = "真实姓名", width = 15)
|
||||
private String realname;
|
||||
@Excel(name = "性别(必填)", width = 15, dicCode = "sex2")
|
||||
private String sex;
|
||||
@Excel(name = "员工编号(必填)", width = 18)
|
||||
private String empSysno;
|
||||
@Excel(name = "身份证号", width = 18)
|
||||
private String idCard;
|
||||
@Excel(name = "单位(必填)", width = 15)
|
||||
private String unit;
|
||||
@Excel(name = "部门(必填)", width = 18)
|
||||
private String depart;
|
||||
@Excel(name = "出生日期", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date birthday;
|
||||
@Excel(name = "手机号", width = 15)
|
||||
private String phone;
|
||||
@Excel(name = "邮箱", width = 15)
|
||||
private String email;
|
||||
@Excel(name = "职务", width = 18, dicCode = "e_job")
|
||||
private String empJob;
|
||||
@Excel(name = "民族", width = 15, dicCode = "nation")
|
||||
private String empNation;
|
||||
@Excel(name = "学历", width = 15, dicCode = "emp_education")
|
||||
private String empDegree;
|
||||
@Excel(name = "婚姻状况", width = 18, dicCode = "mr_state")
|
||||
private String empMarriage;
|
||||
@Excel(name = "籍贯", width = 15)
|
||||
private String empNativeplace;
|
||||
}
|
||||
Reference in New Issue
Block a user