Commit b27cd6ba authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents 6e63c620 2c54d235
......@@ -51,8 +51,7 @@ public class TElecEmployeeInfo extends BaseEntity {
* 员工姓名
*/
@Schema(description ="员工姓名")
@NotNull(message = "员工姓名不能为空")
@Size(max = 20, message = "员工姓名不可超过20位")
@TableField(exist = false)
private String empName;
/**
......
......@@ -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;
}
......@@ -31,6 +31,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
......@@ -132,4 +133,16 @@ public class TElecEmployeeInfoController {
}
return R.failed("未找到身份证号对应的档案信息");
}
/**
* 批量导入电子档案
* @param file
* @return R
*/
@PostMapping("/importZip")
@Operation(summary = "批量导入电子档案", description = "批量导入电子档案")
@SysLog("批量导入电子档案" )
public R<Boolean> importZip(@RequestParam("file") MultipartFile file) {
return this.tElecEmployeeInfoService.importZip(file);
}
}
......@@ -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,26 +122,28 @@ public class TEmployeeInfoController {
}
}
}
if (!Common.isEmpty(obj)) {
if (Common.isNotNull(obj)) {
SimpleValueWrapper objs = (SimpleValueWrapper) obj;
String sql = String.valueOf(objs.get());
if (sql.contains("#deptId")) {
// TODO - 需要关联部门表
}
if (sql.contains("#create_by")) {
sql = sql.replace("#create_by", user.getId());
}
if (sql.contains("#settleDomainId")) {
// TODO - 获取人员结算主体权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql = sql.replace("or a.settle_domain_id in ('0'#settleDomainId) ", "");
}
if (sql.contains("#deptId")) {
// TODO - 获取人员部门权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql = sql.replace(" or dept.dept_id = #deptId ", "");
if (objs != null) {
String sql = String.valueOf(objs.get());
if (sql.contains("#deptId")) {
// TODO - 需要关联部门表
}
if (sql.contains("#create_by")) {
sql = sql.replace("#create_by", user.getId());
}
if (sql.contains("#settleDomainId")) {
// TODO - 获取人员结算主体权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql = sql.replace("or a.settle_domain_id in ('0'#settleDomainId) ", "");
}
if (sql.contains("#deptId")) {
// TODO - 获取人员部门权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql = sql.replace(" or dept.dept_id = #deptId ", "");
}
return R.ok(tEmployeeInfoService.getPage(page, tEmployeeInfo, sql));
}
return R.ok(tEmployeeInfoService.getPage(page, tEmployeeInfo, sql));
}
}
return R.ok(tEmployeeInfoService.getPage(page, tEmployeeInfo, null));
......@@ -159,7 +163,7 @@ public class TEmployeeInfoController {
}
/**
* @param empName 姓名
* @param empName 姓名
* @param empIdCard 身份证
* @Description: 新增人员档案前的校验
* @Author: hgw
......@@ -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,27 +251,28 @@ 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);
}
/**
* @param id 离职档案id
* @param id 离职档案id
* @param projectIds 需要复项的项目ids
* @Description: 档案复档
* @Author: hgw
......@@ -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);
}
}
......@@ -214,7 +214,7 @@ public class TEmployeeProjectController {
*/
@Operation(summary = "通过id批量删除项目档案", description = "通过id批量删除项目档案")
@SysLog("通过id批量删除项目档案" )
@PostMapping("/{ids}" )
@PostMapping("/deletebyIds" )
@PreAuthorize("@pms.hasPermission('archives_temployeeproject_batchdel')" )
public R<List<ErrorMessage>> removeByIds(@RequestParam String ids) {
return tEmployeeProjectService.batchRemoveByIds(ids);
......
......@@ -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);
}
......@@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TElecEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.web.multipart.MultipartFile;
/**
* 电子档案信息表
......@@ -31,4 +33,13 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TElecEmployeeInfo;
public interface TElecEmployeeInfoService extends IService<TElecEmployeeInfo> {
IPage<TElecEmployeeInfo> getTElecEmployeeInfoPage(Page page, TElecEmployeeInfo vo);
/**
* @description: 解析zip文件包中的多个附件,并生成结算记录
* @param file zip文件包
* @return: R
* @author: huyc
* @date: 2022/6/24
*/
R<Boolean> importZip(MultipartFile file);
}
......@@ -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);
}
......@@ -16,13 +16,30 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.io.FileTypeUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ZipUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TElecEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TElecEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TElecEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.UUID;
/**
* 电子档案信息表
......@@ -42,4 +59,56 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
public IPage<TElecEmployeeInfo> getTElecEmployeeInfoPage(Page page, TElecEmployeeInfo tElecEmployeeInfo) {
return baseMapper.getTElecEmployeeInfoPage(page,tElecEmployeeInfo);
}
/**
* @description: 解析zip文件包中的多个附件,并生成结算记录
* @param file zip文件包
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: wangweiguo
* @date: 2021/8/19
*/
@Override
public R<Boolean> importZip(MultipartFile file) {
File unzip = null;
File etractFile = null;
try {
String fileType = FileTypeUtil.getType(file.getInputStream());
// if (!StringUtils.equalsIgnoreCase(fileType, CommonConstants.ZIP_TYPE)) {
// return R.failed(ErrorCodes.IMPORT_FILE_TYPE_ERROR);
// }
List list = new ArrayList();
etractFile = new File(UUID.randomUUID().toString());
unzip = ZipUtil.unzip(file.getInputStream(), etractFile, CharsetUtil.CHARSET_GBK);
ZipFile zipFile=new ZipFile(unzip);
for (Enumeration<? extends ZipArchiveEntry> e = zipFile.getEntries(); e.hasMoreElements();) {
ZipArchiveEntry entry=e.nextElement();
if(!entry.isDirectory()){
BufferedReader br=new BufferedReader(new InputStreamReader(zipFile.getInputStream(entry)));
String line = "";
while((line = br.readLine()) != null){
if(line.length() > 0){
list.add(line);
}
}
br.close();
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (etractFile != null) {
FileUtil.del(etractFile);
}
}
return R.ok();
}
}
......@@ -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;
......@@ -391,8 +392,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
insTEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]);
insTEmployeeInfo.setDeleteFlag(CommonConstants.STATUS_NORMAL);
insTEmployeeInfo.setStatus(CommonConstants.dingleDigitIntArray[0]);
//TODO HUYC 员工编码生成规则
insTEmployeeInfo.setEmpCode("");
insTEmployeeInfo.setEmpCode(this.getCode());
YifuUser user = SecurityUtils.getUser();
insTEmployeeInfo.setCreateBy(user.getId());
insTEmployeeInfo.setCreateName(user.getNickname());
......@@ -420,7 +420,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
insTEmployeePro.setEmpNo(str);
//员工编码生成规则
insTEmployeePro.setEmpCode(this.getCode());
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
insTEmployeePro.setEmpCode(tEmployeeInfo.getEmpCode());
YifuUser user = SecurityUtils.getUser();
insTEmployeePro.setCreateBy(user.getId());
insTEmployeePro.setCreateName(user.getNickname());
......@@ -439,11 +442,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));
}
/**
......@@ -469,7 +473,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (!Common.isEmpty(ids)) {
idsList = Common.initStrToList(ids, CommonConstants.COMMA_STRING);
} else {
return R.failed("传参不能为空");
return R.failed(ErrorCodes.PARAM_NOT_EMPTY);
}
List<TEmployeeProject> list = new ArrayList<>();
if (Common.isNotEmpty(idsList)) {
......@@ -563,7 +567,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());
......
......@@ -44,7 +44,7 @@
<sql id="Base_Column_List">
a.ID,
a.EMP_NAME,
b.EMP_NAME,
a.EMP_IDCARD,
b.EMP_NO,
b.UNIT_NAME,
......@@ -67,7 +67,7 @@
AND a.ID = #{tElecEmployeeInfo.id}
</if>
<if test="tElecEmployeeInfo.empName != null and tElecEmployeeInfo.empName.trim() != ''">
AND a.EMP_NAME = #{tElecEmployeeInfo.empName}
AND b.EMP_NAME = #{tElecEmployeeInfo.empName}
</if>
<if test="tElecEmployeeInfo.empIdcard != null and tElecEmployeeInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD = #{tElecEmployeeInfo.empIdcard}
......
......@@ -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>
......
......@@ -202,6 +202,8 @@ public interface CommonConstants {
int FOUR_INT = 4;
String TEN_STRING = "10";
public static final String SPOT = ".";
/**
* 员工初始序列
* @Author pwang
......@@ -235,11 +237,20 @@ 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 = "是";
int SIX_INT = 6;
int EIGHT_INT = 8;
public static final String ZIP_TYPE = "zip";
int BATCH_COUNT = 100;
String IMPORT_DATA_ANALYSIS_ERROR = "数据导入解析异常,请检查表数据格式";
String CREATE_TIME = "create_time";
......
......@@ -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";
/**
* 项目档案状态为已审核,禁止删除
......@@ -267,4 +271,8 @@ public interface ErrorCodes {
* 待划转员工已在目标项目下不可划转
*/
String CHECKS_CHANGE_EMP_PROJECT = "checks.change.emp.project";
/**
* 导入的文件格式不正确
*/
String IMPORT_FILE_TYPE_ERROR = "import.file.type.error";
}
......@@ -51,6 +51,10 @@ public class DateUtil {
* yyyyMM
*/
public static final String DATETIME_YYYYMM = "yyyyMM";
/**
* yyyy
*/
public static final String DATETIME_YYYY = "yyyy";
/**
* 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,10 @@ 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
import.file.type.error=\u5BFC\u5165\u7684\u6587\u4EF6\u683C\u5F0F\u4E0D\u6B63\u786E
......
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