Commit e185899f authored by hongguangwu's avatar hongguangwu

人员档案相关-最终

parent 4de7b702
......@@ -30,6 +30,8 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* 人员档案表
......@@ -290,40 +292,15 @@ public class TEmployeeInfo extends BaseEntity {
private String deleteFlag;
/**
* 创建人id
* 减档操作人id
*/
@Schema(description = "创建人id")
private String createBy;
/**
* 创建人姓名
*/
@Schema(description = "创建人姓名")
private String createName;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 更新人id
*/
@Schema(description = "更新人id")
private String updateBy;
/**
* 更新时间
*/
@Schema(description = "更新时间")
private LocalDateTime updateTime;
@Schema(description = "减档操作人id")
private String leaveUser;
/**
* 离职操作人id
* 减档操作人姓名
*/
@Schema(description = "离职操作人id")
private String leaveUser;
@Schema(description = "离职操作姓名")
private String leaveUserName;
/**
* 离职时间
......@@ -350,6 +327,14 @@ public class TEmployeeInfo extends BaseEntity {
private String contactAddress;
// 以下是项目档案信息
@TableField(exist = false)
@Schema(description = "单位名称")
private String unitName;
@TableField(exist = false)
@Schema(description = "单位编码")
private String unitNo;
@TableField(exist = false)
@Schema(description = "项目id")
private String deptId;
......@@ -366,5 +351,12 @@ public class TEmployeeInfo extends BaseEntity {
@Schema(description = "就职岗位")
private String post;
@TableField(exist = false)
@Schema(description = "选中的idList")
private List<String> idList;
@TableField(exist = false)
@Schema(description = "导出的表头的Set")
private Set<String> exportFields;
}
/*
* 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 com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 人员档案表excel导出对应的实体
*
* @author hgw
* @date 2022-6-24 15:15:24
*/
@Data
@ColumnWidth(10)
public class EmployeeExportVO extends BaseEntity {
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "员工主码")
private String empCode;
@ExcelProperty(value = "员工类型")
private String empNatrue;
@ExcelProperty(value = "姓名")
private String empName;
@ColumnWidth(20)
@ExcelProperty(value = "身份证号")
private String empIdcard;
@ExcelProperty(value = "身份证开始日期")
private LocalDateTime validityStart;
@ExcelProperty(value = "身份证截止日期")
private LocalDateTime validityEnd;
@ExcelProperty(value = "婚姻状况")
private String empMarriStatus;
@ExcelProperty(value = "民族")
private String empNational;
@ExcelProperty(value = "政治面貌")
private String politicalStatus;
@ExcelProperty(value = "手机号码")
private String empPhone;
@ExcelProperty(value = "邮箱")
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;
@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;
/**
* 人员档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)
*/
@ExcelProperty(value = "人员档案来源")
private String fileSource;
@ExcelProperty(value = "是否多项目")
private String isProjects;
@ExcelProperty(value = "现存项目数")
private Integer projectNum;
@ExcelProperty(value = "项目名称")
private String deptName;
@ExcelProperty(value = "项目编码")
private String deptNo;
/**
* 员工合同状态(字典)
*/
@ExcelProperty(value = "合同状态")
private Integer contractStatus;
/**
* 商险状态(字典)
*/
@ExcelProperty(value = "商险状态")
private Integer insuranceStatus;
/**
* 社保状态(字典)
*/
@ExcelProperty(value = "社保状态")
private Integer socialStatus;
/**
* 公积金状态(字典)
*/
@ExcelProperty(value = "公积金状态")
private Integer fundStatus;
/**
* 近3个月发薪(0否;1是)
*/
@ExcelProperty(value = "近3个月发薪")
private Integer salaryStatus;
@ExcelProperty(value = "创建人")
private String createName;
@ExcelProperty(value = "创建时间")
private LocalDateTime proCreateTime;
@ExcelProperty(value = "减档操作人")
private String leaveUserName;
@ExcelProperty(value = "减档时间")
private LocalDateTime leaveTime;
@ExcelProperty(value = "减档原因")
private String leaveReason;
@ExcelProperty(value = "减档备注")
private String leaveRemark;
/**
* 通信地址
*/
@ExcelProperty(value = "通信地址")
private String contactAddress;
@ExcelProperty(value = "单位名称")
private String unitName;
@ExcelProperty(value = "单位编码")
private String unitNo;
}
/*
* 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.Size;
import java.io.Serializable;
/**
* 人员档案表-批量减档
*
* @author hgw
* @date 2022-6-24 16:04:53
*/
@Data
@ColumnWidth(30)
public class EmployeeLeaveVO implements Serializable {
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "姓名")
@Size(max = 20, message = "姓名不可超过20位")
private String empName;
@ExcelProperty(value = "身份证号")
@Size(max = 20, message = "身份证号不可超过20位")
private String empIdcard;
@ExcelProperty(value = "减档原因")
@Size(max = 32, message = "减档原因不可超过32位")
private String leaveReason;
@ExcelProperty(value = "减档备注")
@Size(max = 255, message = "减档原因不可超过255位")
private String leaveRemark;
}
......@@ -24,6 +24,7 @@ import com.pig4cloud.plugin.excel.vo.ErrorMessage;
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.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeLeaveVO;
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.CommonConstants;
......@@ -46,6 +47,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
......@@ -82,7 +84,7 @@ public class TEmployeeInfoController {
public R<IPage<TEmployeeInfo>> getTEmployeeInfoPage(Page<TEmployeeInfo> page, TEmployeeInfo tEmployeeInfo) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed("请登录!");
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
// 普通用户:
if (CommonConstants.ZERO_STRING.equals(user.getSystemFlag())) {
......@@ -120,8 +122,9 @@ public class TEmployeeInfoController {
}
}
}
if (!Common.isEmpty(obj)) {
if (Common.isNotNull(obj)) {
SimpleValueWrapper objs = (SimpleValueWrapper) obj;
if (objs != null) {
String sql = String.valueOf(objs.get());
if (sql.contains("#deptId")) {
// TODO - 需要关联部门表
......@@ -142,6 +145,7 @@ public class TEmployeeInfoController {
return R.ok(tEmployeeInfoService.getPage(page, tEmployeeInfo, sql));
}
}
}
return R.ok(tEmployeeInfoService.getPage(page, tEmployeeInfo, null));
}
......@@ -222,7 +226,7 @@ public class TEmployeeInfoController {
}
/**
* @param ids
* @param idList
* @Description: 通过ids删除人员档案表
* @Author: hgw
* @Date: 2022/6/21 19:42
......@@ -232,8 +236,8 @@ public class TEmployeeInfoController {
@SysLog("通过ids批量删除人员档案表")
@GetMapping("/batchDeleteEmployee")
@PreAuthorize("@pms.hasPermission('temployeeinfo_batch_del')")
public R<List<ErrorMessage>> batchDeleteEmployee(@RequestParam String ids) {
return tEmployeeInfoService.batchDeleteEmployee(ids);
public R<List<ErrorMessage>> batchDeleteEmployee(@RequestBody List<String> idList) {
return tEmployeeInfoService.batchDeleteEmployee(idList);
}
/**
......@@ -247,23 +251,24 @@ public class TEmployeeInfoController {
@SysLog("通过id减档人员档案表")
@GetMapping("/minusEmployee")
@PreAuthorize("@pms.hasPermission('temployeeinfo_minus')")
public R<String> minusEmployee(@RequestParam String id) {
return tEmployeeInfoService.minusEmployee(id);
public R<String> minusEmployee(@RequestParam String id, @RequestParam String leaveReason
, @RequestParam(required = false) String leaveRemark) {
return tEmployeeInfoService.minusEmployee(id, leaveReason, leaveRemark);
}
/**
* @param ids
* @param idList
* @Description: 通过ids批量减档人员档案表
* @Author: hgw
* @Date: 2022/6/21 19:42
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "通过ids批量减档人员档案表", description = "通过ids批量减档人员档案表")
@SysLog("通过ids批量减档人员档案表")
@Operation(summary = "批量减档人员档案表", description = "批量减档人员档案表")
@SysLog("批量减档人员档案表")
@GetMapping("/batchMinusEmployee")
@PreAuthorize("@pms.hasPermission('temployeeinfo_batch_minus')")
public R<List<ErrorMessage>> batchMinusEmployee(@RequestParam String ids) {
return tEmployeeInfoService.batchMinusEmployee(ids);
public R<List<ErrorMessage>> batchMinusEmployee(@RequestExcel List<EmployeeLeaveVO> excelList, BindingResult bindingResult) {
return tEmployeeInfoService.batchMinusEmployee(excelList, bindingResult);
}
/**
......@@ -290,7 +295,7 @@ public class TEmployeeInfoController {
* @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允许复档复项")
@Operation(summary = "批量导入人员档案", description = "批量导入人员档案 hasPermission('employee_batch_import') 额外属性:isCanAdd:0不可以复档复项;1允许复档复项")
@SysLog("批量导入人员档案")
@PostMapping("/batchImportEmployee")
@PreAuthorize("@pms.hasPermission('employee_batch_import')")
......@@ -306,7 +311,7 @@ public class TEmployeeInfoController {
* @Date: 2022/6/22 20:29
* @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_update')")
@Operation(summary = "批量更新人员档案", description = "批量更新人员档案 hasPermission('employee_batch_update')")
@SysLog("批量更新人员档案")
@PostMapping("/batchUpdateEmployee")
@PreAuthorize("@pms.hasPermission('employee_batch_update')")
......@@ -314,4 +319,32 @@ public class TEmployeeInfoController {
return tEmployeeInfoService.batchUpdateEmployee(excelList, bindingResult);
}
/**
* 批量导出人员档案信息
*
* @Author hgw
* @Date 2022-6-24 09:36:06
**/
@Operation(summary = "批量导出人员档案信息", description = "批量导出人员档案信息 hasPermission('employee_export_employee')")
@SysLog("批量导出人员档案信息")
// @ResponseExcel
@PostMapping("/exportEmployee")
public void exportEmployee(@RequestBody(required = false) TEmployeeInfo employeeInfo, HttpServletResponse response) {
tEmployeeInfoService.exportEmployee(employeeInfo, response);
}
/**
* 批量导出离职档案信息
*
* @Author hgw
* @Date 2022-6-24 09:36:06
**/
@Operation(summary = "批量导出离职档案信息", description = "批量导出离职档案信息 hasPermission('employee_export_employee_leave')")
@SysLog("批量导出离职档案信息")
// @ResponseExcel
@PostMapping("/exportLeaveEmployee")
public void exportLeaveEmployee(@RequestBody(required = false) TEmployeeInfo employeeInfo, HttpServletResponse response) {
tEmployeeInfoService.exportLeaveEmployee(employeeInfo, response);
}
}
......@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.EmployeeExportVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -51,4 +52,17 @@ public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> {
void updateExcelEmployeeInfo(@Param("list") List<TEmployeeInfo> list);
int insertExcelEmployeeInfo(@Param("list") List<TEmployeeInfo> list);
/**
* 获得导出的人员档案列表
* hgw 2022-6-24 10:09:44
*/
List<EmployeeExportVO> getTEmployeeExportList(@Param("tEmployeeInfo") TEmployeeInfo tEmployeeInfo);
/**
* 获得导出的离职档案列表
* hgw 2022-6-24 10:09:44
*/
List<EmployeeExportVO> getTEmployeeLeaveExportList(@Param("tEmployeeInfo") TEmployeeInfo tEmployeeInfo);
}
......@@ -23,10 +23,12 @@ 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.vo.EmpEducationUpdateVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeLeaveVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -94,13 +96,12 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
R<String> deleteEmployee(String id);
/**
* @param ids
* @Description: 批量删除
* @Author: hgw
* @Date: 2022/6/23 16:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<List<ErrorMessage>> batchDeleteEmployee(String ids);
R<List<ErrorMessage>> batchDeleteEmployee(List<String> idList);
/**
* @param id
......@@ -109,7 +110,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Date: 2022/6/21 19:50
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> minusEmployee(String id);
R<String> minusEmployee(String id, String leaveReason, String leaveRemark);
/**
* @param id
......@@ -121,13 +122,12 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
R<String> restoreEmployee(String id, String projectIds);
/**
* @param ids
* @Description: 批量减档
* @Author: hgw
* @Date: 2022/6/23 17:12
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>>
**/
R<List<ErrorMessage>> batchMinusEmployee(String ids);
R<List<ErrorMessage>> batchMinusEmployee(List<EmployeeLeaveVO> excelVOList, BindingResult bindingResult);
/**
* @param employeeInfo 档案信息
......@@ -158,4 +158,21 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
R<List<ErrorMessage>> batchUpdateEmployee(List<EmployeeVO> excelVOList, BindingResult bindingResult);
void updateEducationOfEmp(EmpEducationUpdateVO education);
/**
* @param employeeVo
* @Description: 批量导出人员档案
* @Author: hgw
* @Date: 2022/6/23 10:302022-6-24 09:35:54
**/
void exportEmployee(TEmployeeInfo employeeVo, HttpServletResponse response);
/**
* @param employeeVo
* @Description: 批量导出离职档案
* @Author: hgw
* @Date: 2022/6/23 10:302022-6-24 09:35:54
**/
void exportLeaveEmployee(TEmployeeInfo employeeVo, HttpServletResponse response);
}
......@@ -17,6 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -31,9 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpEducationService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
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.EmployeeNewOldVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
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.SecurityConstants;
......@@ -42,16 +41,27 @@ 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.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
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 com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
......@@ -62,7 +72,7 @@ import java.util.*;
*/
@Service
@RequiredArgsConstructor
@EnableConfigurationProperties({DaprUpmsProperties.class,DaprCheckProperties.class})
@EnableConfigurationProperties({DaprUpmsProperties.class, DaprCheckProperties.class})
public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, TEmployeeInfo> implements TEmployeeInfoService {
// 缓存信息
......@@ -131,6 +141,10 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
@Override
public R<Boolean> updateEmployee(TEmployeeInfo employeeInfo) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
if (Common.isEmpty(employeeInfo) || Common.isEmpty(employeeInfo.getId())) {
return R.failed("请传ID");
}
......@@ -139,12 +153,15 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return R.failed("根据id未找到档案!" + employeeInfo.getId());
}
employeeInfo.setUpdateBy(user.getId());
employeeInfo.setUpdateTime(LocalDateTime.now());
// 更新学历-房
TEmpEducation education = new TEmpEducation();
this.doUpdateEducationCore(education, employeeInfo);
// 记录变更日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], old.getId(),"", old, employeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], old.getId(), "", old, employeeInfo);
return R.ok(this.updateById(employeeInfo));
}
......@@ -187,38 +204,37 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
@Override
public R<List<ErrorMessage>> batchDeleteEmployee(String ids) {
if (Common.isEmpty(ids)) {
public R<List<ErrorMessage>> batchDeleteEmployee(List<String> idList) {
if (idList == null || idList.isEmpty()) {
return R.failed("请选择!");
}
List<ErrorMessage> errorMessageList = new ArrayList<>();
String[] idArr = ids.split(",");
TEmployeeInfo employee;
String id;
List<TEmployeeInfo> canDeleteList = new ArrayList<>();
Set<String> errorMsg;
for (int i = 0; i < idArr.length; i++) {
for (int i = 0; i < idList.size(); i++) {
errorMsg = new HashSet<>();
id = idArr[i];
id = idList.get(i);
employee = this.getById(id);
if (employee != null) {
if (employee.getStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【"+employee.getEmpIdcard()+"】的人员:非草稿状态,无法删除");
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:非草稿状态,无法删除");
}
if (employee.getContractStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【"+employee.getEmpIdcard()+"】的人员:合同状态非初始,无法删除");
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:合同状态非初始,无法删除");
}
if (employee.getInsuranceStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【"+employee.getEmpIdcard()+"】的人员:商险状态非初始,无法删除");
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:商险状态非初始,无法删除");
}
if (employee.getSocialStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【"+employee.getEmpIdcard()+"】的人员:社保状态非初始,无法删除");
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:社保状态非初始,无法删除");
}
if (employee.getFundStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【"+employee.getEmpIdcard()+"】的人员:公积金状态非初始,无法删除");
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:公积金状态非初始,无法删除");
}
if (employee.getSalaryStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【"+employee.getEmpIdcard()+"】的人员:工资状态非初始,无法删除");
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:工资状态非初始,无法删除");
}
// 数据合法情况
if (!CollUtil.isEmpty(errorMsg)) {
......@@ -278,7 +294,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
this.updateById(employee);
// 记录变更日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], old.getId(),"", old, employee);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], old.getId(), "", old, employee);
return R.ok("已复档");
} else {
......@@ -287,44 +303,94 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
@Override
public R<List<ErrorMessage>> batchMinusEmployee(String ids) {
if (Common.isEmpty(ids)) {
return R.failed("请选择!");
public R<List<ErrorMessage>> batchMinusEmployee(List<EmployeeLeaveVO> excelVOList, BindingResult bindingResult) {
if (excelVOList == null || excelVOList.isEmpty()) {
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
List<ErrorMessage> errorMessageList = new ArrayList<>();
String[] idArr = ids.split(",");
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
TEmployeeInfo employee;
String id;
List<TEmployeeInfo> canDeleteList = new ArrayList<>();
Set<String> errorMsg;
List<TEmployeeProject> projectList;
for (int i = 0; i<idArr.length; i++) {
EmployeeLeaveVO excel;
List<String> idCardList = new ArrayList<>();
String idCard;
for (int i = 0; i < excelVOList.size(); i++) {
errorMsg = new HashSet<>();
id = idArr[i];
employee = this.getById(id);
if (employee != null) {
projectList = tEmployeeProjectService.getListByEmpId(id, CommonConstants.ZERO_INT);
if (projectList != null && !projectList.isEmpty()) {
errorMsg.add("身份证【"+employee.getEmpIdcard()+"】的人员:还有【" + projectList.size() + "】条项目未减项,请先去减项");
errorMessageList.add(new ErrorMessage((i + 1L), errorMsg));
excel = excelVOList.get(i);
// 判空
idCard = excel.getEmpIdcard();
if (Common.isEmpty(idCard)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_MUST, excel.getEmpIdcard()));
errorMsgMap.put((i + 2L), new ErrorMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_MUST));
} else {
idCardList.add(idCard);
}
if (Common.isEmpty(excel.getLeaveReason())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_LEAVEREASON_MUST, excel.getEmpIdcard()));
errorMsgMap.put((i + 2L), new ErrorMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_MUST));
}
// 数据不合法
if (!CollUtil.isEmpty(errorMsg)) {
errorMessageList.add(new ErrorMessage((i + 2L), errorMsg));
}
}
// 查找档案库
Map<String, TEmployeeInfo> existEmpMap = new HashMap<>();
if (!idCardList.isEmpty()) {
List<TEmployeeInfo> cards = baseMapper.getListByIdCard(idCardList);
for (TEmployeeInfo employeeInfo : cards) {
existEmpMap.put(employeeInfo.getEmpIdcard(), employeeInfo);
}
}
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
if (Common.isNotNull(errorMsgMap.get((i + 2L)))) {
continue;
}
errorMsg = new HashSet<>();
excel = excelVOList.get(i);
employee = existEmpMap.get(excel.getEmpIdcard());
// 档案存在
if (employee != null) {
// 档案在职
if (employee.getFileStatus() == CommonConstants.ZERO_INT) {
// 开始减档
employee.setFileStatus(CommonConstants.ONE_INT);
employee.setLeaveUser(user.getId());
employee.setLeaveUserName(user.getNickname());
employee.setLeaveReason(excel.getLeaveReason());
employee.setLeaveRemark(excel.getLeaveRemark());
canDeleteList.add(employee);
} else {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_LEAVE_EXISTING, excel.getEmpIdcard()));
}
} else {
errorMessageList.add(new ErrorMessage((i + 1L), errorMsg));
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_NOT_EXISTS, excel.getEmpIdcard()));
}
// 数据不合法
if (!CollUtil.isEmpty(errorMsg)) {
errorMessageList.add(new ErrorMessage((i + 2L), errorMsg));
}
}
if (CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList);
} else {
// 仅更新自己
this.updateBatchById(canDeleteList);
return R.ok();
}
return R.ok();
}
@Override
public R<String> minusEmployee(String id) {
public R<String> minusEmployee(String id, String leaveReason, String leaveRemark) {
TEmployeeInfo employee = this.getById(id);
if (employee != null) {
// 获取项目档案,传参0,过滤项目状态
......@@ -332,7 +398,15 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (projectList != null && !projectList.isEmpty()) {
return R.failed("还有【" + projectList.size() + "】条项目未减项,请先去减项!");
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed("请登录!");
}
employee.setFileStatus(CommonConstants.ONE_INT);
employee.setLeaveUser(user.getId());
employee.setLeaveUserName(user.getNickname());
employee.setLeaveReason(leaveReason);
employee.setLeaveRemark(leaveRemark);
this.updateById(employee);
return R.ok("已减档");
} else {
......@@ -343,6 +417,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
@Override
//@GlobalTransactional // 分布式事务注解
//@Transactional(rollbackFor = Exception)
@Transactional
public R<String> addNewEmployee(TEmployeeInfo employeeInfo) {
// 新建人员档案
R<TEmployeeInfo> checks = this.saveNewEmpLoyee(employeeInfo, CommonConstants.dingleDigitStrArray[4]);
......@@ -368,6 +443,10 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
* @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) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed("请登录!");
}
R<TEmployeeInfo> failed = this.checkEmployeeInfoR(employeeInfo);
if (failed != null) return failed;
if (Common.isEmpty(fileSource)) {
......@@ -404,11 +483,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
// 字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬
employeeInfo.setFileSource(fileSource);
employeeInfo.setStatus(CommonConstants.ZERO_INT);
employeeInfo.setFileStatus(CommonConstants.ZERO_INT);
employeeInfo.setProjectNum(CommonConstants.ONE_INT);
employeeInfo.setDeleteFlag(CommonConstants.STATUS_NORMAL);
this.setBaseData(employeeInfo, fileSource, user);
// 生成主码:
if (Common.isEmpty(employeeInfo.getEmpCode())) {
employeeInfo.setEmpCode(this.getCode());
......@@ -417,6 +493,38 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return R.ok(employeeInfo);
}
/**
* @param employeeInfo
* @Description: 生成基础性别等信息
* @Author: hgw
* @Date: 2022/6/24 16:51
* @return: void
**/
private void setBaseSexInfo(TEmployeeInfo employeeInfo) {
String idCard = employeeInfo.getEmpIdcard();
if (Common.isNotNull(idCard) && Common.isEmpty(employeeInfo.getEmpSex())) {
// 出生日期
String idCardDate = idCard.substring(6, 14);
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMdd");
LocalDate empBirthday = LocalDate.parse(idCardDate, fmt);
employeeInfo.setEmpBirthday(empBirthday);
// 性别
if (idCard.length() > 17) {
if (Integer.parseInt(idCard.substring(16, 1)) % 2 == 1) {
employeeInfo.setEmpSex(CommonConstants.SEX_MAN);
} else {
employeeInfo.setEmpSex(CommonConstants.SEX_WONMAN);
}
}
// 年龄
int idCardYear = Integer.parseInt(idCard.substring(6, 10));
employeeInfo.setEmpAge(DateUtil.getAge(idCardYear));
}
}
/**
* @param employeeInfo
* @Description: 校验空值
......@@ -461,8 +569,12 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
@Override
public R<List<ErrorMessage>> batchImportEmployee(List<EmployeeVO> excelVOList, BindingResult bindingResult, int isCanAdd) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed("请登录!");
}
if (excelVOList == null || excelVOList.isEmpty()) {
return R.failed("数据不可为空");
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
// 通用校验获取失败的数据
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
......@@ -539,7 +651,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
Map<String, String> educationMap;
// 员工类型
Map<String, String> empNatrueMap;
if (dictR == null ) {
if (dictR == null) {
return R.failed("获取字典失败!");
} else {
dictMap = dictR.getData();
......@@ -554,8 +666,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 调用区域服务,渲染区域值
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 ) {
Map<String, String> areaMap;
if (areaR == null) {
return R.failed("获取区域失败!");
} else {
areaMap = areaR.getData();
......@@ -579,7 +691,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
} else if (isCanAdd == 0) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_LEAVE_EXISTING, excel.getEmpIdcard()));
} else {
saveEmp = existEmp;
saveEmp = existEmpMap.get(excel.getEmpIdcard());
}
} else {
// 档案不存在
......@@ -744,7 +856,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isNotNull(excel.getRemark())) {
saveEmp.setRemark(excel.getRemark());
}
this.setBaseData(saveEmp, saveList);
this.setBaseData(saveEmp, CommonConstants.dingleDigitStrArray[4], user);
saveList.add(saveEmp);
}
// 数据合法情况
if (!CollUtil.isEmpty(errorMsg)) {
......@@ -755,29 +868,32 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList);
} else {
// 仅更新自己与学历即可
this.updateBatchById(saveList);
// 更新学历-房
this.saveOrUpdateEducation(saveList);
// 仅新增、复档、更新学历
this.saveOrUpdateData(saveList);
}
return R.ok();
}
/**
* @Description: // 字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬
* @Description: 加载初始数据
* @Author: hgw
* @Date: 2022/6/22 20:21
* @return: void
**/
private void setBaseData(TEmployeeInfo employeeInfo, List<TEmployeeInfo> saveList) {
private void setBaseData(TEmployeeInfo employeeInfo, String fileSource, YifuUser user) {
// 新增档案
employeeInfo.setFileSource(CommonConstants.dingleDigitStrArray[4]);
employeeInfo.setCreateBy(user.getId());
employeeInfo.setCreateName(user.getNickname());
employeeInfo.setCreateTime(LocalDateTime.now());
employeeInfo.setFileSource(fileSource);
employeeInfo.setStatus(CommonConstants.ZERO_INT);
employeeInfo.setFileStatus(CommonConstants.ZERO_INT);
employeeInfo.setProjectNum(CommonConstants.ONE_INT);
employeeInfo.setDeleteFlag(CommonConstants.STATUS_NORMAL);
saveList.add(employeeInfo);
// 生成性别年龄等:
this.setBaseSexInfo(employeeInfo);
}
/**
......@@ -815,7 +931,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
tEmployeeProjectService.updateBatchById(projectList);
}
}
}
}
......@@ -831,11 +946,12 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CODE);
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (!Common.isEmpty(nowNumObj)) {
nowNums = (Integer) nowNumObj + 1;
if (Common.isNotNull(nowNumObj)) {
SimpleValueWrapper value = (SimpleValueWrapper) nowNumObj;
nowNums = (Integer) value.get() + 1;
}
cache.put(nowDay, nowNums);
return this.getFiveNum(String.valueOf(nowNums));
return "ZM" + nowDay + this.getFiveNum(String.valueOf(nowNums));
}
@Override
......@@ -845,8 +961,12 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
@Override
public R<List<ErrorMessage>> batchUpdateEmployee(List<EmployeeVO> excelVOList, BindingResult bindingResult) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed("请登录!");
}
if (excelVOList == null || excelVOList.isEmpty()) {
return R.failed("数据不可为空");
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
// 通用校验获取失败的数据
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
......@@ -917,7 +1037,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
Map<String, String> educationMap;
// 员工类型
Map<String, String> empNatrueMap;
if (dictR == null ) {
if (dictR == null) {
return R.failed("获取字典失败!");
} else {
dictMap = dictR.getData();
......@@ -933,7 +1053,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
R<Map<String, String>> areaR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/area/inner/getAreaToName", null, Map.class, SecurityConstants.FROM_IN);
Map<String, String> areaMap;
if (areaR == null ) {
if (areaR == null) {
return R.failed("获取区域失败!");
} else {
areaMap = areaR.getData();
......@@ -1107,6 +1227,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
newOld.setNewEmployee(saveEmp);
newOld.setOldEmployee(oldEmp);
updateList.add(newOld);
saveEmp.setUpdateBy(user.getId());
saveEmp.setUpdateTime(LocalDateTime.now());
saveList.add(saveEmp);
} else if (saveEmp.getFileStatus() == CommonConstants.ONE_INT) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_LEAVE_EXISTING, excel.getEmpIdcard()));
......@@ -1124,7 +1246,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList);
} else {
this.saveOrUpdateData(saveList);
// 更新
this.updateBatchById(saveList);
// 更新学历-房
this.saveOrUpdateEducation(saveList);
......@@ -1132,7 +1255,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 记录变更日志
for (EmployeeNewOldVO newOldInfo : updateList) {
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0]
, newOldInfo.getOldEmployee().getId(),""
, newOldInfo.getOldEmployee().getId(), ""
, newOldInfo.getOldEmployee(), newOldInfo.getNewEmployee());
}
}
......@@ -1150,6 +1273,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 更新学历-核心
private void doUpdateEducationCore(TEmpEducation education, TEmployeeInfo employeeInfo) {
education.setEmpId(employeeInfo.getId());
education.setEmpName(employeeInfo.getEmpName());
education.setEmpCode(employeeInfo.getEmpCode());
education.setEmpIdcard(employeeInfo.getEmpIdcard());
education.setEducationName(employeeInfo.getHignEducation());
education.setHighIdentification(CommonConstants.ZERO_STRING);
......@@ -1159,4 +1285,77 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
education.setGradutionDate(employeeInfo.getGradutionDate());
tEmpEducationService.insertEducationOfEmp(education);
}
/**
* 获取导出的人员档案列表
*/
@Override
public void exportEmployee(TEmployeeInfo employeeInfo, HttpServletResponse response) {
if (employeeInfo != null && employeeInfo.getExportFields() != null && !employeeInfo.getExportFields().isEmpty()) {
String fileName = "人员档案批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
employeeInfo.setFileStatus(CommonConstants.ZERO_INT);
List<EmployeeExportVO> list = baseMapper.getTEmployeeExportList(employeeInfo);
if (list != null && !list.isEmpty()) {
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeExportVO.class).includeColumnFiledNames(employeeInfo.getExportFields())
.sheet("人员档案").doWrite(list);
out.flush();
} catch (Exception e) {
log.error("人员档案导出异常:", e);
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException e) {
log.error("档案导出异常:", e);
}
}
}
}
}
/**
* 获取导出的离职档案列表
*/
@Override
public void exportLeaveEmployee(TEmployeeInfo employeeInfo, HttpServletResponse response) {
if (employeeInfo != null && employeeInfo.getExportFields() != null && !employeeInfo.getExportFields().isEmpty()) {
String fileName = "离职档案批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
employeeInfo.setFileStatus(CommonConstants.ONE_INT);
List<EmployeeExportVO> list = baseMapper.getTEmployeeLeaveExportList(employeeInfo);
if (list != null && !list.isEmpty()) {
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeExportVO.class).includeColumnFiledNames(employeeInfo.getExportFields())
.sheet("离职档案").doWrite(list);
out.flush();
} catch (Exception e) {
log.error("离职档案导出异常:", e);
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException e) {
log.error("档案导出异常:", e);
}
}
}
}
}
}
......@@ -46,6 +46,7 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult;
......@@ -392,7 +393,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
insTEmployeeInfo.setDeleteFlag(CommonConstants.STATUS_NORMAL);
insTEmployeeInfo.setStatus(CommonConstants.dingleDigitIntArray[0]);
//TODO HUYC 员工编码生成规则
insTEmployeeInfo.setEmpCode("");
insTEmployeeInfo.setEmpCode("查询人员档案的编码");
YifuUser user = SecurityUtils.getUser();
insTEmployeeInfo.setCreateBy(user.getId());
insTEmployeeInfo.setCreateName(user.getNickname());
......@@ -420,7 +421,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
insTEmployeePro.setEmpNo(str);
//员工编码生成规则
insTEmployeePro.setEmpCode(this.getCode());
insTEmployeePro.setEmpCode("查询人员档案的编码");
YifuUser user = SecurityUtils.getUser();
insTEmployeePro.setCreateBy(user.getId());
insTEmployeePro.setCreateName(user.getNickname());
......@@ -439,11 +440,12 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CODE);
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (!Common.isEmpty(nowNumObj)) {
nowNums = (Integer) nowNumObj + 1;
if (Common.isNotNull(nowNumObj)) {
SimpleValueWrapper value = (SimpleValueWrapper) nowNumObj;
nowNums = (Integer) value.get() + 1;
}
cache.put(nowDay, nowNums);
return this.getFiveNum(String.valueOf(nowNums));
return "ZM" + nowDay + this.getFiveNum(String.valueOf(nowNums));
}
/**
......@@ -563,7 +565,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
public void saveEmployeeProjectInfo(TEmployeeInfo employeeInfo) {
TEmployeeProject tEmployeeProject = new TEmployeeProject();
tEmployeeProject.setEmpId(employeeInfo.getId());
tEmployeeProject.setEmpCode(this.getCode());
tEmployeeProject.setEmpCode(employeeInfo.getEmpCode());
tEmployeeProject.setEmpNatrue(employeeInfo.getEmpNatrue());
tEmployeeProject.setEmpName(employeeInfo.getEmpName());
tEmployeeProject.setEmpIdcard(employeeInfo.getEmpIdcard());
......
......@@ -69,12 +69,61 @@
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="leaveUser" column="LEAVE_USER"/>
<result property="leaveUserName" column="LEAVE_USER_NAME"/>
<result property="leaveTime" column="LEAVE_TIME"/>
<result property="leaveReason" column="LEAVE_REASON"/>
<result property="leaveRemark" column="LEAVE_REMARK"/>
<result property="contactAddress" column="CONTACT_ADDRESS"/>
</resultMap>
<resultMap id="tEmployeeExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeExportVO">
<result property="empCode" column="EMP_CODE"/>
<result property="empNatrue" column="EMP_NATRUE"/>
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="validityStart" column="VALIDITY_START"/>
<result property="validityEnd" column="VALIDITY_END"/>
<result property="empMarriStatus" column="EMP_MARRI_STATUS"/>
<result property="empNational" column="EMP_NATIONAL"/>
<result property="politicalStatus" column="POLITICAL_STATUS"/>
<result property="empPhone" column="EMP_PHONE"/>
<result property="empEmail" column="EMP_EMAIL"/>
<result property="idProvince" column="ID_PROVINCE"/>
<result property="idCity" column="ID_CITY"/>
<result property="idTown" column="ID_TOWN"/>
<result property="empRegisType" column="EMP_REGIS_TYPE"/>
<result property="fileProvince" column="FILE_PROVINCE"/>
<result property="fileCity" column="FILE_CITY"/>
<result property="fileTown" column="FILE_TOWN"/>
<result property="isCollege" column="IS_COLLEGE"/>
<result property="hignEducation" column="HIGN_EDUCATION"/>
<result property="school" column="SCHOOL"/>
<result property="major" column="MAJOR"/>
<result property="admissionDate" column="ADMISSION_DATE"/>
<result property="gradutionDate" column="GRADUTION_DATE"/>
<result property="remark" column="REMARK"/>
<result property="fileSource" column="FILE_SOURCE"/>
<result property="isProjects" column="IS_PROJECTS"/>
<result property="projectNum" column="PROJECT_NUM"/>
<result property="deptName" column="DEPT_NAME"/>
<result property="deptNo" column="DEPT_NO"/>
<result property="contractStatus" column="CONTRACT_STATUS"/>
<result property="insuranceStatus" column="INSURANCE_STATUS"/>
<result property="socialStatus" column="SOCIAL_STATUS"/>
<result property="fundStatus" column="FUND_STATUS"/>
<result property="salaryStatus" column="SALARY_STATUS"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="contactAddress" column="CONTACT_ADDRESS"/>
<result property="unitName" column="UNIT_NAME"/>
<result property="unitNo" column="UNIT_NO"/>
<result property="leaveUserName" column="LEAVE_USER_NAME"/>
<result property="leaveTime" column="LEAVE_TIME"/>
<result property="leaveReason" column="LEAVE_REASON"/>
<result property="leaveRemark" column="LEAVE_REMARK"/>
</resultMap>
<sql id="baseParam">
a.ID,
a.EMP_CODE,
......@@ -121,12 +170,54 @@
a.UPDATE_BY,
a.UPDATE_TIME,
a.LEAVE_USER,
a.LEAVE_USER_NAME,
a.LEAVE_TIME,
a.LEAVE_REASON,
a.LEAVE_REMARK,
a.CONTACT_ADDRESS
</sql>
<sql id="Base_Export_List">
a.EMP_CODE,
a.EMP_NATRUE,
a.EMP_NAME,
a.EMP_IDCARD,
a.VALIDITY_START,
a.VALIDITY_END,
a.EMP_MARRI_STATUS,
a.EMP_NATIONAL,
a.POLITICAL_STATUS,
a.EMP_PHONE,
a.EMP_EMAIL,
a.ID_PROVINCE,
a.ID_CITY,
a.ID_TOWN,
a.EMP_REGIS_TYPE,
a.FILE_PROVINCE,
a.FILE_CITY,
a.FILE_TOWN,
a.IS_COLLEGE,
a.HIGN_EDUCATION,
a.SCHOOL,
a.MAJOR,
a.ADMISSION_DATE,
a.GRADUTION_DATE,
a.REMARK,
a.FILE_SOURCE,
if(count(b.id)>1,'是','否') IS_PROJECTS,
a.PROJECT_NUM,
GROUP_CONCAT(b.DEPT_NAME) DEPT_NAME,
GROUP_CONCAT(b.DEPT_NO) DEPT_NO,
a.CONTRACT_STATUS,
a.INSURANCE_STATUS,
a.SOCIAL_STATUS,
a.FUND_STATUS,
a.SALARY_STATUS,
a.CREATE_NAME,
a.CREATE_TIME,
a.CONTACT_ADDRESS
</sql>
<update id="updateEducationOfEmp">
update t_employee_info
<trim prefix="set" suffixOverrides=",">
......@@ -142,6 +233,13 @@
<sql id="employeeInfo_where">
<if test="tEmployeeInfo != null">
<if test="tEmployeeInfo.idList != null">
AND a.id in
<foreach item="idStr" index="index" collection="tEmployeeInfo.idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
<if test="tEmployeeInfo.idList == null">
<if test="tEmployeeInfo.id != null and tEmployeeInfo.id.trim() != ''">
AND a.ID = #{tEmployeeInfo.id}
</if>
......@@ -149,7 +247,7 @@
AND a.EMP_CODE = #{tEmployeeInfo.empCode}
</if>
<if test="tEmployeeInfo.empNatrue != null and tEmployeeInfo.empNatrue.trim() != ''">
AND a.EMP_NATRUE in in concat('(',${tEmployeeInfo.empNatrue},')')
AND a.EMP_NATRUE in (${tEmployeeInfo.empNatrue})
</if>
<if test="tEmployeeInfo.empName != null and tEmployeeInfo.empName.trim() != ''">
AND a.EMP_NAME = #{tEmployeeInfo.empName}
......@@ -247,16 +345,16 @@
</if>
</if>
<if test="tEmployeeInfo.contractStatus != null">
AND a.CONTRACT_STATUS in concat('(',${tEmployeeInfo.contractStatus},')')
AND a.CONTRACT_STATUS in (${tEmployeeInfo.contractStatus})
</if>
<if test="tEmployeeInfo.insuranceStatus != null">
AND a.INSURANCE_STATUS in concat('(',${tEmployeeInfo.insuranceStatus},')')
AND a.INSURANCE_STATUS in (${tEmployeeInfo.insuranceStatus})
</if>
<if test="tEmployeeInfo.socialStatus != null">
AND a.SOCIAL_STATUS in concat('(',${tEmployeeInfo.socialStatus},')')
AND a.SOCIAL_STATUS in (${tEmployeeInfo.socialStatus})
</if>
<if test="tEmployeeInfo.fundStatus != null">
AND a.FUND_STATUS in concat('(',${tEmployeeInfo.fundStatus},')')
AND a.FUND_STATUS in (${tEmployeeInfo.fundStatus})
</if>
<if test="tEmployeeInfo.salaryStatus != null">
AND a.SALARY_STATUS = #{tEmployeeInfo.salaryStatus}
......@@ -282,6 +380,9 @@
<if test="tEmployeeInfo.leaveUser != null and tEmployeeInfo.leaveUser.trim() != ''">
AND a.LEAVE_USER = #{tEmployeeInfo.leaveUser}
</if>
<if test="tEmployeeInfo.leaveUserName != null and tEmployeeInfo.leaveUserName.trim() != ''">
AND a.LEAVE_USER_NAME = #{tEmployeeInfo.leaveUserName}
</if>
<if test="tEmployeeInfo.leaveTime != null">
AND a.LEAVE_TIME = #{tEmployeeInfo.leaveTime}
</if>
......@@ -294,6 +395,16 @@
<if test="tEmployeeInfo.contactAddress != null and tEmployeeInfo.contactAddress.trim() != ''">
AND a.CONTACT_ADDRESS = #{tEmployeeInfo.contactAddress}
</if>
<if test="tEmployeeInfo.unitName != null and tEmployeeInfo.unitName.trim() != ''">
AND b.UNIT_NAME like concat('%',#{tEmployeeInfo.unitName},'%')
</if>
<if test="tEmployeeInfo.deptName != null and tEmployeeInfo.deptName.trim() != ''">
AND b.DEPT_NAME like concat('%',#{tEmployeeInfo.deptName},'%')
</if>
<if test="tEmployeeInfo.deptNo != null and tEmployeeInfo.deptNo.trim() != ''">
AND b.DEPT_NO = #{tEmployeeInfo.deptNo}
</if>
</if>
</if>
</sql>
......@@ -302,7 +413,8 @@
select
<include refid="baseParam"/>
from t_employee_info a
where 1=1
left join t_employee_project b on a.id = b.EMP_ID
where a.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
${sql}
order by a.CREATE_TIME desc
......@@ -313,7 +425,8 @@
select
<include refid="baseParam"/>
from t_employee_info a
where 1=1
left join t_employee_project b on a.id = b.EMP_ID
where a.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
order by a.CREATE_TIME desc
</select>
......@@ -410,4 +523,34 @@
)
</foreach>
</insert>
<!--tEmployeeInfo人员档案导出查询-->
<select id="getTEmployeeExportList" resultMap="tEmployeeExportMap">
select
<include refid="Base_Export_List"/>
from t_employee_info a
left join t_employee_project b on a.id = b.EMP_ID
<where>
a.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
</where>
</select>
<!--tEmployeeInfo离职档案导出查询-->
<select id="getTEmployeeLeaveExportList" resultMap="tEmployeeExportMap">
SELECT
<include refid="Base_Export_List"/>
,GROUP_CONCAT(b.unit_name) UNIT_NAME
,GROUP_CONCAT(b.unit_no) UNIT_NO
,a.LEAVE_TIME
,a.LEAVE_USER
,a.LEAVE_REASON
from t_employee_info a
left join t_employee_project b on a.id = b.EMP_ID
<where>
a.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/>
</where>
</select>
</mapper>
......@@ -623,7 +623,7 @@
FROM
t_employee_project
WHERE
DELETE_FLAG = 0
DELETE_FLAG = '0'
and id not like '%abc'
and
EMP_NO LIKE CONCAT(
......@@ -658,7 +658,7 @@
FROM t_employee_project a
left join t_employee_info b on a.EMP_ID = b.id
<where>
1=1 AND a.DELETE_FLAG = 0
a.DELETE_FLAG = '0'
<include refid="tEmployeeProject_where"/>
</where>
</select>
......@@ -669,7 +669,7 @@
FROM t_employee_project a
left join t_employee_info b on a.EMP_ID = b.id
<where>
1=1 AND a.DELETE_FLAG = 0
a.DELETE_FLAG = '0'
<include refid="exportTEmployeeProject_where"/>
</where>
</select>
......
......@@ -235,6 +235,13 @@ public interface CommonConstants {
String PARAM_IS_NOT_EMPTY = "参数不可为空";
String DATA_CAN_NOT_EMPTY = "数据不可为空";
String PLEASE_LOG_IN = "请登录!";
String SEX_MAN = "1";
String SEX_WONMAN = "2";
// 是否
String IS_FALSE = "否";
String IS_TRUE = "是";
......
......@@ -253,6 +253,10 @@ public interface ErrorCodes {
String ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR = "archives.import.emp.high.education.error";
// 根据身份证未找到人员档案信息
String ARCHIVES_IMPORT_EMP_NOT_EXISTS = "archives.import.emp.not.exists";
// 身份证必填
String ARCHIVES_IMPORT_EMP_IDCARD_MUST = "archives.import.emp.idCard.must";
// 减档原因必填
String ARCHIVES_IMPORT_EMP_LEAVEREASON_MUST = "archives.import.emp.leaveReason.must";
/**
* 项目档案状态为已审核,禁止删除
......
......@@ -52,6 +52,10 @@ public class DateUtil {
*/
public static final String DATETIME_YYYYMM = "yyyyMM";
/**
* yyyy
*/
public static final String DATETIME_YYYY = "yyyy";
/**
* yyyy-MM
*/
public static final String DATETIME_YYYY_MM = "yyyy-MM";
......@@ -1342,7 +1346,6 @@ public class DateUtil {
* @Date: 2020/12/21
* @Description: 获取这个月
* @return: java.lang.String
* @see com.yifu.cloud.v1.common.core.util
**/
public static String getThisMonth(){
SimpleDateFormat sf = new SimpleDateFormat(DateUtil.DATETIME_YYYYMM);
......@@ -1351,6 +1354,20 @@ public class DateUtil {
return thisMonth;
}
/**
* @param years 出生年
* @Description: 获取年龄
* @Author: hgw
* @Date: 2022/6/24 16:49
* @return: int
**/
public static int getAge(int years){
SimpleDateFormat sf = new SimpleDateFormat(DateUtil.DATETIME_YYYY);
Date nowDate = new Date();
int thisYear = Integer.parseInt(sf.format(nowDate));
return thisYear - years + 1;
}
/**
* @Description: 返回当前年月日字符串
* @Author: hgw
......@@ -1362,6 +1379,17 @@ public class DateUtil {
return sf.format(new Date());
}
/**
* @Description: 返回当前年月日时分秒字符串(一般用在导出文件名)
* @Author: hgw
* @Date: 2022-6-24 10:00:41
* @return: java.lang.String
**/
public static String getThisTime(){
SimpleDateFormat sf = new SimpleDateFormat(DateUtil.DATE_PATTERN);
return sf.format(new Date());
}
/**
* @param
......
......@@ -79,6 +79,8 @@ archives.import.emp.area.error=\u6237\u7C4D\u6240\u5728\u5730\u672A\u627E\u5230\
archives.import.emp.file.area.error=\u6863\u6848\u6240\u5728\u5730\u672A\u627E\u5230\u533A\u57DF
archives.import.emp.high.education.error=\u5927\u4E13\u53CA\u4EE5\u4E0A\uFF0C\u6700\u9AD8\u5B66\u5386\u5FC5\u586B
archives.import.emp.not.exists=\u6839\u636E\u8EAB\u4EFD\u8BC1\u672A\u627E\u5230\u4EBA\u5458\u6863\u6848\u4FE1\u606F
archives.import.emp.idCard.must=\u8EAB\u4EFD\u8BC1\u5FC5\u586B
archives.import.emp.leaveReason.must=\u51CF\u6863\u539F\u56E0\u5FC5\u586B
......
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