Commit cceba6d2 authored by hongguangwu's avatar hongguangwu

人员档案-批量导入

parent f3237aa3
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.entity; package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
...@@ -342,5 +343,22 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -342,5 +343,22 @@ public class TEmployeeInfo extends BaseEntity {
@Schema(description = "通信地址") @Schema(description = "通信地址")
private String contactAddress; private String contactAddress;
// 以下是项目档案信息
@TableField(exist = false)
@Schema(description = "项目id")
private String deptId;
@TableField(exist = false)
@Schema(description = "项目名称")
private String deptName;
@TableField(exist = false)
@Schema(description = "项目编码")
private String deptNo;
@TableField(exist = false)
@Schema(description = "就职岗位")
private String post;
} }
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 项目档案表excel对应的实体
*
* @author huyc
* @date 2022-06-20 17:54:40
*/
@Data
@ColumnWidth(30)
public class EmployeeVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工类型(字典值,0外包1派遣2代理)
*/
@NotNull(message = "员工类型不能为空")
@ExcelProperty(value = "员工类型")
private String empNatrue;
/**
* 姓名
*/
@ExcelProperty(value = "姓名")
@Max(value = 20, message = "姓名不可超过20位")
private String empName;
/**
* 身份证号
*/
@ExcelProperty(value = "身份证号")
@Max(value = 20, message = "身份证号不可超过20位")
private String empIdcard;
/**
* 项目编码
*/
@ExcelProperty(value = "项目编码")
@Max(value = 32, message = "项目编码不可超过32位")
private String deptNo;
/**
* 就职岗位
*/
@ExcelProperty(value = "就职岗位")
@Max(value = 50, message = "就职岗位不可超过50位")
private String post;
/**
* 身份证有效期起
*/
@ExcelProperty(value = "身份证开始日期")
private LocalDateTime validityStart;
/**
* 身份证有效期止
*/
@ExcelProperty(value = "身份证截止日期")
private LocalDateTime validityEnd;
/**
* 婚姻状况
*/
@ExcelProperty(value = "婚姻状况")
@Max(value = 32, message = "婚姻状况不可超过32位")
private String empMarriStatus;
/**
* 民族
*/
@ExcelProperty(value = "民族")
@Max(value = 32, message = "民族不可超过32位")
private String empNational;
/**
* 政治面貌
*/
@ExcelProperty(value = "政治面貌")
@Max(value = 32, message = "政治面貌不可超过32位")
private String politicalStatus;
/**
* 手机号码
*/
@ExcelProperty(value = "手机号码")
@Max(value = 11, message = "手机号码不可超过11位")
private String empPhone;
/**
* 邮箱
*/
@ExcelProperty(value = "邮箱")
@Max(value = 32, message = "邮箱不可超过32位")
private String empEmail;
/**
* 身份证-省
*/
@ExcelProperty(value = "户籍所在省")
private String idProvince;
/**
* 身份证-市
*/
@ExcelProperty(value = "户籍所在市")
private String idCity;
/**
* 身份证-县
*/
@ExcelProperty(value = "户籍所在县")
private String idTown;
/**
* 户口性质
*/
@ExcelProperty(value = "户口性质")
private String empRegisType;
/**
* 档案-省
*/
@ExcelProperty(value = "档案所在省")
private String fileProvince;
/**
* 档案-市
*/
@ExcelProperty(value = "档案所在市")
private String fileCity;
/**
* 档案-县
*/
@ExcelProperty(value = "档案所在县")
private String fileTown;
/**
* 是否大专及以上(0否1是)
*/
@ExcelProperty(value = "是否大专及以上")
private String isCollege;
/**
* 最高学历(字典值)
*/
@ExcelProperty(value = "最高学历")
private String hignEducation;
/**
* 学校
*/
@ExcelProperty(value = "学校")
private String school;
/**
* 专业
*/
@ExcelProperty(value = "专业")
private String major;
/**
* 入学时间
*/
@ExcelProperty(value = "入学时间")
private LocalDateTime admissionDate;
/**
* 毕业时间
*/
@ExcelProperty(value = "毕业时间")
private LocalDateTime gradutionDate;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}
...@@ -19,9 +19,14 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller; ...@@ -19,9 +19,14 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserInfo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpFamilyExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
...@@ -39,6 +44,7 @@ import org.springframework.cache.Cache; ...@@ -39,6 +44,7 @@ import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper; import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
...@@ -229,4 +235,20 @@ public class TEmployeeInfoController { ...@@ -229,4 +235,20 @@ public class TEmployeeInfoController {
return tEmployeeInfoService.minusEmployee(id); return tEmployeeInfoService.minusEmployee(id);
} }
/**
* @param excelList
* @param bindingResult
* @Description: 批量导入人员档案
* @Author: hgw
* @Date: 2022/6/22 11:57
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>>
**/
@Operation(description = "批量导入人员档案 hasPermission('employee_batch_import') 额外属性:isCanAdd:0不可以复档复项;1允许复档复项")
@SysLog("批量导入人员档案")
@PostMapping("/batchImportEmployee")
@PreAuthorize("@pms.hasPermission('employee_batch_import')")
public R<List<ErrorMessage>> batchImportEmployee(@RequestExcel List<EmployeeVO> excelList, BindingResult bindingResult, @RequestParam Integer isCanAdd) {
return tEmployeeInfoService.batchImportEmployee(excelList, bindingResult, isCanAdd);
}
} }
...@@ -40,6 +40,12 @@ public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> { ...@@ -40,6 +40,12 @@ public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> {
List<TEmployeeInfo> getList(@Param("tEmployeeInfo") TEmployeeInfo tEmployeeInfo); List<TEmployeeInfo> getList(@Param("tEmployeeInfo") TEmployeeInfo tEmployeeInfo);
// hgw 2022-6-22 15:32:39 根据身份证查询一批档案
List<TEmployeeInfo> getListByIdCard(@Param("idCardList") List<String> idCardList);
// hgw 2022-6-22 15:32:39 根据手机号查询一批档案
List<TEmployeeInfo> getListByPhone(@Param("phoneList") List<String> phoneList);
int updateEducationOfEmp(@Param("education") EmpEducationUpdateVo education); int updateEducationOfEmp(@Param("education") EmpEducationUpdateVo education);
void updateExcelEmployeeInfo(@Param("list") List<TEmployeeInfo> list); void updateExcelEmployeeInfo(@Param("list") List<TEmployeeInfo> list);
......
...@@ -20,9 +20,12 @@ package com.yifu.cloud.plus.v1.yifu.archives.service; ...@@ -20,9 +20,12 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
import java.util.List; import java.util.List;
...@@ -101,7 +104,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> { ...@@ -101,7 +104,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
/** /**
* @param employeeInfo 档案信息 * @param employeeInfo 档案信息
* @param fileSource 人员档案来源(4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬) * @param fileSource 人员档案来源(4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)
* @Description: 新增人员档案,其他服务新增时调用 * @Description: 新增人员档案,其他服务新增时调用
* @Author: hgw * @Author: hgw
* @Date: 2022/6/21 19:03 * @Date: 2022/6/21 19:03
...@@ -109,5 +112,13 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> { ...@@ -109,5 +112,13 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
**/ **/
R<TEmployeeInfo> saveNewEmpLoyee(TEmployeeInfo employeeInfo, String fileSource); R<TEmployeeInfo> saveNewEmpLoyee(TEmployeeInfo employeeInfo, String fileSource);
/**
* @Description: 批量导入人员档案
* @Author: hgw
* @Date: 2022/6/22 11:58
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>>
**/
R<List<ErrorMessage>> batchImportEmployee(List<EmployeeVO> excelVOList, BindingResult bindingResult, int isCanAdd);
void updateEducationOfEmp(EmpEducationUpdateVo education); void updateEducationOfEmp(EmpEducationUpdateVo education);
} }
...@@ -53,6 +53,16 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> { ...@@ -53,6 +53,16 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
**/ **/
List<TEmployeeProject> getListByEmpId(String empId, int projectStatus); List<TEmployeeProject> getListByEmpId(String empId, int projectStatus);
/**
* @param empId
* @param deptNo
* @Description: 获取档案下的项目信息
* @Author: hgw
* @Date: 2022/6/22 17:48
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject>
**/
List<TEmployeeProject> getListByEmpIdAndDeptNo(String empId, String deptNo);
R<List<ErrorMessage>> importEmpProjectUpdate(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult); R<List<ErrorMessage>> importEmpProjectUpdate(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult);
/** /**
......
...@@ -16,26 +16,41 @@ ...@@ -16,26 +16,41 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.archives.service.impl; package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpFamily;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpFamilyExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.cache.Cache; import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult;
import java.util.List; import java.util.*;
/** /**
* 人员档案表 * 人员档案表
...@@ -50,6 +65,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -50,6 +65,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 缓存信息 // 缓存信息
private final CacheManager cacheManager; private final CacheManager cacheManager;
private final TEmployeeProjectService tEmployeeProjectService; private final TEmployeeProjectService tEmployeeProjectService;
private final DaprCheckProperties daprCheckProperties;
private final DaprUpmsProperties daprUpmsProperties;
@Override @Override
public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) { public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) {
...@@ -72,8 +89,21 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -72,8 +89,21 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return new R<>(CommonConstants.dingleDigitIntArray[2], "该人员在离职库已存在,是否'恢复档案'?", employeeInfo); return new R<>(CommonConstants.dingleDigitIntArray[2], "该人员在离职库已存在,是否'恢复档案'?", employeeInfo);
} }
} else { } else {
// TODO - 调用校验服务 // 调用校验服务
TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(employeeInfo.getEmpName());
checkIdCard.setIdCard(employeeInfo.getEmpIdcard());
List<TCheckIdCard> checkList = new ArrayList<>();
checkList.add(checkIdCard);
R<List<TCheckIdCard>> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckidcard/inner/checkIdCard", checkList, TCheckIdCard.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
for (TCheckIdCard check : checkListR.getData()) {
if (check.getIsTrue() == CommonConstants.ZERO_INT) {
return R.failed(check.getReason());
}
}
}
return R.ok(); return R.ok();
} }
} }
...@@ -131,7 +161,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -131,7 +161,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 获取项目档案,传参0,过滤项目状态 // 获取项目档案,传参0,过滤项目状态
List<TEmployeeProject> projectList = tEmployeeProjectService.getListByEmpId(id, CommonConstants.ZERO_INT); List<TEmployeeProject> projectList = tEmployeeProjectService.getListByEmpId(id, CommonConstants.ZERO_INT);
if (projectList != null && !projectList.isEmpty()) { if (projectList != null && !projectList.isEmpty()) {
return R.failed("还有["+projectList+"]条项目未减项,请先去减项!"); return R.failed("还有[" + projectList + "]条项目未减项,请先去减项!");
} }
employee.setFileStatus(CommonConstants.ONE_INT); employee.setFileStatus(CommonConstants.ONE_INT);
this.updateById(employee); this.updateById(employee);
...@@ -155,28 +185,18 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -155,28 +185,18 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return R.ok(); return R.ok();
} }
/** /**
* @param employeeInfo 姓名、身份证、手机号、员工类型 * @param employeeInfo 姓名、身份证、手机号、员工类型
* @param fileSource 4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬 * @param fileSource 4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬
* @Description: 新增档案 * @Description: 新增档案
* @Author: hgw * @Author: hgw
* @Date: 2022/6/21 18:07 * @Date: 2022/6/21 18:07
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo>
**/ **/
public R<TEmployeeInfo> saveNewEmpLoyee(TEmployeeInfo employeeInfo, String fileSource) { public R<TEmployeeInfo> saveNewEmpLoyee(TEmployeeInfo employeeInfo, String fileSource) {
if (Common.isEmpty(employeeInfo.getEmpName())) { R<TEmployeeInfo> failed = this.checkEmployeeInfoR(employeeInfo);
return R.failed("员工姓名必填!"); if (failed != null) return failed;
}
if (Common.isEmpty(employeeInfo.getEmpIdcard())) {
return R.failed("员工身份证必填!");
}
if (Common.isEmpty(employeeInfo.getEmpPhone())) {
return R.failed("手机号必填!");
}
if (Common.isEmpty(employeeInfo.getEmpNatrue())) {
return R.failed("员工类型必填!");
}
if (Common.isEmpty(fileSource)) { if (Common.isEmpty(fileSource)) {
return R.failed("人员档案来源必填!(4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)"); return R.failed("人员档案来源必填!(4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)");
} }
...@@ -199,8 +219,16 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -199,8 +219,16 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) {
return R.failed("该手机号已被使用!"); return R.failed("该手机号已被使用!");
} }
// TODO - 调用校验服务-校验手机号 // 调用校验服务-校验手机号
R<Map<String, TCheckMobile>> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkMobiles", employeeInfo.getEmpPhone(), TCheckMobile.class, SecurityConstants.FROM_IN);
if (checkMobileR != null && checkMobileR.getData() != null) {
for (TCheckMobile checkMobile : checkMobileR.getData().values()) {
if (!CommonConstants.ONE_STRING.equals(checkMobile.getStatus())) {
return R.failed("手机号校验错误!");
}
}
}
} }
// 字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬 // 字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬
employeeInfo.setFileSource(fileSource); employeeInfo.setFileSource(fileSource);
...@@ -210,21 +238,428 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -210,21 +238,428 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
employeeInfo.setDeleteFlag(CommonConstants.STATUS_NORMAL); employeeInfo.setDeleteFlag(CommonConstants.STATUS_NORMAL);
// 生成主码: // 生成主码:
if (Common.isEmpty(employeeInfo.getEmpCode())) { if (Common.isEmpty(employeeInfo.getEmpCode())) {
String nowDay = DateUtil.getThisDay(); employeeInfo.setEmpCode(this.getCode());
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CODE);
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (!Common.isEmpty(nowNumObj)) {
nowNums = (Integer) nowNumObj + 1;
}
cache.put(nowDay, nowNums);
String numStr = this.getFiveNum(String.valueOf(nowNums));
employeeInfo.setEmpCode(numStr);
} }
this.save(employeeInfo); this.save(employeeInfo);
return R.ok(employeeInfo); return R.ok(employeeInfo);
} }
/**
* @param employeeInfo
* @Description: 校验空值
* @Author: hgw
* @Date: 2022/6/22 17:14
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo>
**/
private R<TEmployeeInfo> checkEmployeeInfoR(TEmployeeInfo employeeInfo) {
if (Common.isEmpty(employeeInfo.getEmpName())) {
return R.failed("员工姓名必填!");
}
if (Common.isEmpty(employeeInfo.getEmpIdcard())) {
return R.failed("员工身份证必填!");
}
if (Common.isEmpty(employeeInfo.getEmpPhone())) {
return R.failed("手机号必填!");
}
if (Common.isEmpty(employeeInfo.getEmpNatrue())) {
return R.failed("员工类型必填!");
}
return null;
}
private R<TEmployeeInfo> checkEmployeeVOR(EmployeeVO employeeInfo) {
if (Common.isEmpty(employeeInfo.getEmpIdcard())) {
return R.failed("员工身份证必填!");
}
if (Common.isEmpty(employeeInfo.getDeptNo())) {
return R.failed("项目编码必填!");
}
if (Common.isEmpty(employeeInfo.getEmpName())) {
return R.failed("员工姓名必填!");
}
if (Common.isEmpty(employeeInfo.getEmpPhone())) {
return R.failed("手机号必填!");
}
if (Common.isEmpty(employeeInfo.getEmpNatrue())) {
return R.failed("员工类型必填!");
}
return null;
}
@Override
public R<List<ErrorMessage>> batchImportEmployee(List<EmployeeVO> excelVOList, BindingResult bindingResult, int isCanAdd) {
if (excelVOList == null || excelVOList.isEmpty()) {
return R.failed("数据不可为空");
}
// 通用校验获取失败的数据
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
if (Common.isNotNull(errorMessageList)) {
errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(), errorMessage));
}
// 获取身份证、手机号列表,批量查询档案
List<String> idCardList = new ArrayList<>();
List<String> phoneList = new ArrayList<>();
Map<String, Integer> idCardMap = new HashMap<>();
String idCard;
for (int i = 0; i < excelVOList.size(); i++) {
// 判空
R<TEmployeeInfo> failed = this.checkEmployeeVOR(excelVOList.get(i));
if (failed != null) errorMsgMap.put((i + 2L), new ErrorMessage(failed.getMsg()));
idCard = excelVOList.get(i).getEmpIdcard();
if (Common.isEmpty(idCard)) {
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行身份证号为空!"));
} else {
if (idCardMap.get(idCard) != null) {
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行身份证号与第" + idCardMap.get(idCard) + "行重复!"));
} else {
idCardMap.put(idCard, i + 2);
idCardList.add(idCard);
}
}
if (Common.isEmpty(excelVOList.get(i).getEmpPhone())) {
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行手机号码为空!"));
} else {
phoneList.add(excelVOList.get(i).getEmpPhone());
}
}
// 查找档案库
Map<String, TEmployeeInfo> existEmpMap = new HashMap<>();
Map<String, TEmployeeInfo> existPhoneMap = new HashMap<>();
if (!idCardList.isEmpty()) {
List<TEmployeeInfo> cards = baseMapper.getListByIdCard(idCardList);
for (TEmployeeInfo employeeInfo : cards) {
existEmpMap.put(employeeInfo.getEmpIdcard(), employeeInfo);
}
}
if (!phoneList.isEmpty()) {
List<TEmployeeInfo> phones = baseMapper.getListByPhone(phoneList);
for (TEmployeeInfo employeeInfo : phones) {
existPhoneMap.put(employeeInfo.getEmpPhone(), employeeInfo);
}
}
// 个性化校验逻辑
Set<String> errorMsg;
EmployeeVO excel;
// 已存在的档案信息
TEmployeeInfo existEmp;
// 需要保存的档案信息
TEmployeeInfo saveEmp;
// 存储可保存的档案信息
List<TEmployeeInfo> saveList = new ArrayList<>();
// 调用字典服务,渲染字典值
R<Map<String, Map<String, String>>> dictR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dict/inner/getDictToLable", null, Map.class, SecurityConstants.FROM_IN);
Map<String, Map<String, String>> dictMap;
// 婚姻状况
Map<String, String> empMarriMap;
// 民族
Map<String, String> empNationalMap;
// 政治面貌
Map<String, String> empPoliticalMap;
// 户口性质
Map<String, String> regisTypeMap;
// 最高学历
Map<String, String> educationMap;
// 员工类型
Map<String, String> empNatrueMap;
if (dictR == null ) {
return R.failed("获取字典失败!");
} else {
dictMap = dictR.getData();
empMarriMap = dictMap.get("emp_married");
empNationalMap = dictMap.get("emp_national");
empPoliticalMap = dictMap.get("emp_political");
regisTypeMap = dictMap.get("emp_registype");
educationMap = dictMap.get("education");
empNatrueMap = dictMap.get("emp_natrue");
}
// 调用区域服务,渲染区域值
R<Map<String, String>> areaR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/area/inner/getAreaToName", null, Map.class, SecurityConstants.FROM_IN);
Map<String, String> areaMap = new HashMap<>();
if (areaR == null ) {
return R.failed("获取区域失败!");
} else {
areaMap = areaR.getData();
}
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
if (Common.isNotNull(errorMsgMap.get((i + 2L)))) {
continue;
}
saveEmp = new TEmployeeInfo();
errorMsg = new HashSet<>();
excel = excelVOList.get(i);
existEmp = existEmpMap.get(excel.getEmpIdcard());
// 档案存在
if (existEmp != null) {
// 档案在职
if (existEmp.getFileStatus() == CommonConstants.ZERO_INT) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_EXISTING, excel.getEmpIdcard()));
} else if (isCanAdd == 0) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_LEAVE_EXISTING, excel.getEmpIdcard()));
} else {
saveEmp = existEmp;
}
} else {
// 档案不存在
// 校验身份证实名
TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(excel.getEmpName());
checkIdCard.setIdCard(excel.getEmpIdcard());
List<TCheckIdCard> checkList = new ArrayList<>();
checkList.add(checkIdCard);
R<List<TCheckIdCard>> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckidcard/inner/checkIdCard", checkList, TCheckIdCard.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
for (TCheckIdCard check : checkListR.getData()) {
if (check.getIsTrue() == CommonConstants.ZERO_INT) {
errorMsg.add(check.getReason());
break;
}
}
}
saveEmp.setEmpName(excel.getEmpName());
saveEmp.setEmpIdcard(excel.getEmpIdcard());
// 校验手机号
existEmp = existPhoneMap.get(excel.getEmpPhone());
// 手机号已存在
if (existEmp != null) {
// 非自己使用的
if (!existEmp.getEmpIdcard().equals(excel.getEmpPhone())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR, existEmp.getEmpIdcard()));
}
} else {
R<Map<String, TCheckMobile>> checkMobileR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkMobiles", excel.getEmpPhone(), TCheckMobile.class, SecurityConstants.FROM_IN);
if (checkMobileR != null && checkMobileR.getData() != null) {
for (TCheckMobile check : checkMobileR.getData().values()) {
if (!CommonConstants.ONE_STRING.equals(check.getStatus())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_PHONE_CHECK_ERROR, excel.getEmpIdcard()));
break;
}
}
}
}
// 校验字典数据是否正确-婚姻
if (Common.isNotNull(excel.getEmpMarriStatus())) {
if (empMarriMap.get(excel.getEmpMarriStatus()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_MARRIED_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setEmpMarriStatus(empMarriMap.get(excel.getEmpMarriStatus()));
}
}
// 校验字典数据是否正确-民族
if (Common.isNotNull(excel.getEmpNational())) {
if (empNationalMap.get(excel.getEmpNational()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_NATIONAL_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setEmpNational(empNationalMap.get(excel.getEmpNational()));
}
}
// 校验字典数据是否正确-政治面貌
if (Common.isNotNull(excel.getPoliticalStatus())) {
if (empPoliticalMap.get(excel.getPoliticalStatus()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_POLITICAL_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setPoliticalStatus(empPoliticalMap.get(excel.getPoliticalStatus()));
}
}
// 校验字典数据是否正确-户口性质
if (Common.isNotNull(excel.getEmpRegisType())) {
if (regisTypeMap.get(excel.getEmpRegisType()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_REGISTYPE_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setEmpRegisType(regisTypeMap.get(excel.getEmpRegisType()));
}
}
// 校验字典数据是否正确-最高学历
if (Common.isNotNull(excel.getHignEducation())) {
if (educationMap.get(excel.getHignEducation()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_EDUCATION_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setHignEducation(educationMap.get(excel.getHignEducation()));
}
}
// 校验字典数据是否正确-员工类型
if (Common.isNotNull(excel.getEmpNatrue())) {
if (empNatrueMap.get(excel.getEmpNatrue()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_NATRUE_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setEmpNatrue(empNatrueMap.get(excel.getEmpNatrue()));
}
}
saveEmp.setValidityStart(excel.getValidityStart());
saveEmp.setValidityEnd(excel.getValidityEnd());
saveEmp.setEmpPhone(excel.getEmpPhone());
saveEmp.setEmpEmail(excel.getEmpEmail());
// 户籍所在地
if (Common.isNotNull(excel.getIdProvince())) {
if (areaMap.get(excel.getIdProvince()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setIdProvince(Integer.parseInt(areaMap.get(excel.getIdProvince())));
}
}
if (Common.isNotNull(excel.getIdCity())) {
if (areaMap.get(excel.getIdCity()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setIdCity(Integer.parseInt(areaMap.get(excel.getIdCity())));
}
}
if (Common.isNotNull(excel.getIdTown())) {
if (areaMap.get(excel.getIdTown()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setIdTown(Integer.parseInt(areaMap.get(excel.getIdTown())));
}
}
// 档案所在地
if (Common.isNotNull(excel.getFileProvince())) {
if (areaMap.get(excel.getFileProvince()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_FILE_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setFileProvince(Integer.parseInt(areaMap.get(excel.getFileProvince())));
}
}
if (Common.isNotNull(excel.getFileCity())) {
if (areaMap.get(excel.getFileCity()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_FILE_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setFileCity(Integer.parseInt(areaMap.get(excel.getFileCity())));
}
}
if (Common.isNotNull(excel.getFileTown())) {
if (areaMap.get(excel.getFileTown()) == null) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_FILE_AREA_ERROR, excel.getEmpIdcard()));
} else {
saveEmp.setFileTown(Integer.parseInt(areaMap.get(excel.getFileTown())));
}
}
if (Common.isNotNull(excel.getIsCollege())) {
if (CommonConstants.IS_TRUE.equals(excel.getIsCollege())) {
saveEmp.setIsCollege(CommonConstants.ONE_INT);
if (Common.isEmpty(excel.getHignEducation())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR, excel.getEmpIdcard()));
}
} else {
saveEmp.setIsCollege(CommonConstants.ZERO_INT);
}
}
if (Common.isNotNull(excel.getSchool())) {
saveEmp.setSchool(excel.getSchool());
}
if (Common.isNotNull(excel.getMajor())) {
saveEmp.setMajor(excel.getMajor());
}
if (Common.isNotNull(excel.getAdmissionDate())) {
saveEmp.setAdmissionDate(excel.getAdmissionDate());
}
if (Common.isNotNull(excel.getGradutionDate())) {
saveEmp.setGradutionDate(excel.getGradutionDate());
}
if (Common.isNotNull(excel.getRemark())) {
saveEmp.setRemark(excel.getRemark());
}
this.setBaseData(saveEmp, saveList);
}
// 数据合法情况
if (!CollUtil.isEmpty(errorMsg)) {
// 数据不合法
errorMessageList.add(new ErrorMessage((i + 2L), errorMsg));
}
}
if (CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList);
} else {
this.saveOrUpdateData(saveList);
}
return R.ok();
}
/**
* @Description: 加载初始数据
* @Author: hgw
* @Date: 2022/6/22 20:21
* @return: void
**/
private void setBaseData(TEmployeeInfo employeeInfo, List<TEmployeeInfo> saveList) {
// 新增档案
employeeInfo.setFileSource(CommonConstants.dingleDigitStrArray[4]);
employeeInfo.setStatus(CommonConstants.ONE_INT);
employeeInfo.setFileStatus(CommonConstants.ZERO_INT);
employeeInfo.setProjectNum(CommonConstants.ONE_INT);
employeeInfo.setDeleteFlag(CommonConstants.STATUS_NORMAL);
saveList.add(employeeInfo);
}
/**
* @param saveList
* @Description: 真正的保存
* @Author: hgw
* @Date: 2022/6/22 17:44
* @return: void
**/
private void saveOrUpdateData(List<TEmployeeInfo> saveList) {
for (TEmployeeInfo employeeInfo : saveList) {
// 新增档案
if (Common.isEmpty(employeeInfo.getId())) {
// 生成主码:
if (Common.isEmpty(employeeInfo.getEmpCode())) {
employeeInfo.setEmpCode(this.getCode());
}
this.save(employeeInfo);
// TODO-新增项目档案
// TODO-新增学历
} else {
// 复档复项
employeeInfo.setFileStatus(CommonConstants.ZERO_INT);
this.updateById(employeeInfo);
List<TEmployeeProject> projectList = tEmployeeProjectService.getListByEmpIdAndDeptNo(employeeInfo.getId(), employeeInfo.getDeptNo());
if (projectList != null && !projectList.isEmpty()) {
for (TEmployeeProject project : projectList) {
project.setProjectStatus(CommonConstants.ZERO_INT);
}
tEmployeeProjectService.updateBatchById(projectList);
}
}
}
}
/**
* @param
* @Description: 获取员工主码
* @Author: hgw
* @Date: 2022/6/22 17:52
* @return: java.lang.String
**/
private synchronized String getCode() {
String nowDay = DateUtil.getThisDay();
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CODE);
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (!Common.isEmpty(nowNumObj)) {
nowNums = (Integer) nowNumObj + 1;
}
cache.put(nowDay, nowNums);
return this.getFiveNum(String.valueOf(nowNums));
}
@Override @Override
public void updateEducationOfEmp(EmpEducationUpdateVo education) { public void updateEducationOfEmp(EmpEducationUpdateVo education) {
baseMapper.updateEducationOfEmp(education); baseMapper.updateEducationOfEmp(education);
......
...@@ -471,4 +471,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -471,4 +471,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
project.setDeleteFlag(CommonConstants.STATUS_NORMAL); project.setDeleteFlag(CommonConstants.STATUS_NORMAL);
return this.list(Wrappers.query(project)); return this.list(Wrappers.query(project));
} }
@Override
public List<TEmployeeProject> getListByEmpIdAndDeptNo(String empId, String deptNo) {
TEmployeeProject project = new TEmployeeProject();
project.setEmpId(empId);
project.setDeptNo(deptNo);
project.setDeleteFlag(CommonConstants.STATUS_NORMAL);
return this.list(Wrappers.query(project));
}
} }
...@@ -313,6 +313,30 @@ ...@@ -313,6 +313,30 @@
order by a.CREATE_TIME desc order by a.CREATE_TIME desc
</select> </select>
<!-- hgw 根据身份证查询 -->
<select id="getListByIdCard" resultMap="tEmployeeInfoMap">
select
<include refid="baseParam"/>
from t_employee_info a
where
a.DELETE_FLAG = '0' and a.EMP_IDCARD in
<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!-- hgw 根据手机号查询 -->
<select id="getListByPhone" resultMap="tEmployeeInfoMap">
select
<include refid="baseParam"/>
from t_employee_info a
where
a.DELETE_FLAG = '0' and a.EMP_PHONE in
<foreach item="item" index="index" collection="phoneList" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<update id="updateExcelEmployeeInfo" parameterType="java.util.List"> <update id="updateExcelEmployeeInfo" parameterType="java.util.List">
update t_employee_info update t_employee_info
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
......
...@@ -232,4 +232,8 @@ public interface CommonConstants { ...@@ -232,4 +232,8 @@ public interface CommonConstants {
String SAVE_SUCCESS = "保存成功!"; String SAVE_SUCCESS = "保存成功!";
String PARAM_IS_NOT_EMPTY = "参数不可为空"; String PARAM_IS_NOT_EMPTY = "参数不可为空";
// 是否
String IS_FALSE = "否";
String IS_TRUE = "是";
} }
...@@ -221,6 +221,37 @@ public interface ErrorCodes { ...@@ -221,6 +221,37 @@ public interface ErrorCodes {
* 人员不在该项目,无法更新 * 人员不在该项目,无法更新
*/ */
String CHECKS_EMP_EXIT_ERROR = "checks.emp.exit.error"; String CHECKS_EMP_EXIT_ERROR = "checks.emp.exit.error";
// 该人员已存在,禁止重复添加
String ARCHIVES_IMPORT_EMP_IDCARD_EXISTING = "archives.import.emp.idCard.existing";
// 该人员已减档,禁止导入
String ARCHIVES_IMPORT_EMP_IDCARD_LEAVE_EXISTING = "archives.import.emp.idCard.leave.existing";
// 手机号校验错误
String ARCHIVES_IMPORT_EMP_PHONE_CHECK_ERROR = "archives.import.emp.phone.check.error";
// 手机号已被其他身份证使用
String ARCHIVES_IMPORT_EMP_PHONE_EXIST_ERROR = "archives.import.emp.phone.exist.error";
// 婚姻状况在字典中未找到
String ARCHIVES_IMPORT_EMP_MARRIED_ERROR = "archives.import.emp.married.error";
// 民族在字典中未找到
String ARCHIVES_IMPORT_EMP_NATIONAL_ERROR = "archives.import.emp.national.error";
// 政治面貌在字典中未找到
String ARCHIVES_IMPORT_EMP_POLITICAL_ERROR = "archives.import.emp.political.error";
// 户口性质在字典中未找到
String ARCHIVES_IMPORT_EMP_REGISTYPE_ERROR = "archives.import.emp.registype.error";
// 最高学历在字典中未找到
String ARCHIVES_IMPORT_EMP_EDUCATION_ERROR = "archives.import.emp.education.error";
// 员工类型在字典中未找到
String ARCHIVES_IMPORT_EMP_NATRUE_ERROR = "archives.import.emp.natrue.error";
// 户籍所在地未找到区域
String ARCHIVES_IMPORT_EMP_AREA_ERROR = "archives.import.emp.area.error";
// 档案所在地未找到区域
String ARCHIVES_IMPORT_EMP_FILE_AREA_ERROR = "archives.import.emp.file.area.error";
// 大专及以上,最高学历必填
String ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR = "archives.import.emp.high.education.error";
/** /**
* 项目档案状态为已审核,禁止删除 * 项目档案状态为已审核,禁止删除
*/ */
......
...@@ -65,6 +65,20 @@ archives.emp.certificate.name.existing=\u5DF2\u5B58\u5728\u5BF9\u5E94\u8EAB\u4EF ...@@ -65,6 +65,20 @@ archives.emp.certificate.name.existing=\u5DF2\u5B58\u5728\u5BF9\u5E94\u8EAB\u4EF
checks.change.emp.project=\u5F85\u5212\u8F6C\u5458\u5DE5\u5DF2\u5728\u76EE\u6807\u9879\u76EE\u4E0B\u4E0D\u53EF\u5212\u8F6C checks.change.emp.project=\u5F85\u5212\u8F6C\u5458\u5DE5\u5DF2\u5728\u76EE\u6807\u9879\u76EE\u4E0B\u4E0D\u53EF\u5212\u8F6C
archives.import.emp.idCard.existing=\u8BE5\u4EBA\u5458\u5DF2\u5B58\u5728\uFF0C\u7981\u6B62\u91CD\u590D\u6DFB\u52A0
archives.import.emp.idCard.leave.existing=\u8BE5\u4EBA\u5458\u5DF2\u51CF\u6863\uFF0C\u7981\u6B62\u5BFC\u5165
archives.import.emp.phone.check.error=\u624B\u673A\u53F7\u6821\u9A8C\u9519\u8BEF
archives.import.emp.phone.exist.error=\u624B\u673A\u53F7\u5DF2\u88AB\u5176\u4ED6\u8EAB\u4EFD\u8BC1\u4F7F\u7528
archives.import.emp.married.error=\u5A5A\u59FB\u72B6\u51B5\u5728\u5B57\u5178\u4E2D\u672A\u627E\u5230
archives.import.emp.national.error=\u6C11\u65CF\u5728\u5B57\u5178\u4E2D\u672A\u627E\u5230
archives.import.emp.political.error=\u653F\u6CBB\u9762\u8C8C\u5728\u5B57\u5178\u4E2D\u672A\u627E\u5230
archives.import.emp.registype.error=\u6237\u53E3\u6027\u8D28\u5728\u5B57\u5178\u4E2D\u672A\u627E\u5230
archives.import.emp.education.error=\u6700\u9AD8\u5B66\u5386\u5728\u5B57\u5178\u4E2D\u672A\u627E\u5230
archives.import.emp.natrue.error=\u5458\u5DE5\u7C7B\u578B\u5728\u5B57\u5178\u4E2D\u672A\u627E\u5230
archives.import.emp.area.error=\u6237\u7C4D\u6240\u5728\u5730\u672A\u627E\u5230\u533A\u57DF
archives.import.emp.file.area.error=\u6863\u6848\u6240\u5728\u5730\u672A\u627E\u5230\u533A\u57DF
archives.import.emp.file.area.error=\u5927\u4E13\u53CA\u4EE5\u4E0A\uFF0C\u6700\u9AD8\u5B66\u5386\u5FC5\u586B
......
package com.yifu.cloud.plus.v1.yifu.admin.api.entity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 区划实体
* @author hgw
* @date 2022-6-22 19:30:59
*/
@Data
@Schema(description ="区域")
public class SysArea {
private Integer id;
private String areaName;
private String areaCode;
private Integer parentId;
private LocalDateTime updateDate;
private Integer status;
private Integer createUser;
/**
*车牌简称
*/
private String areaShort;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.controller;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysAreaService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* <p>
* 字典表 前端控制器
* </p>
*
* @author lengleng
* @since 2019-03-19
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/area")
@Tag(name = "区域管理模块")
public class AreaController {
private final SysAreaService sysAreaService;
/**
* @Description: 获取所有区域(id,名称)
* @Author: hgw
* @Date: 2022/6/22 19:33
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.Integer, java.lang.String>>
**/
@Inner
@GetMapping("/inner/getAreaToId")
public R<Map<String, String>> getAreaToId() {
return sysAreaService.getAreaToId();
}
/**
* @param
* @Description: 获取所有区域(名称,id)
* @Author: hgw
* @Date: 2022/6/22 19:34
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/
@Inner
@GetMapping("/inner/getAreaToName")
public R<Map<String, String>> getAreaToName() {
return sysAreaService.getAreaToName();
}
}
...@@ -32,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; ...@@ -32,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils; import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
...@@ -303,4 +304,28 @@ public class DictController { ...@@ -303,4 +304,28 @@ public class DictController {
return R.ok(sysDictItemService.treeMenu(lazy, parentId)); return R.ok(sysDictItemService.treeMenu(lazy, parentId));
} }
/**
* @Description: 获取所有字典数据:用做导入:type,<lable,value>
* @Author: hgw
* @Date: 2022/6/22 18:19
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/
@Inner
@GetMapping("/inner/getDictToLable")
public R<Map<String, Map<String, String>>> getDictToLable() {
return sysDictItemService.getDictToLable();
}
/**
* @Description: 获取所有字典数据:用做导出:type,<value,lable>
* @Author: hgw
* @Date: 2022/6/22 18:20
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/
@Inner
@GetMapping("/inner/getDictToLable")
public R<Map<String, Map<String, String>>> getDictToValue() {
return sysDictItemService.getDictToValue();
}
} }
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 区域表 Mapper 接口
* </p>
*
* @author hgw
* @since 2022-6-22 19:41:44
*/
@Mapper
public interface SysAreaMapper extends BaseMapper<SysArea> {
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.Map;
/**
* 区域
*
* @author hgw
* @date 2022-6-22 19:35:06
*/
public interface SysAreaService extends IService<SysArea> {
/**
* @Description: 获取所有区域数据:用做导出:<id,name>
* @Author: hgw
* @Date: 2022/6/22 18:04
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/
R<Map<String, String>> getAreaToId();
/**
* @Description: 获取所有区域数据:用做导入:<name,id>
* @Author: hgw
* @Date: 2022/6/22 18:04
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/
R<Map<String, String>> getAreaToName();
}
...@@ -63,5 +63,21 @@ public interface SysDictItemService extends IService<SysDictItem> { ...@@ -63,5 +63,21 @@ public interface SysDictItemService extends IService<SysDictItem> {
R<Map<String, Object>> getAllDictItem(); R<Map<String, Object>> getAllDictItem();
/**
* @Description: 获取所有字典数据:用做导入:type,<lable,value>
* @Author: hgw
* @Date: 2022/6/22 18:04
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/
R<Map<String, Map<String, String>>> getDictToLable();
/**
* @Description: 获取所有字典数据:用做导出:type,<value,lable>
* @Author: hgw
* @Date: 2022/6/22 18:04
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/
R<Map<String, Map<String, String>>> getDictToValue();
void clearDictItemCache(); void clearDictItemCache();
} }
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysAreaMapper;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysAreaService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 字典项
*
* @author hgw
* @date 2022-6-22 19:40:43
*/
@Service
public class SysAreaServiceImpl extends ServiceImpl<SysAreaMapper, SysArea> implements SysAreaService {
@Override
public R<Map<String, String>> getAreaToId() {
Map<String, String> resultMap = this.getStringMapMap(true);
return R.ok(resultMap);
}
@Override
public R<Map<String, String>> getAreaToName() {
Map<String, String> resultMap = this.getStringMapMap(false);
return R.ok(resultMap);
}
private Map<String, String> getStringMapMap(boolean type) {
List<SysArea> allList = baseMapper.selectList(Wrappers.<SysArea>query().lambda()
.eq(SysArea::getStatus, CommonConstants.ZERO_INT));
Map<String, String> resultMap = new HashMap<>();
doAssemble(allList, resultMap, type);
return resultMap;
}
/**
* @Description: 组装
* @Author: hgw
* @Date: 2022/6/22 18:12
* @return: void
**/
private void doAssemble(List<SysArea> allList, Map<String, String> resultMap, boolean type) {
if (Common.isNotNull(allList)) {
for (SysArea item : allList) {
if (type) {
resultMap.put(String.valueOf(item.getId()), item.getAreaName());
} else {
resultMap.put(item.getAreaName(), String.valueOf(item.getId()));
}
}
}
}
}
...@@ -200,6 +200,53 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi ...@@ -200,6 +200,53 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
} }
} }
} }
@Override
public R<Map<String, Map<String, String>>> getDictToLable() {
Map<String, Map<String, String>> resultMap = this.getStringMapMap(false);
return R.ok(resultMap);
}
@Override
public R<Map<String, Map<String, String>>> getDictToValue() {
Map<String, Map<String, String>> resultMap = this.getStringMapMap(true);
return R.ok(resultMap);
}
private Map<String, Map<String, String>> getStringMapMap(boolean type) {
List<SysDictItem> allList = baseMapper.selectList(Wrappers.<SysDictItem>query().lambda()
.eq(SysDictItem::getDelFlag,CommonConstants.STATUS_NORMAL));
Map<String, Map<String, String>> resultMap = new HashMap<>();
doAssemble(allList, resultMap, type);
return resultMap;
}
/**
* @Description: 组装
* @Author: hgw
* @Date: 2022/6/22 18:12
* @return: void
**/
private void doAssemble(List<SysDictItem> allList, Map<String, Map<String, String>> resultMap, boolean type) {
if (Common.isNotNull(allList)){
String dictCode;
Map<String, String> dictMap;
for (SysDictItem item : allList) {
dictCode = item.getType();
dictMap = resultMap.get(dictCode);
if (dictMap == null) {
dictMap = new HashMap<>();
}
if (type) {
dictMap.put(item.getValue(), item.getLabel());
} else {
dictMap.put(item.getLabel(), item.getValue());
}
resultMap.put(dictCode, dictMap);
}
}
}
/** /**
* 构建查询的 wrapper * 构建查询的 wrapper
* @param sysDictItem 查询条件 * @param sysDictItem 查询条件
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.admin.mapper.SysAreaMapper">
<resultMap id="sysDictMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea">
<id property="id" column="id"/>
<result property="areaName" column="AREA_NAME"/>
<result property="areaCode" column="AREA_CODE"/>
<result property="parentId" column="PARENT_ID"/>
<result property="updateDate" column="UPDATE_DATE"/>
<result property="status" column="STATUS"/>
<result property="createUser" column="CREATE_USER"/>
<result property="areaShort" column="AREA_SHORT"/>
</resultMap>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment